From 2f38a4bf5e31359d3055b991a2997ca750f6892d Mon Sep 17 00:00:00 2001 From: Eduard Gushchin <44260780+edwardgushchin@users.noreply.github.com> Date: Fri, 26 Jul 2024 17:57:24 +0300 Subject: [PATCH 001/253] Fixed a typo in the link to the GetTouchFingers function --- include/SDL3/SDL_touch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_touch.h b/include/SDL3/SDL_touch.h index fac421fded1f8..93f3b225a94d8 100644 --- a/include/SDL3/SDL_touch.h +++ b/include/SDL3/SDL_touch.h @@ -59,7 +59,7 @@ typedef enum SDL_TouchDeviceType * * \since This struct is available since SDL 3.0.0. * - * \sa SDL_GetTouchFinger + * \sa SDL_GetTouchFingers */ typedef struct SDL_Finger { From 5e513ecc7fed56794f567407b1a7cbe56bc995a3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 26 Jul 2024 06:05:57 -0700 Subject: [PATCH 002/253] Don't automatically free temporary memory, let the application call SDL_FreeTemporaryMemory() when it's ready. Also mark up all functions that return temporary memory with SDL_DECLSPEC_TEMP, to help people implementing language bindings. Fixes https://github.com/libsdl-org/SDL/issues/10378 --- build-scripts/wikiheaders.pl | 14 ++++-- docs/doxyfile | 1 + include/SDL3/SDL_audio.h | 40 ++++------------ include/SDL3/SDL_begin_code.h | 2 + include/SDL3/SDL_camera.h | 25 ++-------- include/SDL3/SDL_clipboard.h | 15 ++---- include/SDL3/SDL_events.h | 46 ++++++++++-------- include/SDL3/SDL_filesystem.h | 20 ++------ include/SDL3/SDL_gamepad.h | 80 +++++++------------------------ include/SDL3/SDL_guid.h | 5 +- include/SDL3/SDL_haptic.h | 15 ++---- include/SDL3/SDL_hints.h | 5 +- include/SDL3/SDL_joystick.h | 30 +++--------- include/SDL3/SDL_keyboard.h | 20 ++------ include/SDL3/SDL_locale.h | 5 +- include/SDL3/SDL_mouse.h | 10 +--- include/SDL3/SDL_pen.h | 5 +- include/SDL3/SDL_properties.h | 5 +- include/SDL3/SDL_render.h | 10 +--- include/SDL3/SDL_sensor.h | 10 +--- include/SDL3/SDL_storage.h | 5 +- include/SDL3/SDL_system.h | 20 ++------ include/SDL3/SDL_thread.h | 5 +- include/SDL3/SDL_touch.h | 15 ++---- include/SDL3/SDL_video.h | 60 +++++------------------ src/dynapi/SDL_dynapi.sym | 1 + src/dynapi/SDL_dynapi_overrides.h | 1 + src/dynapi/SDL_dynapi_procs.h | 1 + src/dynapi/gendynapi.py | 1 + src/events/SDL_events.c | 28 ----------- test/testautomation_events.c | 26 ---------- 31 files changed, 124 insertions(+), 402 deletions(-) diff --git a/build-scripts/wikiheaders.pl b/build-scripts/wikiheaders.pl index c1ed45e97563d..f3b83df3583d6 100755 --- a/build-scripts/wikiheaders.pl +++ b/build-scripts/wikiheaders.pl @@ -936,7 +936,7 @@ sub sanitize_c_typename { my $paramsstr = undef; - if (!$is_forced_inline && $decl =~ /\A\s*extern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_|SDL_)?DECLSPEC\s+(const\s+|)(unsigned\s+|)(.*?)([\*\s]+)(\*?)\s*SDLCALL\s+(.*?)\s*\((.*?)\);/) { + if (!$is_forced_inline && $decl =~ /\A\s*extern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_|SDL_)?DECLSPEC\w*\s+(const\s+|)(unsigned\s+|)(.*?)([\*\s]+)(\*?)\s*SDLCALL\s+(.*?)\s*\((.*?)\);/) { $sym = $8; $rettype = "$3$4$5$6"; $paramsstr = $9; @@ -1000,15 +1000,21 @@ sub sanitize_c_typename { } if (!$is_forced_inline) { # don't do with forced-inline because we don't want the implementation inserted in the wiki. + my $shrink_length = 0; + $decl = ''; # rebuild this with the line breaks, since it looks better for syntax highlighting. foreach (@decllines) { if ($decl eq '') { + my $temp; + $decl = $_; - $decl =~ s/\Aextern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_|SDL_)?DECLSPEC\s+(.*?)\s+(\*?)SDLCALL\s+/$3$4 /; + $temp = $decl; + $temp =~ s/\Aextern\s+(SDL_DEPRECATED\s+|)(SDLMAIN_|SDL_)?DECLSPEC\w*\s+(.*?)\s+(\*?)SDLCALL\s+/$3$4 /; + $shrink_length = length($decl) - length($temp); + $decl = $temp; } else { my $trimmed = $_; - # !!! FIXME: trim space for SDL_DEPRECATED if it was used, too. - $trimmed =~ s/\A\s{28}//; # 28 for shrinking to match the removed "extern SDL_DECLSPEC SDLCALL " + $trimmed =~ s/\A\s{$shrink_length}//; # shrink to match the removed "extern SDL_DECLSPEC SDLCALL " $decl .= $trimmed; } $decl .= "\n"; diff --git a/docs/doxyfile b/docs/doxyfile index 19de1623b756c..c8891d82b5be3 100644 --- a/docs/doxyfile +++ b/docs/doxyfile @@ -1298,6 +1298,7 @@ INCLUDE_FILE_PATTERNS = PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 \ SDL_DECLSPEC= \ + SDL_DECLSPEC_TEMP= \ SDLCALL= \ _WIN32=1 diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index 629cc3a95d3f7..8ee874ac627be 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -400,9 +400,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); * "coreaudio" or "wasapi". These never have Unicode characters, and are not * meant to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param index the index of the audio driver; the value ranges from 0 to * SDL_GetNumAudioDrivers() - 1. * \returns the name of the audio driver at the requested index, or NULL if an @@ -414,7 +411,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); * * \sa SDL_GetNumAudioDrivers */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDriver(int index); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetAudioDriver(int index); /* @} */ /** @@ -424,9 +421,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDriver(int index); * "coreaudio" or "wasapi". These never have Unicode characters, and are not * meant to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the name of the current audio driver or NULL if no driver has been * initialized. * @@ -434,7 +428,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDriver(int index); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentAudioDriver(void); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCurrentAudioDriver(void); /** * Get a list of currently-connected audio playback devices. @@ -450,9 +444,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentAudioDriver(void); * If this function returns NULL, to signify an error, `*count` will be set to * zero. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of device instance IDs or NULL on error; call @@ -465,7 +456,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentAudioDriver(void); * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioRecordingDevices */ -extern SDL_DECLSPEC const SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices(int *count); +extern SDL_DECLSPEC_TEMP const SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices(int *count); /** * Get a list of currently-connected audio recording devices. @@ -481,9 +472,6 @@ extern SDL_DECLSPEC const SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevice * If this function returns NULL, to signify an error, `*count` will be set to * zero. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of device instance IDs, or NULL on failure; @@ -496,14 +484,11 @@ extern SDL_DECLSPEC const SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevice * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioPlaybackDevices */ -extern SDL_DECLSPEC const SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecordingDevices(int *count); +extern SDL_DECLSPEC_TEMP const SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecordingDevices(int *count); /** * Get the human-readable name of a specific audio device. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param devid the instance ID of the device to query. * \returns the name of the audio device, or NULL on failure; call * SDL_GetError() for more information. @@ -516,7 +501,7 @@ extern SDL_DECLSPEC const SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecordingDevic * \sa SDL_GetAudioRecordingDevices * \sa SDL_GetDefaultAudioInfo */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDeviceName(SDL_AudioDeviceID devid); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetAudioDeviceName(SDL_AudioDeviceID devid); /** * Get the current audio format of a specific audio device. @@ -562,9 +547,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid * Audio devices usually have no remapping applied. This is represented by * returning NULL, and does not signify an error. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param devid the instance ID of the device to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as @@ -576,7 +558,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC const int * SDLCALL SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count); +extern SDL_DECLSPEC_TEMP const int * SDLCALL SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count); /** * Open a specific audio device. @@ -1113,9 +1095,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, * Audio streams default to no remapping applied. This is represented by * returning NULL, and does not signify an error. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param stream the SDL_AudioStream to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as @@ -1128,7 +1107,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC const int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count); +extern SDL_DECLSPEC_TEMP const int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count); /** * Get the current output channel map of an audio stream. @@ -1139,9 +1118,6 @@ extern SDL_DECLSPEC const int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_Au * Audio streams default to no remapping applied. This is represented by * returning NULL, and does not signify an error. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param stream the SDL_AudioStream to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as @@ -1154,7 +1130,7 @@ extern SDL_DECLSPEC const int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_Au * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC const int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream *stream, int *count); +extern SDL_DECLSPEC_TEMP const int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream *stream, int *count); /** * Set the current input channel map of an audio stream. diff --git a/include/SDL3/SDL_begin_code.h b/include/SDL3/SDL_begin_code.h index f418c6109d855..a2421875987ac 100644 --- a/include/SDL3/SDL_begin_code.h +++ b/include/SDL3/SDL_begin_code.h @@ -67,6 +67,8 @@ # endif # endif #endif +/* This is used to mark functions that return temporary memory */ +#define SDL_DECLSPEC_TEMP SDL_DECLSPEC /* By default SDL uses the C calling convention */ #ifndef SDLCALL diff --git a/include/SDL3/SDL_camera.h b/include/SDL3/SDL_camera.h index 590214ceca8b6..451b73c8b3490 100644 --- a/include/SDL3/SDL_camera.h +++ b/include/SDL3/SDL_camera.h @@ -134,9 +134,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumCameraDrivers(void); * "coremedia" or "android". These never have Unicode characters, and are not * meant to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param index the index of the camera driver; the value ranges from 0 to * SDL_GetNumCameraDrivers() - 1. * \returns the name of the camera driver at the requested index, or NULL if @@ -148,7 +145,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumCameraDrivers(void); * * \sa SDL_GetNumCameraDrivers */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraDriver(int index); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCameraDriver(int index); /** * Get the name of the current camera driver. @@ -157,9 +154,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraDriver(int index); * "coremedia" or "android". These never have Unicode characters, and are not * meant to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the name of the current camera driver or NULL if no driver has * been initialized. * @@ -167,14 +161,11 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraDriver(int index); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCurrentCameraDriver(void); /** * Get a list of currently connected camera devices. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of cameras returned, may * be NULL. * \returns a 0 terminated array of camera instance IDs or NULL on failure; @@ -186,7 +177,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void); * * \sa SDL_OpenCamera */ -extern SDL_DECLSPEC const SDL_CameraID * SDLCALL SDL_GetCameras(int *count); +extern SDL_DECLSPEC_TEMP const SDL_CameraID * SDLCALL SDL_GetCameras(int *count); /** * Get the list of native formats/sizes a camera supports. @@ -210,9 +201,6 @@ extern SDL_DECLSPEC const SDL_CameraID * SDLCALL SDL_GetCameras(int *count); * there _is_ a camera until the user has given you permission to check * through a scary warning popup. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param devid the camera device instance ID to query. * \param count a pointer filled in with the number of elements in the list, * may be NULL. @@ -226,14 +214,11 @@ extern SDL_DECLSPEC const SDL_CameraID * SDLCALL SDL_GetCameras(int *count); * \sa SDL_GetCameras * \sa SDL_OpenCamera */ -extern SDL_DECLSPEC const SDL_CameraSpec * const * SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count); +extern SDL_DECLSPEC_TEMP const SDL_CameraSpec * const * SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count); /** * Get the human-readable device name for a camera. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the camera device instance ID. * \returns a human-readable device name or NULL on failure; call * SDL_GetError() for more information. @@ -244,7 +229,7 @@ extern SDL_DECLSPEC const SDL_CameraSpec * const * SDLCALL SDL_GetCameraSupporte * * \sa SDL_GetCameras */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraName(SDL_CameraID instance_id); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCameraName(SDL_CameraID instance_id); /** * Get the position of the camera in relation to the system. diff --git a/include/SDL3/SDL_clipboard.h b/include/SDL3/SDL_clipboard.h index 4318b613295dc..bc7c14586d373 100644 --- a/include/SDL3/SDL_clipboard.h +++ b/include/SDL3/SDL_clipboard.h @@ -62,9 +62,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); * This functions returns empty string if there was not enough memory left for * a copy of the clipboard's content. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the clipboard text on success or an empty string on failure; call * SDL_GetError() for more information. * @@ -73,7 +70,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); * \sa SDL_HasClipboardText * \sa SDL_SetClipboardText */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetClipboardText(void); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetClipboardText(void); /** * Query whether the clipboard exists and contains a non-empty text string. @@ -107,9 +104,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text); * This functions returns empty string if there was not enough memory left for * a copy of the primary selection's content. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the primary selection text on success or an empty string on * failure; call SDL_GetError() for more information. * @@ -118,7 +112,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text); * \sa SDL_HasPrimarySelectionText * \sa SDL_SetPrimarySelectionText */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetPrimarySelectionText(void); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetPrimarySelectionText(void); /** * Query whether the primary selection exists and contains a non-empty text @@ -223,15 +217,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearClipboardData(void); * \returns the retrieved data buffer or NULL on failure; call SDL_GetError() * for more information. * - * This returns temporary memory which will be automatically freed - * later, and can be claimed with SDL_ClaimTemporaryMemory(). - * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasClipboardData * \sa SDL_SetClipboardData */ -extern SDL_DECLSPEC const void * SDLCALL SDL_GetClipboardData(const char *mime_type, size_t *size); +extern SDL_DECLSPEC_TEMP const void * SDLCALL SDL_GetClipboardData(const char *mime_type, size_t *size); /** * Query whether there is data in the clipboard for the provided mime type. diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index 68606b5f8ad4e..159399eb41edd 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -352,8 +352,7 @@ typedef struct SDL_KeyboardEvent * will be inserted into the editing text. The length is the number of UTF-8 * characters that will be replaced by new typing. * - * The text string is temporary memory which will be automatically freed - * later, and can be claimed with SDL_ClaimTemporaryMemory(). + * The text string is temporary memory which will be freed in SDL_FreeTemporaryMemory() and can be claimed with SDL_ClaimTemporaryMemory(). * * \since This struct is available since SDL 3.0.0. */ @@ -371,8 +370,7 @@ typedef struct SDL_TextEditingEvent /** * Keyboard IME candidates event structure (event.edit_candidates.*) * - * The candidates are temporary memory which will be automatically freed - * later, and can be claimed with SDL_ClaimTemporaryMemory(). + * The candidates are a single allocation of temporary memory which will be freed in SDL_FreeTemporaryMemory() and can be claimed with SDL_ClaimTemporaryMemory(). * * \since This struct is available since SDL 3.0.0. */ @@ -391,8 +389,7 @@ typedef struct SDL_TextEditingCandidatesEvent /** * Keyboard text input event structure (event.text.*) * - * The text string is temporary memory which will be automatically freed - * later, and can be claimed with SDL_ClaimTemporaryMemory(). + * The text string is temporary memory which will be freed in SDL_FreeTemporaryMemory() and can be claimed with SDL_ClaimTemporaryMemory(). * * This event will never be delivered unless text input is enabled by calling * SDL_StartTextInput(). Text input is disabled by default! @@ -789,9 +786,7 @@ typedef struct SDL_PenButtonEvent * An event used to drop text or request a file open by the system * (event.drop.*) * - * The source and data strings are temporary memory which will be - * automatically freed later, and can be claimed with - * SDL_ClaimTemporaryMemory(). + * The source and data strings are temporary memory which will be freed in SDL_FreeTemporaryMemory() and can be claimed with SDL_ClaimTemporaryMemory(). * * \since This struct is available since SDL 3.0.0. */ @@ -856,6 +851,8 @@ typedef struct SDL_QuitEvent * the programmer; the only requirement is that '''type''' is a value obtained * from SDL_RegisterEvents(). * + * If the data pointers are temporary memory, they will be automatically transfered to the thread that pulls the event from the queue, or freed if the event is flushed. + * * \since This struct is available since SDL 3.0.0. */ typedef struct SDL_UserEvent @@ -1416,8 +1413,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); /** * Allocate temporary memory. * - * You can use this to allocate memory that will be automatically freed later, - * after event processing is complete. + * You can use this to allocate memory from the temporary memory pool for the current thread. * * \param size the amount of memory to allocate. * \returns a pointer to the memory allocated or NULL on failure; call @@ -1428,24 +1424,18 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); * \since This function is available since SDL 3.0.0. * * \sa SDL_ClaimTemporaryMemory + * \sa SDL_FreeTemporaryMemory */ extern SDL_DECLSPEC void * SDLCALL SDL_AllocateTemporaryMemory(size_t size); /** * Claim ownership of temporary memory. * - * Some functions return temporary memory which SDL will automatically clean - * up. If you want to hold onto it past the current event being handled or - * beyond the current function scope, you can call this function to get a - * pointer that you own, and can free using SDL_free() when you're done. - * - * If the memory isn't temporary, this will return NULL, and you don't have - * ownership of the memory. + * This function removes memory from the temporary memory pool for the current thread and gives ownership to the application. The application should use SDL_free() to free it when it is done using it. * * \param mem a pointer allocated with SDL_AllocateTemporaryMemory(). * \returns a pointer to the memory now owned by the application, which must - * be freed using SDL_free(), or NULL if the memory is not temporary - * or is not owned by this thread. + * be freed using SDL_free(), or NULL if the memory is not in the temporary memory pool for the current thread. * * \threadsafety It is safe to call this function from any thread. * @@ -1456,6 +1446,22 @@ extern SDL_DECLSPEC void * SDLCALL SDL_AllocateTemporaryMemory(size_t size); */ extern SDL_DECLSPEC void * SDLCALL SDL_ClaimTemporaryMemory(const void *mem); +/** + * Free temporary memory for the current thread. + * + * This function frees all temporary memory for the current thread. If you would like to hold onto a specific pointer beyond this call, you should call SDL_ClaimTemporaryMemory() to move it out of the temporary memory pool. + * + * This function is automatically called in SDL_Quit() on the main thread and in SDL_CleanupTLS() when other threads complete. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_AllocateTemporaryMemory + * \sa SDL_ClaimTemporaryMemory + */ +extern SDL_DECLSPEC void SDLCALL SDL_FreeTemporaryMemory(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/include/SDL3/SDL_filesystem.h b/include/SDL3/SDL_filesystem.h index ff6ba13e6a47c..8318b25b77e78 100644 --- a/include/SDL3/SDL_filesystem.h +++ b/include/SDL3/SDL_filesystem.h @@ -68,9 +68,6 @@ extern "C" { * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns an absolute path in UTF-8 encoding to the application data * directory. NULL will be returned on error or when the platform * doesn't implement this functionality, call SDL_GetError() for more @@ -80,7 +77,7 @@ extern "C" { * * \sa SDL_GetPrefPath */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetBasePath(void); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetBasePath(void); /** * Get the user-and-app-specific path where files can be written. @@ -124,9 +121,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetBasePath(void); * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param org the name of your organization. * \param app the name of your application. * \returns a UTF-8 string of the user directory in platform-dependent @@ -137,7 +131,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetBasePath(void); * * \sa SDL_GetBasePath */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetPrefPath(const char *org, const char *app); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetPrefPath(const char *org, const char *app); /** * The type of the OS-provided default folder for a specific purpose. @@ -225,9 +219,6 @@ typedef enum SDL_Folder * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * If NULL is returned, the error may be obtained with SDL_GetError(). * * \param folder the type of folder to find. @@ -236,7 +227,7 @@ typedef enum SDL_Folder * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetUserFolder(SDL_Folder folder); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetUserFolder(SDL_Folder folder); /* Abstract filesystem interface */ @@ -369,9 +360,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo * * convenience, but if `count` is non-NULL, on return it will contain the * number of items in the array, not counting the NULL terminator. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param path the path of the directory to enumerate. * \param pattern the pattern that files in the directory must match. Can be * NULL. @@ -385,7 +373,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo * * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * const * SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count); +extern SDL_DECLSPEC_TEMP const char * const * SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_gamepad.h b/include/SDL3/SDL_gamepad.h index 5a8be95c1c58d..1011c9e5d167f 100644 --- a/include/SDL3/SDL_gamepad.h +++ b/include/SDL3/SDL_gamepad.h @@ -389,9 +389,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReloadGamepadMappings(void); /** * Get the current gamepad mappings. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of mappings returned, can * be NULL. * \returns an array of the mapping strings, NULL-terminated, or NULL on @@ -399,14 +396,11 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReloadGamepadMappings(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * const * SDLCALL SDL_GetGamepadMappings(int *count); +extern SDL_DECLSPEC_TEMP const char * const * SDLCALL SDL_GetGamepadMappings(int *count); /** * Get the gamepad mapping string for a given GUID. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param guid a structure containing the GUID for which a mapping is desired. * \returns a mapping string or NULL on failure; call SDL_GetError() for more * information. @@ -416,14 +410,11 @@ extern SDL_DECLSPEC const char * const * SDLCALL SDL_GetGamepadMappings(int *cou * \sa SDL_GetJoystickGUIDForID * \sa SDL_GetJoystickGUID */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID guid); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID guid); /** * Get the current mapping of a gamepad. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * Details about mappings are discussed with SDL_AddGamepadMapping(). * * \param gamepad the gamepad you want to get the current mapping for. @@ -437,7 +428,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID g * \sa SDL_GetGamepadMappingForGUID * \sa SDL_SetGamepadMapping */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad); /** * Set the current mapping of a joystick or gamepad. @@ -471,9 +462,6 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasGamepad(void); /** * Get a list of currently connected gamepads. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of gamepads returned, may * be NULL. * \returns a 0 terminated array of joystick instance IDs or NULL on failure; @@ -484,7 +472,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasGamepad(void); * \sa SDL_HasGamepad * \sa SDL_OpenGamepad */ -extern SDL_DECLSPEC const SDL_JoystickID * SDLCALL SDL_GetGamepads(int *count); +extern SDL_DECLSPEC_TEMP const SDL_JoystickID * SDLCALL SDL_GetGamepads(int *count); /** * Check if the given joystick is supported by the gamepad interface. @@ -505,9 +493,6 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsGamepad(SDL_JoystickID instance_id); * * This can be called before any gamepads are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the joystick instance ID. * \returns the name of the selected gamepad. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. @@ -517,16 +502,13 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsGamepad(SDL_JoystickID instance_id); * \sa SDL_GetGamepadName * \sa SDL_GetGamepads */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadNameForID(SDL_JoystickID instance_id); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadNameForID(SDL_JoystickID instance_id); /** * Get the implementation dependent path of a gamepad. * * This can be called before any gamepads are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the joystick instance ID. * \returns the path of the selected gamepad. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. @@ -536,7 +518,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadNameForID(SDL_JoystickID * \sa SDL_GetGamepadPath * \sa SDL_GetGamepads */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadPathForID(SDL_JoystickID instance_id); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadPathForID(SDL_JoystickID instance_id); /** * Get the player index of a gamepad. @@ -657,9 +639,6 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetRealGamepadTypeForID(SDL_Joys * * This can be called before any gamepads are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the joystick instance ID. * \returns the mapping string. Returns NULL if no mapping is available. * @@ -668,7 +647,7 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetRealGamepadTypeForID(SDL_Joys * \sa SDL_GetGamepads * \sa SDL_GetGamepadMapping */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadMappingForID(SDL_JoystickID instance_id); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadMappingForID(SDL_JoystickID instance_id); /** * Open a gamepad for use. @@ -757,9 +736,6 @@ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_GetGamepadID(SDL_Gamepad *gamepad /** * Get the implementation-dependent name for an opened gamepad. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param gamepad a gamepad identifier previously returned by * SDL_OpenGamepad(). * \returns the implementation dependent name for the gamepad, or NULL if @@ -769,14 +745,11 @@ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_GetGamepadID(SDL_Gamepad *gamepad * * \sa SDL_GetGamepadNameForID */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadName(SDL_Gamepad *gamepad); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadName(SDL_Gamepad *gamepad); /** * Get the implementation-dependent path for an opened gamepad. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param gamepad a gamepad identifier previously returned by * SDL_OpenGamepad(). * \returns the implementation dependent path for the gamepad, or NULL if @@ -786,7 +759,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadName(SDL_Gamepad *gamepad * * \sa SDL_GetGamepadPathForID */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadPath(SDL_Gamepad *gamepad); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadPath(SDL_Gamepad *gamepad); /** * Get the type of an opened gamepad. @@ -902,15 +875,12 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetGamepadFirmwareVersion(SDL_Gamepad *ga * * Returns the serial number of the gamepad, or NULL if it is not available. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param gamepad the gamepad object to query. * \returns the serial number, or NULL if unavailable. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadSerial(SDL_Gamepad *gamepad); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadSerial(SDL_Gamepad *gamepad); /** * Get the Steam Input handle of an opened gamepad, if available. @@ -1022,9 +992,6 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadEventsEnabled(void); /** * Get the SDL joystick layer bindings for a gamepad. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param gamepad a gamepad. * \param count a pointer filled in with the number of bindings returned. * \returns a NULL terminated array of pointers to bindings or NULL on @@ -1032,7 +999,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadEventsEnabled(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const SDL_GamepadBinding * const * SDLCALL SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count); +extern SDL_DECLSPEC_TEMP const SDL_GamepadBinding * const * SDLCALL SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count); /** * Manually pump gamepad updates if not using the loop. @@ -1066,9 +1033,6 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetGamepadTypeFromString(const c /** * Convert from an SDL_GamepadType enum to a string. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param type an enum value for a given SDL_GamepadType. * \returns a string for the given type, or NULL if an invalid type is * specified. The string returned is of the format used by @@ -1078,7 +1042,7 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetGamepadTypeFromString(const c * * \sa SDL_GetGamepadTypeFromString */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadStringForType(SDL_GamepadType type); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadStringForType(SDL_GamepadType type); /** * Convert a string into SDL_GamepadAxis enum. @@ -1105,9 +1069,6 @@ extern SDL_DECLSPEC SDL_GamepadAxis SDLCALL SDL_GetGamepadAxisFromString(const c /** * Convert from an SDL_GamepadAxis enum to a string. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param axis an enum value for a given SDL_GamepadAxis. * \returns a string for the given axis, or NULL if an invalid axis is * specified. The string returned is of the format used by @@ -1117,7 +1078,7 @@ extern SDL_DECLSPEC SDL_GamepadAxis SDLCALL SDL_GetGamepadAxisFromString(const c * * \sa SDL_GetGamepadAxisFromString */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis); /** * Query whether a gamepad has a given axis. @@ -1181,9 +1142,6 @@ extern SDL_DECLSPEC SDL_GamepadButton SDLCALL SDL_GetGamepadButtonFromString(con /** * Convert from an SDL_GamepadButton enum to a string. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param button an enum value for a given SDL_GamepadButton. * \returns a string for the given button, or NULL if an invalid button is * specified. The string returned is of the format used by @@ -1193,7 +1151,7 @@ extern SDL_DECLSPEC SDL_GamepadButton SDLCALL SDL_GetGamepadButtonFromString(con * * \sa SDL_GetGamepadButtonFromString */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadStringForButton(SDL_GamepadButton button); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadStringForButton(SDL_GamepadButton button); /** * Query whether a gamepad has a given button. @@ -1470,9 +1428,6 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseGamepad(SDL_Gamepad *gamepad); * Return the sfSymbolsName for a given button on a gamepad on Apple * platforms. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param gamepad the gamepad to query. * \param button a button on the gamepad. * \returns the sfSymbolsName or NULL if the name can't be found. @@ -1481,14 +1436,11 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseGamepad(SDL_Gamepad *gamepad); * * \sa SDL_GetGamepadAppleSFSymbolsNameForAxis */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button); /** * Return the sfSymbolsName for a given axis on a gamepad on Apple platforms. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param gamepad the gamepad to query. * \param axis an axis on the gamepad. * \returns the sfSymbolsName or NULL if the name can't be found. @@ -1497,7 +1449,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadAppleSFSymbolsNameForButt * * \sa SDL_GetGamepadAppleSFSymbolsNameForButton */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis); /* Ends C function definitions when using C++ */ diff --git a/include/SDL3/SDL_guid.h b/include/SDL3/SDL_guid.h index e0d519b9f9e30..df3f818fe35bc 100644 --- a/include/SDL3/SDL_guid.h +++ b/include/SDL3/SDL_guid.h @@ -66,9 +66,6 @@ typedef struct SDL_GUID { /** * Get an ASCII string representation for a given SDL_GUID. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param guid the SDL_GUID you wish to convert to string. * \returns the string representation of the GUID or NULL on failure; call * SDL_GetError() for more information. @@ -77,7 +74,7 @@ typedef struct SDL_GUID { * * \sa SDL_StringToGUID */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GUIDToString(SDL_GUID guid); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GUIDToString(SDL_GUID guid); /** * Convert a GUID string into a SDL_GUID structure. diff --git a/include/SDL3/SDL_haptic.h b/include/SDL3/SDL_haptic.h index 05263475ee2e2..bd94aebb21638 100644 --- a/include/SDL3/SDL_haptic.h +++ b/include/SDL3/SDL_haptic.h @@ -931,9 +931,6 @@ typedef Uint32 SDL_HapticID; /** * Get a list of currently connected haptic devices. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of haptic devices * returned, may be NULL. * \returns a 0 terminated array of haptic device instance IDs or NULL on @@ -943,16 +940,13 @@ typedef Uint32 SDL_HapticID; * * \sa SDL_OpenHaptic */ -extern SDL_DECLSPEC const SDL_HapticID * SDLCALL SDL_GetHaptics(int *count); +extern SDL_DECLSPEC_TEMP const SDL_HapticID * SDLCALL SDL_GetHaptics(int *count); /** * Get the implementation dependent name of a haptic device. * * This can be called before any haptic devices are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the haptic device instance ID. * \returns the name of the selected haptic device. If no name can be found, * this function returns NULL; call SDL_GetError() for more @@ -963,7 +957,7 @@ extern SDL_DECLSPEC const SDL_HapticID * SDLCALL SDL_GetHaptics(int *count); * \sa SDL_GetHapticName * \sa SDL_OpenHaptic */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetHapticNameForID(SDL_HapticID instance_id); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetHapticNameForID(SDL_HapticID instance_id); /** * Open a haptic device for use. @@ -1016,9 +1010,6 @@ extern SDL_DECLSPEC SDL_HapticID SDLCALL SDL_GetHapticID(SDL_Haptic *haptic); /** * Get the implementation dependent name of a haptic device. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param haptic the SDL_Haptic obtained from SDL_OpenJoystick(). * \returns the name of the selected haptic device. If no name can be found, * this function returns NULL; call SDL_GetError() for more @@ -1028,7 +1019,7 @@ extern SDL_DECLSPEC SDL_HapticID SDLCALL SDL_GetHapticID(SDL_Haptic *haptic); * * \sa SDL_GetHapticNameForID */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetHapticName(SDL_Haptic *haptic); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetHapticName(SDL_Haptic *haptic); /** * Query whether or not the current mouse has haptic capabilities. diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 816364f887288..7914f3d56e0c7 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3872,9 +3872,6 @@ extern SDL_DECLSPEC void SDLCALL SDL_ResetHints(void); /** * Get the value of a hint. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param name the hint to query. * \returns the string value of a hint or NULL if the hint isn't set. * @@ -3883,7 +3880,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ResetHints(void); * \sa SDL_SetHint * \sa SDL_SetHintWithPriority */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetHint(const char *name); /** * Get the boolean value of a hint variable. diff --git a/include/SDL3/SDL_joystick.h b/include/SDL3/SDL_joystick.h index df874b89fbf75..cda666421d049 100644 --- a/include/SDL3/SDL_joystick.h +++ b/include/SDL3/SDL_joystick.h @@ -201,9 +201,6 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasJoystick(void); /** * Get a list of currently connected joysticks. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of joysticks returned, may * be NULL. * \returns a 0 terminated array of joystick instance IDs or NULL on failure; @@ -214,16 +211,13 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasJoystick(void); * \sa SDL_HasJoystick * \sa SDL_OpenJoystick */ -extern SDL_DECLSPEC const SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count); +extern SDL_DECLSPEC_TEMP const SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count); /** * Get the implementation dependent name of a joystick. * * This can be called before any joysticks are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the joystick instance ID. * \returns the name of the selected joystick. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. @@ -233,16 +227,13 @@ extern SDL_DECLSPEC const SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count); * \sa SDL_GetJoystickName * \sa SDL_GetJoysticks */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickNameForID(SDL_JoystickID instance_id); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickNameForID(SDL_JoystickID instance_id); /** * Get the implementation dependent path of a joystick. * * This can be called before any joysticks are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the joystick instance ID. * \returns the path of the selected joystick. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. @@ -252,7 +243,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickNameForID(SDL_JoystickID * \sa SDL_GetJoystickPath * \sa SDL_GetJoysticks */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickPathForID(SDL_JoystickID instance_id); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickPathForID(SDL_JoystickID instance_id); /** * Get the player index of a joystick. @@ -662,9 +653,6 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetJoystickProperties(SDL_Joyst /** * Get the implementation dependent name of a joystick. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the name of the selected joystick. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. @@ -673,14 +661,11 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetJoystickProperties(SDL_Joyst * * \sa SDL_GetJoystickNameForID */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickName(SDL_Joystick *joystick); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickName(SDL_Joystick *joystick); /** * Get the implementation dependent path of a joystick. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the path of the selected joystick. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. @@ -689,7 +674,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickName(SDL_Joystick *joyst * * \sa SDL_GetJoystickPathForID */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickPath(SDL_Joystick *joystick); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickPath(SDL_Joystick *joystick); /** * Get the player index of an opened joystick. @@ -798,16 +783,13 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickFirmwareVersion(SDL_Joystick * * * Returns the serial number of the joystick, or NULL if it is not available. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the serial number of the selected joystick, or NULL if * unavailable. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickSerial(SDL_Joystick *joystick); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickSerial(SDL_Joystick *joystick); /** * Get the type of an opened joystick. diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index bb280ce14bce2..b0d7ce6790247 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -73,9 +73,6 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasKeyboard(void); * power buttons, etc. You should wait for input from a device before you * consider it actively in use. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of keyboards returned, may * be NULL. * \returns a 0 terminated array of keyboards instance IDs or NULL on failure; @@ -86,16 +83,13 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasKeyboard(void); * \sa SDL_GetKeyboardNameForID * \sa SDL_HasKeyboard */ -extern SDL_DECLSPEC const SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count); +extern SDL_DECLSPEC_TEMP const SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count); /** * Get the name of a keyboard. * * This function returns "" if the keyboard doesn't have a name. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the keyboard instance ID. * \returns the name of the selected keyboard or NULL on failure; call * SDL_GetError() for more information. @@ -104,7 +98,7 @@ extern SDL_DECLSPEC const SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count); * * \sa SDL_GetKeyboards */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id); /** * Query the window which currently has keyboard focus. @@ -284,9 +278,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetScancodeName(SDL_Scancode scancode, const /** * Get a human-readable name for a scancode. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * **Warning**: The returned name is by design not stable across platforms, * e.g. the name for `SDL_SCANCODE_LGUI` is "Left GUI" under Linux but "Left * Windows" under Microsoft Windows, and some scancodes like @@ -306,7 +297,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetScancodeName(SDL_Scancode scancode, const * \sa SDL_GetScancodeFromName * \sa SDL_SetScancodeName */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetScancodeName(SDL_Scancode scancode); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetScancodeName(SDL_Scancode scancode); /** * Get a scancode from a human-readable name. @@ -331,9 +322,6 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam * * If the key doesn't have a name, this function returns an empty string (""). * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param key the desired SDL_Keycode to query. * \returns a UTF-8 encoded string of the key name. * @@ -343,7 +331,7 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam * \sa SDL_GetKeyFromScancode * \sa SDL_GetScancodeFromKey */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyName(SDL_Keycode key); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetKeyName(SDL_Keycode key); /** * Get a key code from a human-readable name. diff --git a/include/SDL3/SDL_locale.h b/include/SDL3/SDL_locale.h index 84281e9235761..40fab59e82321 100644 --- a/include/SDL3/SDL_locale.h +++ b/include/SDL3/SDL_locale.h @@ -89,9 +89,6 @@ typedef struct SDL_Locale * if possible, and you can call this function again to get an updated copy of * preferred locales. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of locales returned, may * be NULL. * \returns a NULL terminated array of locale pointers, or NULL on failure; @@ -99,7 +96,7 @@ typedef struct SDL_Locale * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const SDL_Locale * const * SDLCALL SDL_GetPreferredLocales(int *count); +extern SDL_DECLSPEC_TEMP const SDL_Locale * const * SDLCALL SDL_GetPreferredLocales(int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index 8ddc3749548d6..0598ebca86561 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -135,9 +135,6 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasMouse(void); * You should wait for input from a device before you consider it actively in * use. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of mice returned, may be * NULL. * \returns a 0 terminated array of mouse instance IDs or NULL on failure; @@ -148,16 +145,13 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasMouse(void); * \sa SDL_GetMouseNameForID * \sa SDL_HasMouse */ -extern SDL_DECLSPEC const SDL_MouseID * SDLCALL SDL_GetMice(int *count); +extern SDL_DECLSPEC_TEMP const SDL_MouseID * SDLCALL SDL_GetMice(int *count); /** * Get the name of a mouse. * * This function returns "" if the mouse doesn't have a name. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the mouse instance ID. * \returns the name of the selected mouse, or NULL on failure; call * SDL_GetError() for more information. @@ -166,7 +160,7 @@ extern SDL_DECLSPEC const SDL_MouseID * SDLCALL SDL_GetMice(int *count); * * \sa SDL_GetMice */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetMouseNameForID(SDL_MouseID instance_id); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetMouseNameForID(SDL_MouseID instance_id); /** * Get the window which currently has mouse focus. diff --git a/include/SDL3/SDL_pen.h b/include/SDL3/SDL_pen.h index 8fcad1cc64e41..7d44bb597b72d 100644 --- a/include/SDL3/SDL_pen.h +++ b/include/SDL3/SDL_pen.h @@ -224,9 +224,6 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PenConnected(SDL_PenID instance_id); /** * Retrieves a human-readable description for a SDL_PenID. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the pen to query. * \returns a string that contains the name of the pen, intended for human * consumption. The string might or might not be localised, depending @@ -238,7 +235,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PenConnected(SDL_PenID instance_id); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetPenName(SDL_PenID instance_id); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetPenName(SDL_PenID instance_id); /** * Pen capabilities, as reported by SDL_GetPenCapabilities() diff --git a/include/SDL3/SDL_properties.h b/include/SDL3/SDL_properties.h index b649fd1bf673a..9450da714e32a 100644 --- a/include/SDL3/SDL_properties.h +++ b/include/SDL3/SDL_properties.h @@ -378,9 +378,6 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetPointerProperty(SDL_PropertiesID props /** * Get a string property from a group of properties. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param props the properties to query. * \param name the name of the property to query. * \param default_value the default value of the property. @@ -395,7 +392,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetPointerProperty(SDL_PropertiesID props * \sa SDL_HasProperty * \sa SDL_SetStringProperty */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetStringProperty(SDL_PropertiesID props, const char *name, const char *default_value); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetStringProperty(SDL_PropertiesID props, const char *name, const char *default_value); /** * Get a number property from a group of properties. diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index 24326ed09daa6..df6b8b4c5b6fb 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -154,9 +154,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); * "direct3d12" or "metal". These never have Unicode characters, and are not * meant to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param index the index of the rendering driver; the value ranges from 0 to * SDL_GetNumRenderDrivers() - 1. * \returns the name of the rendering driver at the requested index, or NULL @@ -166,7 +163,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); * * \sa SDL_GetNumRenderDrivers */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetRenderDriver(int index); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetRenderDriver(int index); /** * Create a window and default renderer. @@ -325,9 +322,6 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetRenderWindow(SDL_Renderer *rende /** * Get the name of a renderer. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param renderer the rendering context. * \returns the name of the selected renderer, or NULL on failure; call * SDL_GetError() for more information. @@ -337,7 +331,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetRenderWindow(SDL_Renderer *rende * \sa SDL_CreateRenderer * \sa SDL_CreateRendererWithProperties */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetRendererName(SDL_Renderer *renderer); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetRendererName(SDL_Renderer *renderer); /** * Get the properties associated with a renderer. diff --git a/include/SDL3/SDL_sensor.h b/include/SDL3/SDL_sensor.h index 89b1bfd6dbe3a..c0ae5048722cf 100644 --- a/include/SDL3/SDL_sensor.h +++ b/include/SDL3/SDL_sensor.h @@ -160,15 +160,12 @@ extern SDL_DECLSPEC const SDL_SensorID * SDLCALL SDL_GetSensors(int *count); * * This can be called before any sensors are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the sensor instance ID. * \returns the sensor name, or NULL if `instance_id` is not valid. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorNameForID(SDL_SensorID instance_id); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetSensorNameForID(SDL_SensorID instance_id); /** * Get the type of a sensor. @@ -232,16 +229,13 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSensorProperties(SDL_Sensor /** * Get the implementation dependent name of a sensor. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param sensor the SDL_Sensor object. * \returns the sensor name or NULL on failure; call SDL_GetError() for more * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorName(SDL_Sensor *sensor); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetSensorName(SDL_Sensor *sensor); /** * Get the type of a sensor. diff --git a/include/SDL3/SDL_storage.h b/include/SDL3/SDL_storage.h index f95030adf2fe4..bd78da3f6d301 100644 --- a/include/SDL3/SDL_storage.h +++ b/include/SDL3/SDL_storage.h @@ -401,9 +401,6 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetStorageSpaceRemaining(SDL_Storage *sto * convenience, but if `count` is non-NULL, on return it will contain the * number of items in the array, not counting the NULL terminator. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param storage a storage container. * \param path the path of the directory to enumerate. * \param pattern the pattern that files in the directory must match. Can be @@ -420,7 +417,7 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetStorageSpaceRemaining(SDL_Storage *sto * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * const * SDLCALL SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count); +extern SDL_DECLSPEC_TEMP const char * const * SDLCALL SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_system.h b/include/SDL3/SDL_system.h index db996383534c4..a7c1238af54d2 100644 --- a/include/SDL3/SDL_system.h +++ b/include/SDL3/SDL_system.h @@ -411,9 +411,6 @@ extern SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); * * https://developer.android.com/reference/android/content/Context#getFilesDir() * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the path used for internal storage or NULL on failure; call * SDL_GetError() for more information. * @@ -421,7 +418,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); * * \sa SDL_GetAndroidExternalStorageState */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidInternalStoragePath(void); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetAndroidInternalStoragePath(void); /** * Get the current state of external storage for this Android application. @@ -453,9 +450,6 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetAndroidExternalStorageState(void); * * https://developer.android.com/reference/android/content/Context#getExternalFilesDir() * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the path used for external storage for this application on success * or NULL on failure; call SDL_GetError() for more information. * @@ -463,7 +457,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetAndroidExternalStorageState(void); * * \sa SDL_GetAndroidExternalStorageState */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidExternalStoragePath(void); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetAndroidExternalStoragePath(void); /** * Get the path used for caching data for this Android application. @@ -477,15 +471,12 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidExternalStoragePath(void) * * https://developer.android.com/reference/android/content/Context#getCacheDir() * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the path used for caches for this application on success or NULL * on failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidCachePath(void); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetAndroidCachePath(void); typedef void (SDLCALL *SDL_RequestAndroidPermissionCallback)(void *userdata, const char *permission, SDL_bool granted); @@ -632,9 +623,6 @@ typedef enum SDL_WinRT_DeviceFamily * * https://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param pathType the type of path to retrieve, one of SDL_WinRT_Path. * \returns a UTF-8 string (8-bit, multi-byte) containing the path, or NULL if * the path is not available for any reason; call SDL_GetError() for @@ -642,7 +630,7 @@ typedef enum SDL_WinRT_DeviceFamily * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetWinRTFSPath(SDL_WinRT_Path pathType); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetWinRTFSPath(SDL_WinRT_Path pathType); /** * Detects the device family of WinRT platform at runtime. diff --git a/include/SDL3/SDL_thread.h b/include/SDL3/SDL_thread.h index 86aa6cf667328..fb98fd7358815 100644 --- a/include/SDL3/SDL_thread.h +++ b/include/SDL3/SDL_thread.h @@ -330,16 +330,13 @@ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithPropertiesRuntime(S /** * Get the thread name as it was specified in SDL_CreateThread(). * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param thread the thread to query. * \returns a pointer to a UTF-8 string that names the specified thread, or * NULL if it doesn't have a name. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetThreadName(SDL_Thread *thread); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetThreadName(SDL_Thread *thread); /** * Get the thread identifier for the current thread. diff --git a/include/SDL3/SDL_touch.h b/include/SDL3/SDL_touch.h index 93f3b225a94d8..6c9f6ccef10af 100644 --- a/include/SDL3/SDL_touch.h +++ b/include/SDL3/SDL_touch.h @@ -83,9 +83,6 @@ typedef struct SDL_Finger * Therefore the returned list might be empty, although devices are available. * After using all devices at least once the number will be correct. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of touch device IDs or NULL on failure; call @@ -93,21 +90,18 @@ typedef struct SDL_Finger * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const SDL_TouchID * SDLCALL SDL_GetTouchDevices(int *count); +extern SDL_DECLSPEC_TEMP const SDL_TouchID * SDLCALL SDL_GetTouchDevices(int *count); /** * Get the touch device name as reported from the driver. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param touchID the touch device instance ID. * \returns touch device name, or NULL on failure; call SDL_GetError() for * more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetTouchDeviceName(SDL_TouchID touchID); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetTouchDeviceName(SDL_TouchID touchID); /** * Get the type of the given touch device. @@ -122,9 +116,6 @@ extern SDL_DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_Touch /** * Get a list of active fingers for a given touch device. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param touchID the ID of a touch device. * \param count a pointer filled in with the number of fingers returned, can * be NULL. @@ -133,7 +124,7 @@ extern SDL_DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_Touch * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const SDL_Finger * const * SDLCALL SDL_GetTouchFingers(SDL_TouchID touchID, int *count); +extern SDL_DECLSPEC_TEMP const SDL_Finger * const * SDLCALL SDL_GetTouchFingers(SDL_TouchID touchID, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index e159f3c483157..74a0401ee382f 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -349,9 +349,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); * "x11" or "windows". These never have Unicode characters, and are not meant * to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param index the index of a video driver. * \returns the name of the video driver with the given **index**. * @@ -359,7 +356,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); * * \sa SDL_GetNumVideoDrivers */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetVideoDriver(int index); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetVideoDriver(int index); /** * Get the name of the currently initialized video driver. @@ -368,9 +365,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetVideoDriver(int index); * "x11" or "windows". These never have Unicode characters, and are not meant * to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the name of the current video driver or NULL if no driver has been * initialized. * @@ -379,7 +373,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetVideoDriver(int index); * \sa SDL_GetNumVideoDrivers * \sa SDL_GetVideoDriver */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentVideoDriver(void); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCurrentVideoDriver(void); /** * Get the current system theme. @@ -393,9 +387,6 @@ extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void); /** * Get a list of currently connected displays. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of displays returned, may * be NULL. * \returns a 0 terminated array of display instance IDs or NULL on failure; @@ -403,7 +394,7 @@ extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count); +extern SDL_DECLSPEC_TEMP const SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count); /** * Return the primary display. @@ -449,9 +440,6 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetDisplayProperties(SDL_Displa /** * Get the name of a display in UTF-8 encoding. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param displayID the instance ID of the display to query. * \returns the name of a display or NULL on failure; call SDL_GetError() for * more information. @@ -460,7 +448,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetDisplayProperties(SDL_Displa * * \sa SDL_GetDisplays */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetDisplayName(SDL_DisplayID displayID); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetDisplayName(SDL_DisplayID displayID); /** * Get the desktop area represented by a display. @@ -559,9 +547,6 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetDisplayContentScale(SDL_DisplayID displ * - refresh rate -> highest to lowest * - pixel density -> lowest to highest * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param displayID the instance ID of the display to query. * \param count a pointer filled in with the number of display modes returned, * may be NULL. @@ -572,7 +557,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetDisplayContentScale(SDL_DisplayID displ * * \sa SDL_GetDisplays */ -extern SDL_DECLSPEC const SDL_DisplayMode * const * SDLCALL SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count); +extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * const * SDLCALL SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count); /** * Get the closest match to the requested display mode. @@ -584,9 +569,6 @@ extern SDL_DECLSPEC const SDL_DisplayMode * const * SDLCALL SDL_GetFullscreenDis * and finally checking the refresh rate. If all the available modes are too * small, then NULL is returned. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param displayID the instance ID of the display to query. * \param w the width in pixels of the desired display mode. * \param h the height in pixels of the desired display mode. @@ -603,7 +585,7 @@ extern SDL_DECLSPEC const SDL_DisplayMode * const * SDLCALL SDL_GetFullscreenDis * \sa SDL_GetDisplays * \sa SDL_GetFullscreenDisplayModes */ -extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, SDL_bool include_high_density_modes); +extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * SDLCALL SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, SDL_bool include_high_density_modes); /** * Get information about the desktop's display mode. @@ -613,9 +595,6 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetClosestFullscreenDisp * function will return the previous native display mode, and not the current * display mode. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param displayID the instance ID of the display to query. * \returns a pointer to the desktop display mode or NULL on failure; call * SDL_GetError() for more information. @@ -625,7 +604,7 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetClosestFullscreenDisp * \sa SDL_GetCurrentDisplayMode * \sa SDL_GetDisplays */ -extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayID displayID); +extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayID displayID); /** * Get information about the current display mode. @@ -635,9 +614,6 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetDesktopDisplayMode(SD * function will return the current display mode, and not the previous native * display mode. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param displayID the instance ID of the display to query. * \returns a pointer to the desktop display mode or NULL on failure; call * SDL_GetError() for more information. @@ -647,7 +623,7 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetDesktopDisplayMode(SD * \sa SDL_GetDesktopDisplayMode * \sa SDL_GetDisplays */ -extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayID displayID); +extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayID displayID); /** * Get the display containing a point. @@ -768,9 +744,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetWindowFullscreenMode(SDL_Window *window, /** * Query the display mode to use when a window is visible at fullscreen. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param window the window to query. * \returns a pointer to the exclusive fullscreen mode to use or NULL for * borderless fullscreen desktop mode. @@ -780,14 +753,11 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetWindowFullscreenMode(SDL_Window *window, * \sa SDL_SetWindowFullscreenMode * \sa SDL_SetWindowFullscreen */ -extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode(SDL_Window *window); +extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode(SDL_Window *window); /** * Get the raw ICC profile data for the screen the window is currently on. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param window the window to query. * \param size the size of the ICC profile. * \returns the raw ICC profile data on success or NULL on failure; call @@ -795,7 +765,7 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode( * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size); +extern SDL_DECLSPEC_TEMP const void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size); /** * Get the pixel format associated with the window. @@ -812,9 +782,6 @@ extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetWindowPixelFormat(SDL_Window /** * Get a list of valid windows. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of windows returned, may * be NULL. * \returns a NULL terminated array of SDL_Window pointers or NULL on failure; @@ -822,7 +789,7 @@ extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetWindowPixelFormat(SDL_Window * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_Window * const * SDLCALL SDL_GetWindows(int *count); +extern SDL_DECLSPEC_TEMP SDL_Window * const * SDLCALL SDL_GetWindows(int *count); /** * Create a window with the specified dimensions and flags. @@ -1347,9 +1314,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetWindowTitle(SDL_Window *window, const cha /** * Get the title of a window. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param window the window to query. * \returns the title of the window in UTF-8 format or "" if there is no * title. @@ -1358,7 +1322,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetWindowTitle(SDL_Window *window, const cha * * \sa SDL_SetWindowTitle */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetWindowTitle(SDL_Window *window); +extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetWindowTitle(SDL_Window *window); /** * Set the icon for a window. diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 6ea636438f824..0c87fae5b52b4 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -130,6 +130,7 @@ SDL3_0.0.0 { SDL_FlushEvent; SDL_FlushEvents; SDL_FlushRenderer; + SDL_FreeTemporaryMemory; SDL_GDKSuspendComplete; SDL_GL_CreateContext; SDL_GL_DestroyContext; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 9dc1131f1ad94..b4aa6633dcaa2 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -155,6 +155,7 @@ #define SDL_FlushEvent SDL_FlushEvent_REAL #define SDL_FlushEvents SDL_FlushEvents_REAL #define SDL_FlushRenderer SDL_FlushRenderer_REAL +#define SDL_FreeTemporaryMemory SDL_FreeTemporaryMemory_REAL #define SDL_GDKSuspendComplete SDL_GDKSuspendComplete_REAL #define SDL_GL_CreateContext SDL_GL_CreateContext_REAL #define SDL_GL_DestroyContext SDL_GL_DestroyContext_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 7db3f48184350..0ea498c3ebb95 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -175,6 +175,7 @@ SDL_DYNAPI_PROC(int,SDL_FlushAudioStream,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(void,SDL_FlushEvent,(Uint32 a),(a),) SDL_DYNAPI_PROC(void,SDL_FlushEvents,(Uint32 a, Uint32 b),(a,b),) SDL_DYNAPI_PROC(int,SDL_FlushRenderer,(SDL_Renderer *a),(a),return) +SDL_DYNAPI_PROC(void,SDL_FreeTemporaryMemory,(void),(),) SDL_DYNAPI_PROC(void,SDL_GDKSuspendComplete,(void),(),) SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_CreateContext,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GL_DestroyContext,(SDL_GLContext a),(a),return) diff --git a/src/dynapi/gendynapi.py b/src/dynapi/gendynapi.py index fb601af9df4e3..339861427718e 100755 --- a/src/dynapi/gendynapi.py +++ b/src/dynapi/gendynapi.py @@ -197,6 +197,7 @@ def main(): func_ret = func_ret.replace('extern', ' ') func_ret = func_ret.replace('SDLCALL', ' ') func_ret = func_ret.replace('SDL_DECLSPEC', ' ') + func_ret = func_ret.replace('SDL_DECLSPEC_TEMP', ' ') # Remove trailing spaces in front of '*' tmp = "" while func_ret != tmp: diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index 098bec2b1e6dc..6a8021b5a2192 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -79,7 +79,6 @@ static Uint32 SDL_userevents = SDL_EVENT_USER; typedef struct SDL_TemporaryMemory { void *memory; - Uint64 timestamp; struct SDL_TemporaryMemory *prev; struct SDL_TemporaryMemory *next; } SDL_TemporaryMemory; @@ -111,7 +110,6 @@ static struct SDL_EventEntry *free; } SDL_EventQ = { NULL, SDL_FALSE, { 0 }, 0, NULL, NULL, NULL }; -static void SDL_FreeTemporaryMemory(void); static void SDL_CleanupTemporaryMemory(void *data) { @@ -268,23 +266,6 @@ static void SDL_TransferTemporaryMemoryFromEvent(SDL_EventEntry *event) event->memory = NULL; } -static void SDL_CollectTemporaryMemory(SDL_TemporaryMemoryState *state, Uint64 now) -{ - // Temporary memory will age out and be collected after 1 second - const int TEMPORARY_MEMORY_COLLECT_TIME_MS = 1000; - - while (state->head) { - SDL_TemporaryMemory *entry = state->head; - - if ((now - entry->timestamp) < TEMPORARY_MEMORY_COLLECT_TIME_MS) { - break; - } - - SDL_UnlinkTemporaryMemoryEntry(state, entry); - SDL_FreeTemporaryMemoryEntry(state, entry, SDL_TRUE); - } -} - void *SDL_FreeLater(void *memory) { SDL_TemporaryMemoryState *state; @@ -301,16 +282,12 @@ void *SDL_FreeLater(void *memory) return memory; // this is now a leak, but you probably have bigger problems if malloc failed. } - Uint64 now = SDL_GetTicks(); - SDL_CollectTemporaryMemory(state, now); - SDL_TemporaryMemory *entry = (SDL_TemporaryMemory *)SDL_malloc(sizeof(*entry)); if (!entry) { return memory; // this is now a leak, but you probably have bigger problems if malloc failed. We could probably pool up and reuse entries, though. } entry->memory = memory; - entry->timestamp = now; SDL_LinkTemporaryMemoryEntry(state, entry); @@ -885,8 +862,6 @@ void SDL_StopEventLoop(void) SDL_EventQ.free = NULL; SDL_AtomicSet(&SDL_sentinel_pending, 0); - SDL_FreeTemporaryMemory(); - /* Clear disabled event state */ for (i = 0; i < SDL_arraysize(SDL_disabled_events); ++i) { SDL_free(SDL_disabled_events[i]); @@ -1183,9 +1158,6 @@ void SDL_FlushEvents(Uint32 minType, Uint32 maxType) /* Run the system dependent event loops */ static void SDL_PumpEventsInternal(SDL_bool push_sentinel) { - /* Free old event memory */ - SDL_FreeTemporaryMemory(); - /* Release any keys held down from last frame */ SDL_ReleaseAutoReleaseKeys(); diff --git a/test/testautomation_events.c b/test/testautomation_events.c index 9b33f5d75ce55..92438a0522ab8 100644 --- a/test/testautomation_events.c +++ b/test/testautomation_events.c @@ -233,32 +233,6 @@ static int events_temporaryMemory(void *arg) SDL_free(claimed); } - { - /* Create event memory and queue it */ - mem = SDL_AllocateTemporaryMemory(1); - SDLTest_AssertCheck(mem != NULL, "SDL_AllocateTemporaryMemory()"); - *(char *)mem = '3'; - - SDL_zero(event); - event.type = SDL_EVENT_USER; - event.user.data1 = mem; - SDL_PushEvent(&event); - - /* Get the event and verify the memory is valid */ - found = SDL_FALSE; - while (SDL_PollEvent(&event)) { - if (event.type == SDL_EVENT_USER && event.user.data1 == mem) { - found = SDL_TRUE; - } - } - SDLTest_AssertCheck(found, "SDL_PollEvent() returned queued event"); - - /* Verify that pumping the event loop frees event memory */ - SDL_PumpEvents(); - claimed = SDL_ClaimTemporaryMemory(mem); - SDLTest_AssertCheck(claimed == NULL, "SDL_ClaimTemporaryMemory() can't claim memory after pumping the event loop"); - } - return TEST_COMPLETED; } From 2137e6eed1d42616051df3d291e688221222ab04 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Fri, 26 Jul 2024 17:05:33 +0000 Subject: [PATCH 003/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_events.h | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index 159399eb41edd..e07a0397e049a 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -352,7 +352,9 @@ typedef struct SDL_KeyboardEvent * will be inserted into the editing text. The length is the number of UTF-8 * characters that will be replaced by new typing. * - * The text string is temporary memory which will be freed in SDL_FreeTemporaryMemory() and can be claimed with SDL_ClaimTemporaryMemory(). + * The text string is temporary memory which will be freed in + * SDL_FreeTemporaryMemory() and can be claimed with + * SDL_ClaimTemporaryMemory(). * * \since This struct is available since SDL 3.0.0. */ @@ -370,7 +372,9 @@ typedef struct SDL_TextEditingEvent /** * Keyboard IME candidates event structure (event.edit_candidates.*) * - * The candidates are a single allocation of temporary memory which will be freed in SDL_FreeTemporaryMemory() and can be claimed with SDL_ClaimTemporaryMemory(). + * The candidates are a single allocation of temporary memory which will be + * freed in SDL_FreeTemporaryMemory() and can be claimed with + * SDL_ClaimTemporaryMemory(). * * \since This struct is available since SDL 3.0.0. */ @@ -389,7 +393,9 @@ typedef struct SDL_TextEditingCandidatesEvent /** * Keyboard text input event structure (event.text.*) * - * The text string is temporary memory which will be freed in SDL_FreeTemporaryMemory() and can be claimed with SDL_ClaimTemporaryMemory(). + * The text string is temporary memory which will be freed in + * SDL_FreeTemporaryMemory() and can be claimed with + * SDL_ClaimTemporaryMemory(). * * This event will never be delivered unless text input is enabled by calling * SDL_StartTextInput(). Text input is disabled by default! @@ -786,7 +792,9 @@ typedef struct SDL_PenButtonEvent * An event used to drop text or request a file open by the system * (event.drop.*) * - * The source and data strings are temporary memory which will be freed in SDL_FreeTemporaryMemory() and can be claimed with SDL_ClaimTemporaryMemory(). + * The source and data strings are temporary memory which will be freed in + * SDL_FreeTemporaryMemory() and can be claimed with + * SDL_ClaimTemporaryMemory(). * * \since This struct is available since SDL 3.0.0. */ @@ -851,7 +859,9 @@ typedef struct SDL_QuitEvent * the programmer; the only requirement is that '''type''' is a value obtained * from SDL_RegisterEvents(). * - * If the data pointers are temporary memory, they will be automatically transfered to the thread that pulls the event from the queue, or freed if the event is flushed. + * If the data pointers are temporary memory, they will be automatically + * transfered to the thread that pulls the event from the queue, or freed if + * the event is flushed. * * \since This struct is available since SDL 3.0.0. */ @@ -1413,7 +1423,8 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); /** * Allocate temporary memory. * - * You can use this to allocate memory from the temporary memory pool for the current thread. + * You can use this to allocate memory from the temporary memory pool for the + * current thread. * * \param size the amount of memory to allocate. * \returns a pointer to the memory allocated or NULL on failure; call @@ -1431,11 +1442,14 @@ extern SDL_DECLSPEC void * SDLCALL SDL_AllocateTemporaryMemory(size_t size); /** * Claim ownership of temporary memory. * - * This function removes memory from the temporary memory pool for the current thread and gives ownership to the application. The application should use SDL_free() to free it when it is done using it. + * This function removes memory from the temporary memory pool for the current + * thread and gives ownership to the application. The application should use + * SDL_free() to free it when it is done using it. * * \param mem a pointer allocated with SDL_AllocateTemporaryMemory(). * \returns a pointer to the memory now owned by the application, which must - * be freed using SDL_free(), or NULL if the memory is not in the temporary memory pool for the current thread. + * be freed using SDL_free(), or NULL if the memory is not in the + * temporary memory pool for the current thread. * * \threadsafety It is safe to call this function from any thread. * @@ -1449,9 +1463,13 @@ extern SDL_DECLSPEC void * SDLCALL SDL_ClaimTemporaryMemory(const void *mem); /** * Free temporary memory for the current thread. * - * This function frees all temporary memory for the current thread. If you would like to hold onto a specific pointer beyond this call, you should call SDL_ClaimTemporaryMemory() to move it out of the temporary memory pool. + * This function frees all temporary memory for the current thread. If you + * would like to hold onto a specific pointer beyond this call, you should + * call SDL_ClaimTemporaryMemory() to move it out of the temporary memory + * pool. * - * This function is automatically called in SDL_Quit() on the main thread and in SDL_CleanupTLS() when other threads complete. + * This function is automatically called in SDL_Quit() on the main thread and + * in SDL_CleanupTLS() when other threads complete. * * \threadsafety It is safe to call this function from any thread. * From 21411c6418e1d9c6ea4bc431e6fd0fd636b857bb Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 26 Jul 2024 10:39:05 -0700 Subject: [PATCH 004/253] Don't apply creation window flags to external windows. Whoever provided the window has already set it up the way they want it. Fixes SDL removing iconified or maximized state when creating a window from an existing OS window. --- src/video/SDL_video.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 6dbd60e242d25..cd44953e241e0 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2146,9 +2146,14 @@ static void ApplyWindowFlags(SDL_Window *window, SDL_WindowFlags flags) static void SDL_FinishWindowCreation(SDL_Window *window, SDL_WindowFlags flags) { PrepareDragAndDropSupport(window); - ApplyWindowFlags(window, flags); - if (!(flags & SDL_WINDOW_HIDDEN)) { - SDL_ShowWindow(window); + + if (window->flags & SDL_WINDOW_EXTERNAL) { + // Whoever has created the window has already applied whatever flags are needed + } else { + ApplyWindowFlags(window, flags); + if (!(flags & SDL_WINDOW_HIDDEN)) { + SDL_ShowWindow(window); + } } } From 4f55271571fbaf63fc8c1c0924512628fb6ed970 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 26 Jul 2024 18:57:18 -0700 Subject: [PATCH 005/253] Removed temporary memory from the API It was intended to make the API easier to use, but various automatic garbage collection all had flaws, and making the application periodically clean up temporary memory added cognitive load to using the API, and in many cases was it was difficult to restructure threaded code to handle this. So, we're largely going back to the original system, where the API returns allocated results and you free them. In addition, to solve the problems we originally wanted temporary memory for: * Short strings with a finite count, like device names, get stored in a per-thread string pool. * Events continue to use temporary memory internally, which is cleaned up on the next event processing cycle. --- docs/README-migration.md | 38 ++++------ docs/README-strings.md | 52 ------------- docs/README-winrt.md | 39 ---------- include/SDL3/SDL_audio.h | 26 +++---- include/SDL3/SDL_begin_code.h | 7 +- include/SDL3/SDL_camera.h | 14 ++-- include/SDL3/SDL_clipboard.h | 12 +-- include/SDL3/SDL_events.h | 79 -------------------- include/SDL3/SDL_filesystem.h | 12 +-- include/SDL3/SDL_gamepad.h | 44 +++++------ include/SDL3/SDL_guid.h | 6 +- include/SDL3/SDL_haptic.h | 9 ++- include/SDL3/SDL_hints.h | 2 +- include/SDL3/SDL_joystick.h | 14 ++-- include/SDL3/SDL_keyboard.h | 10 +-- include/SDL3/SDL_locale.h | 4 +- include/SDL3/SDL_mouse.h | 6 +- include/SDL3/SDL_pen.h | 2 +- include/SDL3/SDL_properties.h | 9 ++- include/SDL3/SDL_render.h | 4 +- include/SDL3/SDL_sensor.h | 8 +- include/SDL3/SDL_stdinc.h | 6 +- include/SDL3/SDL_storage.h | 4 +- include/SDL3/SDL_system.h | 8 +- include/SDL3/SDL_thread.h | 2 +- include/SDL3/SDL_touch.h | 10 +-- include/SDL3/SDL_video.h | 39 +++++----- src/SDL_guid.c | 19 +++-- src/SDL_hints.c | 10 +-- src/SDL_internal.h | 15 ++-- src/SDL_properties.c | 4 +- src/SDL_utils.c | 45 +++++++++++ src/SDL_utils_c.h | 2 + src/audio/SDL_audio.c | 20 ++--- src/audio/SDL_audiocvt.c | 12 +-- src/camera/SDL_camera.c | 14 ++-- src/core/android/SDL_android.c | 6 +- src/dynapi/SDL_dynapi_procs.h | 66 ++++++++-------- src/dynapi/gendynapi.py | 2 +- src/events/SDL_events.c | 11 ++- src/events/SDL_events_c.h | 5 ++ src/events/SDL_keyboard.c | 12 +-- src/events/SDL_keymap.c | 5 +- src/events/SDL_mouse.c | 6 +- src/events/SDL_pen.c | 2 +- src/events/SDL_touch.c | 10 +-- src/filesystem/SDL_filesystem.c | 10 +-- src/filesystem/SDL_sysfilesystem.h | 2 +- src/filesystem/winrt/SDL_sysfilesystem.cpp | 2 +- src/haptic/SDL_haptic.c | 10 +-- src/joystick/SDL_gamepad.c | 75 ++++++++----------- src/joystick/SDL_joystick.c | 27 ++++--- src/joystick/apple/SDL_mfijoystick.m | 8 +- src/locale/SDL_locale.c | 6 +- src/render/SDL_render.c | 4 +- src/sensor/SDL_sensor.c | 8 +- src/stdlib/SDL_getenv.c | 17 +++-- src/storage/SDL_storage.c | 2 +- src/storage/generic/SDL_genericstorage.c | 12 +-- src/test/SDL_test_common.c | 34 +++++---- src/thread/SDL_thread.c | 4 +- src/video/SDL_clipboard.c | 26 +++---- src/video/SDL_video.c | 87 +++++++++------------- src/video/cocoa/SDL_cocoawindow.m | 3 +- src/video/kmsdrm/SDL_kmsdrmmouse.c | 3 +- src/video/kmsdrm/SDL_kmsdrmvideo.c | 10 +-- src/video/uikit/SDL_uikitmodes.m | 3 +- src/video/uikit/SDL_uikitwindow.m | 9 +-- src/video/wayland/SDL_waylandwindow.c | 3 +- src/video/windows/SDL_windowsevents.c | 6 +- src/video/x11/SDL_x11modes.c | 3 +- src/video/x11/SDL_x11mouse.c | 3 +- src/video/x11/SDL_x11xinput2.c | 57 ++++++++------ test/gamepadutils.c | 6 +- test/pretest.c | 2 +- test/testaudioinfo.c | 3 +- test/testaudiorecording.c | 7 +- test/testautomation_audio.c | 3 +- test/testautomation_clipboard.c | 26 +++++-- test/testautomation_events.c | 67 +---------------- test/testautomation_guid.c | 4 +- test/testautomation_joystick.c | 12 ++- test/testautomation_pen.c | 1 + test/testautomation_video.c | 42 ++++++----- test/testbounds.c | 3 +- test/testcamera.c | 6 +- test/testcontroller.c | 23 +++--- test/testdialog.c | 3 +- test/testdisplayinfo.c | 6 +- test/testfilesystem.c | 7 +- test/testhaptic.c | 61 +++++++-------- test/testhotplug.c | 8 +- test/testime.c | 19 ++++- test/testlocale.c | 3 +- test/testmultiaudio.c | 3 +- test/testpen.c | 4 +- test/testrumble.c | 59 ++++++++------- test/testsensor.c | 3 +- test/testsurround.c | 4 +- test/testwm.c | 7 +- 100 files changed, 721 insertions(+), 837 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 879c2df00e484..d6e0b0731c0ac 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -158,9 +158,9 @@ Rather than iterating over audio devices using a device index, there are new fun if (devices) { for (i = 0; i < num_devices; ++i) { SDL_AudioDeviceID instance_id = devices[i]; - const char *name = SDL_GetAudioDeviceName(instance_id); - SDL_Log("AudioDevice %" SDL_PRIu32 ": %s\n", instance_id, name); + SDL_Log("AudioDevice %" SDL_PRIu32 ": %s\n", instance_id, SDL_GetAudioDeviceName(instance_id)); } + SDL_free(devices); } SDL_QuitSubSystem(SDL_INIT_AUDIO); } @@ -298,10 +298,6 @@ The following symbols have been renamed: The following symbols have been removed: * SDL_MIX_MAXVOLUME - mixer volume is now a float between 0.0 and 1.0 -## SDL_clipboard.h - -SDL_GetClipboardText() and SDL_GetPrimarySelectionText() return a const pointer to temporary memory, which does not need to be freed. You can use SDL_ClaimTemporaryMemory() to convert it to a non-const pointer that should be freed when you're done with it. - ## SDL_cpuinfo.h The intrinsics headers (mmintrin.h, etc.) have been moved to `` and are no longer automatically included in SDL.h. @@ -458,10 +454,6 @@ The following functions have been removed: The following enums have been renamed: * SDL_eventaction => SDL_EventAction -## SDL_filesystem.h - -SDL_GetBasePath() and SDL_GetPrefPath() return a const pointer to temporary memory, which does not need to be freed. You can use SDL_ClaimTemporaryMemory() to convert it to a non-const pointer that should be freed when you're done with it. - ## SDL_gamecontroller.h SDL_gamecontroller.h has been renamed SDL_gamepad.h, and all APIs have been renamed to match. @@ -710,15 +702,13 @@ Rather than iterating over haptic devices using device index, there is a new fun { if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0) { int i, num_haptics; - const SDL_HapticID *haptics = SDL_GetHaptics(&num_haptics); + SDL_HapticID *haptics = SDL_GetHaptics(&num_haptics); if (haptics) { for (i = 0; i < num_haptics; ++i) { SDL_HapticID instance_id = haptics[i]; - const char *name = SDL_GetHapticNameForID(instance_id); - - SDL_Log("Haptic %" SDL_PRIu32 ": %s\n", - instance_id, name ? name : "Unknown"); + SDL_Log("Haptic %" SDL_PRIu32 ": %s\n", instance_id, SDL_GetHapticNameForID(instance_id)); } + SDL_free(haptics); } SDL_QuitSubSystem(SDL_INIT_HAPTIC); } @@ -840,7 +830,7 @@ Rather than iterating over joysticks using device index, there is a new function { if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == 0) { int i, num_joysticks; - const SDL_JoystickID *joysticks = SDL_GetJoysticks(&num_joysticks); + SDL_JoystickID *joysticks = SDL_GetJoysticks(&num_joysticks); if (joysticks) { for (i = 0; i < num_joysticks; ++i) { SDL_JoystickID instance_id = joysticks[i]; @@ -850,6 +840,7 @@ Rather than iterating over joysticks using device index, there is a new function SDL_Log("Joystick %" SDL_PRIu32 ": %s%s%s VID 0x%.4x, PID 0x%.4x\n", instance_id, name ? name : "Unknown", path ? ", " : "", path ? path : "", SDL_GetJoystickVendorForID(instance_id), SDL_GetJoystickProductForID(instance_id)); } + SDL_free(joysticks); } SDL_QuitSubSystem(SDL_INIT_JOYSTICK); } @@ -1034,10 +1025,6 @@ The following symbols have been renamed: SDL_LoadFunction() now returns `SDL_FunctionPointer` instead of `void *`, and should be cast to the appropriate function type. You can define SDL_FUNCTION_POINTER_IS_VOID_POINTER in your project to restore the previous behavior. -## SDL_locale.h - -SDL_GetPreferredLocales() returns a const array of locale pointers, which does not need to be freed. You can use SDL_ClaimTemporaryMemory() to convert it to a non-const pointer that should be freed when you're done with it. - ## SDL_log.h The following macros have been removed: @@ -1588,7 +1575,7 @@ Rather than iterating over sensors using device index, there is a new function S { if (SDL_InitSubSystem(SDL_INIT_SENSOR) == 0) { int i, num_sensors; - const SDL_SensorID *sensors = SDL_GetSensors(&num_sensors); + SDL_SensorID *sensors = SDL_GetSensors(&num_sensors); if (sensors) { for (i = 0; i < num_sensors; ++i) { SDL_Log("Sensor %" SDL_PRIu32 ": %s, type %d, platform type %d\n", @@ -1597,6 +1584,7 @@ Rather than iterating over sensors using device index, there is a new function S SDL_GetSensorTypeForID(sensors[i]), SDL_GetSensorNonPortableTypeForID(sensors[i])); } + SDL_free(sensors); } SDL_QuitSubSystem(SDL_INIT_SENSOR); } @@ -1996,7 +1984,7 @@ Rather than iterating over displays using display index, there is a new function { if (SDL_InitSubSystem(SDL_INIT_VIDEO) == 0) { int i, num_displays = 0; - const SDL_DisplayID *displays = SDL_GetDisplays(&num_displays); + SDL_DisplayID *displays = SDL_GetDisplays(&num_displays); if (displays) { for (i = 0; i < num_displays; ++i) { SDL_DisplayID instance_id = displays[i]; @@ -2004,6 +1992,7 @@ Rather than iterating over displays using display index, there is a new function SDL_Log("Display %" SDL_PRIu32 ": %s\n", instance_id, name ? name : "Unknown"); } + SDL_free(displays); } SDL_QuitSubSystem(SDL_INIT_VIDEO); } @@ -2041,13 +2030,14 @@ Rather than iterating over display modes using an index, there is a new function { SDL_DisplayID display = SDL_GetPrimaryDisplay(); int num_modes = 0; - const SDL_DisplayMode * const *modes = SDL_GetFullscreenDisplayModes(display, &num_modes); + SDL_DisplayMode **modes = SDL_GetFullscreenDisplayModes(display, &num_modes); if (modes) { for (i = 0; i < num_modes; ++i) { SDL_DisplayMode *mode = modes[i]; SDL_Log("Display %" SDL_PRIu32 " mode %d: %dx%d@%gx %gHz\n", display, i, mode->w, mode->h, mode->pixel_density, mode->refresh_rate); } + SDL_free(modes); } } ``` @@ -2080,8 +2070,6 @@ SDL_WindowFlags is used instead of Uint32 for API functions that refer to window SDL_GetWindowOpacity() directly returns the opacity instead of using an out parameter. -SDL_GetWindowICCProfile() returns a const pointer to temporary memory, which does not need to be freed. You can use SDL_ClaimTemporaryMemory() to convert it to a non-const pointer that should be freed when you're done with it. - The following functions have been renamed: * SDL_GL_DeleteContext() => SDL_GL_DestroyContext() * SDL_GetClosestDisplayMode() => SDL_GetClosestFullscreenDisplayMode() diff --git a/docs/README-strings.md b/docs/README-strings.md index 58d94f9270af4..ea86b8d5939f2 100644 --- a/docs/README-strings.md +++ b/docs/README-strings.md @@ -5,55 +5,3 @@ Unless otherwise specified, all strings in SDL, across all platforms, are UTF-8 encoded and can represent the full range of [Unicode](https://unicode.org). - -## The SDL Get String Rule. - -Did you see 'SDL_GetStringRule' in the wiki or headers? Here are the details -that aren't worth copying across dozens of functions' documentation. - -tl;dr: If an SDL function returns a `const char *` string, do not modify or -free it, and if you need to save it, make a copy right away. - -In several cases, SDL wants to return a string to the app, and the question -in any library that does this is: _who owns this thing?_ - -The answer in almost all cases, is that SDL does, but not for long. - -The pointer is only guaranteed to be valid until the next time the event -queue is updated, or SDL_Quit is called. - -The reason for this is memory safety. - -There are several strings that SDL provides that could be freed at -any moment. For example, an app calls SDL_GetAudioDeviceName(), which returns -a string that is part of the internal audio device structure. But, while this -function is returning, the user yanks the USB audio device out of the -computer, and SDL decides to deallocate the structure...and the string! -Now the app is holding a pointer that didn't live long enough to be useful, -and could crash if accessed. - -To avoid this, instead of calling SDL_free on a string as soon as it's done -with it, SDL adds the pointer to a list. This list is freed at specific -points: when the event queue is run (for ongoing cleanup) and when SDL_Quit -is called (to catch things that are just hanging around). This allows the -app to use a string without worrying about it becoming bogus in the middle -of a printf() call. If the app needs it for longer, it should copy it. - -When does "the event queue run"? There are several points: - -- If the app calls SDL_PumpEvents() _from any thread_. -- SDL_PumpEvents is also called by several other APIs internally: - SDL_PollEvent(), SDL_PeepEvents(), SDL_WaitEvent(), - SDL_WaitEventTimeout(), and maybe others. -- If you are using [the main callbacks](main-functions#main-callbacks-in-sdl3), - the event queue can run immediately after any of the callback functions - return. - -Note that these are just guaranteed minimum lifespans; any given string -might live much longer--some might even be static memory that is _never_ -deallocated--but this rule promises that the app has a safe window. - -Note that none of this applies if the return value is `char *` instead of -`const char *`. Please see the specific function's documentation for how -to handle those pointers. - diff --git a/docs/README-winrt.md b/docs/README-winrt.md index eb20ddad7e66f..58a3074205c9c 100644 --- a/docs/README-winrt.md +++ b/docs/README-winrt.md @@ -95,45 +95,6 @@ Here is a rough list of what works, and what doesn't: -Upgrade Notes -------------- - -#### SDL_GetPrefPath() usage when upgrading WinRT apps from SDL 2.0.3 - -SDL 2.0.4 fixes two bugs found in the WinRT version of SDL_GetPrefPath(). -The fixes may affect older, SDL 2.0.3-based apps' save data. Please note -that these changes only apply to SDL-based WinRT apps, and not to apps for -any other platform. - -1. SDL_GetPrefPath() would return an invalid path, one in which the path's - directory had not been created. Attempts to create files there - (via fopen(), for example), would fail, unless that directory was - explicitly created beforehand. - -2. SDL_GetPrefPath(), for non-WinPhone-based apps, would return a path inside - a WinRT 'Roaming' folder, the contents of which get automatically - synchronized across multiple devices. This process can occur while an - application runs, and can cause existing save-data to be overwritten - at unexpected times, with data from other devices. (Windows Phone apps - written with SDL 2.0.3 did not utilize a Roaming folder, due to API - restrictions in Windows Phone 8.0). - - -SDL_GetPrefPath(), starting with SDL 2.0.4, addresses these by: - -1. making sure that SDL_GetPrefPath() returns a directory in which data - can be written to immediately, without first needing to create directories. - -2. basing SDL_GetPrefPath() off of a different, non-Roaming folder, the - contents of which do not automatically get synchronized across devices - (and which require less work to use safely, in terms of data integrity). - -Apps that wish to get their Roaming folder's path can do so either by using -SDL_GetWinRTFSPath(), or directly through the WinRT class, -Windows.Storage.ApplicationData. - - - Setup, High-Level Steps ----------------------- diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index 8ee874ac627be..da1013f3162f7 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -411,7 +411,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); * * \sa SDL_GetNumAudioDrivers */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetAudioDriver(int index); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDriver(int index); /* @} */ /** @@ -428,7 +428,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetAudioDriver(int index); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCurrentAudioDriver(void); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentAudioDriver(void); /** * Get a list of currently-connected audio playback devices. @@ -447,7 +447,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCurrentAudioDriver(void); * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of device instance IDs or NULL on error; call - * SDL_GetError() for more information. + * SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -456,7 +456,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCurrentAudioDriver(void); * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioRecordingDevices */ -extern SDL_DECLSPEC_TEMP const SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices(int *count); +extern SDL_DECLSPEC_FREE SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices(int *count); /** * Get a list of currently-connected audio recording devices. @@ -475,7 +475,7 @@ extern SDL_DECLSPEC_TEMP const SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackD * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of device instance IDs, or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -484,7 +484,7 @@ extern SDL_DECLSPEC_TEMP const SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackD * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioPlaybackDevices */ -extern SDL_DECLSPEC_TEMP const SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecordingDevices(int *count); +extern SDL_DECLSPEC_FREE SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecordingDevices(int *count); /** * Get the human-readable name of a specific audio device. @@ -501,7 +501,7 @@ extern SDL_DECLSPEC_TEMP const SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecording * \sa SDL_GetAudioRecordingDevices * \sa SDL_GetDefaultAudioInfo */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetAudioDeviceName(SDL_AudioDeviceID devid); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDeviceName(SDL_AudioDeviceID devid); /** * Get the current audio format of a specific audio device. @@ -550,7 +550,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid * \param devid the instance ID of the device to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as - * the current output spec's channels, or NULL if default. + * the current output spec's channels, or NULL if default. This should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -558,7 +558,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC_TEMP const int * SDLCALL SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count); +extern SDL_DECLSPEC_FREE int * SDLCALL SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count); /** * Open a specific audio device. @@ -1098,7 +1098,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, * \param stream the SDL_AudioStream to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as - * the current output spec's channels, or NULL if default. + * the current output spec's channels, or NULL if default. This should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. @@ -1107,7 +1107,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC_TEMP const int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count); +extern SDL_DECLSPEC_FREE int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count); /** * Get the current output channel map of an audio stream. @@ -1121,7 +1121,7 @@ extern SDL_DECLSPEC_TEMP const int * SDLCALL SDL_GetAudioStreamInputChannelMap(S * \param stream the SDL_AudioStream to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as - * the current output spec's channels, or NULL if default. + * the current output spec's channels, or NULL if default. This should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. @@ -1130,7 +1130,7 @@ extern SDL_DECLSPEC_TEMP const int * SDLCALL SDL_GetAudioStreamInputChannelMap(S * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC_TEMP const int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream *stream, int *count); +extern SDL_DECLSPEC_FREE int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream *stream, int *count); /** * Set the current input channel map of an audio stream. diff --git a/include/SDL3/SDL_begin_code.h b/include/SDL3/SDL_begin_code.h index a2421875987ac..2483533b8e987 100644 --- a/include/SDL3/SDL_begin_code.h +++ b/include/SDL3/SDL_begin_code.h @@ -67,8 +67,11 @@ # endif # endif #endif -/* This is used to mark functions that return temporary memory */ -#define SDL_DECLSPEC_TEMP SDL_DECLSPEC + +/* This is used to mark functions that return memory that need to be freed with SDL_free() */ +#ifndef SDL_DECLSPEC_FREE +#define SDL_DECLSPEC_FREE SDL_DECLSPEC +#endif /* By default SDL uses the C calling convention */ #ifndef SDLCALL diff --git a/include/SDL3/SDL_camera.h b/include/SDL3/SDL_camera.h index 451b73c8b3490..d8aad2d02dd45 100644 --- a/include/SDL3/SDL_camera.h +++ b/include/SDL3/SDL_camera.h @@ -145,7 +145,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumCameraDrivers(void); * * \sa SDL_GetNumCameraDrivers */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCameraDriver(int index); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraDriver(int index); /** * Get the name of the current camera driver. @@ -161,7 +161,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCameraDriver(int index); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCurrentCameraDriver(void); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void); /** * Get a list of currently connected camera devices. @@ -169,7 +169,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCurrentCameraDriver(void); * \param count a pointer filled in with the number of cameras returned, may * be NULL. * \returns a 0 terminated array of camera instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -177,7 +177,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCurrentCameraDriver(void); * * \sa SDL_OpenCamera */ -extern SDL_DECLSPEC_TEMP const SDL_CameraID * SDLCALL SDL_GetCameras(int *count); +extern SDL_DECLSPEC_FREE SDL_CameraID * SDLCALL SDL_GetCameras(int *count); /** * Get the list of native formats/sizes a camera supports. @@ -205,7 +205,7 @@ extern SDL_DECLSPEC_TEMP const SDL_CameraID * SDLCALL SDL_GetCameras(int *count) * \param count a pointer filled in with the number of elements in the list, * may be NULL. * \returns a NULL terminated array of pointers to SDL_CameraSpec or NULL on - * failure; call SDL_GetError() for more information. + * failure; call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -214,7 +214,7 @@ extern SDL_DECLSPEC_TEMP const SDL_CameraID * SDLCALL SDL_GetCameras(int *count) * \sa SDL_GetCameras * \sa SDL_OpenCamera */ -extern SDL_DECLSPEC_TEMP const SDL_CameraSpec * const * SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count); +extern SDL_DECLSPEC_FREE SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count); /** * Get the human-readable device name for a camera. @@ -229,7 +229,7 @@ extern SDL_DECLSPEC_TEMP const SDL_CameraSpec * const * SDLCALL SDL_GetCameraSup * * \sa SDL_GetCameras */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCameraName(SDL_CameraID instance_id); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraName(SDL_CameraID instance_id); /** * Get the position of the camera in relation to the system. diff --git a/include/SDL3/SDL_clipboard.h b/include/SDL3/SDL_clipboard.h index bc7c14586d373..9323346d7e547 100644 --- a/include/SDL3/SDL_clipboard.h +++ b/include/SDL3/SDL_clipboard.h @@ -63,14 +63,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); * a copy of the clipboard's content. * * \returns the clipboard text on success or an empty string on failure; call - * SDL_GetError() for more information. + * SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasClipboardText * \sa SDL_SetClipboardText */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetClipboardText(void); +extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetClipboardText(void); /** * Query whether the clipboard exists and contains a non-empty text string. @@ -105,14 +105,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text); * a copy of the primary selection's content. * * \returns the primary selection text on success or an empty string on - * failure; call SDL_GetError() for more information. + * failure; call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasPrimarySelectionText * \sa SDL_SetPrimarySelectionText */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetPrimarySelectionText(void); +extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetPrimarySelectionText(void); /** * Query whether the primary selection exists and contains a non-empty text @@ -215,14 +215,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearClipboardData(void); * \param mime_type the mime type to read from the clipboard. * \param size a pointer filled in with the length of the returned data. * \returns the retrieved data buffer or NULL on failure; call SDL_GetError() - * for more information. + * for more information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasClipboardData * \sa SDL_SetClipboardData */ -extern SDL_DECLSPEC_TEMP const void * SDLCALL SDL_GetClipboardData(const char *mime_type, size_t *size); +extern SDL_DECLSPEC_FREE void * SDLCALL SDL_GetClipboardData(const char *mime_type, size_t *size); /** * Query whether there is data in the clipboard for the provided mime type. diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index e07a0397e049a..694495186c769 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -352,10 +352,6 @@ typedef struct SDL_KeyboardEvent * will be inserted into the editing text. The length is the number of UTF-8 * characters that will be replaced by new typing. * - * The text string is temporary memory which will be freed in - * SDL_FreeTemporaryMemory() and can be claimed with - * SDL_ClaimTemporaryMemory(). - * * \since This struct is available since SDL 3.0.0. */ typedef struct SDL_TextEditingEvent @@ -372,10 +368,6 @@ typedef struct SDL_TextEditingEvent /** * Keyboard IME candidates event structure (event.edit_candidates.*) * - * The candidates are a single allocation of temporary memory which will be - * freed in SDL_FreeTemporaryMemory() and can be claimed with - * SDL_ClaimTemporaryMemory(). - * * \since This struct is available since SDL 3.0.0. */ typedef struct SDL_TextEditingCandidatesEvent @@ -393,10 +385,6 @@ typedef struct SDL_TextEditingCandidatesEvent /** * Keyboard text input event structure (event.text.*) * - * The text string is temporary memory which will be freed in - * SDL_FreeTemporaryMemory() and can be claimed with - * SDL_ClaimTemporaryMemory(). - * * This event will never be delivered unless text input is enabled by calling * SDL_StartTextInput(). Text input is disabled by default! * @@ -792,10 +780,6 @@ typedef struct SDL_PenButtonEvent * An event used to drop text or request a file open by the system * (event.drop.*) * - * The source and data strings are temporary memory which will be freed in - * SDL_FreeTemporaryMemory() and can be claimed with - * SDL_ClaimTemporaryMemory(). - * * \since This struct is available since SDL 3.0.0. */ typedef struct SDL_DropEvent @@ -859,10 +843,6 @@ typedef struct SDL_QuitEvent * the programmer; the only requirement is that '''type''' is a value obtained * from SDL_RegisterEvents(). * - * If the data pointers are temporary memory, they will be automatically - * transfered to the thread that pulls the event from the queue, or freed if - * the event is flushed. - * * \since This struct is available since SDL 3.0.0. */ typedef struct SDL_UserEvent @@ -1420,65 +1400,6 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EventEnabled(Uint32 type); */ extern SDL_DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); -/** - * Allocate temporary memory. - * - * You can use this to allocate memory from the temporary memory pool for the - * current thread. - * - * \param size the amount of memory to allocate. - * \returns a pointer to the memory allocated or NULL on failure; call - * SDL_GetError() for more information. - * - * \threadsafety It is safe to call this function from any thread. - * - * \since This function is available since SDL 3.0.0. - * - * \sa SDL_ClaimTemporaryMemory - * \sa SDL_FreeTemporaryMemory - */ -extern SDL_DECLSPEC void * SDLCALL SDL_AllocateTemporaryMemory(size_t size); - -/** - * Claim ownership of temporary memory. - * - * This function removes memory from the temporary memory pool for the current - * thread and gives ownership to the application. The application should use - * SDL_free() to free it when it is done using it. - * - * \param mem a pointer allocated with SDL_AllocateTemporaryMemory(). - * \returns a pointer to the memory now owned by the application, which must - * be freed using SDL_free(), or NULL if the memory is not in the - * temporary memory pool for the current thread. - * - * \threadsafety It is safe to call this function from any thread. - * - * \since This function is available since SDL 3.0.0. - * - * \sa SDL_AllocateTemporaryMemory - * \sa SDL_free - */ -extern SDL_DECLSPEC void * SDLCALL SDL_ClaimTemporaryMemory(const void *mem); - -/** - * Free temporary memory for the current thread. - * - * This function frees all temporary memory for the current thread. If you - * would like to hold onto a specific pointer beyond this call, you should - * call SDL_ClaimTemporaryMemory() to move it out of the temporary memory - * pool. - * - * This function is automatically called in SDL_Quit() on the main thread and - * in SDL_CleanupTLS() when other threads complete. - * - * \threadsafety It is safe to call this function from any thread. - * - * \since This function is available since SDL 3.0.0. - * - * \sa SDL_AllocateTemporaryMemory - * \sa SDL_ClaimTemporaryMemory - */ -extern SDL_DECLSPEC void SDLCALL SDL_FreeTemporaryMemory(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_filesystem.h b/include/SDL3/SDL_filesystem.h index 8318b25b77e78..641300cca4efe 100644 --- a/include/SDL3/SDL_filesystem.h +++ b/include/SDL3/SDL_filesystem.h @@ -77,7 +77,7 @@ extern "C" { * * \sa SDL_GetPrefPath */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetBasePath(void); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetBasePath(void); /** * Get the user-and-app-specific path where files can be written. @@ -125,13 +125,13 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetBasePath(void); * \param app the name of your application. * \returns a UTF-8 string of the user directory in platform-dependent * notation. NULL if there's a problem (creating directory failed, - * etc.). + * etc.). This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetBasePath */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetPrefPath(const char *org, const char *app); +extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetPrefPath(const char *org, const char *app); /** * The type of the OS-provided default folder for a specific purpose. @@ -227,7 +227,7 @@ typedef enum SDL_Folder * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetUserFolder(SDL_Folder folder); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetUserFolder(SDL_Folder folder); /* Abstract filesystem interface */ @@ -367,13 +367,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo * * \param count on return, will be set to the number of items in the returned * array. Can be NULL. * \returns an array of strings on success or NULL on failure; call - * SDL_GetError() for more information. + * SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * const * SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count); +extern SDL_DECLSPEC_FREE char ** SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_gamepad.h b/include/SDL3/SDL_gamepad.h index 1011c9e5d167f..0358c76b52a7d 100644 --- a/include/SDL3/SDL_gamepad.h +++ b/include/SDL3/SDL_gamepad.h @@ -392,25 +392,25 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReloadGamepadMappings(void); * \param count a pointer filled in with the number of mappings returned, can * be NULL. * \returns an array of the mapping strings, NULL-terminated, or NULL on - * failure; call SDL_GetError() for more information. + * failure; call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * const * SDLCALL SDL_GetGamepadMappings(int *count); +extern SDL_DECLSPEC_FREE char ** SDLCALL SDL_GetGamepadMappings(int *count); /** * Get the gamepad mapping string for a given GUID. * * \param guid a structure containing the GUID for which a mapping is desired. * \returns a mapping string or NULL on failure; call SDL_GetError() for more - * information. + * information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetJoystickGUIDForID * \sa SDL_GetJoystickGUID */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID guid); +extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID guid); /** * Get the current mapping of a gamepad. @@ -419,7 +419,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_G * * \param gamepad the gamepad you want to get the current mapping for. * \returns a string that has the gamepad's mapping or NULL if no mapping is - * available; call SDL_GetError() for more information. + * available; call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * @@ -428,7 +428,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_G * \sa SDL_GetGamepadMappingForGUID * \sa SDL_SetGamepadMapping */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad); +extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad); /** * Set the current mapping of a joystick or gamepad. @@ -465,14 +465,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasGamepad(void); * \param count a pointer filled in with the number of gamepads returned, may * be NULL. * \returns a 0 terminated array of joystick instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasGamepad * \sa SDL_OpenGamepad */ -extern SDL_DECLSPEC_TEMP const SDL_JoystickID * SDLCALL SDL_GetGamepads(int *count); +extern SDL_DECLSPEC_FREE SDL_JoystickID * SDLCALL SDL_GetGamepads(int *count); /** * Check if the given joystick is supported by the gamepad interface. @@ -502,7 +502,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsGamepad(SDL_JoystickID instance_id); * \sa SDL_GetGamepadName * \sa SDL_GetGamepads */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadNameForID(SDL_JoystickID instance_id); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadNameForID(SDL_JoystickID instance_id); /** * Get the implementation dependent path of a gamepad. @@ -518,7 +518,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadNameForID(SDL_Joysti * \sa SDL_GetGamepadPath * \sa SDL_GetGamepads */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadPathForID(SDL_JoystickID instance_id); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadPathForID(SDL_JoystickID instance_id); /** * Get the player index of a gamepad. @@ -640,14 +640,14 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetRealGamepadTypeForID(SDL_Joys * This can be called before any gamepads are opened. * * \param instance_id the joystick instance ID. - * \returns the mapping string. Returns NULL if no mapping is available. + * \returns the mapping string. Returns NULL if no mapping is available. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetGamepads * \sa SDL_GetGamepadMapping */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadMappingForID(SDL_JoystickID instance_id); +extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetGamepadMappingForID(SDL_JoystickID instance_id); /** * Open a gamepad for use. @@ -745,7 +745,7 @@ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_GetGamepadID(SDL_Gamepad *gamepad * * \sa SDL_GetGamepadNameForID */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadName(SDL_Gamepad *gamepad); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadName(SDL_Gamepad *gamepad); /** * Get the implementation-dependent path for an opened gamepad. @@ -759,7 +759,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadName(SDL_Gamepad *ga * * \sa SDL_GetGamepadPathForID */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadPath(SDL_Gamepad *gamepad); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadPath(SDL_Gamepad *gamepad); /** * Get the type of an opened gamepad. @@ -880,7 +880,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetGamepadFirmwareVersion(SDL_Gamepad *ga * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadSerial(SDL_Gamepad *gamepad); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadSerial(SDL_Gamepad *gamepad); /** * Get the Steam Input handle of an opened gamepad, if available. @@ -995,11 +995,11 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadEventsEnabled(void); * \param gamepad a gamepad. * \param count a pointer filled in with the number of bindings returned. * \returns a NULL terminated array of pointers to bindings or NULL on - * failure; call SDL_GetError() for more information. + * failure; call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const SDL_GamepadBinding * const * SDLCALL SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count); +extern SDL_DECLSPEC_FREE SDL_GamepadBinding ** SDLCALL SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count); /** * Manually pump gamepad updates if not using the loop. @@ -1042,7 +1042,7 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetGamepadTypeFromString(const c * * \sa SDL_GetGamepadTypeFromString */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadStringForType(SDL_GamepadType type); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadStringForType(SDL_GamepadType type); /** * Convert a string into SDL_GamepadAxis enum. @@ -1078,7 +1078,7 @@ extern SDL_DECLSPEC SDL_GamepadAxis SDLCALL SDL_GetGamepadAxisFromString(const c * * \sa SDL_GetGamepadAxisFromString */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis); /** * Query whether a gamepad has a given axis. @@ -1151,7 +1151,7 @@ extern SDL_DECLSPEC SDL_GamepadButton SDLCALL SDL_GetGamepadButtonFromString(con * * \sa SDL_GetGamepadButtonFromString */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadStringForButton(SDL_GamepadButton button); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadStringForButton(SDL_GamepadButton button); /** * Query whether a gamepad has a given button. @@ -1436,7 +1436,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseGamepad(SDL_Gamepad *gamepad); * * \sa SDL_GetGamepadAppleSFSymbolsNameForAxis */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button); /** * Return the sfSymbolsName for a given axis on a gamepad on Apple platforms. @@ -1449,7 +1449,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadAppleSFSymbolsNameFo * * \sa SDL_GetGamepadAppleSFSymbolsNameForButton */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis); /* Ends C function definitions when using C++ */ diff --git a/include/SDL3/SDL_guid.h b/include/SDL3/SDL_guid.h index df3f818fe35bc..285b2376e50eb 100644 --- a/include/SDL3/SDL_guid.h +++ b/include/SDL3/SDL_guid.h @@ -67,14 +67,14 @@ typedef struct SDL_GUID { * Get an ASCII string representation for a given SDL_GUID. * * \param guid the SDL_GUID you wish to convert to string. - * \returns the string representation of the GUID or NULL on failure; call - * SDL_GetError() for more information. + * \param pszGUID buffer in which to write the ASCII string. + * \param cbGUID the size of pszGUID, should be at least 33 bytes. * * \since This function is available since SDL 3.0.0. * * \sa SDL_StringToGUID */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GUIDToString(SDL_GUID guid); +extern SDL_DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID); /** * Convert a GUID string into a SDL_GUID structure. diff --git a/include/SDL3/SDL_haptic.h b/include/SDL3/SDL_haptic.h index bd94aebb21638..f34ba15b20310 100644 --- a/include/SDL3/SDL_haptic.h +++ b/include/SDL3/SDL_haptic.h @@ -45,6 +45,7 @@ * SDL_HapticID *haptics = SDL_GetHaptics(NULL); * if (haptics) { * haptic = SDL_OpenHaptic(haptics[0]); + * SDL_free(haptics); * } * if (haptic == NULL) * return -1; @@ -934,13 +935,13 @@ typedef Uint32 SDL_HapticID; * \param count a pointer filled in with the number of haptic devices * returned, may be NULL. * \returns a 0 terminated array of haptic device instance IDs or NULL on - * failure; call SDL_GetError() for more information. + * failure; call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_OpenHaptic */ -extern SDL_DECLSPEC_TEMP const SDL_HapticID * SDLCALL SDL_GetHaptics(int *count); +extern SDL_DECLSPEC_FREE SDL_HapticID * SDLCALL SDL_GetHaptics(int *count); /** * Get the implementation dependent name of a haptic device. @@ -957,7 +958,7 @@ extern SDL_DECLSPEC_TEMP const SDL_HapticID * SDLCALL SDL_GetHaptics(int *count) * \sa SDL_GetHapticName * \sa SDL_OpenHaptic */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetHapticNameForID(SDL_HapticID instance_id); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetHapticNameForID(SDL_HapticID instance_id); /** * Open a haptic device for use. @@ -1019,7 +1020,7 @@ extern SDL_DECLSPEC SDL_HapticID SDLCALL SDL_GetHapticID(SDL_Haptic *haptic); * * \sa SDL_GetHapticNameForID */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetHapticName(SDL_Haptic *haptic); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetHapticName(SDL_Haptic *haptic); /** * Query whether or not the current mouse has haptic capabilities. diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 7914f3d56e0c7..51c629c4f6c6b 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3880,7 +3880,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ResetHints(void); * \sa SDL_SetHint * \sa SDL_SetHintWithPriority */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetHint(const char *name); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); /** * Get the boolean value of a hint variable. diff --git a/include/SDL3/SDL_joystick.h b/include/SDL3/SDL_joystick.h index cda666421d049..20d610d85e7e6 100644 --- a/include/SDL3/SDL_joystick.h +++ b/include/SDL3/SDL_joystick.h @@ -204,14 +204,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasJoystick(void); * \param count a pointer filled in with the number of joysticks returned, may * be NULL. * \returns a 0 terminated array of joystick instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasJoystick * \sa SDL_OpenJoystick */ -extern SDL_DECLSPEC_TEMP const SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count); +extern SDL_DECLSPEC_FREE SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count); /** * Get the implementation dependent name of a joystick. @@ -227,7 +227,7 @@ extern SDL_DECLSPEC_TEMP const SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *co * \sa SDL_GetJoystickName * \sa SDL_GetJoysticks */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickNameForID(SDL_JoystickID instance_id); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickNameForID(SDL_JoystickID instance_id); /** * Get the implementation dependent path of a joystick. @@ -243,7 +243,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickNameForID(SDL_Joyst * \sa SDL_GetJoystickPath * \sa SDL_GetJoysticks */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickPathForID(SDL_JoystickID instance_id); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickPathForID(SDL_JoystickID instance_id); /** * Get the player index of a joystick. @@ -661,7 +661,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetJoystickProperties(SDL_Joyst * * \sa SDL_GetJoystickNameForID */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickName(SDL_Joystick *joystick); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickName(SDL_Joystick *joystick); /** * Get the implementation dependent path of a joystick. @@ -674,7 +674,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickName(SDL_Joystick * * * \sa SDL_GetJoystickPathForID */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickPath(SDL_Joystick *joystick); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickPath(SDL_Joystick *joystick); /** * Get the player index of an opened joystick. @@ -789,7 +789,7 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickFirmwareVersion(SDL_Joystick * * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetJoystickSerial(SDL_Joystick *joystick); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickSerial(SDL_Joystick *joystick); /** * Get the type of an opened joystick. diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index b0d7ce6790247..3f48fc0ec4e35 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -76,14 +76,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasKeyboard(void); * \param count a pointer filled in with the number of keyboards returned, may * be NULL. * \returns a 0 terminated array of keyboards instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetKeyboardNameForID * \sa SDL_HasKeyboard */ -extern SDL_DECLSPEC_TEMP const SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count); +extern SDL_DECLSPEC_FREE SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count); /** * Get the name of a keyboard. @@ -98,7 +98,7 @@ extern SDL_DECLSPEC_TEMP const SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *co * * \sa SDL_GetKeyboards */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id); /** * Query the window which currently has keyboard focus. @@ -297,7 +297,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetScancodeName(SDL_Scancode scancode, const * \sa SDL_GetScancodeFromName * \sa SDL_SetScancodeName */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetScancodeName(SDL_Scancode scancode); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetScancodeName(SDL_Scancode scancode); /** * Get a scancode from a human-readable name. @@ -331,7 +331,7 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam * \sa SDL_GetKeyFromScancode * \sa SDL_GetScancodeFromKey */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetKeyName(SDL_Keycode key); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyName(SDL_Keycode key); /** * Get a key code from a human-readable name. diff --git a/include/SDL3/SDL_locale.h b/include/SDL3/SDL_locale.h index 40fab59e82321..66479ceffeca3 100644 --- a/include/SDL3/SDL_locale.h +++ b/include/SDL3/SDL_locale.h @@ -92,11 +92,11 @@ typedef struct SDL_Locale * \param count a pointer filled in with the number of locales returned, may * be NULL. * \returns a NULL terminated array of locale pointers, or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const SDL_Locale * const * SDLCALL SDL_GetPreferredLocales(int *count); +extern SDL_DECLSPEC_FREE SDL_Locale ** SDLCALL SDL_GetPreferredLocales(int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index 0598ebca86561..82ca7be668f54 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -138,14 +138,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasMouse(void); * \param count a pointer filled in with the number of mice returned, may be * NULL. * \returns a 0 terminated array of mouse instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetMouseNameForID * \sa SDL_HasMouse */ -extern SDL_DECLSPEC_TEMP const SDL_MouseID * SDLCALL SDL_GetMice(int *count); +extern SDL_DECLSPEC_FREE SDL_MouseID * SDLCALL SDL_GetMice(int *count); /** * Get the name of a mouse. @@ -160,7 +160,7 @@ extern SDL_DECLSPEC_TEMP const SDL_MouseID * SDLCALL SDL_GetMice(int *count); * * \sa SDL_GetMice */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetMouseNameForID(SDL_MouseID instance_id); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetMouseNameForID(SDL_MouseID instance_id); /** * Get the window which currently has mouse focus. diff --git a/include/SDL3/SDL_pen.h b/include/SDL3/SDL_pen.h index 7d44bb597b72d..c02c0081f2b7e 100644 --- a/include/SDL3/SDL_pen.h +++ b/include/SDL3/SDL_pen.h @@ -235,7 +235,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PenConnected(SDL_PenID instance_id); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetPenName(SDL_PenID instance_id); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetPenName(SDL_PenID instance_id); /** * Pen capabilities, as reported by SDL_GetPenCapabilities() diff --git a/include/SDL3/SDL_properties.h b/include/SDL3/SDL_properties.h index 9450da714e32a..b3e061adc1fe8 100644 --- a/include/SDL3/SDL_properties.h +++ b/include/SDL3/SDL_properties.h @@ -384,7 +384,12 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetPointerProperty(SDL_PropertiesID props * \returns the value of the property, or `default_value` if it is not set or * not a string property. * - * \threadsafety It is safe to call this function from any thread. + * \threadsafety It is safe to call this function from any thread, although + * the data returned is not protected and could potentially be + * freed if you call SDL_SetStringProperty() or + * SDL_ClearProperty() on these properties from another thread. + * If you need to avoid this, use SDL_LockProperties() and + * SDL_UnlockProperties(). * * \since This function is available since SDL 3.0.0. * @@ -392,7 +397,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetPointerProperty(SDL_PropertiesID props * \sa SDL_HasProperty * \sa SDL_SetStringProperty */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetStringProperty(SDL_PropertiesID props, const char *name, const char *default_value); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetStringProperty(SDL_PropertiesID props, const char *name, const char *default_value); /** * Get a number property from a group of properties. diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index df6b8b4c5b6fb..855247c8f54d9 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -163,7 +163,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); * * \sa SDL_GetNumRenderDrivers */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetRenderDriver(int index); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetRenderDriver(int index); /** * Create a window and default renderer. @@ -331,7 +331,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetRenderWindow(SDL_Renderer *rende * \sa SDL_CreateRenderer * \sa SDL_CreateRendererWithProperties */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetRendererName(SDL_Renderer *renderer); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetRendererName(SDL_Renderer *renderer); /** * Get the properties associated with a renderer. diff --git a/include/SDL3/SDL_sensor.h b/include/SDL3/SDL_sensor.h index c0ae5048722cf..fdfcb2175d518 100644 --- a/include/SDL3/SDL_sensor.h +++ b/include/SDL3/SDL_sensor.h @@ -149,11 +149,11 @@ typedef enum SDL_SensorType * \param count a pointer filled in with the number of sensors returned, may * be NULL. * \returns a 0 terminated array of sensor instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const SDL_SensorID * SDLCALL SDL_GetSensors(int *count); +extern SDL_DECLSPEC SDL_SensorID * SDLCALL SDL_GetSensors(int *count); /** * Get the implementation dependent name of a sensor. @@ -165,7 +165,7 @@ extern SDL_DECLSPEC const SDL_SensorID * SDLCALL SDL_GetSensors(int *count); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetSensorNameForID(SDL_SensorID instance_id); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorNameForID(SDL_SensorID instance_id); /** * Get the type of a sensor. @@ -235,7 +235,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSensorProperties(SDL_Sensor * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetSensorName(SDL_Sensor *sensor); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorName(SDL_Sensor *sensor); /** * Get the type of a sensor. diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index 1b157786a6fb6..83296b257bd71 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -527,9 +527,9 @@ extern "C" { #define SDL_stack_free(data) SDL_free(data) #endif -extern SDL_DECLSPEC SDL_MALLOC void * SDLCALL SDL_malloc(size_t size); -extern SDL_DECLSPEC SDL_MALLOC SDL_ALLOC_SIZE2(1, 2) void * SDLCALL SDL_calloc(size_t nmemb, size_t size); -extern SDL_DECLSPEC SDL_ALLOC_SIZE(2) void * SDLCALL SDL_realloc(void *mem, size_t size); +extern SDL_DECLSPEC_FREE SDL_MALLOC void * SDLCALL SDL_malloc(size_t size); +extern SDL_DECLSPEC_FREE SDL_MALLOC SDL_ALLOC_SIZE2(1, 2) void * SDLCALL SDL_calloc(size_t nmemb, size_t size); +extern SDL_DECLSPEC_FREE SDL_ALLOC_SIZE(2) void * SDLCALL SDL_realloc(void *mem, size_t size); extern SDL_DECLSPEC void SDLCALL SDL_free(void *mem); typedef void *(SDLCALL *SDL_malloc_func)(size_t size); diff --git a/include/SDL3/SDL_storage.h b/include/SDL3/SDL_storage.h index bd78da3f6d301..fc669a2a38ff9 100644 --- a/include/SDL3/SDL_storage.h +++ b/include/SDL3/SDL_storage.h @@ -410,14 +410,14 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetStorageSpaceRemaining(SDL_Storage *sto * array. Can be NULL. * \returns an array of strings on success or NULL on failure; call * SDL_GetError() for more information. The caller should pass the - * returned pointer to SDL_free when done with it. + * returned pointer to SDL_free when done with it. This is a single allocation that should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread, assuming * the `storage` object is thread-safe. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * const * SDLCALL SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count); +extern SDL_DECLSPEC_FREE char ** SDLCALL SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_system.h b/include/SDL3/SDL_system.h index a7c1238af54d2..9e79e79408fb1 100644 --- a/include/SDL3/SDL_system.h +++ b/include/SDL3/SDL_system.h @@ -418,7 +418,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); * * \sa SDL_GetAndroidExternalStorageState */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetAndroidInternalStoragePath(void); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidInternalStoragePath(void); /** * Get the current state of external storage for this Android application. @@ -457,7 +457,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetAndroidExternalStorageState(void); * * \sa SDL_GetAndroidExternalStorageState */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetAndroidExternalStoragePath(void); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidExternalStoragePath(void); /** * Get the path used for caching data for this Android application. @@ -476,7 +476,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetAndroidExternalStoragePath( * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetAndroidCachePath(void); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidCachePath(void); typedef void (SDLCALL *SDL_RequestAndroidPermissionCallback)(void *userdata, const char *permission, SDL_bool granted); @@ -630,7 +630,7 @@ typedef enum SDL_WinRT_DeviceFamily * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetWinRTFSPath(SDL_WinRT_Path pathType); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetWinRTFSPath(SDL_WinRT_Path pathType); /** * Detects the device family of WinRT platform at runtime. diff --git a/include/SDL3/SDL_thread.h b/include/SDL3/SDL_thread.h index fb98fd7358815..f6ec760c4bda6 100644 --- a/include/SDL3/SDL_thread.h +++ b/include/SDL3/SDL_thread.h @@ -336,7 +336,7 @@ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithPropertiesRuntime(S * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetThreadName(SDL_Thread *thread); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetThreadName(SDL_Thread *thread); /** * Get the thread identifier for the current thread. diff --git a/include/SDL3/SDL_touch.h b/include/SDL3/SDL_touch.h index 6c9f6ccef10af..5c91152b2621b 100644 --- a/include/SDL3/SDL_touch.h +++ b/include/SDL3/SDL_touch.h @@ -86,11 +86,11 @@ typedef struct SDL_Finger * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of touch device IDs or NULL on failure; call - * SDL_GetError() for more information. + * SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const SDL_TouchID * SDLCALL SDL_GetTouchDevices(int *count); +extern SDL_DECLSPEC_FREE SDL_TouchID * SDLCALL SDL_GetTouchDevices(int *count); /** * Get the touch device name as reported from the driver. @@ -101,7 +101,7 @@ extern SDL_DECLSPEC_TEMP const SDL_TouchID * SDLCALL SDL_GetTouchDevices(int *co * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetTouchDeviceName(SDL_TouchID touchID); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetTouchDeviceName(SDL_TouchID touchID); /** * Get the type of the given touch device. @@ -120,11 +120,11 @@ extern SDL_DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_Touch * \param count a pointer filled in with the number of fingers returned, can * be NULL. * \returns a NULL terminated array of SDL_Finger pointers or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const SDL_Finger * const * SDLCALL SDL_GetTouchFingers(SDL_TouchID touchID, int *count); +extern SDL_DECLSPEC_FREE SDL_Finger ** SDLCALL SDL_GetTouchFingers(SDL_TouchID touchID, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index 74a0401ee382f..18ce210629a12 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -356,7 +356,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); * * \sa SDL_GetNumVideoDrivers */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetVideoDriver(int index); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetVideoDriver(int index); /** * Get the name of the currently initialized video driver. @@ -373,7 +373,7 @@ extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetVideoDriver(int index); * \sa SDL_GetNumVideoDrivers * \sa SDL_GetVideoDriver */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCurrentVideoDriver(void); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentVideoDriver(void); /** * Get the current system theme. @@ -390,11 +390,11 @@ extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void); * \param count a pointer filled in with the number of displays returned, may * be NULL. * \returns a 0 terminated array of display instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count); +extern SDL_DECLSPEC_FREE SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count); /** * Return the primary display. @@ -448,7 +448,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetDisplayProperties(SDL_Displa * * \sa SDL_GetDisplays */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetDisplayName(SDL_DisplayID displayID); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetDisplayName(SDL_DisplayID displayID); /** * Get the desktop area represented by a display. @@ -551,13 +551,13 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetDisplayContentScale(SDL_DisplayID displ * \param count a pointer filled in with the number of display modes returned, * may be NULL. * \returns a NULL terminated array of display mode pointers or NULL on - * failure; call SDL_GetError() for more information. + * failure; call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplays */ -extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * const * SDLCALL SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count); +extern SDL_DECLSPEC_FREE SDL_DisplayMode ** SDLCALL SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count); /** * Get the closest match to the requested display mode. @@ -576,16 +576,17 @@ extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * const * SDLCALL SDL_GetFullscre * for the desktop refresh rate. * \param include_high_density_modes boolean to include high density modes in * the search. - * \returns a pointer to the closest display mode equal to or larger than the - * desired mode, or NULL on failure; call SDL_GetError() for more - * information. + * \param mode a pointer filled in with the closest display mode equal to or larger than the + * desired mode. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplays * \sa SDL_GetFullscreenDisplayModes */ -extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * SDLCALL SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, SDL_bool include_high_density_modes); +extern SDL_DECLSPEC int SDLCALL SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, SDL_bool include_high_density_modes, SDL_DisplayMode *mode); /** * Get information about the desktop's display mode. @@ -604,7 +605,7 @@ extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * SDLCALL SDL_GetClosestFullscree * \sa SDL_GetCurrentDisplayMode * \sa SDL_GetDisplays */ -extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayID displayID); +extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayID displayID); /** * Get information about the current display mode. @@ -623,7 +624,7 @@ extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * SDLCALL SDL_GetDesktopDisplayMo * \sa SDL_GetDesktopDisplayMode * \sa SDL_GetDisplays */ -extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayID displayID); +extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayID displayID); /** * Get the display containing a point. @@ -753,7 +754,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetWindowFullscreenMode(SDL_Window *window, * \sa SDL_SetWindowFullscreenMode * \sa SDL_SetWindowFullscreen */ -extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode(SDL_Window *window); +extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode(SDL_Window *window); /** * Get the raw ICC profile data for the screen the window is currently on. @@ -761,11 +762,11 @@ extern SDL_DECLSPEC_TEMP const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreen * \param window the window to query. * \param size the size of the ICC profile. * \returns the raw ICC profile data on success or NULL on failure; call - * SDL_GetError() for more information. + * SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP const void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size); +extern SDL_DECLSPEC_FREE void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size); /** * Get the pixel format associated with the window. @@ -785,11 +786,11 @@ extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetWindowPixelFormat(SDL_Window * \param count a pointer filled in with the number of windows returned, may * be NULL. * \returns a NULL terminated array of SDL_Window pointers or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_TEMP SDL_Window * const * SDLCALL SDL_GetWindows(int *count); +extern SDL_DECLSPEC_FREE SDL_Window ** SDLCALL SDL_GetWindows(int *count); /** * Create a window with the specified dimensions and flags. @@ -1322,7 +1323,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetWindowTitle(SDL_Window *window, const cha * * \sa SDL_SetWindowTitle */ -extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetWindowTitle(SDL_Window *window); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetWindowTitle(SDL_Window *window); /** * Set the icon for a window. diff --git a/src/SDL_guid.c b/src/SDL_guid.c index d3a3c0b04ff23..cae9683a34f9c 100644 --- a/src/SDL_guid.c +++ b/src/SDL_guid.c @@ -21,21 +21,24 @@ #include "SDL_internal.h" /* convert the guid to a printable string */ -const char *SDL_GUIDToString(SDL_GUID guid) +void SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID) { static const char k_rgchHexToASCII[] = "0123456789abcdef"; int i; - char string[sizeof(guid) * 2 + 1]; - for (i = 0; i < sizeof(guid.data); ++i) { + if ((!pszGUID) || (cbGUID <= 0)) { + return; + } + + for (i = 0; i < sizeof(guid.data) && i < (cbGUID - 1) / 2; i++) { + /* each input byte writes 2 ascii chars, and might write a null byte. */ + /* If we don't have room for next input byte, stop */ unsigned char c = guid.data[i]; - string[i * 2 + 0] = k_rgchHexToASCII[c >> 4]; - string[i * 2 + 1] = k_rgchHexToASCII[c & 0x0F]; + *pszGUID++ = k_rgchHexToASCII[c >> 4]; + *pszGUID++ = k_rgchHexToASCII[c & 0x0F]; } - string[sizeof(string) -1] = '\0'; - - return SDL_CreateTemporaryString(string); + *pszGUID = '\0'; } /*----------------------------------------------------------------------------- diff --git a/src/SDL_hints.c b/src/SDL_hints.c index 905264523abc7..1abbeb930c135 100644 --- a/src/SDL_hints.c +++ b/src/SDL_hints.c @@ -74,7 +74,7 @@ SDL_bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPr entry->callback(entry->userdata, name, old_value, value); entry = next; } - SDL_FreeLater(old_value); + SDL_free(old_value); } hint->priority = priority; return SDL_TRUE; @@ -118,7 +118,7 @@ SDL_bool SDL_ResetHint(const char *name) entry = next; } } - SDL_FreeLater(hint->value); + SDL_free(hint->value); hint->value = NULL; hint->priority = SDL_HINT_DEFAULT; return SDL_TRUE; @@ -145,7 +145,7 @@ void SDL_ResetHints(void) entry = next; } } - SDL_FreeLater(hint->value); + SDL_free(hint->value); hint->value = NULL; hint->priority = SDL_HINT_DEFAULT; } @@ -169,7 +169,7 @@ const char *SDL_GetHint(const char *name) for (hint = SDL_hints; hint; hint = hint->next) { if (SDL_strcmp(name, hint->name) == 0) { if (!env || hint->priority == SDL_HINT_OVERRIDE) { - return hint->value; + return SDL_GetPersistentString(hint->value); } break; } @@ -303,7 +303,7 @@ void SDL_ClearHints(void) SDL_hints = hint->next; SDL_free(hint->name); - SDL_FreeLater(hint->value); + SDL_free(hint->value); for (entry = hint->callbacks; entry;) { SDL_HintWatch *freeable = entry; entry = entry->next; diff --git a/src/SDL_internal.h b/src/SDL_internal.h index 4909e55244ec8..1e77ae0e00445 100644 --- a/src/SDL_internal.h +++ b/src/SDL_internal.h @@ -279,28 +279,23 @@ #define SDL_MAIN_NOIMPL /* don't drag in header-only implementation of SDL_main */ #include -#include "SDL_utils_c.h" - -/* The internal implementations of these functions have up to nanosecond precision. - We can expose these functions as part of the API if we want to later. -*/ /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif +#include "SDL_utils_c.h" + /* Do any initialization that needs to happen before threads are started */ extern void SDL_InitMainThread(void); +/* The internal implementations of these functions have up to nanosecond precision. + We can expose these functions as part of the API if we want to later. +*/ extern int SDLCALL SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS); extern int SDLCALL SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS); extern SDL_bool SDLCALL SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS); -extern const char *SDL_CreateTemporaryString(const char *string); - -/* Add memory to the temporary memory pool, to be freed automatically later */ -extern void *SDL_FreeLater(void *memory); - /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/src/SDL_properties.c b/src/SDL_properties.c index 164b4ddc660df..323bb91dc8cd1 100644 --- a/src/SDL_properties.c +++ b/src/SDL_properties.c @@ -65,12 +65,12 @@ static void SDL_FreePropertyWithCleanup(const void *key, const void *value, void } break; case SDL_PROPERTY_TYPE_STRING: - SDL_FreeLater(property->value.string_value); // SDL_GetStringProperty() returns this pointer + SDL_free(property->value.string_value); break; default: break; } - SDL_FreeLater(property->string_storage); // this pointer might be given to the app by SDL_GetStringProperty. + SDL_free(property->string_storage); } SDL_free((void *)key); SDL_free((void *)value); diff --git a/src/SDL_utils.c b/src/SDL_utils.c index 26a25bec4cdf7..aaf721031ac51 100644 --- a/src/SDL_utils.c +++ b/src/SDL_utils.c @@ -320,3 +320,48 @@ int SDL_URIToLocal(const char *src, char *dst) } return -1; } + +// This is a set of per-thread persistent strings that we can return from the SDL API. +// This is used for short strings that might persist past the lifetime of the object +// they are related to. + +static SDL_TLSID SDL_string_storage; + +static void SDL_FreePersistentStrings( void *value ) +{ + SDL_HashTable *strings = (SDL_HashTable *)value; + SDL_DestroyHashTable(strings); +} + +const char *SDL_GetPersistentString(const char *string) +{ + if (!string) { + return NULL; + } + if (!*string) { + return ""; + } + + SDL_HashTable *strings = (SDL_HashTable *)SDL_GetTLS(&SDL_string_storage); + if (!strings) { + strings = SDL_CreateHashTable(NULL, 32, SDL_HashString, SDL_KeyMatchString, SDL_NukeFreeValue, SDL_FALSE); + if (!strings) { + return NULL; + } + + SDL_SetTLS(&SDL_string_storage, strings, SDL_FreePersistentStrings); + } + + const void *retval; + if (!SDL_FindInHashTable(strings, string, &retval)) { + char *new_string = SDL_strdup(string); + if (!new_string) { + return NULL; + } + + // If the hash table insert fails, at least we can return the string we allocated + retval = new_string; + SDL_InsertIntoHashTable(strings, string, retval); + } + return (const char *)retval; +} diff --git a/src/SDL_utils_c.h b/src/SDL_utils_c.h index 5e41da3e7a656..36375e6a13798 100644 --- a/src/SDL_utils_c.h +++ b/src/SDL_utils_c.h @@ -65,4 +65,6 @@ extern void SDL_SetObjectValid(void *object, SDL_ObjectType type, SDL_bool valid extern SDL_bool SDL_ObjectValid(void *object, SDL_ObjectType type); extern void SDL_SetObjectsInvalid(void); +extern const char *SDL_GetPersistentString(const char *string); + #endif /* SDL_utils_h_ */ diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index d9c6093158ba1..2394865f2f241 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -134,14 +134,14 @@ int SDL_GetNumAudioDrivers(void) const char *SDL_GetAudioDriver(int index) { if (index >= 0 && index < SDL_GetNumAudioDrivers()) { - return SDL_CreateTemporaryString(deduped_bootstrap[index]->name); + return deduped_bootstrap[index]->name; } return NULL; } const char *SDL_GetCurrentAudioDriver(void) { - return SDL_CreateTemporaryString(current_audio.name); + return current_audio.name; } static int GetDefaultSampleFramesFromFreq(const int freq) @@ -1336,7 +1336,7 @@ static int SDLCALL RecordingAudioThread(void *devicep) // thread entry point } -static const SDL_AudioDeviceID *GetAudioDevices(int *count, SDL_bool recording) +static SDL_AudioDeviceID *GetAudioDevices(int *count, SDL_bool recording) { SDL_AudioDeviceID *retval = NULL; int num_devices = 0; @@ -1379,15 +1379,15 @@ static const SDL_AudioDeviceID *GetAudioDevices(int *count, SDL_bool recording) *count = 0; } } - return SDL_FreeLater(retval); + return retval; } -const SDL_AudioDeviceID *SDL_GetAudioPlaybackDevices(int *count) +SDL_AudioDeviceID *SDL_GetAudioPlaybackDevices(int *count) { return GetAudioDevices(count, SDL_FALSE); } -const SDL_AudioDeviceID *SDL_GetAudioRecordingDevices(int *count) +SDL_AudioDeviceID *SDL_GetAudioRecordingDevices(int *count) { return GetAudioDevices(count, SDL_TRUE); } @@ -1438,7 +1438,7 @@ const char *SDL_GetAudioDeviceName(SDL_AudioDeviceID devid) const char *retval = NULL; SDL_AudioDevice *device = ObtainPhysicalAudioDevice(devid); if (device) { - retval = SDL_CreateTemporaryString(device->name); + retval = SDL_GetPersistentString(device->name); } ReleaseAudioDevice(device); @@ -1465,14 +1465,14 @@ int SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int * return retval; } -const int *SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count) +int *SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count) { - const int *retval = NULL; + int *retval = NULL; int channels = 0; SDL_AudioDevice *device = ObtainPhysicalAudioDeviceDefaultAllowed(devid); if (device) { channels = device->spec.channels; - retval = SDL_FreeLater(SDL_ChannelMapDup(device->chmap, channels)); + retval = SDL_ChannelMapDup(device->chmap, channels); } ReleaseAudioDevice(device); diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index d785b14dc37d2..5f72fdc04f1f5 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -636,14 +636,14 @@ int SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream *stream, const int *chmap return SetAudioStreamChannelMap(stream, &stream->dst_spec, &stream->dst_chmap, chmap, channels, SDL_FALSE); } -const int *SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count) +int *SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count) { - const int *retval = NULL; + int *retval = NULL; int channels = 0; if (stream) { SDL_LockMutex(stream->lock); channels = stream->src_spec.channels; - retval = SDL_FreeLater(SDL_ChannelMapDup(stream->src_chmap, channels)); + retval = SDL_ChannelMapDup(stream->src_chmap, channels); SDL_UnlockMutex(stream->lock); } @@ -654,14 +654,14 @@ const int *SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count return retval; } -const int *SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream *stream, int *count) +int *SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream *stream, int *count) { - const int *retval = NULL; + int *retval = NULL; int channels = 0; if (stream) { SDL_LockMutex(stream->lock); channels = stream->dst_spec.channels; - retval = SDL_FreeLater(SDL_ChannelMapDup(stream->dst_chmap, channels)); + retval = SDL_ChannelMapDup(stream->dst_chmap, channels); SDL_UnlockMutex(stream->lock); } diff --git a/src/camera/SDL_camera.c b/src/camera/SDL_camera.c index 0c5e835f5a3d7..160baebccc4e7 100644 --- a/src/camera/SDL_camera.c +++ b/src/camera/SDL_camera.c @@ -66,14 +66,14 @@ int SDL_GetNumCameraDrivers(void) const char *SDL_GetCameraDriver(int index) { if (index >= 0 && index < SDL_GetNumCameraDrivers()) { - return SDL_CreateTemporaryString(bootstrap[index]->name); + return bootstrap[index]->name; } return NULL; } const char *SDL_GetCurrentCameraDriver(void) { - return SDL_CreateTemporaryString(camera_driver.name); + return camera_driver.name; } char *SDL_GetCameraThreadName(SDL_Camera *device, char *buf, size_t buflen) @@ -675,7 +675,7 @@ const char *SDL_GetCameraName(SDL_CameraID instance_id) const char *retval = NULL; SDL_Camera *device = ObtainPhysicalCamera(instance_id); if (device) { - retval = SDL_CreateTemporaryString(device->name); + retval = SDL_GetPersistentString(device->name); ReleaseCamera(device); } return retval; @@ -693,7 +693,7 @@ SDL_CameraPosition SDL_GetCameraPosition(SDL_CameraID instance_id) } -const SDL_CameraID *SDL_GetCameras(int *count) +SDL_CameraID *SDL_GetCameras(int *count) { int dummy_count; if (!count) { @@ -729,10 +729,10 @@ const SDL_CameraID *SDL_GetCameras(int *count) *count = num_devices; - return SDL_FreeLater(retval); + return retval; } -const SDL_CameraSpec * const *SDL_GetCameraSupportedFormats(SDL_CameraID instance_id, int *count) +SDL_CameraSpec **SDL_GetCameraSupportedFormats(SDL_CameraID instance_id, int *count) { if (count) { *count = 0; @@ -761,7 +761,7 @@ const SDL_CameraSpec * const *SDL_GetCameraSupportedFormats(SDL_CameraID instanc ReleaseCamera(device); - return SDL_FreeLater(retval); + return retval; } diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 1e42cd00fc32c..6824289351bb6 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -2584,7 +2584,7 @@ const char *SDL_GetAndroidInternalStoragePath(void) LocalReferenceHolder_Cleanup(&refs); } - return SDL_CreateTemporaryString(s_AndroidInternalFilesPath); + return s_AndroidInternalFilesPath; } Uint32 SDL_GetAndroidExternalStorageState(void) @@ -2669,7 +2669,7 @@ const char *SDL_GetAndroidExternalStoragePath(void) LocalReferenceHolder_Cleanup(&refs); } - return SDL_CreateTemporaryString(s_AndroidExternalFilesPath); + return s_AndroidExternalFilesPath; } const char *SDL_GetAndroidCachePath(void) @@ -2715,7 +2715,7 @@ const char *SDL_GetAndroidCachePath(void) LocalReferenceHolder_Cleanup(&refs); } - return SDL_CreateTemporaryString(s_AndroidCachePath); + return s_AndroidCachePath; } int SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xOffset, int yOffset) diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 0ea498c3ebb95..b2fdd503f5501 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -192,7 +192,7 @@ SDL_DYNAPI_PROC(int,SDL_GL_SetAttribute,(SDL_GLattr a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GL_SetSwapInterval,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_GL_SwapWindow,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void,SDL_GL_UnloadLibrary,(void),(),) -SDL_DYNAPI_PROC(const char *,SDL_GUIDToString,(SDL_GUID a),(a),return) +SDL_DYNAPI_PROC(void,SDL_GUIDToString,(SDL_GUID a, char *b, int c),(a,b,c),) SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadConnected,(SDL_Gamepad *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadEventsEnabled,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadHasAxis,(SDL_Gamepad *a, SDL_GamepadAxis b),(a,b),return) @@ -208,21 +208,21 @@ SDL_DYNAPI_PROC(void*,SDL_GetAndroidJNIEnv,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetAndroidSDKVersion,(void),(),return) SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetAssertionHandler,(void **a),(a),return) SDL_DYNAPI_PROC(const SDL_AssertData*,SDL_GetAssertionReport,(void),(),return) -SDL_DYNAPI_PROC(const int*,SDL_GetAudioDeviceChannelMap,(SDL_AudioDeviceID a, int *b),(a,b),return) +SDL_DYNAPI_PROC(int*,SDL_GetAudioDeviceChannelMap,(SDL_AudioDeviceID a, int *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetAudioDeviceFormat,(SDL_AudioDeviceID a, SDL_AudioSpec *b, int *c),(a,b,c),return) SDL_DYNAPI_PROC(float,SDL_GetAudioDeviceGain,(SDL_AudioDeviceID a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetAudioDeviceName,(SDL_AudioDeviceID a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetAudioDriver,(int a),(a),return) -SDL_DYNAPI_PROC(const SDL_AudioDeviceID*,SDL_GetAudioPlaybackDevices,(int *a),(a),return) -SDL_DYNAPI_PROC(const SDL_AudioDeviceID*,SDL_GetAudioRecordingDevices,(int *a),(a),return) +SDL_DYNAPI_PROC(SDL_AudioDeviceID*,SDL_GetAudioPlaybackDevices,(int *a),(a),return) +SDL_DYNAPI_PROC(SDL_AudioDeviceID*,SDL_GetAudioRecordingDevices,(int *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetAudioStreamAvailable,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetAudioStreamData,(SDL_AudioStream *a, void *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_AudioDeviceID,SDL_GetAudioStreamDevice,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetAudioStreamFormat,(SDL_AudioStream *a, SDL_AudioSpec *b, SDL_AudioSpec *c),(a,b,c),return) SDL_DYNAPI_PROC(float,SDL_GetAudioStreamFrequencyRatio,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(float,SDL_GetAudioStreamGain,(SDL_AudioStream *a),(a),return) -SDL_DYNAPI_PROC(const int*,SDL_GetAudioStreamInputChannelMap,(SDL_AudioStream *a, int *b),(a,b),return) -SDL_DYNAPI_PROC(const int*,SDL_GetAudioStreamOutputChannelMap,(SDL_AudioStream *a, int *b),(a,b),return) +SDL_DYNAPI_PROC(int*,SDL_GetAudioStreamInputChannelMap,(SDL_AudioStream *a, int *b),(a,b),return) +SDL_DYNAPI_PROC(int*,SDL_GetAudioStreamOutputChannelMap,(SDL_AudioStream *a, int *b),(a,b),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetAudioStreamProperties,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetAudioStreamQueued,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetBasePath,(void),(),return) @@ -236,11 +236,11 @@ SDL_DYNAPI_PROC(const char*,SDL_GetCameraName,(SDL_CameraID a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetCameraPermissionState,(SDL_Camera *a),(a),return) SDL_DYNAPI_PROC(SDL_CameraPosition,SDL_GetCameraPosition,(SDL_CameraID a),(a),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetCameraProperties,(SDL_Camera *a),(a),return) -SDL_DYNAPI_PROC(const SDL_CameraSpec* const*,SDL_GetCameraSupportedFormats,(SDL_CameraID a, int *b),(a,b),return) -SDL_DYNAPI_PROC(const SDL_CameraID*,SDL_GetCameras,(int *a),(a),return) -SDL_DYNAPI_PROC(const void*,SDL_GetClipboardData,(const char *a, size_t *b),(a,b),return) -SDL_DYNAPI_PROC(const char*,SDL_GetClipboardText,(void),(),return) -SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetClosestFullscreenDisplayMode,(SDL_DisplayID a, int b, int c, float d, SDL_bool e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(SDL_CameraSpec**,SDL_GetCameraSupportedFormats,(SDL_CameraID a, int *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_CameraID*,SDL_GetCameras,(int *a),(a),return) +SDL_DYNAPI_PROC(void*,SDL_GetClipboardData,(const char *a, size_t *b),(a,b),return) +SDL_DYNAPI_PROC(char*,SDL_GetClipboardText,(void),(),return) +SDL_DYNAPI_PROC(int,SDL_GetClosestFullscreenDisplayMode,(SDL_DisplayID a, int b, int c, float d, SDL_bool e, SDL_DisplayMode *f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(const char*,SDL_GetCurrentAudioDriver,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetCurrentCameraDriver,(void),(),return) SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetCurrentDisplayMode,(SDL_DisplayID a),(a),return) @@ -269,18 +269,18 @@ SDL_DYNAPI_PROC(SDL_DisplayID,SDL_GetDisplayForWindow,(SDL_Window *a),(a),return SDL_DYNAPI_PROC(const char*,SDL_GetDisplayName,(SDL_DisplayID a),(a),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetDisplayProperties,(SDL_DisplayID a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetDisplayUsableBounds,(SDL_DisplayID a, SDL_Rect *b),(a,b),return) -SDL_DYNAPI_PROC(const SDL_DisplayID*,SDL_GetDisplays,(int *a),(a),return) +SDL_DYNAPI_PROC(SDL_DisplayID*,SDL_GetDisplays,(int *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetError,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_GetEventFilter,(SDL_EventFilter *a, void **b),(a,b),return) SDL_DYNAPI_PROC(float,SDL_GetFloatProperty,(SDL_PropertiesID a, const char *b, float c),(a,b,c),return) -SDL_DYNAPI_PROC(const SDL_DisplayMode* const*,SDL_GetFullscreenDisplayModes,(SDL_DisplayID a, int *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_DisplayMode**,SDL_GetFullscreenDisplayModes,(SDL_DisplayID a, int *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetGDKDefaultUser,(XUserHandle *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetGDKTaskQueue,(XTaskQueueHandle *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetGamepadAppleSFSymbolsNameForAxis,(SDL_Gamepad *a, SDL_GamepadAxis b),(a,b),return) SDL_DYNAPI_PROC(const char*,SDL_GetGamepadAppleSFSymbolsNameForButton,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return) SDL_DYNAPI_PROC(Sint16,SDL_GetGamepadAxis,(SDL_Gamepad *a, SDL_GamepadAxis b),(a,b),return) SDL_DYNAPI_PROC(SDL_GamepadAxis,SDL_GetGamepadAxisFromString,(const char *a),(a),return) -SDL_DYNAPI_PROC(const SDL_GamepadBinding* const*,SDL_GetGamepadBindings,(SDL_Gamepad *a, int *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_GamepadBinding**,SDL_GetGamepadBindings,(SDL_Gamepad *a, int *b),(a,b),return) SDL_DYNAPI_PROC(Uint8,SDL_GetGamepadButton,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return) SDL_DYNAPI_PROC(SDL_GamepadButton,SDL_GetGamepadButtonFromString,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_GamepadButtonLabel,SDL_GetGamepadButtonLabel,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return) @@ -292,10 +292,10 @@ SDL_DYNAPI_PROC(SDL_Gamepad*,SDL_GetGamepadFromPlayerIndex,(int a),(a),return) SDL_DYNAPI_PROC(SDL_GUID,SDL_GetGamepadGUIDForID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(SDL_JoystickID,SDL_GetGamepadID,(SDL_Gamepad *a),(a),return) SDL_DYNAPI_PROC(SDL_Joystick*,SDL_GetGamepadJoystick,(SDL_Gamepad *a),(a),return) -SDL_DYNAPI_PROC(const char*,SDL_GetGamepadMapping,(SDL_Gamepad *a),(a),return) -SDL_DYNAPI_PROC(const char*,SDL_GetGamepadMappingForGUID,(SDL_GUID a),(a),return) -SDL_DYNAPI_PROC(const char*,SDL_GetGamepadMappingForID,(SDL_JoystickID a),(a),return) -SDL_DYNAPI_PROC(const char * const *,SDL_GetGamepadMappings,(int *a),(a),return) +SDL_DYNAPI_PROC(char*,SDL_GetGamepadMapping,(SDL_Gamepad *a),(a),return) +SDL_DYNAPI_PROC(char*,SDL_GetGamepadMappingForGUID,(SDL_GUID a),(a),return) +SDL_DYNAPI_PROC(char*,SDL_GetGamepadMappingForID,(SDL_JoystickID a),(a),return) +SDL_DYNAPI_PROC(char **,SDL_GetGamepadMappings,(int *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetGamepadName,(SDL_Gamepad *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetGamepadNameForID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetGamepadPath,(SDL_Gamepad *a),(a),return) @@ -321,7 +321,7 @@ SDL_DYNAPI_PROC(SDL_GamepadType,SDL_GetGamepadTypeForID,(SDL_JoystickID a),(a),r SDL_DYNAPI_PROC(SDL_GamepadType,SDL_GetGamepadTypeFromString,(const char *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GetGamepadVendor,(SDL_Gamepad *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GetGamepadVendorForID,(SDL_JoystickID a),(a),return) -SDL_DYNAPI_PROC(const SDL_JoystickID*,SDL_GetGamepads,(int *a),(a),return) +SDL_DYNAPI_PROC(SDL_JoystickID*,SDL_GetGamepads,(int *a),(a),return) SDL_DYNAPI_PROC(SDL_MouseButtonFlags,SDL_GetGlobalMouseState,(float *a, float *b),(a,b),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetGlobalProperties,(void),(),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetGrabbedWindow,(void),(),return) @@ -331,7 +331,7 @@ SDL_DYNAPI_PROC(SDL_Haptic*,SDL_GetHapticFromID,(SDL_HapticID a),(a),return) SDL_DYNAPI_PROC(SDL_HapticID,SDL_GetHapticID,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetHapticName,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetHapticNameForID,(SDL_HapticID a),(a),return) -SDL_DYNAPI_PROC(const SDL_HapticID*,SDL_GetHaptics,(int *a),(a),return) +SDL_DYNAPI_PROC(SDL_HapticID*,SDL_GetHaptics,(int *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetHint,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_GetHintBoolean,(const char *a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetIOProperties,(SDL_IOStream *a),(a),return) @@ -367,21 +367,21 @@ SDL_DYNAPI_PROC(SDL_JoystickType,SDL_GetJoystickType,(SDL_Joystick *a),(a),retur SDL_DYNAPI_PROC(SDL_JoystickType,SDL_GetJoystickTypeForID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickVendor,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickVendorForID,(SDL_JoystickID a),(a),return) -SDL_DYNAPI_PROC(const SDL_JoystickID*,SDL_GetJoysticks,(int *a),(a),return) +SDL_DYNAPI_PROC(SDL_JoystickID*,SDL_GetJoysticks,(int *a),(a),return) SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromName,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromScancode,(SDL_Scancode a, SDL_Keymod b),(a,b),return) SDL_DYNAPI_PROC(const char*,SDL_GetKeyName,(SDL_Keycode a),(a),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetKeyboardFocus,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetKeyboardNameForID,(SDL_KeyboardID a),(a),return) SDL_DYNAPI_PROC(const Uint8*,SDL_GetKeyboardState,(int *a),(a),return) -SDL_DYNAPI_PROC(const SDL_KeyboardID*,SDL_GetKeyboards,(int *a),(a),return) +SDL_DYNAPI_PROC(SDL_KeyboardID*,SDL_GetKeyboards,(int *a),(a),return) SDL_DYNAPI_PROC(void,SDL_GetLogOutputFunction,(SDL_LogOutputFunction *a, void **b),(a,b),) SDL_DYNAPI_PROC(SDL_LogPriority,SDL_GetLogPriority,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetMasksForPixelFormat,(SDL_PixelFormat a, int *b, Uint32 *c, Uint32 *d, Uint32 *e, Uint32 *f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(int,SDL_GetMaxHapticEffects,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetMaxHapticEffectsPlaying,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(void,SDL_GetMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),) -SDL_DYNAPI_PROC(const SDL_MouseID*,SDL_GetMice,(int *a),(a),return) +SDL_DYNAPI_PROC(SDL_MouseID*,SDL_GetMice,(int *a),(a),return) SDL_DYNAPI_PROC(SDL_Keymod,SDL_GetModState,(void),(),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetMouseFocus,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetMouseNameForID,(SDL_MouseID a),(a),return) @@ -417,10 +417,10 @@ SDL_DYNAPI_PROC(const char*,SDL_GetPixelFormatName,(SDL_PixelFormat a),(a),retur SDL_DYNAPI_PROC(const char*,SDL_GetPlatform,(void),(),return) SDL_DYNAPI_PROC(void*,SDL_GetPointerProperty,(SDL_PropertiesID a, const char *b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_PowerState,SDL_GetPowerInfo,(int *a, int *b),(a,b),return) -SDL_DYNAPI_PROC(const char*,SDL_GetPrefPath,(const char *a, const char *b),(a,b),return) -SDL_DYNAPI_PROC(const SDL_Locale* const*,SDL_GetPreferredLocales,(int *a),(a),return) +SDL_DYNAPI_PROC(char*,SDL_GetPrefPath,(const char *a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_Locale**,SDL_GetPreferredLocales,(int *a),(a),return) SDL_DYNAPI_PROC(SDL_DisplayID,SDL_GetPrimaryDisplay,(void),(),return) -SDL_DYNAPI_PROC(const char*,SDL_GetPrimarySelectionText,(void),(),return) +SDL_DYNAPI_PROC(char*,SDL_GetPrimarySelectionText,(void),(),return) SDL_DYNAPI_PROC(SDL_PropertyType,SDL_GetPropertyType,(SDL_PropertiesID a, const char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_GetRGB,(Uint32 a, const SDL_PixelFormatDetails *b, const SDL_Palette *c, Uint8 *d, Uint8 *e, Uint8 *f),(a,b,c,d,e,f),) SDL_DYNAPI_PROC(void,SDL_GetRGBA,(Uint32 a, const SDL_PixelFormatDetails *b, const SDL_Palette *c, Uint8 *d, Uint8 *e, Uint8 *f, Uint8 *g),(a,b,c,d,e,f,g),) @@ -473,7 +473,7 @@ SDL_DYNAPI_PROC(int,SDL_GetSensorNonPortableTypeForID,(SDL_SensorID a),(a),retur SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetSensorProperties,(SDL_Sensor *a),(a),return) SDL_DYNAPI_PROC(SDL_SensorType,SDL_GetSensorType,(SDL_Sensor *a),(a),return) SDL_DYNAPI_PROC(SDL_SensorType,SDL_GetSensorTypeForID,(SDL_SensorID a),(a),return) -SDL_DYNAPI_PROC(const SDL_SensorID*,SDL_GetSensors,(int *a),(a),return) +SDL_DYNAPI_PROC(SDL_SensorID*,SDL_GetSensors,(int *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetSilenceValueForFormat,(SDL_AudioFormat a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetStorageFileSize,(SDL_Storage *a, const char *b, Uint64 *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetStoragePathInfo,(SDL_Storage *a, const char *b, SDL_PathInfo *c),(a,b,c),return) @@ -505,8 +505,8 @@ SDL_DYNAPI_PROC(Uint64,SDL_GetTicks,(void),(),return) SDL_DYNAPI_PROC(Uint64,SDL_GetTicksNS,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetTouchDeviceName,(SDL_TouchID a),(a),return) SDL_DYNAPI_PROC(SDL_TouchDeviceType,SDL_GetTouchDeviceType,(SDL_TouchID a),(a),return) -SDL_DYNAPI_PROC(const SDL_TouchID*,SDL_GetTouchDevices,(int *a),(a),return) -SDL_DYNAPI_PROC(const SDL_Finger* const*,SDL_GetTouchFingers,(SDL_TouchID a, int *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_TouchID*,SDL_GetTouchDevices,(int *a),(a),return) +SDL_DYNAPI_PROC(SDL_Finger**,SDL_GetTouchFingers,(SDL_TouchID a, int *b),(a,b),return) SDL_DYNAPI_PROC(const char*,SDL_GetUserFolder,(SDL_Folder a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetVersion,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetVideoDriver,(int a),(a),return) @@ -518,7 +518,7 @@ SDL_DYNAPI_PROC(float,SDL_GetWindowDisplayScale,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_WindowFlags,SDL_GetWindowFlags,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowFromID,(SDL_WindowID a),(a),return) SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetWindowFullscreenMode,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(const void*,SDL_GetWindowICCProfile,(SDL_Window *a, size_t *b),(a,b),return) +SDL_DYNAPI_PROC(void*,SDL_GetWindowICCProfile,(SDL_Window *a, size_t *b),(a,b),return) SDL_DYNAPI_PROC(SDL_WindowID,SDL_GetWindowID,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowKeyboardGrab,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetWindowMaximumSize,(SDL_Window *a, int *b, int *c),(a,b,c),return) @@ -537,9 +537,9 @@ SDL_DYNAPI_PROC(int,SDL_GetWindowSizeInPixels,(SDL_Window *a, int *b, int *c),(a SDL_DYNAPI_PROC(SDL_Surface*,SDL_GetWindowSurface,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetWindowSurfaceVSync,(SDL_Window *a, int *b),(a,b),return) SDL_DYNAPI_PROC(const char*,SDL_GetWindowTitle,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_Window* const*,SDL_GetWindows,(int *a),(a),return) -SDL_DYNAPI_PROC(const char * const *,SDL_GlobDirectory,(const char *a, const char *b, SDL_GlobFlags c, int *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(const char * const *,SDL_GlobStorageDirectory,(SDL_Storage *a, const char *b, const char *c, SDL_GlobFlags d, int *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(SDL_Window**,SDL_GetWindows,(int *a),(a),return) +SDL_DYNAPI_PROC(char **,SDL_GlobDirectory,(const char *a, const char *b, SDL_GlobFlags c, int *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(char **,SDL_GlobStorageDirectory,(SDL_Storage *a, const char *b, const char *c, SDL_GlobFlags d, int *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HapticEffectSupported,(SDL_Haptic *a, const SDL_HapticEffect *b),(a,b),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HapticRumbleSupported,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_HasARMSIMD,(void),(),return) diff --git a/src/dynapi/gendynapi.py b/src/dynapi/gendynapi.py index 339861427718e..8c4fd3dfb91a6 100755 --- a/src/dynapi/gendynapi.py +++ b/src/dynapi/gendynapi.py @@ -197,7 +197,7 @@ def main(): func_ret = func_ret.replace('extern', ' ') func_ret = func_ret.replace('SDLCALL', ' ') func_ret = func_ret.replace('SDL_DECLSPEC', ' ') - func_ret = func_ret.replace('SDL_DECLSPEC_TEMP', ' ') + func_ret = func_ret.replace('SDL_DECLSPEC_FREE', ' ') # Remove trailing spaces in front of '*' tmp = "" while func_ret != tmp: diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index 6a8021b5a2192..51ad2d38bc653 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -236,10 +236,6 @@ static void SDL_TransferTemporaryMemoryToEvent(SDL_EventEntry *event) SDL_LinkTemporaryMemoryToEvent(event, event->event.drop.data); break; default: - if (event->event.type >= SDL_EVENT_USER && event->event.type <= SDL_EVENT_LAST-1) { - SDL_LinkTemporaryMemoryToEvent(event, event->event.user.data1); - SDL_LinkTemporaryMemoryToEvent(event, event->event.user.data2); - } break; } } @@ -266,7 +262,7 @@ static void SDL_TransferTemporaryMemoryFromEvent(SDL_EventEntry *event) event->memory = NULL; } -void *SDL_FreeLater(void *memory) +static void *SDL_FreeLater(void *memory) { SDL_TemporaryMemoryState *state; @@ -275,7 +271,7 @@ void *SDL_FreeLater(void *memory) } // Make sure we're not adding this to the list twice - SDL_assert(!SDL_ClaimTemporaryMemory(memory)); + //SDL_assert(!SDL_ClaimTemporaryMemory(memory)); state = SDL_GetTemporaryMemoryState(SDL_TRUE); if (!state) { @@ -1158,6 +1154,9 @@ void SDL_FlushEvents(Uint32 minType, Uint32 maxType) /* Run the system dependent event loops */ static void SDL_PumpEventsInternal(SDL_bool push_sentinel) { + /* Free any temporary memory from old events */ + SDL_FreeTemporaryMemory(); + /* Release any keys held down from last frame */ SDL_ReleaseAutoReleaseKeys(); diff --git a/src/events/SDL_events_c.h b/src/events/SDL_events_c.h index 181583d71d07f..32e00cb1f611c 100644 --- a/src/events/SDL_events_c.h +++ b/src/events/SDL_events_c.h @@ -45,6 +45,11 @@ extern int SDL_SendKeymapChangedEvent(void); extern int SDL_SendLocaleChangedEvent(void); extern int SDL_SendSystemThemeChangedEvent(void); +extern void *SDL_AllocateTemporaryMemory(size_t size); +extern const char *SDL_CreateTemporaryString(const char *string); +extern void *SDL_ClaimTemporaryMemory(const void *mem); +extern void SDL_FreeTemporaryMemory(void); + extern int SDL_SendQuit(void); extern int SDL_InitEvents(void); diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index b0c3fcb66b5e6..63c503d149c57 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -177,7 +177,7 @@ SDL_bool SDL_HasKeyboard(void) return (SDL_keyboard_count > 0); } -const SDL_KeyboardID *SDL_GetKeyboards(int *count) +SDL_KeyboardID *SDL_GetKeyboards(int *count) { int i; SDL_KeyboardID *keyboards; @@ -198,7 +198,7 @@ const SDL_KeyboardID *SDL_GetKeyboards(int *count) } } - return SDL_FreeLater(keyboards); + return keyboards; } const char *SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id) @@ -207,7 +207,7 @@ const char *SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id) if (keyboard_index < 0) { return NULL; } - return SDL_CreateTemporaryString(SDL_keyboards[keyboard_index].name); + return SDL_GetPersistentString(SDL_keyboards[keyboard_index].name); } void SDL_ResetKeyboard(void) @@ -762,7 +762,7 @@ int SDL_SendEditingText(const char *text, int start, int length) static const char * const *CreateCandidatesForEvent(char **candidates, int num_candidates) { - char **event_candidates; + const char **event_candidates; int i; char *ptr; size_t total_length = (num_candidates + 1) * sizeof(*event_candidates); @@ -773,7 +773,7 @@ static const char * const *CreateCandidatesForEvent(char **candidates, int num_c total_length += length; } - event_candidates = (char **)SDL_malloc(total_length); + event_candidates = (const char **)SDL_AllocateTemporaryMemory(total_length); if (!event_candidates) { return NULL; } @@ -788,7 +788,7 @@ static const char * const *CreateCandidatesForEvent(char **candidates, int num_c } event_candidates[i] = NULL; - return SDL_FreeLater(event_candidates); + return event_candidates; } int SDL_SendEditingTextCandidates(char **candidates, int num_candidates, int selected_candidate, SDL_bool horizontal) diff --git a/src/events/SDL_keymap.c b/src/events/SDL_keymap.c index cfa5b213e9029..18300d9d60200 100644 --- a/src/events/SDL_keymap.c +++ b/src/events/SDL_keymap.c @@ -957,7 +957,8 @@ const char *SDL_GetScancodeName(SDL_Scancode scancode) if (!name) { name = ""; } - return SDL_CreateTemporaryString(name); + // This is pointing to static memory or application managed memory + return name; } SDL_Scancode SDL_GetScancodeFromName(const char *name) @@ -1015,7 +1016,7 @@ const char *SDL_GetKeyName(SDL_Keycode key) end = SDL_UCS4ToUTF8(key, name); *end = '\0'; - return SDL_CreateTemporaryString(name); + return SDL_GetPersistentString(name); } } diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index b7329f959f899..b56fc76434127 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -361,7 +361,7 @@ SDL_bool SDL_HasMouse(void) return (SDL_mouse_count > 0); } -const SDL_MouseID *SDL_GetMice(int *count) +SDL_MouseID *SDL_GetMice(int *count) { int i; SDL_MouseID *mice; @@ -382,7 +382,7 @@ const SDL_MouseID *SDL_GetMice(int *count) } } - return SDL_FreeLater(mice); + return mice; } const char *SDL_GetMouseNameForID(SDL_MouseID instance_id) @@ -391,7 +391,7 @@ const char *SDL_GetMouseNameForID(SDL_MouseID instance_id) if (mouse_index < 0) { return NULL; } - return SDL_CreateTemporaryString(SDL_mice[mouse_index].name); + return SDL_GetPersistentString(SDL_mice[mouse_index].name); } void SDL_SetDefaultCursor(SDL_Cursor *cursor) diff --git a/src/events/SDL_pen.c b/src/events/SDL_pen.c index 5feef99c62bcb..ac33ee4cffa12 100644 --- a/src/events/SDL_pen.c +++ b/src/events/SDL_pen.c @@ -213,7 +213,7 @@ const char *SDL_GetPenName(SDL_PenID instance_id) { const char *result; SDL_LOAD_LOCK_PEN(pen, instance_id, NULL); - result = pen->name; /* Allocated separately from the pen table, so it is safe to hand to client code */ + result = SDL_GetPersistentString(pen->name); SDL_UNLOCK_PENS(); return result; } diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c index 9bb14ed6446cb..4206f6383a15d 100644 --- a/src/events/SDL_touch.c +++ b/src/events/SDL_touch.c @@ -49,7 +49,7 @@ SDL_bool SDL_TouchDevicesAvailable(void) return SDL_num_touch > 0; } -const SDL_TouchID *SDL_GetTouchDevices(int *count) +SDL_TouchID *SDL_GetTouchDevices(int *count) { if (count) { *count = 0; @@ -67,7 +67,7 @@ const SDL_TouchID *SDL_GetTouchDevices(int *count) } } - return SDL_FreeLater(retval); + return retval; } static int SDL_GetTouchIndex(SDL_TouchID id) @@ -105,7 +105,7 @@ const char *SDL_GetTouchDeviceName(SDL_TouchID id) if (!touch) { return NULL; } - return SDL_CreateTemporaryString(touch->name); + return SDL_GetPersistentString(touch->name); } SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID id) @@ -134,7 +134,7 @@ static SDL_Finger *SDL_GetFinger(const SDL_Touch *touch, SDL_FingerID id) return touch->fingers[index]; } -const SDL_Finger * const * SDL_GetTouchFingers(SDL_TouchID touchID, int *count) +SDL_Finger **SDL_GetTouchFingers(SDL_TouchID touchID, int *count) { SDL_Finger **fingers; SDL_Finger *finger_data; @@ -164,7 +164,7 @@ const SDL_Finger * const * SDL_GetTouchFingers(SDL_TouchID touchID, int *count) if (count) { *count = touch->num_fingers; } - return SDL_FreeLater(fingers); + return fingers; } int SDL_AddTouch(SDL_TouchID touchID, SDL_TouchDeviceType type, const char *name) diff --git a/src/filesystem/SDL_filesystem.c b/src/filesystem/SDL_filesystem.c index 9eb44d48645e6..442f5021bc01f 100644 --- a/src/filesystem/SDL_filesystem.c +++ b/src/filesystem/SDL_filesystem.c @@ -298,7 +298,7 @@ static int SDLCALL GlobDirectoryCallback(void *userdata, const char *dirname, co return retval; } -const char * const *SDL_InternalGlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count, SDL_GlobEnumeratorFunc enumerator, SDL_GlobGetPathInfoFunc getpathinfo, void *userdata) +char **SDL_InternalGlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count, SDL_GlobEnumeratorFunc enumerator, SDL_GlobGetPathInfoFunc getpathinfo, void *userdata) { int dummycount; if (!count) { @@ -393,7 +393,7 @@ const char * const *SDL_InternalGlobDirectory(const char *path, const char *patt SDL_free(folded); SDL_free(pathcpy); - return SDL_FreeLater(retval); + return retval; } static int GlobDirectoryGetPathInfo(const char *path, SDL_PathInfo *info, void *userdata) @@ -406,7 +406,7 @@ static int GlobDirectoryEnumerator(const char *path, SDL_EnumerateDirectoryCallb return SDL_EnumerateDirectory(path, cb, cbuserdata); } -const char * const *SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count) +char **SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count) { //SDL_Log("SDL_GlobDirectory('%s', '%s') ...", path, pattern); return SDL_InternalGlobDirectory(path, pattern, flags, count, GlobDirectoryEnumerator, GlobDirectoryGetPathInfo, NULL); @@ -441,10 +441,10 @@ const char *SDL_GetUserFolder(SDL_Folder folder) } -const char *SDL_GetPrefPath(const char *org, const char *app) +char *SDL_GetPrefPath(const char *org, const char *app) { char *path = SDL_SYS_GetPrefPath(org, app); - return SDL_FreeLater(path); + return path; } diff --git a/src/filesystem/SDL_sysfilesystem.h b/src/filesystem/SDL_sysfilesystem.h index 5dfb3ebc3e7f5..83a59d20a1bb2 100644 --- a/src/filesystem/SDL_sysfilesystem.h +++ b/src/filesystem/SDL_sysfilesystem.h @@ -36,7 +36,7 @@ int SDL_SYS_GetPathInfo(const char *path, SDL_PathInfo *info); typedef int (*SDL_GlobEnumeratorFunc)(const char *path, SDL_EnumerateDirectoryCallback cb, void *cbuserdata, void *userdata); typedef int (*SDL_GlobGetPathInfoFunc)(const char *path, SDL_PathInfo *info, void *userdata); -const char * const *SDL_InternalGlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count, SDL_GlobEnumeratorFunc enumerator, SDL_GlobGetPathInfoFunc getpathinfo, void *userdata); +char **SDL_InternalGlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count, SDL_GlobEnumeratorFunc enumerator, SDL_GlobGetPathInfoFunc getpathinfo, void *userdata); #endif diff --git a/src/filesystem/winrt/SDL_sysfilesystem.cpp b/src/filesystem/winrt/SDL_sysfilesystem.cpp index 04dacd55fe8d1..df16663e07f15 100644 --- a/src/filesystem/winrt/SDL_sysfilesystem.cpp +++ b/src/filesystem/winrt/SDL_sysfilesystem.cpp @@ -115,7 +115,7 @@ extern "C" const char *SDL_GetWinRTFSPath(SDL_WinRT_Path pathType) char *utf8Path = WIN_StringToUTF8W(ucs2Path); utf8Paths[pathType] = utf8Path; SDL_free(utf8Path); - return SDL_CreateTemporaryString(utf8Paths[pathType].c_str()); + return SDL_GetPersistentString(utf8Paths[pathType].c_str()); } extern "C" char *SDL_SYS_GetBasePath(void) diff --git a/src/haptic/SDL_haptic.c b/src/haptic/SDL_haptic.c index 4d3ced531da10..bb009ec565c31 100644 --- a/src/haptic/SDL_haptic.c +++ b/src/haptic/SDL_haptic.c @@ -63,7 +63,7 @@ static SDL_bool SDL_GetHapticIndex(SDL_HapticID instance_id, int *driver_index) return SDL_FALSE; } -const SDL_HapticID *SDL_GetHaptics(int *count) +SDL_HapticID *SDL_GetHaptics(int *count) { int device_index; int haptic_index = 0, num_haptics = 0; @@ -89,7 +89,7 @@ const SDL_HapticID *SDL_GetHaptics(int *count) } } - return SDL_FreeLater(haptics); + return haptics; } const char *SDL_GetHapticNameForID(SDL_HapticID instance_id) @@ -98,9 +98,9 @@ const char *SDL_GetHapticNameForID(SDL_HapticID instance_id) const char *name = NULL; if (SDL_GetHapticIndex(instance_id, &device_index)) { - name = SDL_SYS_HapticName(device_index); + name = SDL_GetPersistentString(SDL_SYS_HapticName(device_index)); } - return SDL_CreateTemporaryString(name); + return name; } SDL_Haptic *SDL_OpenHaptic(SDL_HapticID instance_id) @@ -189,7 +189,7 @@ const char *SDL_GetHapticName(SDL_Haptic *haptic) { CHECK_HAPTIC_MAGIC(haptic, NULL); - return SDL_CreateTemporaryString(haptic->name); + return SDL_GetPersistentString(haptic->name); } SDL_bool SDL_IsMouseHaptic(void) diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c index 435f3b3b3375b..4dc94d7cf9d18 100644 --- a/src/joystick/SDL_gamepad.c +++ b/src/joystick/SDL_gamepad.c @@ -89,7 +89,7 @@ typedef struct GamepadMapping_t typedef struct { int refcount _guarded; - const SDL_JoystickID *joysticks _guarded; + SDL_JoystickID *joysticks _guarded; GamepadMapping_t **joystick_mappings _guarded; int num_changed_mappings _guarded; @@ -579,6 +579,7 @@ static void PopMappingChangeTracking(void) } } + SDL_free(tracker->joysticks); SDL_free(tracker->joystick_mappings); SDL_free(tracker->changed_mappings); SDL_free(tracker); @@ -2075,14 +2076,14 @@ int SDL_AddGamepadMapping(const char *mapping) static char *CreateMappingString(GamepadMapping_t *mapping, SDL_GUID guid) { char *pMappingString, *pPlatformString; - const char *pchGUID; + char pchGUID[33]; size_t needed; SDL_bool need_platform = SDL_FALSE; const char *platform = NULL; SDL_AssertJoysticksLocked(); - pchGUID = SDL_GUIDToString(guid); + SDL_GUIDToString(guid, pchGUID, sizeof(pchGUID)); /* allocate enough memory for GUID + ',' + name + ',' + mapping + \0 */ needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1; @@ -2124,7 +2125,7 @@ static char *CreateMappingString(GamepadMapping_t *mapping, SDL_GUID guid) return pMappingString; } -const char * const *SDL_GetGamepadMappings(int *count) +char **SDL_GetGamepadMappings(int *count) { int num_mappings = 0; char **retval = NULL; @@ -2197,13 +2198,13 @@ const char * const *SDL_GetGamepadMappings(int *count) SDL_free(mappings); } - return SDL_FreeLater(retval); + return retval; } /* * Get the mapping string for this GUID */ -const char *SDL_GetGamepadMappingForGUID(SDL_GUID guid) +char *SDL_GetGamepadMappingForGUID(SDL_GUID guid) { char *retval; @@ -2219,13 +2220,13 @@ const char *SDL_GetGamepadMappingForGUID(SDL_GUID guid) } SDL_UnlockJoysticks(); - return SDL_FreeLater(retval); + return retval; } /* * Get the mapping string for this device */ -const char *SDL_GetGamepadMapping(SDL_Gamepad *gamepad) +char *SDL_GetGamepadMapping(SDL_Gamepad *gamepad) { char *retval; @@ -2237,7 +2238,7 @@ const char *SDL_GetGamepadMapping(SDL_Gamepad *gamepad) } SDL_UnlockJoysticks(); - return SDL_FreeLater(retval); + return retval; } /* @@ -2357,7 +2358,7 @@ int SDL_InitGamepadMappings(void) int SDL_InitGamepads(void) { int i; - const SDL_JoystickID *joysticks; + SDL_JoystickID *joysticks; SDL_gamepads_initialized = SDL_TRUE; @@ -2372,6 +2373,7 @@ int SDL_InitGamepads(void) SDL_PrivateGamepadAdded(joysticks[i]); } } + SDL_free(joysticks); } return 0; @@ -2381,7 +2383,7 @@ SDL_bool SDL_HasGamepad(void) { int num_joysticks = 0; int num_gamepads = 0; - const SDL_JoystickID *joysticks = SDL_GetJoysticks(&num_joysticks); + SDL_JoystickID *joysticks = SDL_GetJoysticks(&num_joysticks); if (joysticks) { int i; for (i = num_joysticks - 1; i >= 0 && num_gamepads == 0; --i) { @@ -2389,6 +2391,7 @@ SDL_bool SDL_HasGamepad(void) ++num_gamepads; } } + SDL_free(joysticks); } if (num_gamepads > 0) { return SDL_TRUE; @@ -2396,11 +2399,11 @@ SDL_bool SDL_HasGamepad(void) return SDL_FALSE; } -const SDL_JoystickID *SDL_GetGamepads(int *count) +SDL_JoystickID *SDL_GetGamepads(int *count) { int num_joysticks = 0; int num_gamepads = 0; - SDL_JoystickID *joysticks = SDL_ClaimTemporaryMemory(SDL_GetJoysticks(&num_joysticks)); + SDL_JoystickID *joysticks = SDL_GetJoysticks(&num_joysticks); if (joysticks) { int i; for (i = num_joysticks - 1; i >= 0; --i) { @@ -2414,7 +2417,7 @@ const SDL_JoystickID *SDL_GetGamepads(int *count) if (count) { *count = num_gamepads; } - return SDL_FreeLater(joysticks); + return joysticks; } const char *SDL_GetGamepadNameForID(SDL_JoystickID instance_id) @@ -2428,7 +2431,7 @@ const char *SDL_GetGamepadNameForID(SDL_JoystickID instance_id) if (SDL_strcmp(mapping->name, "*") == 0) { retval = SDL_GetJoystickNameForID(instance_id); } else { - retval = SDL_CreateTemporaryString(mapping->name); + retval = SDL_GetPersistentString(mapping->name); } } } @@ -2516,7 +2519,7 @@ SDL_GamepadType SDL_GetRealGamepadTypeForID(SDL_JoystickID instance_id) return type; } -const char *SDL_GetGamepadMappingForID(SDL_JoystickID instance_id) +char *SDL_GetGamepadMappingForID(SDL_JoystickID instance_id) { char *retval = NULL; @@ -2524,15 +2527,15 @@ const char *SDL_GetGamepadMappingForID(SDL_JoystickID instance_id) { GamepadMapping_t *mapping = SDL_PrivateGetGamepadMapping(instance_id, SDL_TRUE); if (mapping) { - const char *pchGUID; - const SDL_GUID guid = SDL_GetJoystickGUIDForID(instance_id); - pchGUID = SDL_GUIDToString(guid); + char pchGUID[33]; + SDL_GUID guid = SDL_GetJoystickGUIDForID(instance_id); + SDL_GUIDToString(guid, pchGUID, sizeof(pchGUID)); SDL_asprintf(&retval, "%s,%s,%s", pchGUID, mapping->name, mapping->mapping); } } SDL_UnlockJoysticks(); - return SDL_FreeLater(retval); + return retval; } /* @@ -3307,7 +3310,7 @@ const char *SDL_GetGamepadName(SDL_Gamepad *gamepad) gamepad->joystick->steam_handle != 0) { retval = SDL_GetJoystickName(gamepad->joystick); } else { - retval = SDL_CreateTemporaryString(gamepad->name); + retval = SDL_GetPersistentString(gamepad->name); } } SDL_UnlockJoysticks(); @@ -3427,7 +3430,7 @@ const char * SDL_GetGamepadSerial(SDL_Gamepad *gamepad) if (!joystick) { return NULL; } - return SDL_GetJoystickSerial(joystick); // this already returns a SDL_FreeLater pointer. + return SDL_GetJoystickSerial(joystick); } @@ -3543,7 +3546,7 @@ SDL_Gamepad *SDL_GetGamepadFromPlayerIndex(int player_index) /* * Get the SDL joystick layer bindings for this gamepad */ -const SDL_GamepadBinding * const*SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count) +SDL_GamepadBinding **SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count) { SDL_GamepadBinding **bindings = NULL; @@ -3574,7 +3577,7 @@ const SDL_GamepadBinding * const*SDL_GetGamepadBindings(SDL_Gamepad *gamepad, in } SDL_UnlockJoysticks(); - return SDL_FreeLater(bindings); + return bindings; } int SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) @@ -3845,9 +3848,9 @@ void SDL_GamepadHandleDelayedGuideButton(SDL_Joystick *joystick) const char *SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button) { + const char *retval = NULL; #ifdef SDL_JOYSTICK_MFI - char *IOS_GetAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button); - char *retval; + const char *IOS_GetAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button); SDL_LockJoysticks(); { @@ -3856,21 +3859,15 @@ const char *SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_ retval = IOS_GetAppleSFSymbolsNameForButton(gamepad, button); } SDL_UnlockJoysticks(); - - // retval was malloc'd by IOS_GetAppleSFSymbolsNameForButton - if (retval && *retval) { - return SDL_FreeLater(retval); - } - SDL_free(retval); #endif - return NULL; + return retval; } const char *SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis) { + const char *retval = NULL; #ifdef SDL_JOYSTICK_MFI - char *IOS_GetAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis); - char *retval; + const char *IOS_GetAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis); SDL_LockJoysticks(); { @@ -3879,12 +3876,6 @@ const char *SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_Ga retval = IOS_GetAppleSFSymbolsNameForAxis(gamepad, axis); } SDL_UnlockJoysticks(); - - // retval was malloc'd by IOS_GetAppleSFSymbolsNameForAxis - if (retval && *retval) { - return SDL_FreeLater(retval); - } - SDL_free(retval); #endif - return NULL; + return retval; } diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 4a2760a852eb1..e03537079ddc8 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -714,7 +714,7 @@ SDL_bool SDL_HasJoystick(void) return SDL_FALSE; } -const SDL_JoystickID *SDL_GetJoysticks(int *count) +SDL_JoystickID *SDL_GetJoysticks(int *count) { int i, num_joysticks, device_index; int joystick_index = 0, total_joysticks = 0; @@ -751,7 +751,7 @@ const SDL_JoystickID *SDL_GetJoysticks(int *count) } SDL_UnlockJoysticks(); - return SDL_FreeLater(joysticks); + return joysticks; } const SDL_SteamVirtualGamepadInfo *SDL_GetJoystickVirtualGamepadInfoForID(SDL_JoystickID instance_id) @@ -780,9 +780,9 @@ const char *SDL_GetJoystickNameForID(SDL_JoystickID instance_id) SDL_LockJoysticks(); info = SDL_GetJoystickVirtualGamepadInfoForID(instance_id); if (info) { - name = SDL_CreateTemporaryString(info->name); + name = SDL_GetPersistentString(info->name); } else if (SDL_GetDriverAndJoystickIndex(instance_id, &driver, &device_index)) { - name = SDL_CreateTemporaryString(driver->GetDeviceName(device_index)); + name = SDL_GetPersistentString(driver->GetDeviceName(device_index)); } SDL_UnlockJoysticks(); @@ -800,7 +800,7 @@ const char *SDL_GetJoystickPathForID(SDL_JoystickID instance_id) SDL_LockJoysticks(); if (SDL_GetDriverAndJoystickIndex(instance_id, &driver, &device_index)) { - path = SDL_CreateTemporaryString(driver->GetDevicePath(device_index)); + path = SDL_GetPersistentString(driver->GetDevicePath(device_index)); } SDL_UnlockJoysticks(); @@ -858,7 +858,7 @@ static SDL_bool IsROGAlly(SDL_Joystick *joystick) SDL_bool has_ally_gyro = SDL_FALSE; if (SDL_InitSubSystem(SDL_INIT_SENSOR) == 0) { - const SDL_SensorID *sensors = SDL_GetSensors(NULL); + SDL_SensorID *sensors = SDL_GetSensors(NULL); if (sensors) { int i; for (i = 0; sensors[i]; ++i) { @@ -877,6 +877,7 @@ static SDL_bool IsROGAlly(SDL_Joystick *joystick) } } } + SDL_free(sensors); } SDL_QuitSubSystem(SDL_INIT_SENSOR); } @@ -951,7 +952,7 @@ static SDL_bool ShouldAttemptSensorFusion(SDL_Joystick *joystick, SDL_bool *inve static void AttemptSensorFusion(SDL_Joystick *joystick, SDL_bool invert_sensors) { - const SDL_SensorID *sensors; + SDL_SensorID *sensors; unsigned int i, j; SDL_AssertJoysticksLocked(); @@ -980,6 +981,7 @@ static void AttemptSensorFusion(SDL_Joystick *joystick, SDL_bool invert_sensors) SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_GYRO, 0.0f); } } + SDL_free(sensors); } SDL_QuitSubSystem(SDL_INIT_SENSOR); @@ -1651,9 +1653,9 @@ const char *SDL_GetJoystickName(SDL_Joystick *joystick) info = SDL_GetJoystickVirtualGamepadInfoForID(joystick->instance_id); if (info) { - retval = SDL_CreateTemporaryString(info->name); + retval = SDL_GetPersistentString(info->name); } else { - retval = SDL_CreateTemporaryString(joystick->name); + retval = SDL_GetPersistentString(joystick->name); } } SDL_UnlockJoysticks(); @@ -1673,7 +1675,7 @@ const char *SDL_GetJoystickPath(SDL_Joystick *joystick) CHECK_JOYSTICK_MAGIC(joystick, NULL); if (joystick->path) { - retval = SDL_CreateTemporaryString(joystick->path); + retval = SDL_GetPersistentString(joystick->path); } else { SDL_Unsupported(); retval = NULL; @@ -1903,7 +1905,7 @@ void SDL_CloseJoystick(SDL_Joystick *joystick) void SDL_QuitJoysticks(void) { int i; - const SDL_JoystickID *joysticks; + SDL_JoystickID *joysticks; SDL_LockJoysticks(); @@ -1914,6 +1916,7 @@ void SDL_QuitJoysticks(void) for (i = 0; joysticks[i]; ++i) { SDL_PrivateJoystickRemoved(joysticks[i]); } + SDL_free(joysticks); } while (SDL_joysticks) { @@ -3428,7 +3431,7 @@ const char *SDL_GetJoystickSerial(SDL_Joystick *joystick) { CHECK_JOYSTICK_MAGIC(joystick, NULL); - retval = SDL_CreateTemporaryString(joystick->serial); + retval = SDL_GetPersistentString(joystick->serial); } SDL_UnlockJoysticks(); diff --git a/src/joystick/apple/SDL_mfijoystick.m b/src/joystick/apple/SDL_mfijoystick.m index 22604ca01c73c..892e1a015046f 100644 --- a/src/joystick/apple/SDL_mfijoystick.m +++ b/src/joystick/apple/SDL_mfijoystick.m @@ -1916,7 +1916,7 @@ static void GetAppleSFSymbolsNameForElement(GCControllerElement *element, char * } #endif /* SDL_JOYSTICK_MFI && ENABLE_PHYSICAL_INPUT_PROFILE */ -char *IOS_GetAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button) +const char *IOS_GetAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button) { char elementName[256]; elementName[0] = '\0'; @@ -2031,10 +2031,10 @@ static void GetAppleSFSymbolsNameForElement(GCControllerElement *element, char * } #endif - return SDL_strdup(elementName); + return *elementName ? SDL_GetPersistentString(elementName) : NULL; } -char *IOS_GetAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis) +const char *IOS_GetAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis) { char elementName[256]; elementName[0] = '\0'; @@ -2071,7 +2071,7 @@ static void GetAppleSFSymbolsNameForElement(GCControllerElement *element, char * } } #endif - return *elementName ? SDL_strdup(elementName) : NULL; + return *elementName ? SDL_GetPersistentString(elementName) : NULL; } SDL_JoystickDriver SDL_IOS_JoystickDriver = { diff --git a/src/locale/SDL_locale.c b/src/locale/SDL_locale.c index 423e0acf52461..6b3c8022397a6 100644 --- a/src/locale/SDL_locale.c +++ b/src/locale/SDL_locale.c @@ -22,7 +22,7 @@ #include "SDL_internal.h" #include "SDL_syslocale.h" -static const SDL_Locale * const *build_locales_from_csv_string(char *csv, int *count) +static SDL_Locale **build_locales_from_csv_string(char *csv, int *count) { int i, num_locales; size_t slen; @@ -95,10 +95,10 @@ static const SDL_Locale * const *build_locales_from_csv_string(char *csv, int *c *count = num_locales; } - return SDL_FreeLater(retval); + return retval; } -const SDL_Locale * const *SDL_GetPreferredLocales(int *count) +SDL_Locale **SDL_GetPreferredLocales(int *count) { char locbuf[128]; /* enough for 21 "xx_YY," language strings. */ const char *hint = SDL_GetHint(SDL_HINT_PREFERRED_LOCALES); diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 0bc1d4b791a18..28a0340b46132 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -811,7 +811,7 @@ const char *SDL_GetRenderDriver(int index) SDL_GetNumRenderDrivers() - 1); return NULL; } - return SDL_CreateTemporaryString(render_drivers[index]->name); + return render_drivers[index]->name; #else SDL_SetError("SDL not built with rendering support"); return NULL; @@ -1204,7 +1204,7 @@ const char *SDL_GetRendererName(SDL_Renderer *renderer) { CHECK_RENDERER_MAGIC(renderer, NULL); - return renderer->name; + return SDL_GetPersistentString(renderer->name); } SDL_PropertiesID SDL_GetRendererProperties(SDL_Renderer *renderer) diff --git a/src/sensor/SDL_sensor.c b/src/sensor/SDL_sensor.c index 466bf3734c9ac..f13d3e8b0a7e3 100644 --- a/src/sensor/SDL_sensor.c +++ b/src/sensor/SDL_sensor.c @@ -170,7 +170,7 @@ SDL_bool SDL_SensorsOpened(void) return opened; } -const SDL_SensorID *SDL_GetSensors(int *count) +SDL_SensorID *SDL_GetSensors(int *count) { int i, num_sensors, device_index; int sensor_index = 0, total_sensors = 0; @@ -207,7 +207,7 @@ const SDL_SensorID *SDL_GetSensors(int *count) } SDL_UnlockSensors(); - return SDL_FreeLater(sensors); + return sensors; } /* @@ -246,7 +246,7 @@ const char *SDL_GetSensorNameForID(SDL_SensorID instance_id) SDL_LockSensors(); if (SDL_GetDriverAndSensorIndex(instance_id, &driver, &device_index)) { - name = SDL_CreateTemporaryString(driver->GetDeviceName(device_index)); + name = SDL_GetPersistentString(driver->GetDeviceName(device_index)); } SDL_UnlockSensors(); @@ -407,7 +407,7 @@ const char *SDL_GetSensorName(SDL_Sensor *sensor) { CHECK_SENSOR_MAGIC(sensor, NULL); - retval = SDL_CreateTemporaryString(sensor->name); + retval = SDL_GetPersistentString(sensor->name); } SDL_UnlockSensors(); diff --git a/src/stdlib/SDL_getenv.c b/src/stdlib/SDL_getenv.c index 020982d45e4fe..c37568ab877cf 100644 --- a/src/stdlib/SDL_getenv.c +++ b/src/stdlib/SDL_getenv.c @@ -185,7 +185,8 @@ const char *SDL_getenv(const char *name) const char *SDL_getenv(const char *name) { DWORD length, maxlen = 0; - char *retval = NULL; + char *string = NULL; + const char *retval = NULL; /* Input validation */ if (!name || *name == '\0') { @@ -193,20 +194,24 @@ const char *SDL_getenv(const char *name) } for ( ; ; ) { - length = GetEnvironmentVariableA(name, retval, maxlen); + length = GetEnvironmentVariableA(name, string, maxlen); if (length > maxlen) { - char *string = (char *)SDL_realloc(retval, length); - if (!string) { + char *temp = (char *)SDL_realloc(string, length); + if (!temp) { return NULL; } - retval = string; + string = temp; maxlen = length; } else { break; } } - return SDL_FreeLater(retval); + if (string) { + retval = SDL_GetPersistentString(string); + SDL_free(string); + } + return retval; } #else const char *SDL_getenv(const char *name) diff --git a/src/storage/SDL_storage.c b/src/storage/SDL_storage.c index 47adcfe7c5a74..bc31f0c4f5bee 100644 --- a/src/storage/SDL_storage.c +++ b/src/storage/SDL_storage.c @@ -353,7 +353,7 @@ static int GlobStorageDirectoryEnumerator(const char *path, SDL_EnumerateDirecto return SDL_EnumerateStorageDirectory((SDL_Storage *) userdata, path, cb, cbuserdata); } -const char * const *SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count) +char **SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count) { CHECK_STORAGE_MAGIC_RET(NULL) return SDL_InternalGlobDirectory(path, pattern, flags, count, GlobStorageDirectoryEnumerator, GlobStorageDirectoryGetPathInfo, storage); diff --git a/src/storage/generic/SDL_genericstorage.c b/src/storage/generic/SDL_genericstorage.c index 859786dfbcea3..ad43ddc3487af 100644 --- a/src/storage/generic/SDL_genericstorage.c +++ b/src/storage/generic/SDL_genericstorage.c @@ -203,10 +203,8 @@ static SDL_Storage *GENERIC_Title_Create(const char *override, SDL_PropertiesID if (override != NULL) { basepath = SDL_strdup(override); } else { - const char *sdlbasepath = SDL_GetBasePath(); - if (sdlbasepath) { - basepath = SDL_strdup(sdlbasepath); - } + const char *base = SDL_GetBasePath(); + basepath = base ? SDL_strdup(base) : NULL; } if (basepath != NULL) { @@ -242,11 +240,7 @@ static const SDL_StorageInterface GENERIC_user_iface = { static SDL_Storage *GENERIC_User_Create(const char *org, const char *app, SDL_PropertiesID props) { SDL_Storage *result; - char *prefpath = NULL; - const char *sdlprefpath = SDL_GetPrefPath(org, app); - if (sdlprefpath) { - prefpath = SDL_strdup(sdlprefpath); - } + char *prefpath = SDL_GetPrefPath(org, app); if (prefpath == NULL) { return NULL; } diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 689be07ffb33b..fbe1f18e67a1a 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1130,7 +1130,6 @@ static SDL_HitTestResult SDLCALL SDLTest_ExampleHitTestCallback(SDL_Window *win, SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state) { int i, j, m, n, w, h; - const SDL_DisplayMode *fullscreen_mode; char text[1024]; if (state->flags & SDL_INIT_VIDEO) { @@ -1192,9 +1191,9 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state) } if (state->verbose & VERBOSE_MODES) { - const SDL_DisplayID *displays; + SDL_DisplayID *displays; SDL_Rect bounds, usablebounds; - const SDL_DisplayMode * const *modes; + SDL_DisplayMode **modes; const SDL_DisplayMode *mode; int bpp; Uint32 Rmask, Gmask, Bmask, Amask; @@ -1258,6 +1257,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state) } } } + SDL_free(modes); #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) /* Print the D3D9 adapter index */ @@ -1269,6 +1269,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state) SDL_Log("DXGI Adapter Index: %d Output Index: %d", adapterIndex, outputIndex); #endif } + SDL_free(displays); } if (state->verbose & VERBOSE_RENDER) { @@ -1285,10 +1286,11 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state) state->displayID = SDL_GetPrimaryDisplay(); if (state->display_index > 0) { - const SDL_DisplayID *displays = SDL_GetDisplays(&n); + SDL_DisplayID *displays = SDL_GetDisplays(&n); if (state->display_index < n) { state->displayID = displays[state->display_index]; } + SDL_free(displays); if (SDL_WINDOWPOS_ISUNDEFINED(state->window_x)) { state->window_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(state->displayID); @@ -1304,10 +1306,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state) if (state->window_flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) { include_high_density_modes = SDL_TRUE; } - fullscreen_mode = SDL_GetClosestFullscreenDisplayMode(state->displayID, state->window_w, state->window_h, state->refresh_rate, include_high_density_modes); - if (fullscreen_mode) { - SDL_memcpy(&state->fullscreen_mode, fullscreen_mode, sizeof(state->fullscreen_mode)); - } + SDL_GetClosestFullscreenDisplayMode(state->displayID, state->window_w, state->window_h, state->refresh_rate, include_high_density_modes, &state->fullscreen_mode); } state->windows = @@ -1622,7 +1621,7 @@ static void SDLTest_PrintEvent(const SDL_Event *event) SDL_Rect rect; SDL_GetWindowSafeArea(SDL_GetWindowFromID(event->window.windowID), &rect); - SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " changed safe area to: %d,%d %dx%d\n", + SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " changed safe area to: %d,%d %dx%d\n", event->window.windowID, rect.x, rect.y, rect.w, rect.h); break; } @@ -2008,7 +2007,7 @@ static void SDLTest_PasteScreenShot(void) for (i = 0; i < SDL_arraysize(image_formats); ++i) { size_t size; - const void *data = SDL_GetClipboardData(image_formats[i], &size); + void *data = SDL_GetClipboardData(image_formats[i], &size); if (data) { char filename[16]; SDL_IOStream *file; @@ -2020,6 +2019,7 @@ static void SDLTest_PasteScreenShot(void) SDL_WriteIO(file, data, size); SDL_CloseIO(file); } + SDL_free(data); return; } } @@ -2029,7 +2029,7 @@ static void SDLTest_PasteScreenShot(void) static void FullscreenTo(SDLTest_CommonState *state, int index, int windowId) { int num_displays; - const SDL_DisplayID *displays; + SDL_DisplayID *displays; SDL_Window *window; SDL_WindowFlags flags; const SDL_DisplayMode *mode; @@ -2060,8 +2060,9 @@ static void FullscreenTo(SDLTest_CommonState *state, int index, int windowId) if (state->window_flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) { include_high_density_modes = SDL_TRUE; } - mode = SDL_GetClosestFullscreenDisplayMode(displays[index], state->window_w, state->window_h, state->refresh_rate, include_high_density_modes); - SDL_SetWindowFullscreenMode(window, mode); + if (SDL_GetClosestFullscreenDisplayMode(displays[index], state->window_w, state->window_h, state->refresh_rate, include_high_density_modes, &new_mode) == 0) { + SDL_SetWindowFullscreenMode(window, &new_mode); + } } } if (!mode) { @@ -2070,6 +2071,7 @@ static void FullscreenTo(SDLTest_CommonState *state, int index, int windowId) SDL_SetWindowFullscreen(window, SDL_TRUE); } } + SDL_free(displays); } int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event *event) @@ -2270,12 +2272,13 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_V: if (withAlt) { /* Alt-V paste awesome text from the primary selection! */ - const char *text = SDL_GetPrimarySelectionText(); + char *text = SDL_GetPrimarySelectionText(); if (*text) { SDL_Log("Primary selection: %s\n", text); } else { SDL_Log("Primary selection is empty\n"); } + SDL_free(text); } else if (withControl) { if (withShift) { @@ -2283,12 +2286,13 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event SDLTest_PasteScreenShot(); } else { /* Ctrl-V paste awesome text! */ - const char *text = SDL_GetClipboardText(); + char *text = SDL_GetClipboardText(); if (*text) { SDL_Log("Clipboard: %s\n", text); } else { SDL_Log("Clipboard is empty\n"); } + SDL_free(text); } } break; diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index d502c02c440f8..a34280b38bfa7 100644 --- a/src/thread/SDL_thread.c +++ b/src/thread/SDL_thread.c @@ -433,7 +433,7 @@ SDL_ThreadID SDL_GetThreadID(SDL_Thread *thread) const char *SDL_GetThreadName(SDL_Thread *thread) { if (thread) { - return thread->name; + return SDL_GetPersistentString(thread->name); } else { return NULL; } @@ -451,7 +451,7 @@ void SDL_WaitThread(SDL_Thread *thread, int *status) if (status) { *status = thread->status; } - SDL_FreeLater(thread->name); + SDL_free(thread->name); SDL_free(thread); } } diff --git a/src/video/SDL_clipboard.c b/src/video/SDL_clipboard.c index f89ef60f684b3..559747e766d97 100644 --- a/src/video/SDL_clipboard.c +++ b/src/video/SDL_clipboard.c @@ -162,7 +162,7 @@ void *SDL_GetInternalClipboardData(SDL_VideoDevice *_this, const char *mime_type return data; } -const void *SDL_GetClipboardData(const char *mime_type, size_t *size) +void *SDL_GetClipboardData(const char *mime_type, size_t *size) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); @@ -184,16 +184,16 @@ const void *SDL_GetClipboardData(const char *mime_type, size_t *size) *size = 0; if (_this->GetClipboardData) { - return SDL_FreeLater(_this->GetClipboardData(_this, mime_type, size)); + return _this->GetClipboardData(_this, mime_type, size); } else if (_this->GetClipboardText && SDL_IsTextMimeType(mime_type)) { char *text = _this->GetClipboardText(_this); if (text && *text == '\0') { SDL_free(text); text = NULL; } - return SDL_FreeLater(text); + return text; } else { - return SDL_FreeLater(SDL_GetInternalClipboardData(_this, mime_type, size)); + return SDL_GetInternalClipboardData(_this, mime_type, size); } } @@ -282,30 +282,30 @@ int SDL_SetClipboardText(const char *text) return SDL_ClearClipboardData(); } -const char *SDL_GetClipboardText(void) +char *SDL_GetClipboardText(void) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); size_t i, num_mime_types; const char **text_mime_types; size_t length; - const char *text = NULL; + char *text = NULL; if (!_this) { SDL_SetError("Video subsystem must be initialized to get clipboard text"); - return ""; + return SDL_strdup(""); } text_mime_types = SDL_GetTextMimeTypes(_this, &num_mime_types); for (i = 0; i < num_mime_types; ++i) { - const void *clipdata = SDL_GetClipboardData(text_mime_types[i], &length); + void *clipdata = SDL_GetClipboardData(text_mime_types[i], &length); if (clipdata) { - text = (const char *)clipdata; + text = (char *)clipdata; break; } } if (!text) { - text = SDL_CreateTemporaryString(""); + text = SDL_strdup(""); } return text; } @@ -356,7 +356,7 @@ int SDL_SetPrimarySelectionText(const char *text) return 0; } -const char *SDL_GetPrimarySelectionText(void) +char *SDL_GetPrimarySelectionText(void) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); @@ -366,13 +366,13 @@ const char *SDL_GetPrimarySelectionText(void) } if (_this->GetPrimarySelectionText) { - return SDL_FreeLater(_this->GetPrimarySelectionText(_this)); + return _this->GetPrimarySelectionText(_this); } else { const char *text = _this->primary_selection_text; if (!text) { text = ""; } - return SDL_CreateTemporaryString(text); + return SDL_strdup(text); } } diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index cd44953e241e0..49855ab8779ea 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -519,7 +519,7 @@ int SDL_GetNumVideoDrivers(void) const char *SDL_GetVideoDriver(int index) { if (index >= 0 && index < SDL_GetNumVideoDrivers()) { - return SDL_CreateTemporaryString(bootstrap[index]->name); + return bootstrap[index]->name; } return NULL; } @@ -663,7 +663,7 @@ const char *SDL_GetCurrentVideoDriver(void) SDL_UninitializedVideo(); return NULL; } - return SDL_CreateTemporaryString(_this->name); + return _this->name; } SDL_VideoDevice *SDL_GetVideoDevice(void) @@ -698,7 +698,7 @@ static void SDL_UpdateDesktopBounds(void) SDL_Rect rect; SDL_zero(rect); - const SDL_DisplayID *displays = SDL_GetDisplays(NULL); + SDL_DisplayID *displays = SDL_GetDisplays(NULL); if (displays) { for (int i = 0; displays[i]; ++i) { SDL_Rect bounds; @@ -710,6 +710,7 @@ static void SDL_UpdateDesktopBounds(void) } } } + SDL_free(displays); } SDL_copyp(&_this->desktop_bounds, &rect); } @@ -848,7 +849,7 @@ void SDL_DelVideoDisplay(SDL_DisplayID displayID, SDL_bool send_event) SDL_UpdateDesktopBounds(); } -const SDL_DisplayID *SDL_GetDisplays(int *count) +SDL_DisplayID *SDL_GetDisplays(int *count) { int i; SDL_DisplayID *displays; @@ -877,7 +878,7 @@ const SDL_DisplayID *SDL_GetDisplays(int *count) *count = 0; } } - return SDL_FreeLater(displays); + return displays; } SDL_VideoDisplay *SDL_GetVideoDisplay(SDL_DisplayID displayID) @@ -1115,19 +1116,6 @@ static void SDL_UpdateFullscreenDisplayModes(SDL_VideoDisplay *display) } } -static const SDL_DisplayMode *SDL_CreateTemporaryDisplayMode(const SDL_DisplayMode *mode) -{ - SDL_DisplayMode *retval = NULL; - - if (mode) { - retval = (SDL_DisplayMode *)SDL_malloc(sizeof(*retval)); - if (retval) { - SDL_copyp(retval, mode); - } - } - return SDL_FreeLater(retval); -} - // Return the matching mode as a pointer into our current mode list static const SDL_DisplayMode *SDL_GetFullscreenModeMatch(const SDL_DisplayMode *mode) { @@ -1174,16 +1162,6 @@ static const SDL_DisplayMode *SDL_GetFullscreenModeMatch(const SDL_DisplayMode * return mode; } -// Return the window's fullscreen mode as a pointer into our current mode list -static const SDL_DisplayMode *SDL_GetWindowFullscreenModeInternal(SDL_Window *window) -{ - if (window->flags & SDL_WINDOW_FULLSCREEN) { - return SDL_GetFullscreenModeMatch(&window->current_fullscreen_mode); - } else { - return SDL_GetFullscreenModeMatch(&window->requested_fullscreen_mode); - } -} - SDL_bool SDL_AddFullscreenDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode) { SDL_DisplayMode *modes; @@ -1250,7 +1228,7 @@ void SDL_ResetFullscreenDisplayModes(SDL_VideoDisplay *display) display->current_mode = &display->desktop_mode; } -const SDL_DisplayMode * const *SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count) +SDL_DisplayMode **SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count) { int i; int num_modes; @@ -1283,17 +1261,21 @@ const SDL_DisplayMode * const *SDL_GetFullscreenDisplayModes(SDL_DisplayID displ *count = 0; } } - return SDL_FreeLater(retval); + return retval; } -const SDL_DisplayMode *SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, SDL_bool include_high_density_modes) +int SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, SDL_bool include_high_density_modes, SDL_DisplayMode *result) { const SDL_DisplayMode *mode, *closest = NULL; float aspect_ratio; int i; SDL_VideoDisplay *display = SDL_GetVideoDisplay(displayID); - CHECK_DISPLAY_MAGIC(display, NULL); + if (result) { + SDL_zerop(result); + } + + CHECK_DISPLAY_MAGIC(display, -1); if (h > 0) { aspect_ratio = (float)w / h; @@ -1340,7 +1322,13 @@ const SDL_DisplayMode *SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID display closest = mode; } - return SDL_CreateTemporaryDisplayMode(closest); + if (!closest) { + return SDL_SetError("Couldn't find any matching video modes"); + } + if (result) { + SDL_copyp(result, closest); + } + return 0; } static SDL_bool DisplayModeChanged(const SDL_DisplayMode *old, const SDL_DisplayMode *new) @@ -1379,7 +1367,7 @@ const SDL_DisplayMode *SDL_GetDesktopDisplayMode(SDL_DisplayID displayID) CHECK_DISPLAY_MAGIC(display, NULL); - return SDL_CreateTemporaryDisplayMode(&display->desktop_mode); + return &display->desktop_mode; } void SDL_SetCurrentDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode) @@ -1408,7 +1396,7 @@ const SDL_DisplayMode *SDL_GetCurrentDisplayMode(SDL_DisplayID displayID) /* Make sure our mode list is updated */ SDL_UpdateFullscreenDisplayModes(display); - return SDL_CreateTemporaryDisplayMode(display->current_mode); + return display->current_mode; } int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay *display, SDL_DisplayMode *mode) @@ -1771,7 +1759,7 @@ int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_FullscreenOp fullscreen, SD } if (fullscreen) { - mode = (SDL_DisplayMode *)SDL_GetWindowFullscreenModeInternal(window); + mode = (SDL_DisplayMode *)SDL_GetWindowFullscreenMode(window); if (mode) { window->fullscreen_exclusive = SDL_TRUE; } else { @@ -2014,23 +2002,23 @@ int SDL_SetWindowFullscreenMode(SDL_Window *window, const SDL_DisplayMode *mode) const SDL_DisplayMode *SDL_GetWindowFullscreenMode(SDL_Window *window) { - const SDL_DisplayMode *retval; - CHECK_WINDOW_MAGIC(window, NULL); CHECK_WINDOW_NOT_POPUP(window, NULL); - retval = SDL_GetWindowFullscreenModeInternal(window); - - return SDL_CreateTemporaryDisplayMode(retval); + if (window->flags & SDL_WINDOW_FULLSCREEN) { + return SDL_GetFullscreenModeMatch(&window->current_fullscreen_mode); + } else { + return SDL_GetFullscreenModeMatch(&window->requested_fullscreen_mode); + } } -const void *SDL_GetWindowICCProfile(SDL_Window *window, size_t *size) +void *SDL_GetWindowICCProfile(SDL_Window *window, size_t *size) { if (!_this->GetWindowICCProfile) { SDL_Unsupported(); return NULL; } - return SDL_FreeLater(_this->GetWindowICCProfile(_this, window, size)); + return _this->GetWindowICCProfile(_this, window, size); } SDL_PixelFormat SDL_GetWindowPixelFormat(SDL_Window *window) @@ -2080,7 +2068,7 @@ void SDL_ToggleDragAndDropSupport(void) } } -SDL_Window * const *SDLCALL SDL_GetWindows(int *count) +SDL_Window **SDLCALL SDL_GetWindows(int *count) { if (count) { *count = 0; @@ -2115,7 +2103,7 @@ SDL_Window * const *SDLCALL SDL_GetWindows(int *count) if (count) { *count = num_added; } - return SDL_FreeLater(windows); + return windows; } static void ApplyWindowFlags(SDL_Window *window, SDL_WindowFlags flags) @@ -3033,7 +3021,7 @@ int SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h) SDL_GetWindowSize(window, w, h); - if ((window->flags & SDL_WINDOW_FULLSCREEN) && SDL_GetWindowFullscreenModeInternal(window)) { + if ((window->flags & SDL_WINDOW_FULLSCREEN) && SDL_GetWindowFullscreenMode(window)) { mode = SDL_GetCurrentDisplayMode(displayID); } else { mode = SDL_GetDesktopDisplayMode(displayID); @@ -3786,7 +3774,6 @@ void SDL_OnWindowDisplayChanged(SDL_Window *window) { if (window->flags & SDL_WINDOW_FULLSCREEN) { SDL_DisplayID displayID = SDL_GetDisplayForWindowPosition(window); - const SDL_DisplayMode *new_mode = NULL; if (window->requested_fullscreen_mode.w != 0 || window->requested_fullscreen_mode.h != 0) { SDL_bool include_high_density_modes = SDL_FALSE; @@ -3794,11 +3781,7 @@ void SDL_OnWindowDisplayChanged(SDL_Window *window) if (window->requested_fullscreen_mode.pixel_density > 1.0f) { include_high_density_modes = SDL_TRUE; } - new_mode = SDL_GetClosestFullscreenDisplayMode(displayID, window->requested_fullscreen_mode.w, window->requested_fullscreen_mode.h, window->requested_fullscreen_mode.refresh_rate, include_high_density_modes); - } - - if (new_mode) { - SDL_copyp(&window->current_fullscreen_mode, new_mode); + SDL_GetClosestFullscreenDisplayMode(displayID, window->requested_fullscreen_mode.w, window->requested_fullscreen_mode.h, window->requested_fullscreen_mode.refresh_rate, include_high_density_modes, &window->current_fullscreen_mode); } else { SDL_zero(window->current_fullscreen_mode); } diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 5cfeb7091b07f..7dc8ae50fc416 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1803,7 +1803,7 @@ - (void)touchesBeganWithEvent:(NSEvent *)theEvent } if (existingTouchCount == 0) { int numFingers; - const SDL_Finger * const *fingers = SDL_GetTouchFingers(touchID, &numFingers); + SDL_Finger **fingers = SDL_GetTouchFingers(touchID, &numFingers); if (fingers) { DLog("Reset Lost Fingers: %d", numFingers); for (--numFingers; numFingers >= 0; --numFingers) { @@ -1816,6 +1816,7 @@ - (void)touchesBeganWithEvent:(NSEvent *)theEvent SDL_Window *window = NULL; SDL_SendTouch(Cocoa_GetEventTimestamp([theEvent timestamp]), touchID, finger->id, window, SDL_FALSE, 0, 0, 0); } + SDL_free(fingers); } } diff --git a/src/video/kmsdrm/SDL_kmsdrmmouse.c b/src/video/kmsdrm/SDL_kmsdrmmouse.c index 16be026e36759..2b9a796dfbb92 100644 --- a/src/video/kmsdrm/SDL_kmsdrmmouse.c +++ b/src/video/kmsdrm/SDL_kmsdrmmouse.c @@ -315,13 +315,14 @@ static int KMSDRM_ShowCursor(SDL_Cursor *cursor) This happens on video quit, where we get here after the mouse focus has been unset, yet SDL wants to restore the system default cursor (makes no sense here). */ - const SDL_DisplayID *displays = SDL_GetDisplays(NULL); + SDL_DisplayID *displays = SDL_GetDisplays(NULL); if (displays) { /* Iterate on the displays, hiding the cursor. */ for (i = 0; i < displays[i]; i++) { display = SDL_GetVideoDisplay(displays[i]); ret = KMSDRM_RemoveCursorFromBO(display); } + SDL_free(displays); } } else { display = SDL_GetVideoDisplayForWindow(window); diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index 32adfa28fbd2b..513043b2d19b8 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -514,12 +514,11 @@ static drmModeModeInfo *KMSDRM_GetClosestDisplayMode(SDL_VideoDisplay *display, SDL_DisplayData *dispdata = display->internal; drmModeConnector *connector = dispdata->connector; - const SDL_DisplayMode *closest; + SDL_DisplayMode closest; drmModeModeInfo *drm_mode; - closest = SDL_GetClosestFullscreenDisplayMode(display->id, width, height, 0.0f, SDL_FALSE); - if (closest) { - const SDL_DisplayModeData *modedata = closest->internal; + if (SDL_GetClosestFullscreenDisplayMode(display->id, width, height, 0.0f, SDL_FALSE, &closest) == 0) { + const SDL_DisplayModeData *modedata = closest.internal; drm_mode = &connector->modes[modedata->mode_index]; return drm_mode; } else { @@ -535,7 +534,7 @@ static drmModeModeInfo *KMSDRM_GetClosestDisplayMode(SDL_VideoDisplay *display, /* Deinitializes the internal of the SDL Displays in the SDL display list. */ static void KMSDRM_DeinitDisplays(SDL_VideoDevice *_this) { - const SDL_DisplayID *displays; + SDL_DisplayID *displays; SDL_DisplayData *dispdata; int i; @@ -559,6 +558,7 @@ static void KMSDRM_DeinitDisplays(SDL_VideoDevice *_this) dispdata->crtc = NULL; } } + SDL_free(displays); } } diff --git a/src/video/uikit/SDL_uikitmodes.m b/src/video/uikit/SDL_uikitmodes.m index 80f9c9477d415..50d6722016b67 100644 --- a/src/video/uikit/SDL_uikitmodes.m +++ b/src/video/uikit/SDL_uikitmodes.m @@ -310,7 +310,7 @@ int UIKit_AddDisplay(SDL_bool send_event){ void UIKit_DelDisplay(UIScreen *uiscreen, SDL_bool send_event) { - const SDL_DisplayID *displays; + SDL_DisplayID *displays; int i; displays = SDL_GetDisplays(NULL); @@ -326,6 +326,7 @@ void UIKit_DelDisplay(UIScreen *uiscreen, SDL_bool send_event) break; } } + SDL_free(displays); } } diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index d105e59051ccb..9102de5f7e7a0 100644 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/src/video/uikit/SDL_uikitwindow.m @@ -172,20 +172,19 @@ int UIKit_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie #if !defined(SDL_PLATFORM_TVOS) && !defined(SDL_PLATFORM_VISIONOS) const CGSize origsize = data.uiscreen.currentMode.size; if ((origsize.width == 0.0f) && (origsize.height == 0.0f)) { - const SDL_DisplayMode *bestmode; + SDL_DisplayMode bestmode; SDL_bool include_high_density_modes = SDL_FALSE; if (window->flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) { include_high_density_modes = SDL_TRUE; } - bestmode = SDL_GetClosestFullscreenDisplayMode(display->id, window->w, window->h, 0.0f, include_high_density_modes); - if (bestmode) { - SDL_UIKitDisplayModeData *modedata = (__bridge SDL_UIKitDisplayModeData *)bestmode->internal; + if (SDL_GetClosestFullscreenDisplayMode(display->id, window->w, window->h, 0.0f, include_high_density_modes, &bestmode) == 0) { + SDL_UIKitDisplayModeData *modedata = (__bridge SDL_UIKitDisplayModeData *)bestmode.internal; [data.uiscreen setCurrentMode:modedata.uiscreenmode]; /* desktop_mode doesn't change here (the higher level will * use it to set all the screens back to their defaults * upon window destruction, SDL_Quit(), etc. */ - SDL_SetCurrentDisplayMode(display, bestmode); + SDL_SetCurrentDisplayMode(display, &bestmode); } } diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index a962f5c43ad28..986275ecdac7f 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -516,7 +516,7 @@ static void Wayland_move_window(SDL_Window *window) { SDL_WindowData *wind = window->internal; SDL_DisplayData *display; - const SDL_DisplayID *displays; + SDL_DisplayID *displays; if (wind->outputs && wind->num_outputs) { display = wind->outputs[wind->num_outputs - 1]; @@ -559,6 +559,7 @@ static void Wayland_move_window(SDL_Window *window) break; } } + SDL_free(displays); } } diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index de87e9e35c98f..bdd19c8c2eaa8 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -867,11 +867,11 @@ void WIN_CheckKeyboardAndMouseHotplug(SDL_VideoDevice *_this, SDL_bool initial_c PRAWINPUTDEVICELIST raw_devices = NULL; UINT raw_device_count = 0; int old_keyboard_count = 0; - const SDL_KeyboardID *old_keyboards = NULL; + SDL_KeyboardID *old_keyboards = NULL; int new_keyboard_count = 0; SDL_KeyboardID *new_keyboards = NULL; int old_mouse_count = 0; - const SDL_MouseID *old_mice = NULL; + SDL_MouseID *old_mice = NULL; int new_mouse_count = 0; SDL_MouseID *new_mice = NULL; SDL_bool send_event = !initial_check; @@ -982,7 +982,9 @@ void WIN_CheckKeyboardAndMouseHotplug(SDL_VideoDevice *_this, SDL_bool initial_c } } + SDL_free(old_keyboards); SDL_free(new_keyboards); + SDL_free(old_mice); SDL_free(new_mice); SetupDiDestroyDeviceInfoList(devinfo); diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c index 9419f77305156..d830123bf1099 100644 --- a/src/video/x11/SDL_x11modes.c +++ b/src/video/x11/SDL_x11modes.c @@ -686,7 +686,7 @@ static int X11_UpdateXRandRDisplay(SDL_VideoDevice *_this, Display *dpy, int scr static void X11_HandleXRandROutputChange(SDL_VideoDevice *_this, const XRROutputChangeNotifyEvent *ev) { - const SDL_DisplayID *displays; + SDL_DisplayID *displays; SDL_VideoDisplay *display = NULL; int i; @@ -704,6 +704,7 @@ static void X11_HandleXRandROutputChange(SDL_VideoDevice *_this, const XRROutput break; } } + SDL_free(displays); } if (ev->connection == RR_Disconnected) { /* output is going away */ diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index 1e11a9eb829f9..3bb88b0648921 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -418,7 +418,7 @@ static int X11_CaptureMouse(SDL_Window *window) static SDL_MouseButtonFlags X11_GetGlobalMouseState(float *x, float *y) { SDL_VideoData *videodata = SDL_GetVideoDevice()->internal; - const SDL_DisplayID *displays; + SDL_DisplayID *displays; Display *display = GetDisplay(); int i; @@ -460,6 +460,7 @@ static SDL_MouseButtonFlags X11_GetGlobalMouseState(float *x, float *y) } } } + SDL_free(displays); } } diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c index 9ab979f0f126a..df96499fdea5d 100644 --- a/src/video/x11/SDL_x11xinput2.c +++ b/src/video/x11/SDL_x11xinput2.c @@ -725,6 +725,30 @@ static SDL_bool HasDeviceID(Uint32 deviceID, const Uint32 *list, int count) return SDL_FALSE; } +static void AddDeviceID64(Uint64 deviceID, Uint64 **list, int *count) +{ + int new_count = (*count + 1); + Uint64 *new_list = (Uint64 *)SDL_realloc(*list, new_count * sizeof(*new_list)); + if (!new_list) { + /* Oh well, we'll drop this one */ + return; + } + new_list[new_count - 1] = deviceID; + + *count = new_count; + *list = new_list; +} + +static SDL_bool HasDeviceID64(Uint64 deviceID, const Uint64 *list, int count) +{ + for (int i = 0; i < count; ++i) { + if (deviceID == list[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + #endif // SDL_VIDEO_DRIVER_X11_XINPUT2 void X11_Xinput2UpdateDevices(SDL_VideoDevice *_this, SDL_bool initial_check) @@ -734,18 +758,17 @@ void X11_Xinput2UpdateDevices(SDL_VideoDevice *_this, SDL_bool initial_check) XIDeviceInfo *info; int ndevices; int old_keyboard_count = 0; - const SDL_KeyboardID *old_keyboards = NULL; + SDL_KeyboardID *old_keyboards = NULL; int new_keyboard_count = 0; SDL_KeyboardID *new_keyboards = NULL; int old_mouse_count = 0; - const SDL_MouseID *old_mice = NULL; + SDL_MouseID *old_mice = NULL; int new_mouse_count = 0; SDL_MouseID *new_mice = NULL; int old_touch_count = 0; - const SDL_TouchID *old_touch_devices64 = NULL; - Uint32 *old_touch_devices = NULL; + Uint64 *old_touch_devices = NULL; int new_touch_count = 0; - Uint32 *new_touch_devices = NULL; + Uint64 *new_touch_devices = NULL; SDL_bool send_event = !initial_check; SDL_assert(X11_Xinput2IsInitialized()); @@ -754,17 +777,7 @@ void X11_Xinput2UpdateDevices(SDL_VideoDevice *_this, SDL_bool initial_check) old_keyboards = SDL_GetKeyboards(&old_keyboard_count); old_mice = SDL_GetMice(&old_mouse_count); - - /* SDL_TouchID is 64-bit, but our helper functions take Uint32 */ - old_touch_devices64 = SDL_GetTouchDevices(&old_touch_count); - if (old_touch_count > 0) { - old_touch_devices = (Uint32 *)SDL_malloc(old_touch_count * sizeof(*old_touch_devices)); - if (old_touch_devices) { - for (int i = 0; i < old_touch_count; ++i) { - old_touch_devices[i] = (Uint32)old_touch_devices64[i]; - } - } - } + old_touch_devices = SDL_GetTouchDevices(&old_touch_count); for (int i = 0; i < ndevices; i++) { XIDeviceInfo *dev = &info[i]; @@ -796,7 +809,7 @@ void X11_Xinput2UpdateDevices(SDL_VideoDevice *_this, SDL_bool initial_check) #ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH for (int j = 0; j < dev->num_classes; j++) { - Uint32 touchID; + Uint64 touchID; SDL_TouchDeviceType touchType; XIAnyClassInfo *class = dev->classes[j]; XITouchClassInfo *t = (XITouchClassInfo *)class; @@ -806,9 +819,9 @@ void X11_Xinput2UpdateDevices(SDL_VideoDevice *_this, SDL_bool initial_check) continue; } - touchID = (Uint32)t->sourceid; - AddDeviceID(touchID, &new_touch_devices, &new_touch_count); - if (!HasDeviceID(touchID, old_touch_devices, old_touch_count)) { + touchID = (Uint64)t->sourceid; + AddDeviceID64(touchID, &new_touch_devices, &new_touch_count); + if (!HasDeviceID64(touchID, old_touch_devices, old_touch_count)) { if (t->mode == XIDependentTouch) { touchType = SDL_TOUCH_DEVICE_INDIRECT_RELATIVE; } else { /* XIDirectTouch */ @@ -833,12 +846,14 @@ void X11_Xinput2UpdateDevices(SDL_VideoDevice *_this, SDL_bool initial_check) } for (int i = old_touch_count; i--;) { - if (!HasDeviceID(old_touch_devices[i], new_touch_devices, new_touch_count)) { + if (!HasDeviceID64(old_touch_devices[i], new_touch_devices, new_touch_count)) { SDL_DelTouch(old_touch_devices[i]); } } + SDL_free(old_keyboards); SDL_free(new_keyboards); + SDL_free(old_mice); SDL_free(new_mice); SDL_free(old_touch_devices); SDL_free(new_touch_devices); diff --git a/test/gamepadutils.c b/test/gamepadutils.c index 887c83fc70b70..562a9e0cb5277 100644 --- a/test/gamepadutils.c +++ b/test/gamepadutils.c @@ -416,12 +416,13 @@ void UpdateGamepadImageFromGamepad(GamepadImage *ctx, SDL_Gamepad *gamepad) } ctx->type = SDL_GetGamepadType(gamepad); - const char *mapping = SDL_GetGamepadMapping(gamepad); + char *mapping = SDL_GetGamepadMapping(gamepad); if (mapping) { if (SDL_strstr(mapping, "SDL_GAMECONTROLLER_USE_BUTTON_LABELS")) { /* Just for display purposes */ ctx->type = SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO; } + SDL_free(mapping); } for (i = 0; i < SDL_GAMEPAD_BUTTON_TOUCHPAD; ++i) { @@ -1021,7 +1022,7 @@ void RenderGamepadDisplay(GamepadDisplay *ctx, SDL_Gamepad *gamepad) const float arrow_extent = 48.0f; SDL_FRect dst, rect, highlight; Uint8 r, g, b, a; - const char *mapping = NULL; + char *mapping; SDL_bool has_accel; SDL_bool has_gyro; @@ -1285,6 +1286,7 @@ void RenderGamepadDisplay(GamepadDisplay *ctx, SDL_Gamepad *gamepad) } } } + SDL_free(mapping); } void DestroyGamepadDisplay(GamepadDisplay *ctx) diff --git a/test/pretest.c b/test/pretest.c index 66c2e36734a37..9d81f8733acb2 100644 --- a/test/pretest.c +++ b/test/pretest.c @@ -27,7 +27,7 @@ int main(int argc, char *argv[]) (void)argv; SDL_Init(0); start = SDL_GetTicks(); - SDL_GetPrefPath("libsdl", "test_filesystem"); + SDL_free(SDL_GetPrefPath("libsdl", "test_filesystem")); prequit = SDL_GetTicks(); SDL_Log("SDL_GetPrefPath took %" SDL_PRIu64 "ms", prequit - start); SDL_Quit(); diff --git a/test/testaudioinfo.c b/test/testaudioinfo.c index f389e41b0e25d..a32268761bdde 100644 --- a/test/testaudioinfo.c +++ b/test/testaudioinfo.c @@ -20,7 +20,7 @@ print_devices(SDL_bool recording) const char *typestr = (recording ? "recording" : "playback"); int n = 0; int frames; - const SDL_AudioDeviceID *devices = recording ? SDL_GetAudioRecordingDevices(&n) : SDL_GetAudioPlaybackDevices(&n); + SDL_AudioDeviceID *devices = recording ? SDL_GetAudioRecordingDevices(&n) : SDL_GetAudioPlaybackDevices(&n); if (!devices) { SDL_Log(" Driver failed to report %s devices: %s\n\n", typestr, SDL_GetError()); @@ -46,6 +46,7 @@ print_devices(SDL_bool recording) } SDL_Log("\n"); } + SDL_free(devices); } int main(int argc, char **argv) diff --git a/test/testaudiorecording.c b/test/testaudiorecording.c index 214d6d040aa68..b983143c4392c 100644 --- a/test/testaudiorecording.c +++ b/test/testaudiorecording.c @@ -23,7 +23,7 @@ static SDLTest_CommonState *state = NULL; int SDL_AppInit(void **appstate, int argc, char **argv) { - const SDL_AudioDeviceID *devices; + SDL_AudioDeviceID *devices; SDL_AudioSpec outspec; SDL_AudioSpec inspec; SDL_AudioDeviceID device; @@ -103,6 +103,7 @@ int SDL_AppInit(void **appstate, int argc, char **argv) device = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, NULL); if (!device) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for playback: %s!\n", SDL_GetError()); + SDL_free(devices); return SDL_APP_FAILURE; } SDL_PauseAudioDevice(device); @@ -110,9 +111,11 @@ int SDL_AppInit(void **appstate, int argc, char **argv) stream_out = SDL_CreateAudioStream(&outspec, &outspec); if (!stream_out) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create an audio stream for playback: %s!\n", SDL_GetError()); + SDL_free(devices); return SDL_APP_FAILURE; } else if (SDL_BindAudioStream(device, stream_out) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't bind an audio stream for playback: %s!\n", SDL_GetError()); + SDL_free(devices); return SDL_APP_FAILURE; } @@ -124,8 +127,10 @@ int SDL_AppInit(void **appstate, int argc, char **argv) device = SDL_OpenAudioDevice(want_device, NULL); if (!device) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for recording: %s!\n", SDL_GetError()); + SDL_free(devices); return SDL_APP_FAILURE; } + SDL_free(devices); SDL_PauseAudioDevice(device); SDL_GetAudioDeviceFormat(device, &inspec, NULL); stream_in = SDL_CreateAudioStream(&inspec, &inspec); diff --git a/test/testautomation_audio.c b/test/testautomation_audio.c index a61c58fe40f71..8ff197492d7be 100644 --- a/test/testautomation_audio.c +++ b/test/testautomation_audio.c @@ -366,7 +366,7 @@ static int audio_enumerateAndNameAudioDevices(void *arg) int t; int i, n; const char *name; - const SDL_AudioDeviceID *devices = NULL; + SDL_AudioDeviceID *devices; /* Iterate over types: t=0 playback device, t=1 recording device */ for (t = 0; t < 2; t++) { @@ -388,6 +388,7 @@ static int audio_enumerateAndNameAudioDevices(void *arg) } } } + SDL_free(devices); } return TEST_COMPLETED; diff --git a/test/testautomation_clipboard.c b/test/testautomation_clipboard.c index 3af66c645806e..1b67434f184c5 100644 --- a/test/testautomation_clipboard.c +++ b/test/testautomation_clipboard.c @@ -86,9 +86,9 @@ static int clipboard_testClipboardDataFunctions(void *arg) int last_clipboard_update_count; int last_clipboard_callback_count; int last_clipboard_cleanup_count; - const void *data; + void *data; size_t size; - const char *text; + char *text; const char *expected_text; TestClipboardData test_data1 = { @@ -163,11 +163,12 @@ static int clipboard_testClipboardDataFunctions(void *arg) clipboard_cleanup_count - last_clipboard_cleanup_count); expected_text = "TEST"; - text = (char *) SDL_GetClipboardText(); + text = SDL_GetClipboardText(); SDLTest_AssertCheck( text && SDL_strcmp(text, expected_text) == 0, "Verify clipboard text, expected \"%s\", got \"%s\"", expected_text, text); + SDL_free(text); boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT]); SDLTest_AssertCheck( @@ -186,6 +187,7 @@ static int clipboard_testClipboardDataFunctions(void *arg) size == SDL_strlen(expected_text), "Verify test text size, expected %d, got %d", (int)SDL_strlen(expected_text), (int)size); + SDL_free(text); expected_text = "CUSTOM"; boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_CUSTOM_TEXT]); @@ -205,6 +207,7 @@ static int clipboard_testClipboardDataFunctions(void *arg) size == SDL_strlen(expected_text), "Verify test text size, expected %d, got %d", (int)SDL_strlen(expected_text), (int)size); + SDL_free(text); boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_DATA]); SDLTest_AssertCheck( @@ -218,6 +221,7 @@ static int clipboard_testClipboardDataFunctions(void *arg) size == test_data1.data_size, "Verify test data size, expected %d, got %d", (int)test_data1.data_size, (int)size); + SDL_free(data); boolResult = SDL_HasClipboardData("test/invalid"); SDLTest_AssertCheck( @@ -232,6 +236,7 @@ static int clipboard_testClipboardDataFunctions(void *arg) size == 0, "Verify invalid data size, expected 0, got %d", (int)size); + SDL_free(data); #if 0 /* There's no guarantee how or when the callback is called */ SDLTest_AssertCheck( @@ -260,11 +265,12 @@ static int clipboard_testClipboardDataFunctions(void *arg) clipboard_cleanup_count - last_clipboard_cleanup_count); expected_text = "TEST"; - text = (char *) SDL_GetClipboardText(); + text = SDL_GetClipboardText(); SDLTest_AssertCheck( text && SDL_strcmp(text, expected_text) == 0, "Verify clipboard text, expected \"%s\", got \"%s\"", expected_text, text); + SDL_free(text); boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT]); SDLTest_AssertCheck( @@ -283,6 +289,7 @@ static int clipboard_testClipboardDataFunctions(void *arg) size == SDL_strlen(expected_text), "Verify test text size, expected %d, got %d", (int)SDL_strlen(expected_text), (int)size); + SDL_free(text); expected_text = "CUSTOM"; boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_CUSTOM_TEXT]); @@ -302,6 +309,7 @@ static int clipboard_testClipboardDataFunctions(void *arg) size == SDL_strlen(expected_text), "Verify test text size, expected %d, got %d", (int)SDL_strlen(expected_text), (int)size); + SDL_free(text); data = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_DATA], &size); SDLTest_AssertCheck( @@ -311,6 +319,7 @@ static int clipboard_testClipboardDataFunctions(void *arg) size == test_data2.data_size, "Verify test data size, expected %d, got %d", (int)test_data2.data_size, (int)size); + SDL_free(data); data = SDL_GetClipboardData("test/invalid", &size); SDLTest_AssertCheck( @@ -321,6 +330,7 @@ static int clipboard_testClipboardDataFunctions(void *arg) size == 0, "Verify invalid data size, expected 0, got %d", (int)size); + SDL_free(data); #if 0 /* There's no guarantee how or when the callback is called */ SDLTest_AssertCheck( @@ -376,7 +386,7 @@ static int clipboard_testClipboardTextFunctions(void *arg) char *text = SDL_strdup(textRef); SDL_bool boolResult; int intResult; - const char *charResult; + char *charResult; int last_clipboard_update_count; SDL_AddEventWatch(ClipboardEventWatch, NULL); @@ -393,6 +403,7 @@ static int clipboard_testClipboardTextFunctions(void *arg) charResult && SDL_strcmp(charResult, "") == 0, "Verify SDL_GetClipboardText returned \"\", got %s", charResult); + SDL_free(charResult); boolResult = SDL_HasClipboardText(); SDLTest_AssertCheck( boolResult == SDL_FALSE, @@ -425,6 +436,7 @@ static int clipboard_testClipboardTextFunctions(void *arg) charResult && SDL_strcmp(textRef, charResult) == 0, "Verify SDL_GetClipboardText returned correct string, expected '%s', got '%s'", textRef, charResult); + SDL_free(charResult); SDLTest_AssertCheck( clipboard_update_count == last_clipboard_update_count + 1, "Verify clipboard update count incremented by 1, got %d", @@ -458,7 +470,7 @@ static int clipboard_testPrimarySelectionTextFunctions(void *arg) char *text = SDL_strdup(textRef); SDL_bool boolResult; int intResult; - const char *charResult; + char *charResult; int last_clipboard_update_count; SDL_AddEventWatch(ClipboardEventWatch, NULL); @@ -475,6 +487,7 @@ static int clipboard_testPrimarySelectionTextFunctions(void *arg) charResult && SDL_strcmp(charResult, "") == 0, "Verify SDL_GetPrimarySelectionText returned \"\", got %s", charResult); + SDL_free(charResult); boolResult = SDL_HasPrimarySelectionText(); SDLTest_AssertCheck( boolResult == SDL_FALSE, @@ -506,6 +519,7 @@ static int clipboard_testPrimarySelectionTextFunctions(void *arg) charResult && SDL_strcmp(textRef, charResult) == 0, "Verify SDL_GetPrimarySelectionText returned correct string, expected '%s', got '%s'", textRef, charResult); + SDL_free(charResult); SDLTest_AssertCheck( clipboard_update_count == last_clipboard_update_count + 1, "Verify clipboard update count incremented by 1, got %d", diff --git a/test/testautomation_events.c b/test/testautomation_events.c index 92438a0522ab8..14418f76ccff2 100644 --- a/test/testautomation_events.c +++ b/test/testautomation_events.c @@ -175,67 +175,6 @@ static int events_addDelEventWatchWithUserdata(void *arg) return TEST_COMPLETED; } -/** - * Creates and validates temporary event memory - */ -static int events_temporaryMemory(void *arg) -{ - SDL_Event event; - void *mem, *claimed, *tmp; - SDL_bool found; - - { - /* Create and claim event memory */ - mem = SDL_AllocateTemporaryMemory(1); - SDLTest_AssertCheck(mem != NULL, "SDL_AllocateTemporaryMemory()"); - *(char *)mem = '1'; - - claimed = SDL_ClaimTemporaryMemory(mem); - SDLTest_AssertCheck(claimed != NULL, "SDL_ClaimTemporaryMemory() returned a valid pointer"); - - /* Verify that we can't claim it again */ - tmp = SDL_ClaimTemporaryMemory(mem); - SDLTest_AssertCheck(tmp == NULL, "SDL_ClaimTemporaryMemory() can't claim memory twice"); - - /* Clean up */ - SDL_free(claimed); - } - - { - /* Create event memory and queue it */ - mem = SDL_AllocateTemporaryMemory(1); - SDLTest_AssertCheck(mem != NULL, "SDL_AllocateTemporaryMemory()"); - *(char *)mem = '2'; - - SDL_zero(event); - event.type = SDL_EVENT_USER; - event.user.data1 = mem; - SDL_PushEvent(&event); - - /* Verify that we can't claim the memory once it's on the queue */ - claimed = SDL_ClaimTemporaryMemory(mem); - SDLTest_AssertCheck(claimed == NULL, "SDL_ClaimTemporaryMemory() can't claim memory on the event queue"); - - /* Get the event and verify the memory is valid */ - found = SDL_FALSE; - while (SDL_PollEvent(&event)) { - if (event.type == SDL_EVENT_USER && event.user.data1 == mem) { - found = SDL_TRUE; - } - } - SDLTest_AssertCheck(found, "SDL_PollEvent() returned queued event"); - - /* Verify that we can claim the memory now that we've dequeued it */ - claimed = SDL_ClaimTemporaryMemory(mem); - SDLTest_AssertCheck(claimed != NULL, "SDL_ClaimTemporaryMemory() can claim memory after dequeuing event"); - - /* Clean up */ - SDL_free(claimed); - } - - return TEST_COMPLETED; -} - /* ================= Test References ================== */ /* Events test cases */ @@ -251,13 +190,9 @@ static const SDLTest_TestCaseReference eventsTest3 = { (SDLTest_TestCaseFp)events_addDelEventWatchWithUserdata, "events_addDelEventWatchWithUserdata", "Adds and deletes an event watch function with userdata", TEST_ENABLED }; -static const SDLTest_TestCaseReference eventsTestTemporaryMemory = { - (SDLTest_TestCaseFp)events_temporaryMemory, "events_temporaryMemory", "Creates and validates temporary event memory", TEST_ENABLED -}; - /* Sequence of Events test cases */ static const SDLTest_TestCaseReference *eventsTests[] = { - &eventsTest1, &eventsTest2, &eventsTest3, &eventsTestTemporaryMemory, NULL + &eventsTest1, &eventsTest2, &eventsTest3, NULL }; /* Events test suite (global) */ diff --git a/test/testautomation_guid.c b/test/testautomation_guid.c index b2fe4d8a495dc..55eaebb51d98e 100644 --- a/test/testautomation_guid.c +++ b/test/testautomation_guid.c @@ -106,13 +106,13 @@ TestGUIDToString(void *arg) SDLTest_AssertPass("Call to SDL_GUIDToString"); for (i = 0; i < NUM_TEST_GUIDS; ++i) { - const char *guid_str; + char guid_str[33]; SDL_GUID guid; upper_lower_to_bytestring(guid.data, test_guids[i].upper, test_guids[i].lower); - guid_str = SDL_GUIDToString(guid); + SDL_GUIDToString(guid, guid_str, sizeof(guid_str)); SDLTest_AssertCheck(SDL_strcmp(guid_str, test_guids[i].str) == 0, "Checking whether strings match, expected %s, got %s\n", test_guids[i].str, guid_str); } diff --git a/test/testautomation_joystick.c b/test/testautomation_joystick.c index a97ce55c7b41c..64fc550e1d3bd 100644 --- a/test/testautomation_joystick.c +++ b/test/testautomation_joystick.c @@ -64,13 +64,15 @@ static int TestVirtualJoystick(void *arg) gamepad = SDL_OpenGamepad(SDL_GetJoystickID(joystick)); SDLTest_AssertCheck(gamepad != NULL, "SDL_OpenGamepad() succeeded"); if (gamepad) { - SDLTest_AssertCheck(SDL_strcmp(SDL_GetGamepadName(gamepad), desc.name) == 0, "SDL_GetGamepadName()"); + const char *name = SDL_GetGamepadName(gamepad); + SDLTest_AssertCheck(name && SDL_strcmp(name, desc.name) == 0, "SDL_GetGamepadName()"); SDLTest_AssertCheck(SDL_GetGamepadVendor(gamepad) == desc.vendor_id, "SDL_GetGamepadVendor()"); SDLTest_AssertCheck(SDL_GetGamepadProduct(gamepad) == desc.product_id, "SDL_GetGamepadProduct()"); /* Set an explicit mapping with a different name */ SDL_SetGamepadMapping(SDL_GetJoystickID(joystick), "ff0013db5669727475616c2043007601,Virtual Gamepad,a:b0,b:b1,x:b2,y:b3,back:b4,guide:b5,start:b6,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpup:b11,dpdown:b12,dpleft:b13,dpright:b14,misc1:b15,paddle1:b16,paddle2:b17,paddle3:b18,paddle4:b19,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetGamepadName(gamepad), "Virtual Gamepad") == 0, "SDL_GetGamepadName() == Virtual Gamepad"); + name = SDL_GetGamepadName(gamepad); + SDLTest_AssertCheck(name && SDL_strcmp(name, "Virtual Gamepad") == 0, "SDL_GetGamepadName() == Virtual Gamepad"); SDLTest_AssertCheck(SDL_GetGamepadButtonLabel(gamepad, SDL_GAMEPAD_BUTTON_SOUTH) == SDL_GAMEPAD_BUTTON_LABEL_A, "SDL_GetGamepadButtonLabel(SDL_GAMEPAD_BUTTON_SOUTH) == SDL_GAMEPAD_BUTTON_LABEL_A"); /* Set the south button and verify that the gamepad responds */ @@ -84,7 +86,8 @@ static int TestVirtualJoystick(void *arg) /* Set an explicit mapping with legacy Nintendo style buttons */ SDL_SetGamepadMapping(SDL_GetJoystickID(joystick), "ff0013db5669727475616c2043007601,Virtual Nintendo Gamepad,a:b1,b:b0,x:b3,y:b2,back:b4,guide:b5,start:b6,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpup:b11,dpdown:b12,dpleft:b13,dpright:b14,misc1:b15,paddle1:b16,paddle2:b17,paddle3:b18,paddle4:b19,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetGamepadName(gamepad), "Virtual Nintendo Gamepad") == 0, "SDL_GetGamepadName() == Virtual Nintendo Gamepad"); + name = SDL_GetGamepadName(gamepad); + SDLTest_AssertCheck(name && SDL_strcmp(name, "Virtual Nintendo Gamepad") == 0, "SDL_GetGamepadName() == Virtual Nintendo Gamepad"); SDLTest_AssertCheck(SDL_GetGamepadButtonLabel(gamepad, SDL_GAMEPAD_BUTTON_SOUTH) == SDL_GAMEPAD_BUTTON_LABEL_B, "SDL_GetGamepadButtonLabel(SDL_GAMEPAD_BUTTON_SOUTH) == SDL_GAMEPAD_BUTTON_LABEL_B"); /* Set the south button and verify that the gamepad responds */ @@ -98,7 +101,8 @@ static int TestVirtualJoystick(void *arg) /* Set an explicit mapping with PS4 style buttons */ SDL_SetGamepadMapping(SDL_GetJoystickID(joystick), "ff0013db5669727475616c2043007601,Virtual PS4 Gamepad,type:ps4,a:b0,b:b1,x:b2,y:b3,back:b4,guide:b5,start:b6,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpup:b11,dpdown:b12,dpleft:b13,dpright:b14,misc1:b15,paddle1:b16,paddle2:b17,paddle3:b18,paddle4:b19,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetGamepadName(gamepad), "Virtual PS4 Gamepad") == 0, "SDL_GetGamepadName() == Virtual PS4 Gamepad"); + name = SDL_GetGamepadName(gamepad); + SDLTest_AssertCheck(name && SDL_strcmp(name, "Virtual PS4 Gamepad") == 0, "SDL_GetGamepadName() == Virtual PS4 Gamepad"); SDLTest_AssertCheck(SDL_GetGamepadButtonLabel(gamepad, SDL_GAMEPAD_BUTTON_SOUTH) == SDL_GAMEPAD_BUTTON_LABEL_CROSS, "SDL_GetGamepadButtonLabel(SDL_GAMEPAD_BUTTON_SOUTH) == SDL_GAMEPAD_BUTTON_LABEL_CROSS"); /* Set the south button and verify that the gamepad responds */ diff --git a/test/testautomation_pen.c b/test/testautomation_pen.c index e655dc0250f77..35f3beedf85f1 100644 --- a/test/testautomation_pen.c +++ b/test/testautomation_pen.c @@ -38,6 +38,7 @@ #define SDL_GetPenName SDL_SUT_GetPenName #define SDL_GetPenCapabilities SDL_SUT_GetPenCapabilities #define SDL_GetPenType SDL_SUT_GetPenType +#define SDL_GetPersistentString(X) X #define SDL_GetPenPtr SDL_SUT_GetPenPtr #define SDL_PenModifyBegin SDL_SUT_PenModifyBegin diff --git a/test/testautomation_video.c b/test/testautomation_video.c index 26620a5cc257c..e40254689fd18 100644 --- a/test/testautomation_video.c +++ b/test/testautomation_video.c @@ -13,7 +13,7 @@ static SDL_Window *createVideoSuiteTestWindow(const char *title) { SDL_Window *window; - SDL_Window * const *windows; + SDL_Window **windows; SDL_Event event; int w, h; int count; @@ -34,6 +34,7 @@ static SDL_Window *createVideoSuiteTestWindow(const char *title) windows = SDL_GetWindows(&count); SDLTest_AssertCheck(windows != NULL, "Validate that returned window list is not NULL"); SDLTest_AssertCheck(windows[0] == window, "Validate that the window is first in the window list"); + SDL_free(windows); /* Wayland and XWayland windows require that a frame be presented before they are fully mapped and visible onscreen. * This is required for the mouse/keyboard grab tests to pass. @@ -305,8 +306,8 @@ static int video_getWindowFlags(void *arg) */ static int video_getFullscreenDisplayModes(void *arg) { - const SDL_DisplayID *displays; - const SDL_DisplayMode * const *modes; + SDL_DisplayID *displays; + SDL_DisplayMode **modes; int count; int i; @@ -321,7 +322,9 @@ static int video_getFullscreenDisplayModes(void *arg) SDLTest_AssertPass("Call to SDL_GetFullscreenDisplayModes(%" SDL_PRIu32 ")", displays[i]); SDLTest_AssertCheck(modes != NULL, "Validate returned value from function; expected != NULL; got: %p", modes); SDLTest_AssertCheck(count >= 0, "Validate number of modes; expected: >= 0; got: %d", count); + SDL_free(modes); } + SDL_free(displays); } return TEST_COMPLETED; @@ -332,11 +335,11 @@ static int video_getFullscreenDisplayModes(void *arg) */ static int video_getClosestDisplayModeCurrentResolution(void *arg) { - const SDL_DisplayID *displays; - const SDL_DisplayMode * const *modes; + SDL_DisplayID *displays; + SDL_DisplayMode **modes; SDL_DisplayMode current; - const SDL_DisplayMode *closest; - int i, num_modes; + SDL_DisplayMode closest; + int i, result, num_modes; /* Get number of displays */ displays = SDL_GetDisplays(NULL); @@ -355,21 +358,23 @@ static int video_getClosestDisplayModeCurrentResolution(void *arg) SDL_memcpy(¤t, modes[0], sizeof(current)); /* Make call */ - closest = SDL_GetClosestFullscreenDisplayMode(displays[i], current.w, current.h, current.refresh_rate, SDL_FALSE); + result = SDL_GetClosestFullscreenDisplayMode(displays[i], current.w, current.h, current.refresh_rate, SDL_FALSE, &closest); SDLTest_AssertPass("Call to SDL_GetClosestFullscreenDisplayMode(target=current)"); - SDLTest_Assert(closest != NULL, "Verify returned value is not NULL"); + SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); /* Check that one gets the current resolution back again */ - if (closest) { - SDLTest_AssertCheck(closest->w == current.w, + if (result == 0) { + SDLTest_AssertCheck(closest.w == current.w, "Verify returned width matches current width; expected: %d, got: %d", - current.w, closest->w); - SDLTest_AssertCheck(closest->h == current.h, + current.w, closest.w); + SDLTest_AssertCheck(closest.h == current.h, "Verify returned height matches current height; expected: %d, got: %d", - current.h, closest->h); + current.h, closest.h); } } + SDL_free(modes); } + SDL_free(displays); } return TEST_COMPLETED; @@ -380,8 +385,9 @@ static int video_getClosestDisplayModeCurrentResolution(void *arg) */ static int video_getClosestDisplayModeRandomResolution(void *arg) { - const SDL_DisplayID *displays; + SDL_DisplayID *displays; SDL_DisplayMode target; + SDL_DisplayMode closest; int i; int variation; @@ -403,10 +409,11 @@ static int video_getClosestDisplayModeRandomResolution(void *arg) target.refresh_rate = (variation & 8) ? (float)SDLTest_RandomIntegerInRange(25, 120) : 0.0f; /* Make call; may or may not find anything, so don't validate any further */ - SDL_GetClosestFullscreenDisplayMode(displays[i], target.w, target.h, target.refresh_rate, SDL_FALSE); + SDL_GetClosestFullscreenDisplayMode(displays[i], target.w, target.h, target.refresh_rate, SDL_FALSE, &closest); SDLTest_AssertPass("Call to SDL_GetClosestFullscreenDisplayMode(target=random/variation%d)", variation); } } + SDL_free(displays); } return TEST_COMPLETED; @@ -1668,7 +1675,7 @@ static int video_getSetWindowData(void *arg) */ static int video_setWindowCenteredOnDisplay(void *arg) { - const SDL_DisplayID *displays; + SDL_DisplayID *displays; SDL_Window *window; const char *title = "video_setWindowCenteredOnDisplay Test Window"; int x, y, w, h; @@ -1864,6 +1871,7 @@ static int video_setWindowCenteredOnDisplay(void *arg) destroyVideoSuiteTestWindow(window); } } + SDL_free(displays); } return TEST_COMPLETED; diff --git a/test/testbounds.c b/test/testbounds.c index d747822a0031e..143f74c6dc4d2 100644 --- a/test/testbounds.c +++ b/test/testbounds.c @@ -16,7 +16,7 @@ int main(int argc, char **argv) { - const SDL_DisplayID *displays; + SDL_DisplayID *displays; int i; SDLTest_CommonState *state; @@ -47,6 +47,7 @@ int main(int argc, char **argv) bounds.x, bounds.y, bounds.w, bounds.h, usable.x, usable.y, usable.w, usable.h); } + SDL_free(displays); } SDL_Quit(); diff --git a/test/testcamera.c b/test/testcamera.c index 25dbaa51e65a7..a600e447d0260 100644 --- a/test/testcamera.c +++ b/test/testcamera.c @@ -28,7 +28,7 @@ static SDL_CameraID back_camera = 0; static void PrintCameraSpecs(SDL_CameraID camera_id) { - const SDL_CameraSpec *const *specs = SDL_GetCameraSupportedFormats(camera_id, NULL); + SDL_CameraSpec **specs = SDL_GetCameraSupportedFormats(camera_id, NULL); if (specs) { int i; @@ -37,6 +37,7 @@ static void PrintCameraSpecs(SDL_CameraID camera_id) const SDL_CameraSpec *s = specs[i]; SDL_Log(" %dx%d %.2f FPS %s\n", s->width, s->height, (float)s->framerate_numerator / s->framerate_denominator, SDL_GetPixelFormatName(s->format)); } + SDL_free(specs); } } @@ -101,7 +102,7 @@ int SDL_AppInit(void **appstate, int argc, char *argv[]) return SDL_APP_FAILURE; } - const SDL_CameraID *devices = SDL_GetCameras(&devcount); + SDL_CameraID *devices = SDL_GetCameras(&devcount); if (!devices) { SDL_Log("SDL_GetCameras failed: %s", SDL_GetError()); return SDL_APP_FAILURE; @@ -139,6 +140,7 @@ int SDL_AppInit(void **appstate, int argc, char *argv[]) camera_id = devices[0]; } } + SDL_free(devices); if (!camera_id) { SDL_Log("No cameras available?"); diff --git a/test/testcontroller.c b/test/testcontroller.c index 5be697c140c30..dd1311f4c87e7 100644 --- a/test/testcontroller.c +++ b/test/testcontroller.c @@ -351,7 +351,6 @@ static void RefreshControllerName(void) } } - SDL_free(controller_name); if (name) { controller_name = SDL_strdup(name); } else { @@ -680,7 +679,7 @@ static void CopyMapping(void) static void PasteMapping(void) { if (controller) { - const char *mapping = SDL_GetClipboardText(); + char *mapping = SDL_GetClipboardText(); if (MappingHasBindings(mapping)) { StopBinding(); SDL_SetGamepadMapping(controller->id, mapping); @@ -688,6 +687,7 @@ static void PasteMapping(void) } else { /* Not a valid mapping, ignore it */ } + SDL_free(mapping); } } @@ -742,7 +742,7 @@ static void CopyControllerName(void) static void PasteControllerName(void) { SDL_free(controller_name); - controller_name = SDL_strdup(SDL_GetClipboardText()); + controller_name = SDL_GetClipboardText(); CommitControllerName(); } @@ -918,9 +918,9 @@ static void AddController(SDL_JoystickID id, SDL_bool verbose) if (verbose && !SDL_IsGamepad(id)) { const char *name = SDL_GetJoystickName(joystick); const char *path = SDL_GetJoystickPath(joystick); - const char *guid; + char guid[33]; SDL_Log("Opened joystick %s%s%s\n", name, path ? ", " : "", path ? path : ""); - guid = SDL_GUIDToString(SDL_GetJoystickGUID(joystick)); + SDL_GUIDToString(SDL_GetJoystickGUID(joystick), guid, sizeof(guid)); SDL_Log("No gamepad mapping for %s\n", guid); } } else { @@ -973,7 +973,6 @@ static void DelController(SDL_JoystickID id) static void HandleGamepadRemapped(SDL_JoystickID id) { - const char *sdlmapping; char *mapping; int i = FindController(id); @@ -988,8 +987,7 @@ static void HandleGamepadRemapped(SDL_JoystickID id) } /* Get the current mapping */ - sdlmapping = SDL_GetGamepadMapping(controllers[i].gamepad); - mapping = sdlmapping ? SDL_strdup(sdlmapping) : NULL; + mapping = SDL_GetGamepadMapping(controllers[i].gamepad); /* Make sure the mapping has a valid name */ if (mapping && !MappingHasName(mapping)) { @@ -1065,9 +1063,10 @@ static void HandleGamepadAdded(SDL_JoystickID id, SDL_bool verbose) } if (verbose) { - const char *mapping = SDL_GetGamepadMapping(gamepad); + char *mapping = SDL_GetGamepadMapping(gamepad); if (mapping) { SDL_Log("Mapping: %s\n", mapping); + SDL_free(mapping); } } } else { @@ -1187,7 +1186,7 @@ static void OpenVirtualGamepad(void) static void CloseVirtualGamepad(void) { int i; - const SDL_JoystickID *joysticks = SDL_GetJoysticks(NULL); + SDL_JoystickID *joysticks = SDL_GetJoysticks(NULL); if (joysticks) { for (i = 0; joysticks[i]; ++i) { SDL_JoystickID instance_id = joysticks[i]; @@ -1195,6 +1194,7 @@ static void CloseVirtualGamepad(void) SDL_DetachVirtualJoystick(instance_id); } } + SDL_free(joysticks); } if (virtual_joystick) { @@ -2053,13 +2053,14 @@ int main(int argc, char *argv[]) if (show_mappings) { int count = 0; - const char * const *mappings = SDL_GetGamepadMappings(&count); + char **mappings = SDL_GetGamepadMappings(&count); int map_i; SDL_Log("Supported mappings:\n"); for (map_i = 0; map_i < count; ++map_i) { SDL_Log("\t%s\n", mappings[map_i]); } SDL_Log("\n"); + SDL_free(mappings); } /* Create a window to display gamepad state */ diff --git a/test/testdialog.c b/test/testdialog.c index 29b3472dd96b8..c298d7fe830dd 100644 --- a/test/testdialog.c +++ b/test/testdialog.c @@ -44,7 +44,8 @@ static void SDLCALL callback(void* userdata, const char* const* files, int filte } } -int main(int argc, char *argv[]) { +int main(int argc, char *argv[]) +{ SDL_Window *w; SDL_Renderer *r; SDLTest_CommonState *state; diff --git a/test/testdisplayinfo.c b/test/testdisplayinfo.c index 86b9173f9d775..afb9e8ac383cd 100644 --- a/test/testdisplayinfo.c +++ b/test/testdisplayinfo.c @@ -33,8 +33,8 @@ print_mode(const char *prefix, const SDL_DisplayMode *mode) int main(int argc, char *argv[]) { - const SDL_DisplayID *displays; - const SDL_DisplayMode * const *modes; + SDL_DisplayID *displays; + SDL_DisplayMode **modes; const SDL_DisplayMode *mode; int num_displays, i; SDLTest_CommonState *state; @@ -94,9 +94,11 @@ int main(int argc, char *argv[]) (void)SDL_snprintf(prefix, sizeof(prefix), " MODE %d", m); print_mode(prefix, modes[m]); } + SDL_free(modes); SDL_Log("\n"); } + SDL_free(displays); SDL_Quit(); SDLTest_CommonDestroyState(state); diff --git a/test/testfilesystem.c b/test/testfilesystem.c index 9d840efd319b7..e24d9d89e0418 100644 --- a/test/testfilesystem.c +++ b/test/testfilesystem.c @@ -61,7 +61,7 @@ static int SDLCALL enum_callback(void *userdata, const char *origdir, const char int main(int argc, char *argv[]) { SDLTest_CommonState *state; - const char *pref_path; + char *pref_path; const char *base_path; /* Initialize test framework */ @@ -98,6 +98,7 @@ int main(int argc, char *argv[]) } else { SDL_Log("pref path: '%s'\n", pref_path); } + SDL_free(pref_path); pref_path = SDL_GetPrefPath(NULL, "test_filesystem"); if (!pref_path) { @@ -106,9 +107,10 @@ int main(int argc, char *argv[]) } else { SDL_Log("pref path: '%s'\n", pref_path); } + SDL_free(pref_path); if (base_path) { - const char * const *globlist; + char **globlist; SDL_IOStream *stream; const char *text = "foo\n"; @@ -124,6 +126,7 @@ int main(int argc, char *argv[]) for (i = 0; globlist[i]; i++) { SDL_Log("GLOB[%d]: '%s'", i, globlist[i]); } + SDL_free(globlist); } /* !!! FIXME: put this in a subroutine and make it test more thoroughly (and put it in testautomation). */ diff --git a/test/testhaptic.c b/test/testhaptic.c index 77cb98a16f6c3..0406a871a8083 100644 --- a/test/testhaptic.c +++ b/test/testhaptic.c @@ -40,7 +40,7 @@ int main(int argc, char **argv) int id[9]; int nefx; unsigned int supported; - const SDL_HapticID *haptics; + SDL_HapticID *haptics; int num_haptics; /* Initialize test framework */ @@ -88,44 +88,47 @@ int main(int argc, char **argv) for (i = 0; i < num_haptics; ++i) { SDL_Log(" %s\n", SDL_GetHapticNameForID(haptics[i])); } - if (haptics) { - if (num_haptics == 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Haptic devices found!\n"); - return 1; - } + if (num_haptics == 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Haptic devices found!\n"); + SDL_free(haptics); + return 1; + } - /* We'll just use index or the first force feedback device found */ - if (!name) { - i = (index != -1) ? index : 0; + /* We'll just use index or the first force feedback device found */ + if (!name) { + i = (index != -1) ? index : 0; - if (i >= num_haptics) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Index out of range, aborting.\n"); - return 1; - } + if (i >= num_haptics) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Index out of range, aborting.\n"); + SDL_free(haptics); + return 1; } - /* Try to find matching device */ - else { - for (i = 0; i < num_haptics; i++) { - if (SDL_strstr(SDL_GetHapticNameForID(haptics[i]), name) != NULL) { - break; - } - } - - if (i >= num_haptics) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find device matching '%s', aborting.\n", name); - return 1; + } + /* Try to find matching device */ + else { + for (i = 0; i < num_haptics; i++) { + if (SDL_strstr(SDL_GetHapticNameForID(haptics[i]), name) != NULL) { + break; } } - haptic = SDL_OpenHaptic(haptics[i]); - if (!haptic) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n", SDL_GetError()); + if (i >= num_haptics) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find device matching '%s', aborting.\n", name); + SDL_free(haptics); return 1; } - SDL_Log("Device: %s\n", SDL_GetHapticName(haptic)); - HapticPrintSupported(haptic); } + haptic = SDL_OpenHaptic(haptics[i]); + if (!haptic) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n", SDL_GetError()); + SDL_free(haptics); + return 1; + } + SDL_Log("Device: %s\n", SDL_GetHapticName(haptic)); + HapticPrintSupported(haptic); + SDL_free(haptics); + /* We only want force feedback errors. */ SDL_ClearError(); diff --git a/test/testhotplug.c b/test/testhotplug.c index 328ef76c11602..ec635c1bf4fe3 100644 --- a/test/testhotplug.c +++ b/test/testhotplug.c @@ -80,18 +80,18 @@ int main(int argc, char *argv[]) //SDL_CreateWindow("Dummy", 128, 128, 0); */ - SDL_GetKeyboards(&num_keyboards); + SDL_free(SDL_GetKeyboards(&num_keyboards)); SDL_Log("There are %d keyboards at startup\n", num_keyboards); - SDL_GetMice(&num_mice); + SDL_free(SDL_GetMice(&num_mice)); SDL_Log("There are %d mice at startup\n", num_mice); - SDL_GetJoysticks(&num_joysticks); + SDL_free(SDL_GetJoysticks(&num_joysticks)); SDL_Log("There are %d joysticks at startup\n", num_joysticks); if (enable_haptic) { int num_haptics; - SDL_GetHaptics(&num_haptics); + SDL_free(SDL_GetHaptics(&num_haptics)); SDL_Log("There are %d haptic devices at startup\n", num_haptics); } diff --git a/test/testime.c b/test/testime.c index a49b6ebff1410..b9bf090b031f9 100644 --- a/test/testime.c +++ b/test/testime.c @@ -53,7 +53,7 @@ static int cursor_length = 0; static SDL_bool cursor_visible; static Uint64 last_cursor_change; static SDL_BlendMode highlight_mode; -static const char **candidates; +static char **candidates; static int num_candidates; static int selected_candidate; static SDL_bool horizontal_candidates; @@ -476,6 +476,11 @@ static void InitInput(void) static void ClearCandidates(void) { + int i; + + for (i = 0; i < num_candidates; ++i) { + SDL_free(candidates[i]); + } SDL_free(candidates); candidates = NULL; num_candidates = 0; @@ -483,12 +488,20 @@ static void ClearCandidates(void) static void SaveCandidates(SDL_Event *event) { + int i; + ClearCandidates(); num_candidates = event->edit_candidates.num_candidates; if (num_candidates > 0) { - candidates = (const char **)SDL_ClaimTemporaryMemory(event->edit_candidates.candidates); - SDL_assert(candidates); + candidates = (char **)SDL_malloc(num_candidates * sizeof(*candidates)); + if (!candidates) { + num_candidates = 0; + return; + } + for (i = 0; i < num_candidates; ++i) { + candidates[i] = SDL_strdup(event->edit_candidates.candidates[i]); + } selected_candidate = event->edit_candidates.selected_candidate; horizontal_candidates = event->edit_candidates.horizontal; } diff --git a/test/testlocale.c b/test/testlocale.c index 5a9a53d344509..d0196d2e561ba 100644 --- a/test/testlocale.c +++ b/test/testlocale.c @@ -15,7 +15,7 @@ static void log_locales(void) { - const SDL_Locale * const *locales = SDL_GetPreferredLocales(NULL); + SDL_Locale **locales = SDL_GetPreferredLocales(NULL); if (!locales) { SDL_Log("Couldn't determine locales: %s", SDL_GetError()); } else { @@ -29,6 +29,7 @@ static void log_locales(void) total++; } SDL_Log("%u locales seen.", total); + SDL_free(locales); } } diff --git a/test/testmultiaudio.c b/test/testmultiaudio.c index 8c91ca1cd58c6..98bab13e38069 100644 --- a/test/testmultiaudio.c +++ b/test/testmultiaudio.c @@ -135,7 +135,7 @@ test_multi_audio(const SDL_AudioDeviceID *devices, int devcount) int main(int argc, char **argv) { - const SDL_AudioDeviceID *devices = NULL; + SDL_AudioDeviceID *devices; int devcount = 0; int i; char *filename = NULL; @@ -192,6 +192,7 @@ int main(int argc, char **argv) test_multi_audio(devices, devcount); SDL_free(sound); } + SDL_free(devices); } SDL_free(filename); diff --git a/test/testpen.c b/test/testpen.c index b5318b7cf1cc5..288ec54862a5a 100644 --- a/test/testpen.c +++ b/test/testpen.c @@ -222,7 +222,7 @@ static void dump_state(void) for (i = 0; i < pens_nr; ++i) { SDL_PenID penid = pens[i]; SDL_GUID guid = SDL_GetPenGUID(penid); - const char *guid_str; + char guid_str[33]; float axes[SDL_PEN_NUM_AXES]; float x, y; int k; @@ -232,7 +232,7 @@ static void dump_state(void) char *type; char *buttons_str; - guid_str = SDL_GUIDToString(guid); + SDL_GUIDToString(guid, guid_str, sizeof(guid_str)); switch (SDL_GetPenType(penid)) { case SDL_PEN_TYPE_ERASER: diff --git a/test/testrumble.c b/test/testrumble.c index a16fc3bfc3ac8..d57463fba3582 100644 --- a/test/testrumble.c +++ b/test/testrumble.c @@ -39,7 +39,7 @@ int main(int argc, char **argv) char *name = NULL; int index; SDLTest_CommonState *state; - const SDL_HapticID *haptics; + SDL_HapticID *haptics; int num_haptics; /* Initialize test framework */ @@ -89,43 +89,46 @@ int main(int argc, char **argv) SDL_INIT_HAPTIC); haptics = SDL_GetHaptics(&num_haptics); SDL_Log("%d Haptic devices detected.\n", num_haptics); - if (haptics) { - if (num_haptics == 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Haptic devices found!\n"); - return 1; - } + if (num_haptics == 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Haptic devices found!\n"); + SDL_free(haptics); + return 1; + } - /* We'll just use index or the first force feedback device found */ - if (!name) { - i = (index != -1) ? index : 0; + /* We'll just use index or the first force feedback device found */ + if (!name) { + i = (index != -1) ? index : 0; - if (i >= num_haptics) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Index out of range, aborting.\n"); - return 1; - } + if (i >= num_haptics) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Index out of range, aborting.\n"); + SDL_free(haptics); + return 1; } - /* Try to find matching device */ - else { - for (i = 0; i < num_haptics; i++) { - if (SDL_strstr(SDL_GetHapticNameForID(haptics[i]), name) != NULL) { - break; - } - } - - if (i >= num_haptics) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find device matching '%s', aborting.\n", name); - return 1; + } + /* Try to find matching device */ + else { + for (i = 0; i < num_haptics; i++) { + if (SDL_strstr(SDL_GetHapticNameForID(haptics[i]), name) != NULL) { + break; } } - haptic = SDL_OpenHaptic(haptics[i]); - if (!haptic) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n", SDL_GetError()); + if (i >= num_haptics) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find device matching '%s', aborting.\n", name); + SDL_free(haptics); return 1; } - SDL_Log("Device: %s\n", SDL_GetHapticName(haptic)); } + haptic = SDL_OpenHaptic(haptics[i]); + if (!haptic) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n", SDL_GetError()); + SDL_free(haptics); + return 1; + } + SDL_Log("Device: %s\n", SDL_GetHapticName(haptic)); + SDL_free(haptics); + /* We only want force feedback errors. */ SDL_ClearError(); diff --git a/test/testsensor.c b/test/testsensor.c index 38bced06ea8db..404c9723bf3c4 100644 --- a/test/testsensor.c +++ b/test/testsensor.c @@ -58,7 +58,7 @@ static void HandleSensorEvent(SDL_SensorEvent *event) int main(int argc, char **argv) { - const SDL_SensorID *sensors; + SDL_SensorID *sensors; int i, num_sensors, num_opened; SDLTest_CommonState *state; @@ -104,6 +104,7 @@ int main(int argc, char **argv) } } } + SDL_free(sensors); } SDL_Log("Opened %d sensors\n", num_opened); diff --git a/test/testsurround.c b/test/testsurround.c index 7601bffa93bc5..7796001e48f98 100644 --- a/test/testsurround.c +++ b/test/testsurround.c @@ -146,7 +146,7 @@ static void SDLCALL fill_buffer(void *userdata, SDL_AudioStream *stream, int len int main(int argc, char *argv[]) { - const SDL_AudioDeviceID *devices = NULL; + SDL_AudioDeviceID *devices; SDLTest_CommonState *state; int devcount = 0; int i; @@ -181,7 +181,6 @@ int main(int argc, char *argv[]) devices = SDL_GetAudioPlaybackDevices(&devcount); if (!devices) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GetAudioPlaybackDevices() failed: %s\n", SDL_GetError()); - devcount = 0; } SDL_Log("Available audio devices:"); @@ -233,6 +232,7 @@ int main(int argc, char *argv[]) SDL_DestroyAudioStream(stream); } + SDL_free(devices); SDL_Quit(); return 0; diff --git a/test/testwm.c b/test/testwm.c index 517e308bd1f29..dfd642a48ea94 100644 --- a/test/testwm.c +++ b/test/testwm.c @@ -53,7 +53,7 @@ static const SDL_DisplayMode *highlighted_mode = NULL; static void draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_FRect viewport) { - const SDL_DisplayMode * const *modes; + SDL_DisplayMode **modes; char text[1024]; const int lineHeight = 10; int i, j; @@ -62,7 +62,7 @@ draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_FRect viewport) float x, y; float table_top; SDL_FPoint mouse_pos = { -1.0f, -1.0f }; - const SDL_DisplayID *displays; + SDL_DisplayID *displays; /* Get mouse position */ if (SDL_GetMouseFocus() == window) { @@ -99,7 +99,6 @@ draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_FRect viewport) } displays = SDL_GetDisplays(NULL); - if (displays) { for (i = 0; displays[i]; ++i) { SDL_DisplayID display = displays[i]; @@ -143,7 +142,9 @@ draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_FRect viewport) column_chars = 0; } } + SDL_free(modes); } + SDL_free(displays); } } From 0f2fc2fbaa080a00cc3447dc611209a3a9802de1 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sat, 27 Jul 2024 03:59:43 +0000 Subject: [PATCH 006/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_audio.h | 15 ++++++++++----- include/SDL3/SDL_camera.h | 7 +++++-- include/SDL3/SDL_clipboard.h | 9 ++++++--- include/SDL3/SDL_filesystem.h | 6 ++++-- include/SDL3/SDL_gamepad.h | 20 ++++++++++++++------ include/SDL3/SDL_haptic.h | 3 ++- include/SDL3/SDL_joystick.h | 3 ++- include/SDL3/SDL_keyboard.h | 3 ++- include/SDL3/SDL_locale.h | 4 +++- include/SDL3/SDL_mouse.h | 3 ++- include/SDL3/SDL_sensor.h | 3 ++- include/SDL3/SDL_storage.h | 4 +++- include/SDL3/SDL_touch.h | 7 +++++-- include/SDL3/SDL_video.h | 18 ++++++++++++------ 14 files changed, 72 insertions(+), 33 deletions(-) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index da1013f3162f7..efd46c0e2e19a 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -447,7 +447,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentAudioDriver(void); * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of device instance IDs or NULL on error; call - * SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * SDL_GetError() for more information. This should be freed with + * SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -475,7 +476,8 @@ extern SDL_DECLSPEC_FREE SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of device instance IDs, or NULL on failure; - * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -550,7 +552,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid * \param devid the instance ID of the device to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as - * the current output spec's channels, or NULL if default. This should be freed with SDL_free() when it is no longer needed. + * the current output spec's channels, or NULL if default. This + * should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -1098,7 +1101,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, * \param stream the SDL_AudioStream to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as - * the current output spec's channels, or NULL if default. This should be freed with SDL_free() when it is no longer needed. + * the current output spec's channels, or NULL if default. This + * should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. @@ -1121,7 +1125,8 @@ extern SDL_DECLSPEC_FREE int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_Aud * \param stream the SDL_AudioStream to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as - * the current output spec's channels, or NULL if default. This should be freed with SDL_free() when it is no longer needed. + * the current output spec's channels, or NULL if default. This + * should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. diff --git a/include/SDL3/SDL_camera.h b/include/SDL3/SDL_camera.h index d8aad2d02dd45..77cfc3551ac83 100644 --- a/include/SDL3/SDL_camera.h +++ b/include/SDL3/SDL_camera.h @@ -169,7 +169,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void); * \param count a pointer filled in with the number of cameras returned, may * be NULL. * \returns a 0 terminated array of camera instance IDs or NULL on failure; - * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -205,7 +206,9 @@ extern SDL_DECLSPEC_FREE SDL_CameraID * SDLCALL SDL_GetCameras(int *count); * \param count a pointer filled in with the number of elements in the list, * may be NULL. * \returns a NULL terminated array of pointers to SDL_CameraSpec or NULL on - * failure; call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. + * failure; call SDL_GetError() for more information. This is a + * single allocation that should be freed with SDL_free() when it is + * no longer needed. * * \threadsafety It is safe to call this function from any thread. * diff --git a/include/SDL3/SDL_clipboard.h b/include/SDL3/SDL_clipboard.h index 9323346d7e547..1c1bd6bd9668e 100644 --- a/include/SDL3/SDL_clipboard.h +++ b/include/SDL3/SDL_clipboard.h @@ -63,7 +63,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); * a copy of the clipboard's content. * * \returns the clipboard text on success or an empty string on failure; call - * SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * SDL_GetError() for more information. This should be freed with + * SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * @@ -105,7 +106,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text); * a copy of the primary selection's content. * * \returns the primary selection text on success or an empty string on - * failure; call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * failure; call SDL_GetError() for more information. This should be + * freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * @@ -215,7 +217,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearClipboardData(void); * \param mime_type the mime type to read from the clipboard. * \param size a pointer filled in with the length of the returned data. * \returns the retrieved data buffer or NULL on failure; call SDL_GetError() - * for more information. This should be freed with SDL_free() when it is no longer needed. + * for more information. This should be freed with SDL_free() when it + * is no longer needed. * * \since This function is available since SDL 3.0.0. * diff --git a/include/SDL3/SDL_filesystem.h b/include/SDL3/SDL_filesystem.h index 641300cca4efe..34b450472eafe 100644 --- a/include/SDL3/SDL_filesystem.h +++ b/include/SDL3/SDL_filesystem.h @@ -125,7 +125,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetBasePath(void); * \param app the name of your application. * \returns a UTF-8 string of the user directory in platform-dependent * notation. NULL if there's a problem (creating directory failed, - * etc.). This should be freed with SDL_free() when it is no longer needed. + * etc.). This should be freed with SDL_free() when it is no longer + * needed. * * \since This function is available since SDL 3.0.0. * @@ -367,7 +368,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo * * \param count on return, will be set to the number of items in the returned * array. Can be NULL. * \returns an array of strings on success or NULL on failure; call - * SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. + * SDL_GetError() for more information. This is a single allocation + * that should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * diff --git a/include/SDL3/SDL_gamepad.h b/include/SDL3/SDL_gamepad.h index 0358c76b52a7d..1291ae77e506a 100644 --- a/include/SDL3/SDL_gamepad.h +++ b/include/SDL3/SDL_gamepad.h @@ -392,7 +392,9 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReloadGamepadMappings(void); * \param count a pointer filled in with the number of mappings returned, can * be NULL. * \returns an array of the mapping strings, NULL-terminated, or NULL on - * failure; call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. + * failure; call SDL_GetError() for more information. This is a + * single allocation that should be freed with SDL_free() when it is + * no longer needed. * * \since This function is available since SDL 3.0.0. */ @@ -403,7 +405,8 @@ extern SDL_DECLSPEC_FREE char ** SDLCALL SDL_GetGamepadMappings(int *count); * * \param guid a structure containing the GUID for which a mapping is desired. * \returns a mapping string or NULL on failure; call SDL_GetError() for more - * information. This should be freed with SDL_free() when it is no longer needed. + * information. This should be freed with SDL_free() when it is no + * longer needed. * * \since This function is available since SDL 3.0.0. * @@ -419,7 +422,8 @@ extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID gu * * \param gamepad the gamepad you want to get the current mapping for. * \returns a string that has the gamepad's mapping or NULL if no mapping is - * available; call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * available; call SDL_GetError() for more information. This should + * be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * @@ -465,7 +469,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasGamepad(void); * \param count a pointer filled in with the number of gamepads returned, may * be NULL. * \returns a 0 terminated array of joystick instance IDs or NULL on failure; - * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * @@ -640,7 +645,8 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetRealGamepadTypeForID(SDL_Joys * This can be called before any gamepads are opened. * * \param instance_id the joystick instance ID. - * \returns the mapping string. Returns NULL if no mapping is available. This should be freed with SDL_free() when it is no longer needed. + * \returns the mapping string. Returns NULL if no mapping is available. This + * should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * @@ -995,7 +1001,9 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadEventsEnabled(void); * \param gamepad a gamepad. * \param count a pointer filled in with the number of bindings returned. * \returns a NULL terminated array of pointers to bindings or NULL on - * failure; call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. + * failure; call SDL_GetError() for more information. This is a + * single allocation that should be freed with SDL_free() when it is + * no longer needed. * * \since This function is available since SDL 3.0.0. */ diff --git a/include/SDL3/SDL_haptic.h b/include/SDL3/SDL_haptic.h index f34ba15b20310..d288a86a357f7 100644 --- a/include/SDL3/SDL_haptic.h +++ b/include/SDL3/SDL_haptic.h @@ -935,7 +935,8 @@ typedef Uint32 SDL_HapticID; * \param count a pointer filled in with the number of haptic devices * returned, may be NULL. * \returns a 0 terminated array of haptic device instance IDs or NULL on - * failure; call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * failure; call SDL_GetError() for more information. This should be + * freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * diff --git a/include/SDL3/SDL_joystick.h b/include/SDL3/SDL_joystick.h index 20d610d85e7e6..97130027725f6 100644 --- a/include/SDL3/SDL_joystick.h +++ b/include/SDL3/SDL_joystick.h @@ -204,7 +204,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasJoystick(void); * \param count a pointer filled in with the number of joysticks returned, may * be NULL. * \returns a 0 terminated array of joystick instance IDs or NULL on failure; - * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index 3f48fc0ec4e35..4c2569ecbbd88 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -76,7 +76,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasKeyboard(void); * \param count a pointer filled in with the number of keyboards returned, may * be NULL. * \returns a 0 terminated array of keyboards instance IDs or NULL on failure; - * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * diff --git a/include/SDL3/SDL_locale.h b/include/SDL3/SDL_locale.h index 66479ceffeca3..121108bc7c9d5 100644 --- a/include/SDL3/SDL_locale.h +++ b/include/SDL3/SDL_locale.h @@ -92,7 +92,9 @@ typedef struct SDL_Locale * \param count a pointer filled in with the number of locales returned, may * be NULL. * \returns a NULL terminated array of locale pointers, or NULL on failure; - * call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. + * call SDL_GetError() for more information. This is a single + * allocation that should be freed with SDL_free() when it is no + * longer needed. * * \since This function is available since SDL 3.0.0. */ diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index 82ca7be668f54..074cd9c1a1a35 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -138,7 +138,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasMouse(void); * \param count a pointer filled in with the number of mice returned, may be * NULL. * \returns a 0 terminated array of mouse instance IDs or NULL on failure; - * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * diff --git a/include/SDL3/SDL_sensor.h b/include/SDL3/SDL_sensor.h index fdfcb2175d518..2d4aa468d946a 100644 --- a/include/SDL3/SDL_sensor.h +++ b/include/SDL3/SDL_sensor.h @@ -149,7 +149,8 @@ typedef enum SDL_SensorType * \param count a pointer filled in with the number of sensors returned, may * be NULL. * \returns a 0 terminated array of sensor instance IDs or NULL on failure; - * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ diff --git a/include/SDL3/SDL_storage.h b/include/SDL3/SDL_storage.h index fc669a2a38ff9..84a90f0e76a63 100644 --- a/include/SDL3/SDL_storage.h +++ b/include/SDL3/SDL_storage.h @@ -410,7 +410,9 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetStorageSpaceRemaining(SDL_Storage *sto * array. Can be NULL. * \returns an array of strings on success or NULL on failure; call * SDL_GetError() for more information. The caller should pass the - * returned pointer to SDL_free when done with it. This is a single allocation that should be freed with SDL_free() when it is no longer needed. + * returned pointer to SDL_free when done with it. This is a single + * allocation that should be freed with SDL_free() when it is no + * longer needed. * * \threadsafety It is safe to call this function from any thread, assuming * the `storage` object is thread-safe. diff --git a/include/SDL3/SDL_touch.h b/include/SDL3/SDL_touch.h index 5c91152b2621b..d040680b56cd9 100644 --- a/include/SDL3/SDL_touch.h +++ b/include/SDL3/SDL_touch.h @@ -86,7 +86,8 @@ typedef struct SDL_Finger * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of touch device IDs or NULL on failure; call - * SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * SDL_GetError() for more information. This should be freed with + * SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ @@ -120,7 +121,9 @@ extern SDL_DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_Touch * \param count a pointer filled in with the number of fingers returned, can * be NULL. * \returns a NULL terminated array of SDL_Finger pointers or NULL on failure; - * call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. + * call SDL_GetError() for more information. This is a single + * allocation that should be freed with SDL_free() when it is no + * longer needed. * * \since This function is available since SDL 3.0.0. */ diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index 18ce210629a12..f0b0d7755ef49 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -390,7 +390,8 @@ extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void); * \param count a pointer filled in with the number of displays returned, may * be NULL. * \returns a 0 terminated array of display instance IDs or NULL on failure; - * call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ @@ -551,7 +552,9 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetDisplayContentScale(SDL_DisplayID displ * \param count a pointer filled in with the number of display modes returned, * may be NULL. * \returns a NULL terminated array of display mode pointers or NULL on - * failure; call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. + * failure; call SDL_GetError() for more information. This is a + * single allocation that should be freed with SDL_free() when it is + * no longer needed. * * \since This function is available since SDL 3.0.0. * @@ -576,8 +579,8 @@ extern SDL_DECLSPEC_FREE SDL_DisplayMode ** SDLCALL SDL_GetFullscreenDisplayMode * for the desktop refresh rate. * \param include_high_density_modes boolean to include high density modes in * the search. - * \param mode a pointer filled in with the closest display mode equal to or larger than the - * desired mode. + * \param mode a pointer filled in with the closest display mode equal to or + * larger than the desired mode. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * @@ -762,7 +765,8 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode( * \param window the window to query. * \param size the size of the ICC profile. * \returns the raw ICC profile data on success or NULL on failure; call - * SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed. + * SDL_GetError() for more information. This should be freed with + * SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ @@ -786,7 +790,9 @@ extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetWindowPixelFormat(SDL_Window * \param count a pointer filled in with the number of windows returned, may * be NULL. * \returns a NULL terminated array of SDL_Window pointers or NULL on failure; - * call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed. + * call SDL_GetError() for more information. This is a single + * allocation that should be freed with SDL_free() when it is no + * longer needed. * * \since This function is available since SDL 3.0.0. */ From 538adc52d2503e7171165492565c81a04b858e2c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 26 Jul 2024 21:10:47 -0700 Subject: [PATCH 007/253] Removed the temporary memory symbols from the public API --- src/dynapi/SDL_dynapi.sym | 3 --- src/dynapi/SDL_dynapi_overrides.h | 3 --- src/dynapi/SDL_dynapi_procs.h | 3 --- 3 files changed, 9 deletions(-) diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 0c87fae5b52b4..0d518a41279e3 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -11,7 +11,6 @@ SDL3_0.0.0 { SDL_AddTimer; SDL_AddTimerNS; SDL_AddVulkanRenderSemaphores; - SDL_AllocateTemporaryMemory; SDL_AtomicAdd; SDL_AtomicCompareAndSwap; SDL_AtomicCompareAndSwapPointer; @@ -32,7 +31,6 @@ SDL3_0.0.0 { SDL_BlitSurfaceUncheckedScaled; SDL_BroadcastCondition; SDL_CaptureMouse; - SDL_ClaimTemporaryMemory; SDL_CleanupTLS; SDL_ClearAudioStream; SDL_ClearClipboardData; @@ -130,7 +128,6 @@ SDL3_0.0.0 { SDL_FlushEvent; SDL_FlushEvents; SDL_FlushRenderer; - SDL_FreeTemporaryMemory; SDL_GDKSuspendComplete; SDL_GL_CreateContext; SDL_GL_DestroyContext; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index b4aa6633dcaa2..5b87ee5ca62d0 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -36,7 +36,6 @@ #define SDL_AddTimer SDL_AddTimer_REAL #define SDL_AddTimerNS SDL_AddTimerNS_REAL #define SDL_AddVulkanRenderSemaphores SDL_AddVulkanRenderSemaphores_REAL -#define SDL_AllocateTemporaryMemory SDL_AllocateTemporaryMemory_REAL #define SDL_AtomicAdd SDL_AtomicAdd_REAL #define SDL_AtomicCompareAndSwap SDL_AtomicCompareAndSwap_REAL #define SDL_AtomicCompareAndSwapPointer SDL_AtomicCompareAndSwapPointer_REAL @@ -57,7 +56,6 @@ #define SDL_BlitSurfaceUncheckedScaled SDL_BlitSurfaceUncheckedScaled_REAL #define SDL_BroadcastCondition SDL_BroadcastCondition_REAL #define SDL_CaptureMouse SDL_CaptureMouse_REAL -#define SDL_ClaimTemporaryMemory SDL_ClaimTemporaryMemory_REAL #define SDL_CleanupTLS SDL_CleanupTLS_REAL #define SDL_ClearAudioStream SDL_ClearAudioStream_REAL #define SDL_ClearClipboardData SDL_ClearClipboardData_REAL @@ -155,7 +153,6 @@ #define SDL_FlushEvent SDL_FlushEvent_REAL #define SDL_FlushEvents SDL_FlushEvents_REAL #define SDL_FlushRenderer SDL_FlushRenderer_REAL -#define SDL_FreeTemporaryMemory SDL_FreeTemporaryMemory_REAL #define SDL_GDKSuspendComplete SDL_GDKSuspendComplete_REAL #define SDL_GL_CreateContext SDL_GL_CreateContext_REAL #define SDL_GL_DestroyContext SDL_GL_DestroyContext_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index b2fdd503f5501..341c70c38f18b 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -56,7 +56,6 @@ SDL_DYNAPI_PROC(int,SDL_AddHintCallback,(const char *a, SDL_HintCallback b, void SDL_DYNAPI_PROC(SDL_TimerID,SDL_AddTimer,(Uint32 a, SDL_TimerCallback b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_TimerID,SDL_AddTimerNS,(Uint64 a, SDL_NSTimerCallback b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_AddVulkanRenderSemaphores,(SDL_Renderer *a, Uint32 b, Sint64 c, Sint64 d),(a,b,c,d),return) -SDL_DYNAPI_PROC(void*,SDL_AllocateTemporaryMemory,(size_t a),(a),return) SDL_DYNAPI_PROC(int,SDL_AtomicAdd,(SDL_AtomicInt *a, int b),(a,b),return) SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCompareAndSwap,(SDL_AtomicInt *a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCompareAndSwapPointer,(void **a, void *b, void *c),(a,b,c),return) @@ -77,7 +76,6 @@ SDL_DYNAPI_PROC(int,SDL_BlitSurfaceUnchecked,(SDL_Surface *a, const SDL_Rect *b, SDL_DYNAPI_PROC(int,SDL_BlitSurfaceUncheckedScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d, SDL_ScaleMode e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_BroadcastCondition,(SDL_Condition *a),(a),return) SDL_DYNAPI_PROC(int,SDL_CaptureMouse,(SDL_bool a),(a),return) -SDL_DYNAPI_PROC(void*,SDL_ClaimTemporaryMemory,(const void *a),(a),return) SDL_DYNAPI_PROC(void,SDL_CleanupTLS,(void),(),) SDL_DYNAPI_PROC(int,SDL_ClearAudioStream,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(int,SDL_ClearClipboardData,(void),(),return) @@ -175,7 +173,6 @@ SDL_DYNAPI_PROC(int,SDL_FlushAudioStream,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(void,SDL_FlushEvent,(Uint32 a),(a),) SDL_DYNAPI_PROC(void,SDL_FlushEvents,(Uint32 a, Uint32 b),(a,b),) SDL_DYNAPI_PROC(int,SDL_FlushRenderer,(SDL_Renderer *a),(a),return) -SDL_DYNAPI_PROC(void,SDL_FreeTemporaryMemory,(void),(),) SDL_DYNAPI_PROC(void,SDL_GDKSuspendComplete,(void),(),) SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_CreateContext,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GL_DestroyContext,(SDL_GLContext a),(a),return) From 37881b3150e6a26419f7b2b84c24d6d33a0f52c6 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 26 Jul 2024 18:16:58 +0200 Subject: [PATCH 008/253] cmake: use genex to link with Apple Frameworks --- CMakeLists.txt | 47 ++++++++++++++++++++++-------------------- cmake/sdltargets.cmake | 21 ++++++++++++------- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1989bfae73823..89c0e8991687f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2347,77 +2347,80 @@ elseif(APPLE) endif() endif() + # Minimum version for $ + cmake_minimum_required(VERSION 3.24) + # Actually load the frameworks at the end so we don't duplicate include. if(SDL_FRAMEWORK_COREVIDEO) find_library(COREMEDIA CoreMedia) if(COREMEDIA) - sdl_link_dependency(corevideo LINK_OPTIONS "-Wl,-framework,CoreMedia") + sdl_link_dependency(corevideo LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,CoreMedia") endif() - sdl_link_dependency(corevideo LINK_OPTIONS "-Wl,-framework,CoreVideo") + sdl_link_dependency(corevideo LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,CoreVideo") endif() if(SDL_FRAMEWORK_COCOA) - sdl_link_dependency(cocoa LINK_OPTIONS "-Wl,-framework,Cocoa") + sdl_link_dependency(cocoa LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,Cocoa") endif() if(SDL_FRAMEWORK_IOKIT) - sdl_link_dependency(iokit LINK_OPTIONS "-Wl,-framework,IOKit") + sdl_link_dependency(iokit LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,IOKit") endif() if(SDL_FRAMEWORK_FF) - sdl_link_dependency(ff LINK_OPTIONS "-Wl,-framework,ForceFeedback") + sdl_link_dependency(ff LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,ForceFeedback") endif() if(SDL_FRAMEWORK_CARBON) - sdl_link_dependency(carbon LINK_OPTIONS "-Wl,-framework,Carbon") + sdl_link_dependency(carbon LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,Carbon") endif() if(SDL_FRAMEWORK_COREAUDIO) - sdl_link_dependency(core_audio LINK_OPTIONS "-Wl,-framework,CoreAudio") + sdl_link_dependency(core_audio LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,CoreAudio") endif() if(SDL_FRAMEWORK_AUDIOTOOLBOX) - sdl_link_dependency(audio_toolbox LINK_OPTIONS "-Wl,-framework,AudioToolbox") + sdl_link_dependency(audio_toolbox LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,AudioToolbox") endif() if(SDL_FRAMEWORK_AVFOUNDATION) - sdl_link_dependency(av_foundation LINK_OPTIONS "-Wl,-framework,AVFoundation") + sdl_link_dependency(av_foundation LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,AVFoundation") endif() if(SDL_FRAMEWORK_COREBLUETOOTH) - sdl_link_dependency(core_bluetooth LINK_OPTIONS "-Wl,-framework,CoreBluetooth") + sdl_link_dependency(core_bluetooth LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,CoreBluetooth") endif() if(SDL_FRAMEWORK_COREGRAPHICS) - sdl_link_dependency(core_graphics LINK_OPTIONS "-Wl,-framework,CoreGraphics") + sdl_link_dependency(core_graphics LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,CoreGraphics") endif() if(SDL_FRAMEWORK_COREMOTION) - sdl_link_dependency(core_motion LINK_OPTIONS "-Wl,-framework,CoreMotion") + sdl_link_dependency(core_motion LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,CoreMotion") endif() if(SDL_FRAMEWORK_FOUNDATION) - sdl_link_dependency(foundation LINK_OPTIONS "-Wl,-framework,Foundation") + sdl_link_dependency(foundation LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,Foundation") endif() if(SDL_FRAMEWORK_GAMECONTROLLER) find_library(GAMECONTROLLER GameController) if(GAMECONTROLLER) - sdl_link_dependency(game_controller LINK_OPTIONS "-Wl,-weak_framework,GameController") + sdl_link_dependency(game_controller LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,GameController") endif() endif() if(SDL_FRAMEWORK_METAL) if(IOS OR TVOS OR VISIONOS OR WATCHOS) - sdl_link_dependency(metal LINK_OPTIONS "-Wl,-framework,Metal") + sdl_link_dependency(metal LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,Metal") else() - sdl_link_dependency(metal LINK_OPTIONS "-Wl,-weak_framework,Metal") + sdl_link_dependency(metal LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,Metal") endif() endif() if(SDL_FRAMEWORK_OPENGLES) - sdl_link_dependency(opengles LINK_OPTIONS "-Wl,-framework,OpenGLES") + sdl_link_dependency(opengles LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,OpenGLES") endif() if(SDL_FRAMEWORK_QUARTZCORE) if(IOS OR TVOS OR VISIONOS OR WATCHOS) - sdl_link_dependency(quartz_core LINK_OPTIONS "-Wl,-framework,QuartzCore") + sdl_link_dependency(quartz_core LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,QuartzCore") else() - sdl_link_dependency(metal LINK_OPTIONS "-Wl,-weak_framework,QuartzCore") + sdl_link_dependency(metal LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,QuartzCore") endif() endif() if(SDL_FRAMEWORK_UIKIT) - sdl_link_dependency(ui_kit LINK_OPTIONS "-Wl,-framework,UIKit") + sdl_link_dependency(ui_kit LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,UIKit") endif() if(SDL_FRAMEWORK_COREHAPTICS) find_library(COREHAPTICS CoreHaptics) if(COREHAPTICS) - sdl_link_dependency(core_haptics LINK_OPTIONS "-Wl,-framework,CoreHaptics") + sdl_link_dependency(core_haptics LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,CoreHaptics") endif() endif() @@ -2885,7 +2888,7 @@ if (SDL_DIALOG) set(HAVE_SDL_DIALOG TRUE) elseif(MACOS) sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/cocoa/SDL_cocoadialog.m) - sdl_link_dependency(uniformtypeidentifiers LINK_OPTIONS "-Wl,-weak_framework,UniformTypeIdentifiers") + sdl_link_dependency(uniformtypeidentifiers LIBS "$" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,UniformTypeIdentifiers") set(HAVE_SDL_DIALOG TRUE) endif() endif() diff --git a/cmake/sdltargets.cmake b/cmake/sdltargets.cmake index e4a870db5e8ae..d11061c9cb69b 100644 --- a/cmake/sdltargets.cmake +++ b/cmake/sdltargets.cmake @@ -28,7 +28,7 @@ function(sdl_sources) set_property(TARGET SDL3-collector APPEND PROPERTY INTERFACE_SOURCES ${ARGS_SHARED} ${ARGS_STATIC} ${ARGS_UNPARSED_ARGUMENTS}) endfunction() -# Use sdl_generic_link_dependency to describe a private dependency of SDL3. All options are optional. +# Use sdl_generic_link_dependency to describe a private dependency. All options are optional. # Users should use sdl_link_dependency and sdl_test_link_dependency instead # - SHARED_TARGETS: shared targets to add this dependency to # - STATIC_TARGETS: static targets to add this dependency to @@ -36,12 +36,13 @@ endfunction() # - INCLUDES: the include directories of the dependency # - PKG_CONFIG_PREFIX: name of the prefix, when using the functions of FindPkgConfig # - PKG_CONFIG_SPECS: pkg-config spec, used as argument for the functions of FindPkgConfig -# - PKG_CONFIG_LIBS: libs that will only end up in the Libs.private of sdl3.pc +# - PKG_CONFIG_LIBS: libs that will only end up in the Libs.private of the .pc file +# - PKG_CONFIG_LINK_OPTIONS: ldflags that will only end up in the Libs.private of sdl3.pc # - CMAKE_MODULE: CMake module name of the dependency, used as argument of find_package -# - LIBS: list of libraries to link to -# - LINK_OPTIONS: list of link options +# - LIBS: list of libraries to link to (cmake and pkg-config) +# - LINK_OPTIONS: list of link options (also used in pc file, unless PKG_CONFIG_LINK_OPTION is used) function(sdl_generic_link_dependency ID) - cmake_parse_arguments(ARGS "" "COLLECTOR" "SHARED_TARGETS;STATIC_TARGETS;INCLUDES;PKG_CONFIG_LIBS;PKG_CONFIG_PREFIX;PKG_CONFIG_SPECS;CMAKE_MODULE;LIBS;LINK_OPTIONS" ${ARGN}) + cmake_parse_arguments(ARGS "" "COLLECTOR" "SHARED_TARGETS;STATIC_TARGETS;INCLUDES;PKG_CONFIG_LINK_OPTIONS;PKG_CONFIG_LIBS;PKG_CONFIG_PREFIX;PKG_CONFIG_SPECS;CMAKE_MODULE;LIBS;LINK_OPTIONS" ${ARGN}) foreach(target IN LISTS ARGS_SHARED_TARGETS) if(TARGET ${target}) target_include_directories(${target} SYSTEM PRIVATE ${ARGS_INCLUDES}) @@ -63,6 +64,7 @@ function(sdl_generic_link_dependency ID) set_property(TARGET ${ARGS_COLLECTOR} APPEND PROPERTY INTERFACE_SDL_DEP_${ID}_PKG_CONFIG_PREFIX ${ARGS_PKG_CONFIG_PREFIX}) set_property(TARGET ${ARGS_COLLECTOR} APPEND PROPERTY INTERFACE_SDL_DEP_${ID}_PKG_CONFIG_SPECS ${ARGS_PKG_CONFIG_SPECS}) set_property(TARGET ${ARGS_COLLECTOR} APPEND PROPERTY INTERFACE_SDL_DEP_${ID}_PKG_CONFIG_LIBS ${ARGS_PKG_CONFIG_LIBS}) + set_property(TARGET ${ARGS_COLLECTOR} APPEND PROPERTY INTERFACE_SDL_DEP_${ID}_PKG_CONFIG_LINK_OPTIONS ${ARGS_PKG_CONFIG_LINK_OPTIONS}) set_property(TARGET ${ARGS_COLLECTOR} APPEND PROPERTY INTERFACE_SDL_DEP_${ID}_LIBS ${ARGS_LIBS}) set_property(TARGET ${ARGS_COLLECTOR} APPEND PROPERTY INTERFACE_SDL_DEP_${ID}_LINK_OPTIONS ${ARGS_LINK_OPTIONS}) set_property(TARGET ${ARGS_COLLECTOR} APPEND PROPERTY INTERFACE_SDL_DEP_${ID}_CMAKE_MODULE ${ARGS_CMAKE_MODULE}) @@ -294,14 +296,19 @@ function(configure_sdl3_pc) get_property(CMAKE_MODULE TARGET SDL3-collector PROPERTY INTERFACE_SDL_DEP_${ID}_CMAKE_MODULE) get_property(PKG_CONFIG_SPECS TARGET SDL3-collector PROPERTY INTERFACE_SDL_DEP_${ID}_PKG_CONFIG_SPECS) get_property(PKG_CONFIG_LIBS TARGET SDL3-collector PROPERTY INTERFACE_SDL_DEP_${ID}_PKG_CONFIG_LIBS) + get_property(PKG_CONFIG_LDFLAGS TARGET SDL3-collector PROPERTY INTERFACE_SDL_DEP_${ID}_PKG_CONFIG_LINK_OPTIONS) get_property(LIBS TARGET SDL3-collector PROPERTY INTERFACE_SDL_DEP_${ID}_LIBS) get_property(LINK_OPTIONS TARGET SDL3-collector PROPERTY INTERFACE_SDL_DEP_${ID}_LINK_OPTIONS) list(APPEND private_requires ${PKG_CONFIG_SPECS}) list(APPEND private_libs ${PKG_CONFIG_LIBS}) - if(NOT PKG_CONFIG_SPECS AND NOT CMAKE_MODULE) - list(APPEND private_libs ${LIBS}) + if(PKG_CONFIG_SPECS OR PKG_CONFIG_LIBS OR PKG_CONFIG_LDFLAGS) + list(APPEND private_ldflags ${PKG_CONFIG_LDFLAGS}) + else() list(APPEND private_ldflags ${LINK_OPTIONS}) + if(NOT CMAKE_MODULE) + list(APPEND private_libs ${LIBS}) + endif() endif() endforeach() From 8a5d1fc1967beb66d0be4bf5d3e04a845920effc Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 26 Jul 2024 21:00:33 +0200 Subject: [PATCH 009/253] cmake: add swift test --- cmake/test/CMakeLists.txt | 25 +++++++++++++++++++++++++ cmake/test/main.swift | 13 +++++++++++++ cmake/test/swift/module.modulemap | 4 ++++ cmake/test/swift/shim.h | 3 +++ 4 files changed, 45 insertions(+) create mode 100644 cmake/test/main.swift create mode 100644 cmake/test/swift/module.modulemap create mode 100644 cmake/test/swift/shim.h diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index 066a1ee4a3e4e..11754a828ef4e 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -3,6 +3,19 @@ cmake_minimum_required(VERSION 3.12) project(sdl_test LANGUAGES C) +include(CheckLanguage) + +if(APPLE) + # multiple values for CMAKE_OSX_ARCHITECTURES not supported with Swift + list(LENGTH CMAKE_OSX_ARCHITECTURES count_osx_archs) + if(count_osx_archs LESS_EQUAL 1) + check_language(Swift) + if(CMAKE_Swift_COMPILER) + enable_language(Swift) + endif() + endif() +endif() + message(STATUS "CMAKE_SYSTEM_NAME= ${CMAKE_SYSTEM_NAME}") message(STATUS "CMAKE_SYSTEM_PROCESSOR= ${CMAKE_SYSTEM_PROCESSOR}") @@ -74,6 +87,12 @@ if(TEST_SHARED) add_executable(sdltest-shared sdltest.c) target_link_libraries(sdltest-shared PRIVATE SDL3::SDL3_test SDL3::SDL3-shared) endif() + + if(CMAKE_Swift_COMPILER) + add_executable(swift-shared main.swift) + target_include_directories(swift-shared PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/swift") + target_link_libraries(swift-shared PRIVATE SDL3::SDL3-shared) + endif() endif() if(TEST_STATIC) @@ -92,6 +111,12 @@ if(TEST_STATIC) add_executable(sdltest-static sdltest.c) target_link_libraries(sdltest-static PRIVATE SDL3::SDL3_test SDL3::SDL3-static) endif() + + if(CMAKE_Swift_COMPILER) + add_executable(swift-static main.swift) + target_include_directories(swift-static PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/swift") + target_link_libraries(swift-static PRIVATE SDL3::SDL3-static) + endif() endif() find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3) diff --git a/cmake/test/main.swift b/cmake/test/main.swift new file mode 100644 index 0000000000000..6c5d8b8318cbd --- /dev/null +++ b/cmake/test/main.swift @@ -0,0 +1,13 @@ +/* Contributed by Piotr Usewicz (https://github.com/pusewicz) */ + +import SDL3 + +guard SDL_Init(Uint32(SDL_INIT_VIDEO)) == 0 else { + fatalError("SDL_Init error: \(String(cString: SDL_GetError()))") +} + +var sdlVersion = SDL_GetVersion() + +print("SDL version: \(sdlVersion)") + +SDL_Quit() diff --git a/cmake/test/swift/module.modulemap b/cmake/test/swift/module.modulemap new file mode 100644 index 0000000000000..bbc26a995dcfd --- /dev/null +++ b/cmake/test/swift/module.modulemap @@ -0,0 +1,4 @@ +module SDL3 [extern_c] { + header "shim.h" + export * +} diff --git a/cmake/test/swift/shim.h b/cmake/test/swift/shim.h new file mode 100644 index 0000000000000..dba8c6fd4c251 --- /dev/null +++ b/cmake/test/swift/shim.h @@ -0,0 +1,3 @@ +/* Contributed by Piotr Usewicz (https://github.com/pusewicz) */ + +#include From 6f1136c6ceb221a31c0415d38538d4c38774642d Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 27 Jul 2024 13:06:54 +0200 Subject: [PATCH 010/253] testgles2: fix leaks --- test/testgles2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/testgles2.c b/test/testgles2.c index 4c4bcc7094ade..6426dc9074504 100644 --- a/test/testgles2.c +++ b/test/testgles2.c @@ -68,6 +68,7 @@ static SDL_GLContext *context = NULL; static int depth = 16; static SDL_bool suspend_when_occluded; static GLES2_Context ctx; +static shader_data *datas; static int LoadContext(GLES2_Context *data) { @@ -100,6 +101,7 @@ quit(int rc) { int i; + SDL_free(datas); if (context) { for (i = 0; i < state->num_windows; i++) { if (context[i]) { @@ -535,7 +537,6 @@ Render(unsigned int width, unsigned int height, shader_data *data) static int done; static Uint32 frames; -static shader_data *datas; #ifndef SDL_PLATFORM_EMSCRIPTEN static thread_data *threads; #endif @@ -934,6 +935,7 @@ int main(int argc, char *argv[]) SDL_WaitThread(threads[i].thread, NULL); } } + SDL_free(threads); } else { while (!done) { loop(); From 3bfc103e765a6fabc795decd33bdc48c803c2079 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 27 Jul 2024 13:44:04 +0200 Subject: [PATCH 011/253] tests: start memory tracking first + clean up cached text textures --- test/testcustomcursor.c | 7 ++++--- test/testdraw.c | 11 ++++++----- test/testpopup.c | 1 + test/testrendertarget.c | 7 ++++--- test/testtime.c | 1 + test/testtimer.c | 2 +- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/test/testcustomcursor.c b/test/testcustomcursor.c index 7b7b650402c7a..6a4910fa83afb 100644 --- a/test/testcustomcursor.c +++ b/test/testcustomcursor.c @@ -342,14 +342,15 @@ int main(int argc, char *argv[]) const char *color_cursor = NULL; SDL_Cursor *cursor; - /* Enable standard application logging */ - SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); - /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); if (!state) { return 1; } + + /* Enable standard application logging */ + SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + for (i = 1; i < argc;) { int consumed; diff --git a/test/testdraw.c b/test/testdraw.c index d558bac26bfc1..2a7d6c36edbf3 100644 --- a/test/testdraw.c +++ b/test/testdraw.c @@ -14,7 +14,7 @@ #include #include -#include +#include #ifdef SDL_PLATFORM_EMSCRIPTEN #include @@ -217,10 +217,6 @@ static void loop(void) int main(int argc, char *argv[]) { int i; - - /* Enable standard application logging */ - SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); - /* Initialize parameters */ num_objects = NUM_OBJECTS; @@ -229,6 +225,10 @@ int main(int argc, char *argv[]) if (!state) { return 1; } + + /* Enable standard application logging */ + SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + for (i = 1; i < argc;) { int consumed; @@ -309,6 +309,7 @@ int main(int argc, char *argv[]) } #endif + SDLTest_CleanupTextDrawing(); SDLTest_CommonQuit(state); return 0; diff --git a/test/testpopup.c b/test/testpopup.c index 8084bad63ca7c..ecb04128f1dfd 100644 --- a/test/testpopup.c +++ b/test/testpopup.c @@ -55,6 +55,7 @@ static void quit(int rc) SDL_free(menus); menus = NULL; + SDLTest_CleanupTextDrawing(); SDLTest_CommonQuit(state); /* Let 'main()' return normally */ if (rc != 0) { diff --git a/test/testrendertarget.c b/test/testrendertarget.c index c3883650462d9..2c4b6dc0ca109 100644 --- a/test/testrendertarget.c +++ b/test/testrendertarget.c @@ -218,14 +218,15 @@ int main(int argc, char *argv[]) int frames; Uint64 then, now; - /* Enable standard application logging */ - SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); - /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); if (!state) { return 1; } + + /* Enable standard application logging */ + SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + for (i = 1; i < argc;) { int consumed; diff --git a/test/testtime.c b/test/testtime.c index 505c05ebcb5dd..14e8a57b22aba 100644 --- a/test/testtime.c +++ b/test/testtime.c @@ -221,6 +221,7 @@ int main(int argc, char *argv[]) } quit: + SDLTest_CleanupTextDrawing(); SDLTest_CommonQuit(state); return 0; } diff --git a/test/testtimer.c b/test/testtimer.c index 249b76a7ebcee..ab797c2f5a720 100644 --- a/test/testtimer.c +++ b/test/testtimer.c @@ -261,7 +261,7 @@ int main(int argc, char *argv[]) return_code = test_sdl_delay_within_bounds(); } - SDLTest_CommonDestroyState(state); SDL_Quit(); + SDLTest_CommonDestroyState(state); return return_code; } From 76f60c4b66bed7b1e8040312659bd7748812ae59 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 24 Jul 2024 23:30:23 +0200 Subject: [PATCH 012/253] riscos: fix -Wunused-variable --- src/video/riscos/SDL_riscosvideo.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/video/riscos/SDL_riscosvideo.c b/src/video/riscos/SDL_riscosvideo.c index 0cba7506d88b8..917a4123be9fe 100644 --- a/src/video/riscos/SDL_riscosvideo.c +++ b/src/video/riscos/SDL_riscosvideo.c @@ -101,8 +101,6 @@ VideoBootStrap RISCOS_bootstrap = { static int RISCOS_VideoInit(SDL_VideoDevice *_this) { - SDL_VideoData *data = _this->internal; - if (RISCOS_InitEvents(_this) < 0) { return -1; } From 3374e57102a1de63ca2fc56953ec674e06f1dfbc Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 25 Jul 2024 11:45:50 +0200 Subject: [PATCH 013/253] stdinc: strcasecmp is declared in strings.h --- include/SDL3/SDL_stdinc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index 83296b257bd71..96cc643a26ed2 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -2963,8 +2963,9 @@ size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size); /* Starting LLVM 16, the analyser errors out if these functions do not have their prototype defined (clang-diagnostic-implicit-function-declaration) */ -#include #include +#include +#include #define SDL_malloc malloc #define SDL_calloc calloc From da8aa84c1d121a655792cbc703ccc68c036e2c7f Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 17 Jul 2024 00:26:04 +0200 Subject: [PATCH 014/253] ci: merge all workflows into one --- .../setup-loongarch64-toolchain/action.yml | 49 ++ .../action.yml | 5 +- .github/workflows/android.yml | 147 ----- .github/workflows/build.yml | 33 + .github/workflows/cpactions.yml | 57 -- .github/workflows/create-test-plan.py | 614 ++++++++++++++++++ .github/workflows/emscripten.yml | 60 -- .github/workflows/generic.yml | 341 ++++++++++ .github/workflows/haiku.yml | 59 -- .github/workflows/ios.yml | 24 - .github/workflows/loongarch64.yml | 93 --- .github/workflows/main.yml | 188 ------ .github/workflows/msvc.yml | 142 ---- .github/workflows/n3ds.yml | 67 -- .github/workflows/ppc64le.yml | 62 -- .github/workflows/ps2.yml | 62 -- .github/workflows/psp.yml | 74 --- .github/workflows/release.yml | 5 - .github/workflows/riscos.yml | 66 -- .github/workflows/visionos.yml.disabled | 22 - .github/workflows/vita.yml | 138 ---- cmake/sdlcpu.cmake | 2 + 22 files changed, 1042 insertions(+), 1268 deletions(-) create mode 100644 .github/actions/setup-loongarch64-toolchain/action.yml rename .github/actions/{setup-msvc-libusb-action => setup-msvc-libusb}/action.yml (91%) delete mode 100644 .github/workflows/android.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/cpactions.yml create mode 100755 .github/workflows/create-test-plan.py delete mode 100644 .github/workflows/emscripten.yml create mode 100644 .github/workflows/generic.yml delete mode 100644 .github/workflows/haiku.yml delete mode 100644 .github/workflows/ios.yml delete mode 100644 .github/workflows/loongarch64.yml delete mode 100644 .github/workflows/main.yml delete mode 100644 .github/workflows/msvc.yml delete mode 100644 .github/workflows/n3ds.yml delete mode 100644 .github/workflows/ppc64le.yml delete mode 100644 .github/workflows/ps2.yml delete mode 100644 .github/workflows/psp.yml delete mode 100644 .github/workflows/riscos.yml delete mode 100644 .github/workflows/visionos.yml.disabled delete mode 100644 .github/workflows/vita.yml diff --git a/.github/actions/setup-loongarch64-toolchain/action.yml b/.github/actions/setup-loongarch64-toolchain/action.yml new file mode 100644 index 0000000000000..9cf53eaf49b53 --- /dev/null +++ b/.github/actions/setup-loongarch64-toolchain/action.yml @@ -0,0 +1,49 @@ +name: 'Setup libusb for MSBC' +description: 'Greet someone' +inputs: + version: + description: 'LoongArch64 version' + default: '2022.09.06' +outputs: + prefix: + description: "LoongArch toolchain prefix" + value: ${{ steps.final.outputs.prefix }} + cc: + description: "LoongArch C compiler" + value: ${{ steps.final.outputs.cc }} + cxx: + description: "LoongArch C++ compiler" + value: ${{ steps.final.outputs.cxx }} +runs: + using: 'composite' + steps: + - uses: actions/cache/restore@v4 + id: restore-cache + with: + path: /opt/cross-tools + key: loongarch64-${{ matrix.platform.toolchain-version }} + + - name: 'Download LoongArch64 gcc+glibc toolchain' + if: ${{ !steps.restore-cache.outputs.cache-hit }} + shell: bash + run: | + url="https://github.com/loongson/build-tools/releases/download/${{ matrix.platform.toolchain-version }}/loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz" + + wget "$url" -O /tmp/toolchain.tar.xz + + mkdir -p /opt + tar -C /opt -x -f /tmp/toolchain.tar.xz + + - uses: actions/cache/save@v4 + if: ${{ !steps.restore-cache.outputs.cache-hit }} + with: + path: /opt/cross-tools + key: loongarch64-${{ matrix.platform.toolchain-version }} + - name: 'Set output vars' + id: final + shell: bash + run: | + prefix=/opt/cross-tools + echo "prefix=${prefix}" >> $GITHUB_OUTPUT + echo "cc=${prefix}/bin/loongarch64-unknown-linux-gnu-gcc" >> $GITHUB_OUTPUT + echo "cxx=${prefix}/bin/loongarch64-unknown-linux-gnu-g++" >> $GITHUB_OUTPUT diff --git a/.github/actions/setup-msvc-libusb-action/action.yml b/.github/actions/setup-msvc-libusb/action.yml similarity index 91% rename from .github/actions/setup-msvc-libusb-action/action.yml rename to .github/actions/setup-msvc-libusb/action.yml index a0e766618141d..fbf451af63595 100644 --- a/.github/actions/setup-msvc-libusb-action/action.yml +++ b/.github/actions/setup-msvc-libusb/action.yml @@ -1,5 +1,5 @@ -name: 'Setup libusb for MSBC' -description: 'Greet someone' +name: 'Setup libusb for MSVC' +description: 'Setup libusb for MSVC' inputs: version: description: 'libusb version' @@ -68,3 +68,4 @@ runs: exit 1 } echo "root=${libusb_incdir};${libusb_libdir}" >> $env:GITHUB_OUTPUT + echo "LibUSB_ROOT=${libusb_incdir};${libusb_libdir}" >> $env:GITHUB_ENV diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml deleted file mode 100644 index 28a08c6bfe9c3..0000000000000 --- a/.github/workflows/android.yml +++ /dev/null @@ -1,147 +0,0 @@ -name: Build (Android) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - android: - name: ${{ matrix.platform.name }} - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - platform: - - { name: "Android.mk", ndk-build: 1 } - - { name: "Gradle", gradle: 1 } - - { name: "CMake", cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-android-arm64", apk-artifact: "SDL-android-apks-arm64" } - - { name: "CMake (lean and mean)", cmake: 1, cppflags: "-DSDL_LEAN_AND_MEAN=1", android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-lean-android-arm64", apk-artifact: "SDL-lean-android-apks-arm64" } - - steps: - - uses: actions/checkout@v4 - - uses: nttld/setup-ndk@v1 - if: ${{ matrix.platform.cmake || matrix.platform.ndk-build }} - id: setup_ndk - with: - local-cache: true - ndk-version: r21e - - name: Build (Android.mk) - if: ${{ matrix.platform.ndk-build }} - run: | - ./build-scripts/androidbuildlibs.sh - - uses: actions/setup-java@v4 - if: ${{ matrix.platform.cmake || matrix.platform.gradle }} - with: - distribution: 'temurin' - java-version: '17' - - name: Create Gradle project - if: ${{ matrix.platform.gradle }} - run: | - python build-scripts/create-android-project.py \ - --output "build" \ - --variant copy \ - org.libsdl.testspriteminimal \ - test/testspriteminimal.c test/icon.h - echo "" - echo "Project contents:" - echo "" - find "build/org.libsdl.testspriteminimal" - - name: Build app (Gradle & ndk-build) - if: ${{ matrix.platform.gradle }} - run: | - cd build/org.libsdl.testspriteminimal - ./gradlew -i assembleRelease - - name: Build app (Gradle & CMake) - if: ${{ matrix.platform.gradle }} - run: | - cd build/org.libsdl.testspriteminimal - ./gradlew -i assembleRelease -PBUILD_WITH_CMAKE=1 -# - name: Build library (Gradle) -# if: ${{ matrix.platform.gradle }} -# run: | -# cd build/org.libsdl.testspriteminimal -# ./gradlew -i assembleRelease -PBUILD_AS_LIBRARY=1 - - name: Setup (CMake) - if: ${{ matrix.platform.cmake }} - run: | - sudo apt-get update - sudo apt-get install ninja-build pkg-config - - name: Configure (CMake) - if: ${{ matrix.platform.cmake }} - run: | - cmake -S . -B build \ - -DCMAKE_C_FLAGS="${{ matrix.platform.cppflags }}" \ - -DCMAKE_CXX_FLAGS="${{ matrix.platform.cppflags }}" \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_CLANG_TIDY=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \ - -DANDROID_ABI=${{ matrix.platform.android_abi }} \ - -DSDL_SHARED=ON \ - -DSDL_STATIC=ON \ - -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DCMAKE_INSTALL_PREFIX=prefix \ - -DCMAKE_BUILD_TYPE=Release \ - -GNinja - - name: Build (CMake) - if: ${{ matrix.platform.cmake }} - run: | - cmake --build build --config Release --parallel --verbose - - name: Build test apk's (CMake) - if: ${{ matrix.platform.cmake }} - run: | - cmake --build build --config Release --parallel \ - --target \ - testaudiorecording-apk \ - testautomation-apk \ - testcontroller-apk \ - testmultiaudio-apk \ - testsprite-apk \ - --verbose - - name: Install (CMake) - if: ${{ matrix.platform.cmake }} - run: | - cmake --install build --config Release - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - if: ${{ matrix.platform.cmake }} - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - if: ${{ matrix.platform.cmake }} - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \ - -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \ - -DANDROID_ABI=${{ matrix.platform.android_abi }} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - if: ${{ matrix.platform.cmake }} - run: | - export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}" - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - if: ${{ matrix.platform.cmake }} - with: - if-no-files-found: error - name: ${{ matrix.platform.artifact }} - path: build/dist/SDL3* - - uses: actions/upload-artifact@v4 - if: ${{ matrix.platform.cmake }} - with: - if-no-files-found: error - name: ${{ matrix.platform.apk-artifact }} - path: build/test/*.apk diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000000..94fb83ca81bd9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: 'Build (All)' + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + +jobs: + controller: + name: 'Create test plan' + runs-on: 'ubuntu-latest' + outputs: + platforms: ${{ steps.plan.outputs.platforms }} + steps: + - uses: actions/setup-python@main + with: + python-version: 3.x + - uses: actions/checkout@main + with: + sparse-checkout: '.github/workflows/create-test-plan.py' + - name: 'Create plan' + id: plan + run: | + python .github/workflows/create-test-plan.py \ + --github-variable platforms \ + --github-ci \ + --verbose + level1: + needs: [controller] + uses: './.github/workflows/generic.yml' + with: + platforms: ${{ needs.controller.outputs.platforms }} diff --git a/.github/workflows/cpactions.yml b/.github/workflows/cpactions.yml deleted file mode 100644 index 75f1b712d2103..0000000000000 --- a/.github/workflows/cpactions.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Build (C/P Actions) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - freebsd: - runs-on: ubuntu-latest - name: '${{ matrix.platform.name }} ${{ matrix.platform.os-version }}' - timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - platform: - - { name: FreeBSD, os: freebsd, os-version: '13.3', os-arch: x86-64, artifact: SDL-freebsd-x64, - sdl-cmake-configure-arguments: '-DSDL_CHECK_REQUIRED_INCLUDES="/usr/local/include" -DSDL_CHECK_REQUIRED_LINK_OPTIONS="-L/usr/local/lib"', - setup-cmd: 'sudo pkg update', - install-cmd: 'sudo pkg install -y cmake ninja pkgconf libXcursor libXext libXinerama libXi libXfixes libXrandr libXScrnSaver libXxf86vm wayland wayland-protocols libxkbcommon mesa-libs libglvnd evdev-proto libinotify alsa-lib jackit pipewire pulseaudio sndio dbus zh-fcitx ibus libudev-devd', - } - - { name: NetBSD, os: netbsd, os-version: '10.0', os-arch: x86-64, artifact: SDL-netbsd-x64, - sdl-cmake-configure-arguments: '', - setup-cmd: 'export PATH="/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH";export PKG_CONFIG_PATH="/usr/pkg/lib/pkgconfig";export PKG_PATH="https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f "1 2" -d.)/All/";echo "PKG_PATH=$PKG_PATH";echo "uname -a -> \"$(uname -a)\"";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update', - install-cmd: 'sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1', - } - steps: - - uses: actions/checkout@v4 - - name: Build - uses: cross-platform-actions/action@v0.25.0 - with: - operating_system: ${{ matrix.platform.os }} - architecture: ${{ matrix.platform.os-arch }} - version: ${{ matrix.platform.os-version }} - run: | - ${{ matrix.platform.setup-cmd }} - ${{ matrix.platform.install-cmd }} - cmake -S . -B build -GNinja \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_BUILD_TYPE=Release \ - -DSDL_WERROR=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - ${{ matrix.platform.sdl-cmake-configure-arguments }} - cmake --build build/ --config Release --verbose - cmake --build build/ --config Release --target package - - cmake --build build/ --config Release --target clean - rm -rf build/dist/_CPack_Packages - rm -rf build/CMakeFiles - rm -rf build/docs - - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: ${{ matrix.platform.artifact }} - path: build/dist/SDL3* diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py new file mode 100755 index 0000000000000..e9be4a148e677 --- /dev/null +++ b/.github/workflows/create-test-plan.py @@ -0,0 +1,614 @@ +#!/usr/bin/env python +import argparse +import dataclasses +from enum import Enum +import json +import logging +import os +from typing import Optional + +logger = logging.getLogger(__name__) + + +class AppleArch(Enum): + Aarch64 = "aarch64" + X86_64 = "x86_64" + + +class MsvcArch(Enum): + X86 = "x86" + X64 = "x64" + Arm32 = "arm" + Arm64 = "arm64" + + +class JobOs(Enum): + WindowsLatest = "windows-latest" + UbuntuLatest = "ubuntu-latest" + MacosLatest = "macos-latest" + Ubuntu20_04 = "ubuntu-20.04" + Ubuntu22_04 = "ubuntu-22.04" + Ubuntu24_04 = "ubuntu-24.04" + Macos12 = "macos-12" + + +class SdlPlatform(Enum): + Android = "android" + Emscripten = "emscripten" + Haiku = "haiku" + LoongArch64 = "loongarch64" + Msys2 = "msys2" + Linux = "linux" + MacOS = "macos" + Ios = "ios" + Tvos = "tvos" + Msvc = "msvc" + N3ds = "n3ds" + PowerPC64 = "powerpc64" + Ps2 = "ps2" + Psp = "psp" + Riscos = "riscos" + FreeBSD = "freebsd" + NetBSD = "netbsd" + + +class Msys2Platform(Enum): + Mingw32 = "mingw32" + Mingw64 = "mingw64" + Clang32 = "clang32" + Clang64 = "clang64" + Ucrt64 = "ucrt64" + + +class IntelCompiler(Enum): + Icc = "icc" + Icx = "icx" + + +@dataclasses.dataclass(slots=True) +class JobSpec: + name: str + os: JobOs + platform: SdlPlatform + artifact: Optional[str] + container: Optional[str] = None + no_cmake: bool = False + android_mk: bool = False + android_gradle: bool = False + lean: bool = False + android_arch: Optional[str] = None + android_abi: Optional[str] = None + android_platform: Optional[int] = None + msys2_platform: Optional[Msys2Platform] = None + intel: Optional[IntelCompiler] = None + apple_framework: Optional[bool] = None + apple_archs: Optional[set[AppleArch]] = None + msvc_project: Optional[str] = None + msvc_arch: Optional[MsvcArch] = None + clang_cl: bool = False + uwp: bool = False + + +JOB_SPECS = [ + JobSpec(name="Windows (msys2, mingw32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32", msys2_platform=Msys2Platform.Mingw32, ), + JobSpec(name="Windows (msys2, mingw64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64", msys2_platform=Msys2Platform.Mingw64, ), + JobSpec(name="Windows (msys2, clang32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32-clang", msys2_platform=Msys2Platform.Clang32, ), + JobSpec(name="Windows (msys2, clang64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-clang", msys2_platform=Msys2Platform.Clang64, ), + JobSpec(name="Windows (msys2, ucrt64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-ucrt", msys2_platform=Msys2Platform.Ucrt64, ), + JobSpec(name="Windows (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_project="VisualC/SDL.sln", ), + JobSpec(name="Windows (MSVC, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_project="VisualC/SDL.sln", ), + JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ), + JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ), + JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ), + JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ), + JobSpec(name="UWP (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-UWP", msvc_arch=MsvcArch.X64, msvc_project="VisualC-WinRT/SDL-UWP.sln", uwp=True, ), + JobSpec(name="Ubuntu 20.04", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04", ), + JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", ), + JobSpec(name="Ubuntu 20.04 (Intel oneAPI)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-oneapi", intel=IntelCompiler.Icx, ), + JobSpec(name="Ubuntu 20.04 (Intel Compiler)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-icc", intel=IntelCompiler.Icc, ), + JobSpec(name="MacOS (Framework) (x86_64)", os=JobOs.Macos12, platform=SdlPlatform.MacOS, artifact="SDL-macos-framework", apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ), + JobSpec(name="MacOS (Framework) (arm64)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact=None, apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ), + JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-gnu", apple_framework=False, apple_archs={AppleArch.Aarch64, }, ), + JobSpec(name="Android (CMake)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, ), + JobSpec(name="Android (CMake, lean)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-lean-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, lean=True, ), + JobSpec(name="Android (Android.mk)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_mk=True, ), + JobSpec(name="iOS (xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Ios, artifact=None, no_cmake=True, ), + JobSpec(name="tvOS (xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Tvos, artifact=None, no_cmake=True, ), + JobSpec(name="Android (Gradle)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_gradle=True, ), + JobSpec(name="Emscripten", os=JobOs.UbuntuLatest, platform=SdlPlatform.Emscripten, artifact="SDL-emscripten", ), + JobSpec(name="Haiku", os=JobOs.UbuntuLatest, platform=SdlPlatform.Haiku, artifact="SDL-haiku-x64", container="haiku/cross-compiler:x86_64-r1beta4", ), + JobSpec(name="LoongArch64", os=JobOs.UbuntuLatest, platform=SdlPlatform.LoongArch64, artifact="SDL-loongarch64", ), + JobSpec(name="Nintendo 3DS", os=JobOs.UbuntuLatest, platform=SdlPlatform.N3ds, artifact="SDL-n3ds", container="devkitpro/devkitarm:latest", ), + JobSpec(name="PowerPC64", os=JobOs.UbuntuLatest, platform=SdlPlatform.PowerPC64, artifact="SDL-ppc64le", container="dockcross/linux-ppc64le:latest", ), + JobSpec(name="Sony PlayStation 2", os=JobOs.UbuntuLatest, platform=SdlPlatform.Ps2, artifact="SDL-ps2", container="ps2dev/ps2dev:latest", ), + JobSpec(name="Sony PlayStation Portable", os=JobOs.UbuntuLatest, platform=SdlPlatform.Psp, artifact="SDL-psp", container="pspdev/pspdev:latest", ), + JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ), + JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", ), + JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", ), +] + + +@dataclasses.dataclass(slots=True) +class JobDetails: + name: str + os: str + platform: str + artifact: str + no_cmake: bool + build_tests: bool = True + container: str = "" + cmake_build_type: str = "Release" + shell: str = "sh" + sudo: str = "sudo" + cmake_config_emulator: str = "" + apk_packages: list[str] = dataclasses.field(default_factory=list) + apt_packages: list[str] = dataclasses.field(default_factory=list) + brew_packages: list[str] = dataclasses.field(default_factory=list) + cmake_toolchain_file: str = "" + cmake_arguments: list[str] = dataclasses.field(default_factory=list) + cmake_build_arguments: list[str] = dataclasses.field(default_factory=list) + clang_tidy: bool = True + cppflags: list[str] = dataclasses.field(default_factory=list) + cc: str = "" + cxx: str = "" + cflags: list[str] = dataclasses.field(default_factory=list) + cxxflags: list[str] = dataclasses.field(default_factory=list) + ldflags: list[str] = dataclasses.field(default_factory=list) + pollute_directories: list[str] = dataclasses.field(default_factory=list) + use_cmake: bool = True + shared: bool = True + static: bool = True + run_tests: bool = True + test_pkg_config: bool = True + cc_from_cmake: bool = False + source_cmd: str = "" + java: bool = False + android_apks: list[str] = dataclasses.field(default_factory=list) + android_ndk: bool = False + android_mk: bool = False + android_gradle: bool = False + minidump: bool = False + intel: bool = False + msys2_msystem: str = "" + msys2_env: str = "" + msys2_no_perl: bool = False + werror: bool = True + msvc_vcvars: str = "" + msvc_project: str = "" + msvc_project_flags: list[str] = dataclasses.field(default_factory=list) + setup_ninja: bool = False + setup_libusb_arch: str = "" + xcode_sdk: str = "" + cpactions: bool = False + cpactions_os: str = "" + cpactions_version: str = "" + cpactions_arch: str = "" + cpactions_setup_cmd: str = "" + cpactions_install_cmd: str = "" + + def to_workflow(self) -> dict[str, str|bool]: + data = { + "name": self.name, + "os": self.os, + "container": self.container if self.container else "", + "platform": self.platform, + "artifact": self.artifact, + "shell": self.shell, + "msys2-msystem": self.msys2_msystem, + "msys2-env": self.msys2_env, + "msys2-no-perl": self.msys2_no_perl, + "android-ndk": self.android_ndk, + "java": self.java, + "intel": self.intel, + "apk-packages": my_shlex_join(self.apk_packages), + "apt-packages": my_shlex_join(self.apt_packages), + "test-pkg-config": self.test_pkg_config, + "brew-packages": my_shlex_join(self.brew_packages), + "pollute-directories": my_shlex_join(self.pollute_directories), + "no-cmake": self.no_cmake, + "build-tests": self.build_tests, + "source-cmd": self.source_cmd, + "cmake-config-emulator": self.cmake_config_emulator, + "cc": self.cc, + "cxx": self.cxx, + "cflags": my_shlex_join(self.cppflags + self.cflags), + "cxxflags": my_shlex_join(self.cppflags + self.cxxflags), + "ldflags": my_shlex_join(self.ldflags), + "cmake-toolchain-file": self.cmake_toolchain_file, + "clang-tidy": self.clang_tidy, + "cmake-arguments": my_shlex_join(self.cmake_arguments), + "cmake-build-arguments": my_shlex_join(self.cmake_build_arguments), + "shared": self.shared, + "static": self.static, + "cmake-build-type": self.cmake_build_type, + "run-tests": self.run_tests, + "android-apks": my_shlex_join(self.android_apks), + "android-gradle": self.android_gradle, + "android-mk": self.android_mk, + "werror": self.werror, + "sudo": self.sudo, + "msvc-vcvars": self.msvc_vcvars, + "msvc-project": self.msvc_project, + "msvc-project-flags": my_shlex_join(self.msvc_project_flags), + "setup-ninja": self.setup_ninja, + "setup-libusb-arch": self.setup_libusb_arch, + "cc-from-cmake": self.cc_from_cmake, + "xcode-sdk": self.xcode_sdk, + "cpactions": self.cpactions, + "cpactions-os": self.cpactions_os, + "cpactions-version": self.cpactions_version, + "cpactions-arch": self.cpactions_arch, + "cpactions-setup-cmd": self.cpactions_setup_cmd, + "cpactions-install-cmd": self.cpactions_install_cmd, + } + return {k: v for k, v in data.items() if v != ""} + + +def my_shlex_join(s): + def escape(s): + if s[:1] == "'" and s[-1:] == "'": + return s + if set(s).intersection(set("; \t")): + return f'"{s}"' + return s + + return " ".join(escape(s)) + + +def spec_to_job(spec: JobSpec) -> JobDetails: + job = JobDetails( + name=spec.name, + os=spec.os.value, + artifact=spec.artifact or "", + container=spec.container or "", + platform=spec.platform.value, + sudo="sudo", + no_cmake=spec.no_cmake, + ) + if job.os.startswith("ubuntu"): + job.apt_packages.extend([ + "ninja-build", + "pkg-config", + ]) + win32 = spec.platform in (SdlPlatform.Msys2, SdlPlatform.Msvc) + fpic = None + build_parallel = True + if spec.lean: + job.cppflags.append("-DSDL_LEAN_AND_MEAN=1") + if win32: + job.cmake_arguments.append("-DSDLTEST_PROCDUMP=ON") + job.minidump = True + if spec.intel is not None: + match spec.intel: + case IntelCompiler.Icx: + job.cc = "icx" + job.cxx = "icpx" + case IntelCompiler.Icc: + job.cc = "icc" + job.cxx = "icpc" + job.cppflags.append("-diag-disable=10441") + job.clang_tidy = False + case _: + raise ValueError(f"Invalid intel={spec.intel}") + job.source_cmd = f"source /opt/intel/oneapi/setvars.sh;" + job.intel = True + job.shell = "bash" + job.cmake_arguments.extend(( + f"-DCMAKE_C_COMPILER={job.cc}", + f"-DCMAKE_CXX_COMPILER={job.cxx}", + "-DCMAKE_SYSTEM_NAME=Linux", + )) + match spec.platform: + case SdlPlatform.Msvc: + job.setup_ninja = True + job.clang_tidy = False # complains about \threadsafety: "unknown command tag name [clang-diagnostic-documentation-unknown-command]" + job.msvc_project = spec.msvc_project if spec.msvc_project else "" + job.test_pkg_config = False + job.cmake_arguments.extend(( + "-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=ProgramDatabase", + "-DCMAKE_EXE_LINKER_FLAGS=-DEBUG", + "-DCMAKE_SHARED_LINKER_FLAGS=-DEBUG", + )) + if spec.uwp: + job.cmake_arguments.append("'-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$:Debug>DLL'") + else: + job.cmake_arguments.append("'-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$:Debug>'") + if spec.clang_cl: + job.cmake_arguments.extend(( + "-DCMAKE_C_COMPILER=clang-cl", + "-DCMAKE_CXX_COMPILER=clang-cl", + )) + match spec.msvc_arch: + case MsvcArch.X86: + job.cflags.append("/clang:-m32") + job.ldflags.append("/MACHINE:X86") + case MsvcArch.X64: + job.cflags.append("/clang:-m64") + job.ldflags.append("/MACHINE:X64") + case _: + raise ValueError(f"Unsupported clang-cl architecture (arch={spec.msvc_arch})") + if spec.msvc_project: + match spec.msvc_arch: + case MsvcArch.X86: + job.msvc_project_flags.append("-p:Platform=Win32") + case MsvcArch.X64: + job.msvc_project_flags.append("-p:Platform=x64") + case _: + raise ValueError(f"Unsupported vcxproj architecture (arch={spec.msvc_arch})") + match spec.msvc_arch: + case MsvcArch.X86: + job.msvc_vcvars = "x64_x86" + case MsvcArch.X64: + job.msvc_vcvars = "x64" + case MsvcArch.Arm32: + job.msvc_vcvars = "x64_arm" + job.run_tests = False + case MsvcArch.Arm64: + job.msvc_vcvars = "x64_arm64" + job.run_tests = False + if spec.uwp: + job.build_tests = False + job.cmake_arguments.extend(( + "-DCMAKE_SYSTEM_NAME=WindowsStore", + "-DCMAKE_SYSTEM_VERSION=10.0", + )) + job.msvc_project_flags.append("-p:WindowsTargetPlatformVersion=10.0.17763.0") + else: + match spec.msvc_arch: + case MsvcArch.X86: + job.setup_libusb_arch = "x86" + case MsvcArch.X64: + job.setup_libusb_arch = "x64" + case SdlPlatform.Linux: + job.apt_packages.extend(( + "gnome-desktop-testing", + "libasound2-dev", + "libpulse-dev", + "libaudio-dev", + "libjack-dev", + "libsndio-dev", + "libusb-1.0-0-dev", + "libx11-dev", + "libxext-dev", + "libxrandr-dev", + "libxcursor-dev", + "libxfixes-dev", + "libxi-dev", + "libxss-dev", + "libwayland-dev", + "libxkbcommon-dev", + "libdrm-dev", + "libgbm-dev", + "libgl1-mesa-dev", + "libgles2-mesa-dev", + "libegl1-mesa-dev", + "libdbus-1-dev", + "libibus-1.0-dev", + "libudev-dev", + "fcitx-libs-dev", + )) + fpic = True + assert spec.os.value.startswith("ubuntu-") + ubuntu_year, ubuntu_month = [int(v) for v in spec.os.value.removeprefix("ubuntu-").split(".", 1)] + if ubuntu_year >= 22: + job.apt_packages.extend(("libpipewire-0.3-dev", "libdecor-0-dev")) + case SdlPlatform.Ios | SdlPlatform.Tvos: + match spec.platform: + case SdlPlatform.Ios: + job.xcode_sdk = 'iphoneos' + case SdlPlatform.Tvos: + job.xcode_sdk = 'appletvos' + case SdlPlatform.MacOS: + if spec.apple_framework: + job.static = False + job.clang_tidy = False + job.test_pkg_config = False + job.cmake_arguments.extend(( + "'-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'", + "-DSDL_FRAMEWORK=ON", + )) + else: + job.clang_tidy = True + job.cmake_arguments.extend(( + "-DCMAKE_OSX_ARCHITECTURES=arm64", + "-DCLANG_TIDY_BINARY=$(brew --prefix llvm)/bin/clang-tidy", + )) + job.apt_packages = [] + job.brew_packages.append("ninja") + if job.test_pkg_config: + job.brew_packages.append("pkg-config") + if job.clang_tidy: + job.brew_packages.append("llvm") + case SdlPlatform.Android: + job.android_gradle = spec.android_gradle + job.android_mk = spec.android_mk + job.run_tests = False + if spec.android_mk or not spec.no_cmake: + job.android_ndk = True + if spec.android_gradle or not spec.no_cmake: + job.java = True + if spec.android_mk or spec.android_gradle: + job.apt_packages = [] + if not spec.no_cmake: + job.cmake_arguments.extend(( + f"-DANDROID_PLATFORM={spec.android_platform}", + f"-DANDROID_ABI={spec.android_abi}", + )) + job.cmake_toolchain_file = "${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" + job.cc = f"${{ANDROID_NDK_HOME}}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target={spec.android_arch}-none-linux-androideabi{spec.android_platform}" + + job.android_apks = [ + "testaudiorecording-apk", + "testautomation-apk", + "testcontroller-apk", + "testmultiaudio-apk", + "testsprite-apk", + ] + case SdlPlatform.Emscripten: + job.run_tests = False + job.shared = False + job.cmake_config_emulator = "emcmake" + job.cmake_build_type = "Debug" + job.test_pkg_config = False + case SdlPlatform.Ps2: + build_parallel = False + job.shared = False + job.sudo = "" + job.apt_packages = [] + job.apk_packages = ["cmake", "gmp", "mpc1", "mpfr4", "ninja", "pkgconf", "git", ] + job.cmake_toolchain_file = "${PS2DEV}/ps2sdk/ps2dev.cmake" + job.clang_tidy = False + job.run_tests = False + job.shared = False + job.cc = "mips64r5900el-ps2-elf-gcc" + job.ldflags = ["-L${PS2DEV}/ps2sdk/ee/lib", "-L${PS2DEV}/gsKit/lib", "-L${PS2DEV}/ps2sdk/ports/lib", ] + case SdlPlatform.Psp: + build_parallel = False + job.sudo = "" + job.apt_packages = [] + job.apk_packages = ["cmake", "gmp", "mpc1", "mpfr4", "ninja", "pkgconf", ] + job.cmake_toolchain_file = "${PSPDEV}/psp/share/pspdev.cmake" + job.clang_tidy = False + job.run_tests = False + job.shared = False + job.cc = "psp-gcc" + job.ldflags = ["-L${PSPDEV}/lib", "-L${PSPDEV}/psp/lib", "-L${PSPDEV}/psp/sdk/lib", ] + job.pollute_directories = ["${PSPDEV}/include", "${PSPDEV}/psp/include", "${PSPDEV}/psp/sdk/include", ] + case SdlPlatform.Haiku: + fpic = False + job.run_tests = False + job.cc = "x86_64-unknown-haiku-gcc" + job.cxx = "x86_64-unknown-haiku-g++" + job.sudo = "" + job.cmake_arguments.extend(( + f"-DCMAKE_C_COMPILER={job.cc}", + f"-DCMAKE_CXX_COMPILER={job.cxx}", + "-DCMAKE_SYSTEM_NAME=Haiku", + )) + case SdlPlatform.PowerPC64: + # FIXME: Enable SDL_WERROR + job.werror = False + job.clang_tidy = False + job.run_tests = False + job.sudo = "" + job.apt_packages = [] + case SdlPlatform.LoongArch64: + job.run_tests = False + job.cc = "${LOONGARCH64_CC}" + job.cxx = "${LOONGARCH64_CXX}" + job.cmake_arguments.extend(( + f"-DCMAKE_C_COMPILER={job.cc}", + f"-DCMAKE_CXX_COMPILER={job.cxx}", + "-DCMAKE_SYSTEM_NAME=Linux", + )) + case SdlPlatform.N3ds: + job.shared = False + job.apt_packages = ["ninja-build"] + job.clang_tidy = False + job.run_tests = False + job.cc_from_cmake = True + job.cmake_toolchain_file = "${DEVKITPRO}/cmake/3DS.cmake" + case SdlPlatform.Msys2: + job.shell = "msys2 {0}" + assert spec.msys2_platform + job.msys2_msystem = spec.msys2_platform.value + job.msys2_env = { + "mingw32": "mingw-w64-i686", + "mingw64": "mingw-w64-x86_64", + "clang32": "mingw-w64-clang-i686", + "clang64": "mingw-w64-clang-x86_64", + "ucrt64": "mingw-w64-ucrt-x86_64", + }[spec.msys2_platform.value] + job.msys2_no_perl = spec.msys2_platform in (Msys2Platform.Mingw32, Msys2Platform.Clang32) + case SdlPlatform.Riscos: + # FIXME: Enable SDL_WERROR + job.werror = False + job.apt_packages = ["cmake", "ninja-build"] + job.test_pkg_config = False + job.shared = False + job.run_tests = False + job.sudo = "" + job.cmake_arguments.extend(( + "-DRISCOS:BOOL=ON", + "-DCMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON", + "-DSDL_GCC_ATOMICS:BOOL=OFF", + )) + job.cmake_toolchain_file = "/home/riscos/env/toolchain-riscos.cmake" + case SdlPlatform.FreeBSD | SdlPlatform.NetBSD: + job.cpactions = True + job.no_cmake = True + job.run_tests = False + job.apt_packages = [] + match spec.platform: + case SdlPlatform.FreeBSD: + job.cpactions_os = "freebsd" + job.cpactions_version = "13.3" + job.cpactions_arch = "x86-64" + job.cpactions_setup_cmd = "sudo pkg update" + job.cpactions_install_cmd = "sudo pkg install -y cmake ninja pkgconf libXcursor libXext libXinerama libXi libXfixes libXrandr libXScrnSaver libXxf86vm wayland wayland-protocols libxkbcommon mesa-libs libglvnd evdev-proto libinotify alsa-lib jackit pipewire pulseaudio sndio dbus zh-fcitx ibus libudev-devd" + job.cmake_arguments.extend(( + "-DSDL_CHECK_REQUIRED_INCLUDES=/usr/local/include", + "-DSDL_CHECK_REQUIRED_LINK_OPTIONS=-L/usr/local/lib", + )) + case SdlPlatform.NetBSD: + job.cpactions_os = "netbsd" + job.cpactions_version = "10.0" + job.cpactions_arch = "x86-64" + job.cpactions_setup_cmd = "export PATH=\"/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH\"; export PKG_CONFIG_PATH=\"/usr/pkg/lib/pkgconfig\";export PKG_PATH=\"https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f \"1 2\" -d.)/All/\";echo \"PKG_PATH=$PKG_PATH\";echo \"uname -a -> \"$(uname -a)\"\";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update" + job.cpactions_install_cmd = "sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1" + case _: + raise ValueError(f"Unsupported platform={spec.platform}") + + if not build_parallel: + job.cmake_build_arguments.append("-j1") + if job.cflags: + job.cmake_arguments.append(f"-DCMAKE_C_FLAGS={my_shlex_join(job.cflags)}") + if job.cxxflags: + job.cmake_arguments.append(f"-DCMAKE_CXX_FLAGS={my_shlex_join(job.cxxflags)}") + if job.ldflags: + job.cmake_arguments.append(f"-DCMAKE_SHARED_LINKER_FLAGS=\"{my_shlex_join(job.ldflags)}\"") + job.cmake_arguments.append(f"-DCMAKE_EXE_LINKER_FLAGS=\"{my_shlex_join(job.ldflags)}\"") + + def tf(b): + return "ON" if b else "OFF" + + if fpic is not None: + job.cmake_arguments.append(f"-DCMAKE_POSITION_INDEPENDENT_CODE={tf(fpic)}") + + return job + + +def main(): + parser = argparse.ArgumentParser(allow_abbrev=False) + parser.add_argument("--github-variable", default="platforms") + parser.add_argument("--github-ci", action="store_true") + parser.add_argument("--verbose", action="store_true") + args = parser.parse_args() + + logging.basicConfig(level=logging.INFO if args.verbose else logging.WARNING) + + all_platforms = [] + for spec in JOB_SPECS: + logger.info("spec=%r", spec) + job = spec_to_job(spec) + logger.info("job=%r", job) + platform = job.to_workflow() + logger.info("platform=%r", platform) + all_platforms.append(platform) + + if args.github_ci: + platforms_json = json.dumps(all_platforms) + txt = f"{args.github_variable}={platforms_json}" + logger.info("%s", txt) + if "GITHUB_OUTPUT" in os.environ: + with open(os.environ["GITHUB_OUTPUT"], "a") as f: + f.write(txt) + f.write("\n") + else: + logger.warning("GITHUB_OUTPUT not defined") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) + diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml deleted file mode 100644 index 875b01dc847c9..0000000000000 --- a/.github/workflows/emscripten.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Build (Emscripten) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - emscripten: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: mymindstorm/setup-emsdk@v14 - with: - version: 3.1.35 - - name: Install ninja - run: | - sudo apt-get -y update - sudo apt-get install -y ninja-build - - name: Configure (CMake) - run: | - emcmake cmake -S . -B build \ - -Wdeprecated -Wdev -Werror \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_INSTALL_PREFIX=prefix \ - -GNinja - - name: Build (CMake) - run: cmake --build build/ --verbose - - name: Run build-time tests - run: | - set -eu - export SDL_TESTS_QUICK=1 - # FIXME: enable Emscripten build time tests - # ctest -VV --test-dir build/ - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build/ - - name: Package (CPack) - run: | - cmake --build build/ --config Debug --target package - - name: Verify CMake configuration files - run: | - emcmake cmake -S cmake/test -B cmake_config_build \ - -DCMAKE_BUILD_TYPE=Debug \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DTEST_SHARED=FALSE \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} - cmake --build cmake_config_build --verbose - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-emscripten - path: build/dist/SDL3* diff --git a/.github/workflows/generic.yml b/.github/workflows/generic.yml new file mode 100644 index 0000000000000..917b4b735cba9 --- /dev/null +++ b/.github/workflows/generic.yml @@ -0,0 +1,341 @@ +name: 'Build' +run-name: 'Configure, Build and Test SDL' + +on: + workflow_call: + inputs: + platforms: + description: 'JSON-encoded test properties' + type: string + required: true + +jobs: + build: + name: ${{ matrix.platform.name }} + runs-on: ${{ matrix.platform.os }} + container: ${{ matrix.platform.container }} + defaults: + run: + shell: ${{ matrix.platform.shell }} + strategy: + fail-fast: false + matrix: + platform: ${{ fromJSON(inputs.platforms) }} + steps: + - name: 'Set up MSYS2' + if: ${{ matrix.platform.platform == 'msys2' }} + uses: msys2/setup-msys2@v2 + with: + msystem: ${{ matrix.platform.msys2-msystem }} + install: >- + ${{ matrix.platform.msys2-env }}-cc + ${{ matrix.platform.msys2-env }}-cmake + ${{ matrix.platform.msys2-env }}-ninja + ${{ (!matrix.platform.msys2-no-perl && format('{0}-perl', matrix.platform.msys2-env)) || '' }} + ${{ matrix.platform.msys2-env }}-pkg-config + ${{ matrix.platform.msys2-env }}-clang-tools-extra + - uses: actions/checkout@v4 + - name: 'Set up ninja' + if: ${{ matrix.platform.setup-ninja }} + uses: ./.github/actions/setup-ninja + - name: 'Set up libusb' + id: libusb + if: ${{ matrix.platform.setup-libusb-arch != '' }} + uses: ./.github/actions/setup-msvc-libusb + with: + arch: ${{ matrix.platform.setup-libusb-arch }} + - uses: mymindstorm/setup-emsdk@v14 + if: ${{ matrix.platform.platform == 'emscripten' }} + with: + version: 3.1.35 + - uses: nttld/setup-ndk@v1 + if: ${{ matrix.platform.android-ndk }} + id: setup-ndk + with: + local-cache: true + ndk-version: r21e + - name: 'Configure Android NDK variables' + if: ${{ matrix.platform.android-ndk }} + shell: sh + run: | + # We cannot use GitHub expressions in the controller job + echo "ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >>$GITHUB_ENV + - uses: actions/setup-java@v4 + if: ${{ matrix.platform.java }} + with: + distribution: 'temurin' + java-version: '17' + - uses: ilammy/msvc-dev-cmd@v1 + if: ${{ matrix.platform.platform == 'msvc' }} + with: + arch: ${{ matrix.platform.msvc-vcvars }} + - name: 'Set up LoongArch64 toolchain' + uses: ./.github/actions/setup-loongarch64-toolchain + id: setup-loongarch64-toolchain + if: ${{ matrix.platform.platform == 'loongarch64' }} + with: + version: '2022.09.0' + - name: 'Configure LoongArch64 variables' + if: ${{ matrix.platform.platform == 'loongarch64' }} + shell: sh + run: | + # We cannot use GitHub expressions in the controller job + echo "LOONGARCH64_CC=${{ steps.setup-loongarch64-toolchain.outputs.cc }}" >>$GITHUB_ENV + echo "LOONGARCH64_CXX=${{ steps.setup-loongarch64-toolchain.outputs.cxx }}" >>$GITHUB_ENV + - name: 'Setup Intel oneAPI toolchain' + id: intel + if: ${{ matrix.platform.intel }} + run: | + # Download the key to system keyring + wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ + | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null + + # Add signed entry to apt sources and configure the APT client to use Intel repository: + echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + + # Update package list + sudo apt-get update -y + + # Install oneAPI + sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic + - name: 'Install apk packages' + if: ${{ matrix.platform.apk-packages != '' }} + run: | + ${{ matrix.platform.sudo }} apk update + ${{ matrix.platform.sudo }} apk add ${{ matrix.platform.apk-packages }} + - name: 'Install apt packages' + if: ${{ matrix.platform.apt-packages != '' }} + run: | + ${{ matrix.platform.sudo }} apt-get update + ${{ matrix.platform.sudo }} apt-get install -y ${{ matrix.platform.apt-packages }} + - name: 'Install brew packages' + if: ${{ matrix.platform.brew-packages != '' }} + run: | + export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 + brew update + brew install ${{ matrix.platform.brew-packages }} + + - name: 'Pollute toolchain with "bad SDL headers' + if: ${{ matrix.platform.pollute-directories != '' }} + #shell: ${{ matrix.platform.shell }} + run: | + # Create "bad" SDL headers in the toolchain. + # SDL sources should not use these. + for include in ${{ matrix.platform.pollute-directories }}; do + toolchain_directory="${include}/SDL3" + echo "Creating directory ${toolchain_directory}" + mkdir -p "${toolchain_directory}/SDL3" + for header in include/SDL3/*.h; do + dest="${toolchain_directory}/SDL3/$(basename "${header}")" + echo "Creating ${dest}" + echo '#error "System SDL headers must not be used by build system"' >"$dest" + done + done + + - name: 'Configure (CMake)' + if: ${{ !matrix.platform.no-cmake }} + #shell: ${{ matrix.platform.shell }} + run: | + ${{ matrix.platform.source-cmd }} + ${{ matrix.platform.cmake-config-emulator }} cmake -S . -B build -GNinja \ + -Wdeprecated -Wdev -Werror \ + ${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \ + -DSDL_WERROR=${{ matrix.platform.werror }} \ + -DSDL_EXAMPLES=${{ matrix.platform.build-tests }} \ + -DSDL_TESTS=${{ matrix.platform.build-tests }} \ + -DSDL_INSTALL_TESTS=${{ matrix.platform.build-tests }} \ + -DSDL_CLANG_TIDY=${{ matrix.platform.clang-tidy }} \ + -DSDL_DISABLE_INSTALL_DOCS=OFF \ + -DSDL_DISABLE_INSTALL_CPACK=OFF \ + -DSDL_DISABLE_INSTALL_DOCS=OFF \ + ${{ matrix.platform.cmake-arguments }} \ + -DSDL_SHARED=${{ matrix.platform.shared }} \ + -DSDL_STATIC=${{ matrix.platform.static }} \ + -DSDL_VENDOR_INFO="Github Workflow" \ + -DCMAKE_INSTALL_PREFIX=prefix \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} + - name: 'Build (CMake)' + id: build + if: ${{ !matrix.platform.no-cmake }} +# shell: ${{ matrix.platform.shell }} + run: | + ${{ matrix.platform.source-cmd }} + cmake --build build --config ${{ matrix.platform.cmake-build-type }} --verbose -- ${{ matrix.platform.cmake-build-arguments }} + - name: 'Run build-time tests (CMake)' + id: tests + if: ${{ !matrix.platform.no-cmake && matrix.platform.run-tests }} +# shell: ${{ matrix.platform.shell }} + run: | + ${{ matrix.platform.source-cmd }} + set -eu + export SDL_TESTS_QUICK=1 + ctest -VV --test-dir build/ -j2 + if test "${{ runner.os }}" = "Linux"; then + # This should show us the SDL_REVISION + strings build/libSDL3.so.0 | grep SDL- + fi + - name: "Build test apk's (CMake)" + id: apks + if: ${{ steps.build.outcome == 'success' && matrix.platform.android-apks != '' }} +# shell: ${{ matrix.platform.shell }} + run: | + ${{ matrix.platform.source-cmd }} + cmake --build build --config ${{ matrix.platform.cmake-build-type }} \ + --target \ + ${{ matrix.platform.android-apks }} \ + --verbose \ + -- ${{ matrix.platform.cmake-build-arguments }} + - name: 'Install (CMake)' + id: install + if: ${{ steps.build.outcome == 'success' }} +# shell: ${{ matrix.platform.shell }} + run: | + ${{ matrix.platform.source-cmd }} + cmake --install build --config ${{ matrix.platform.cmake-build-type }} + echo "prefix=$(pwd)/prefix" >> $GITHUB_OUTPUT + ( cd prefix; find . ) | LC_ALL=C sort -u + - name: 'Package (CPack)' + id: package + if: ${{ steps.build.outcome == 'success' }} +# shell: ${{ matrix.platform.shell }} + run: | + # DMG creation on macOS occasionally fails, so try multiple times + # https://gitlab.kitware.com/cmake/cmake/-/issues/25671 + success=0 + max_tries=10 + for i in $(seq $max_tries); do + cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --target package -- ${{ matrix.platform.cmake-build-arguments }} && success=1 + if test $success = 1; then + break + fi + echo "Package creation failed. Sleep 1 second and try again." + sleep 1 + done + if test $success = 0; then + echo "Package creation failed after $max_tries attempts." + exit 1 + fi + - name: 'Verify CMake configuration files' + if: ${{ steps.install.outcome == 'success' }} +# shell: ${{ matrix.platform.shell }} + run: | + ${{ matrix.platform.source-cmd }} + ${{ matrix.platform.cmake-config-emulator }} cmake -S cmake/test -B cmake_test_build -GNinja \ + ${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \ + -DTEST_SHARED=${{ matrix.platform.shared }} \ + -DTEST_STATIC=${{ matrix.platform.static }} \ + ${{ matrix.platform.cmake-arguments }} \ + -DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} \ + -DCMAKE_PREFIX_PATH="${{ steps.install.outputs.prefix }}" + cmake --build cmake_test_build --verbose --config ${{ matrix.platform.cmake-build-type }} -- ${{ matrix.platform.cmake-build-arguments }} + - name: 'Extract CC/CXX/CFLAGS/CXXFLAGS from CMake toolchain' + if: ${{ steps.install.outcome == 'success' && matrix.platform.cc-from-cmake }} +# shell: ${{ matrix.platform.shell }} + run: | + cmake -S .github/cmake -B /tmp/cmake_extract \ + ${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \ + -DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} \ + -DVAR_PATH=/tmp/env.txt + cat /tmp/env.txt >> $GITHUB_ENV + - name: 'Verify sdl3.pc' +# shell: ${{ matrix.platform.shell }} + if: ${{ steps.install.outcome == 'success' && matrix.platform.test-pkg-config }} + run: | + ${{ matrix.platform.source-cmd }} + ${{ matrix.platform.cc && format('export CC="{0}"', matrix.platform.cc) || '' }} + ${{ matrix.platform.cflags && format('export CFLAGS="{0}"', matrix.platform.cflags) || '' }} + ${{ matrix.platform.ldflags && format('export LDFLAGS="{0}"', matrix.platform.ldflags) || '' }} + export PKG_CONFIG_PATH=${{ steps.install.outputs.prefix }}/lib/pkgconfig + cmake/test/test_pkgconfig.sh + - name: 'Build (cross-platform-actions, BSD)' + id: cpactions + if: ${{ matrix.platform.cpactions }} + uses: cross-platform-actions/action@v0.25.0 + with: + operating_system: ${{ matrix.platform.cpactions-os }} + architecture: ${{ matrix.platform.cpactions-arch }} + version: ${{ matrix.platform.cpactions-version }} + run: | + ${{ matrix.platform.cpactions-setup-cmd }} + ${{ matrix.platform.cpactions-install-cmd }} + cmake -S . -B build -GNinja \ + ${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \ + -Wdeprecated -Wdev -Werror \ + -DSDL_WERROR=${{ matrix.platform.werror }} \ + -DSDL_DISABLE_INSTALL_DOCS=OFF \ + ${{ matrix.platform.cmake-arguments }} \ + -DSDL_SHARED=${{ matrix.platform.shared }} \ + -DSDL_STATIC=${{ matrix.platform.static }} \ + -DSDL_VENDOR_INFO="Github Workflow" \ + -DCMAKE_INSTALL_PREFIX=prefix \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} + cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --verbose + cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --target package + + cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --target clean + rm -rf build/dist/_CPack_Packages + rm -rf build/CMakeFiles + rm -rf build/docs + - name: "Upload Android test apk's" + uses: actions/upload-artifact@v4 + if: ${{ always() && matrix.platform.artifact != '' && steps.apks.outcome == 'success' }} + with: + if-no-files-found: error + name: '${{ matrix.platform.artifact }}-apks' + path: build/test/*.apk + - name: Add msbuild to PATH + id: setup-msbuild + if: ${{ matrix.platform.msvc-project != '' }} + uses: microsoft/setup-msbuild@v2 + - name: Build msbuild + if: ${{ matrix.platform.msvc-project != '' }} + run: | + "$(cygpath -u '${{ steps.setup-msbuild.outputs.msbuildPath }}\msbuild.exe')" ${{ matrix.platform.msvc-project }} -m -p:BuildInParallel=true -p:Configuration=Release ${{ matrix.platform.msvc-project-flags }} + - name: 'Build (Android.mk)' + if: ${{ matrix.platform.android-mk }} + run: | + ./build-scripts/androidbuildlibs.sh + - name: 'Create Gradle project (Android)' + if: ${{ matrix.platform.android-gradle }} + run: | + for folder in build-ndk-build build-cmake; do + python build-scripts/create-android-project.py \ + --output "${folder}" \ + --variant copy \ + org.libsdl.testspriteminimal \ + test/testspriteminimal.c test/icon.h + done + echo "" + echo "Project contents:" + echo "" + find "build-ndk-build/org.libsdl.testspriteminimal" + - name: 'Build Android app (Gradle & ndk-build)' + if: ${{ matrix.platform.android-gradle }} + run: | + cd build-ndk-build/org.libsdl.testspriteminimal + ./gradlew -i assembleRelease + - name: 'Build Android app (Gradle & CMake)' + if: ${{ matrix.platform.android-gradle }} + run: | + cd build-cmake/org.libsdl.testspriteminimal + ./gradlew -i assembleRelease -PBUILD_WITH_CMAKE=1 + - name: 'Build (xcode)' + if: ${{ matrix.platform.xcode-sdk != '' }} + run: | + xcodebuild -project Xcode/SDL/SDL.xcodeproj -target SDL3 -configuration Release -sdk ${{ matrix.platform.xcode-sdk }} clean build + - name: 'Upload binary package' + uses: actions/upload-artifact@v4 + if: ${{ always() && matrix.platform.artifact != '' && (steps.package.outcome == 'success' || steps.cpactions.outcome == 'success') }} + with: + if-no-files-found: error + name: '${{ matrix.platform.artifact }}' + path: build/dist/SDL3* + - name: 'Upload minidumps' + uses: actions/upload-artifact@v4 + if: ${{ always() && steps.tests.outcome == 'failure' && (matrix.platform.platform == 'msvc' || matrix.platform.platform == 'msys2') }} + with: + if-no-files-found: ignore + name: '${{ matrix.platform.artifact }}-minidumps' + path: build/**/*.dmp diff --git a/.github/workflows/haiku.yml b/.github/workflows/haiku.yml deleted file mode 100644 index b157a0cb1e919..0000000000000 --- a/.github/workflows/haiku.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Build (Haiku) - -on: [push, pull_request] - -jobs: - haiku: - runs-on: ubuntu-latest - name: Haiku - container: haiku/cross-compiler:x86_64-r1beta4 - steps: - - uses: actions/checkout@v4 - - name: Setup dependencies - run: | - apt-get install pkg-config -y - - name: Configure Haiku environment variables - run: | - echo "CC=x86_64-unknown-haiku-gcc" >> $GITHUB_ENV - echo "CXX=x86_64-unknown-haiku-g++" >> $GITHUB_ENV - - name: Configure (CMake) - run: | - cmake -S . -B build -GNinja \ - -Wdeprecated -Wdev -Werror \ - -DSDL_SHARED=ON \ - -DSDL_STATIC=ON \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_VENDOR_INFO=Github_Workflow \ - -DCMAKE_INSTALL_PREFIX=cmake_prefix \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_SYSTEM_NAME=Haiku - - name: Build (CMake) - run: | - cmake --build build/ --config Release --verbose --parallel - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV - cmake --install build/ --config Release - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_SYSTEM_NAME=Haiku - cmake --build ./cmake_config_build --verbose - - name: Verify sdl3.pc - run: | - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-haiku - path: build/dist/SDL3* diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml deleted file mode 100644 index f791e89d56405..0000000000000 --- a/.github/workflows/ios.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Build (iOS/tvOS) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - Build: - name: ${{ matrix.platform.name }} - runs-on: macos-latest - - strategy: - fail-fast: false - matrix: - platform: - - { name: iOS, target: SDL3, sdk: iphoneos } - - { name: tvOS, target: SDL3, sdk: appletvos } - - steps: - - uses: actions/checkout@v4 - - name: Build - run: xcodebuild -project Xcode/SDL/SDL.xcodeproj -target '${{ matrix.platform.target }}' -configuration Release -sdk ${{ matrix.platform.sdk }} clean build diff --git a/.github/workflows/loongarch64.yml b/.github/workflows/loongarch64.yml deleted file mode 100644 index 174e9d4835431..0000000000000 --- a/.github/workflows/loongarch64.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Build (LoongArch64) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - loongarch64: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - platform: - - { toolchain-version: 2022.09.06 } - steps: - - uses: actions/checkout@v4 - - name: Install build requirements - run: | - sudo apt-get update -y - sudo apt-get install -y --no-install-recommends cmake ninja-build pkg-config tar wget - - - uses: actions/cache/restore@v4 - id: restore-cache - with: - path: /opt/cross-tools - key: loongarch64-${{ matrix.platform.toolchain-version }} - - - name: Download LoongArch64 gcc+glibc toolchain - if: ${{ !steps.restore-cache.outputs.cache-hit }} - run: | - url="https://github.com/loongson/build-tools/releases/download/${{ matrix.platform.toolchain-version }}/loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz" - - wget "$url" -O /tmp/toolchain.tar.xz - - mkdir -p /opt - tar -C /opt -x -f /tmp/toolchain.tar.xz - - - uses: actions/cache/save@v3 - if: ${{ !steps.restore-cache.outputs.cache-hit }} - with: - path: /opt/cross-tools - key: loongarch64-${{ matrix.platform.toolchain-version }} - - - name: Set-up Loongarch64 build environment - run: | - echo "/opt/cross-tools/bin" >> $GITHUB_PATH - echo "CC=loongarch64-unknown-linux-gnu-gcc" >> $GITHUB_ENV - echo "CXX=loongarch64-unknown-linux-gnu-g++" >> $GITHUB_ENV - - - name: Configure (CMake) - run: | - cmake -S . -B build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DSDL_SHARED=ON \ - -DSDL_STATIC=ON \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix - - name: Build (CMake) - run: | - cmake --build build --verbose - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build/ - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DTEST_SHARED=TRUE \ - -DTEST_STATIC=TRUE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - run: | - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-loongarch64 - path: build/dist/SDL3* diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index f562d640cb564..0000000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,188 +0,0 @@ -name: Build - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - Build: - name: ${{ matrix.platform.name }} - runs-on: ${{ matrix.platform.os }} - - defaults: - run: - shell: ${{ matrix.platform.shell }} - - strategy: - fail-fast: false - matrix: - platform: - - { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, cmake: '-DSDLTEST_PROCDUMP=ON', artifact: 'SDL-mingw32', no-perl: true } - - { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, cmake: '-DSDLTEST_PROCDUMP=ON', artifact: 'SDL-mingw64' } - - { name: Windows (clang32), os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686, cmake: '-DSDLTEST_PROCDUMP=ON', artifact: 'SDL-msys2-clang32', no-perl: true } - - { name: Windows (clang64), os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64, cmake: '-DSDLTEST_PROCDUMP=ON', artifact: 'SDL-msys2-clang64' } - - { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64, cmake: '-DSDLTEST_PROCDUMP=ON', artifact: 'SDL-msys2-ucrt64' } - - { name: Ubuntu 20.04, os: ubuntu-20.04, shell: sh, artifact: 'SDL-ubuntu20.04' } - - { name: Intel oneAPI (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-oneapi', intel: true, - source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icx; export CXX=icx;'} - - { name: Intel Compiler (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-icc', intel: true, cmake: '-DSDL_CLANG_TIDY=OFF', - source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icc; export CXX=icpc; export CFLAGS=-diag-disable=10441; export CXXFLAGS=-diag-disable=10441; '} - - { name: Ubuntu 22.04, os: ubuntu-22.04, shell: sh, artifact: 'SDL-ubuntu22.04' } - - { name: MacOS (Framework) (x86_64), os: macos-12, shell: sh, cmake-platform: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"', cmake: '-DSDL_FRAMEWORK=ON -DSDL_CLANG_TIDY=OFF', skip_test_pkgconfig: true, artifact: 'SDL-macos-framework', no-static: true } - - { name: MacOS (Framework) (arm64), os: macos-latest, shell: sh, cmake-platform: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"', cmake: '-DSDL_FRAMEWORK=ON -DSDL_CLANG_TIDY=OFF', skip_test_pkgconfig: true, no-static: true } - - { name: MacOS (GNU prefix), os: macos-latest, shell: sh, cmake-platform: '-DCMAKE_OSX_ARCHITECTURES="arm64"', cmake: '-DCLANG_TIDY_BINARY="$(brew --prefix llvm)/bin/clang-tidy"', artifact: 'SDL-macos-arm64-gnu' } - - { name: iOS (GNU prefix), os: macos-latest, shell: sh, cmake-platform: '-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"', cross-build: true, skip_test_pkgconfig: true, artifact: 'SDL-ios-gnu' } - - { name: tvOS (GNU prefix), os: macos-latest, shell: sh, cmake-platform: '-DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"', cross-build: true, skip_test_pkgconfig: true, artifact: 'SDL-tvos-gnu' } - - steps: - - name: Set up MSYS2 - if: matrix.platform.shell == 'msys2 {0}' - uses: msys2/setup-msys2@v2 - with: - msystem: ${{ matrix.platform.msystem }} - install: >- - ${{ matrix.platform.msys-env }}-cc - ${{ matrix.platform.msys-env }}-cmake - ${{ matrix.platform.msys-env }}-ninja - ${{ (!matrix.platform.no-perl && format('{0}-perl', matrix.platform.msys-env)) || '' }} - ${{ matrix.platform.msys-env }}-pkg-config - ${{ matrix.platform.msys-env }}-clang-tools-extra - - - name: Setup Linux dependencies - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install build-essential git \ - pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \ - libaudio-dev libjack-dev libsndio-dev libusb-1.0-0-dev libx11-dev libxext-dev \ - libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \ - libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \ - libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev - - - name: Setup extra Ubuntu 22.04 dependencies - if: matrix.platform.os == 'ubuntu-22.04' - run: | - sudo apt-get install libpipewire-0.3-dev libdecor-0-dev - - - name: Setup Macos dependencies - if: runner.os == 'macOS' - run: | - export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 - brew update - brew install \ - ninja \ - pkg-config \ - llvm - - - name: Setup Intel oneAPI - if: matrix.platform.intel - run: | - # Download the key to system keyring - wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ - | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null - - # Add signed entry to apt sources and configure the APT client to use Intel repository: - echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list - - # Update package list - sudo apt-get update -y - - # Install oneAPI - sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic - - - uses: actions/checkout@v4 - - name: Check that versioning is consistent - # We only need to run this once: arbitrarily use the Linux/CMake build - if: "runner.os == 'Linux'" - run: ./build-scripts/test-versioning.sh - - name: Configure (CMake) - run: | - ${{ matrix.platform.source_cmd }} - cmake -S . -B build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DSDL_SHARED=ON \ - -DSDL_STATIC=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_WERROR=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DSDL_CLANG_TIDY=ON \ - -DSDL_DISABLE_INSTALL_DOCS=${{ !matrix.platform.no-perl }} \ - -DCMAKE_INSTALL_PREFIX=cmake_prefix \ - -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DCMAKE_BUILD_TYPE=Release \ - ${{ matrix.platform.cmake-platform }} \ - ${{ matrix.platform.cmake }} - - name: Build (CMake) - id: build - run: | - ${{ matrix.platform.source_cmd }} - cmake --build build/ --config Release --verbose --parallel - - name: Run build-time tests (CMake) - id: tests - if: ${{ !matrix.platform.cross-build }} - run: | - ${{ matrix.platform.source_cmd }} - set -eu - export SDL_TESTS_QUICK=1 - ctest -VV --test-dir build/ -j2 - if test "${{ runner.os }}" = "Linux"; then - # This should show us the SDL_REVISION - strings build/libSDL3.so.0 | grep SDL- - fi - - name: Install (CMake) - run: | - ${{ matrix.platform.source_cmd }} - set -eu - cmake --install build/ --config Release - ( cd cmake_prefix; find . ) | LC_ALL=C sort -u - - name: Package (CPack) - if: ${{ always() && steps.build.outcome == 'success' }} - run: | - # DMG creation on macOS occasionally fails, so try multiple times - # https://gitlab.kitware.com/cmake/cmake/-/issues/25671 - success=0 - max_tries=10 - for i in $(seq $max_tries); do - cmake --build build/ --config Release --target package && success=1 - if test $success = 1; then - break - fi - echo "Package creation failed. Sleep 1 second and try again." - sleep 1 - done - if test $success = 0; then - echo "Package creation failed after $max_tries attempts." - exit 1 - fi - - name: Verify CMake configuration files - run: | - ${{ matrix.platform.source_cmd }} - cmake -S cmake/test -B cmake_config_build -G Ninja \ - ${{ matrix.platform.cmake-platform }} \ - -DTEST_SHARED=ON \ - -DTEST_STATIC=${{ !matrix.platform.no-static }} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=$(echo "${{ github.workspace }}/cmake_prefix" | sed -e 's#\\#/#g') - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - if: ${{ !matrix.platform.skip_test_pkgconfig }} - run: | - ${{ matrix.platform.source_cmd }} - export PKG_CONFIG_PATH=$(echo "${{ github.workspace }}/cmake_prefix/lib/pkgconfig" | sed -e 's#\\#/#g') - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - if: ${{ always() && steps.tests.outcome == 'failure' }} - with: - if-no-files-found: ignore - name: '${{ matrix.platform.artifact }}-minidumps' - path: build/**/*.dmp - - uses: actions/upload-artifact@v4 - if: ${{ always() && matrix.platform.artifact != '' && steps.build.outcome == 'success' }} - with: - if-no-files-found: error - name: ${{ matrix.platform.artifact }} - path: build/dist/SDL3* diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml deleted file mode 100644 index 6554d47ac8a7c..0000000000000 --- a/.github/workflows/msvc.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: Build (MSVC) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - Build: - name: ${{ matrix.platform.name }} - runs-on: windows-latest - - strategy: - fail-fast: false - matrix: - platform: - - { name: 'Windows (x64)', vcvars: 'x64', artifact: 'SDL-VC-x64', project: 'VisualC/SDL.sln', projectflags: '/p:Platform=x64', } - - { name: 'Windows (x86)', vcvars: 'x64_x86', artifact: 'SDL-VC-x86', project: 'VisualC/SDL.sln', projectflags: '/p:Platform=Win32', } - - { name: 'Windows (clang-cl x64)', vcvars: 'x64', artifact: 'SDL-clang-cl-x64', cmake-args: '-DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl', cppflags: '/clang:-m64', ldflags: '/MACHINE:X64', } - - { name: 'Windows (clang-cl x86)', vcvars: 'x86', artifact: 'SDL-clang-cl-x86', cmake-args: '-DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl', cppflags: '/clang:-m32', ldflags: '/MACHINE:X86', } - - { name: 'Windows (ARM)', vcvars: 'x64_arm', artifact: 'SDL-VC-arm32', notests: true, } - - { name: 'Windows (ARM64)', vcvars: 'x64_arm64', artifact: 'SDL-VC-arm64', notests: true, } - - { name: 'UWP (x64)', vcvars: 'x64', artifact: 'SDL-VC-UWP', notests: true, cmake-args: '-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DSDL_TESTS=OFF', - project: 'VisualC-WinRT/SDL-UWP.sln', projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0', } - - steps: - - uses: actions/checkout@v4 - - name: Set up ninja - uses: ./.github/actions/setup-ninja - - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: ${{ matrix.platform.vcvars }} - - name: Set up libusb - uses: ./.github/actions/setup-msvc-libusb-action - if: ${{ matrix.platform.libusb-arch != '' }} - id: libusb - with: - arch: ${{ matrix.platform.libusb-arch }} - - name: Create CMake project using SDL as a subproject - shell: python - run: | - import os - import textwrap - srcdir = r"${{ github.workspace }}".replace("\\", "/") - builddir = f"{ srcdir }/build" - os.makedirs(builddir) - cmakelists_txt = textwrap.dedent(f"""\ - # MSVC runtime library flags are selected by an abstraction - set(CMAKE_POLICY_DEFAULT_CMP0091 "NEW" CACHE STRING "MSVC runtime library flags are selected by an abstraction") - # MSVC debug information format flags are selected by an abstraction - set(CMAKE_POLICY_DEFAULT_CMP0141 "NEW" CACHE STRING "MSVC debug information format flags are selected by an abstraction") - cmake_minimum_required(VERSION 3.0...3.25) - project(sdl_user) - # Always build .PDB symbol file - set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "MSVC debug information format" FORCE) - set(CMAKE_EXE_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flags for executables" FORCE) - set(CMAKE_SHARED_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flag for shared libraries" FORCE) - if(WINDOWS_STORE) # WINDOWS_STORE is available AFTER project() - # UWP only supports dynamic runtime - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL" CACHE STRING "MSVC runtime libary" FORCE) - else() - # Use static runtime library - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>" CACHE STRING "MSVC runtime libary" FORCE) - endif() - enable_testing() - add_subdirectory("{ srcdir }" SDL) - """) - print(cmakelists_txt) - with open(f"{ builddir }/CMakeLists.txt", "w") as f: - f.write(cmakelists_txt) - - name: Configure (CMake) - run: cmake -S build -B build -GNinja ` - -Wdeprecated -Wdev -Werror ` - -DCMAKE_BUILD_TYPE=Release ` - -DSDL_WERROR=ON ` - -DSDL_SHARED=ON ` - -DSDL_STATIC=ON ` - -DSDL_TESTS=ON ` - -DSDL_EXAMPLES=ON \ - -DCMAKE_C_FLAGS="${{ matrix.platform.cppflags }}" ` - -DCMAKE_CXX_FLAGS="${{ matrix.platform.cppflags }}" ` - -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.platform.ldflags }}" ` - -DCMAKE_SHARED_LINKER_FLAGS="${{ matrix.platform.ldflags }}" ` - -DCMAKE_STATIC_LINKER_FLAGS="${{ matrix.platform.ldflags }}" ` - -DSDL_INSTALL_TESTS=ON ` - -DSDL_VENDOR_INFO="Github Workflow" ` - -DSDL_DISABLE_INSTALL=OFF ` - -DSDL_DISABLE_INSTALL_CPACK=OFF ` - -DSDL_DISABLE_INSTALL_DOCS=OFF ` - -DSDLTEST_PROCDUMP=ON ` - -DLibUSB_ROOT="${{ steps.libusb.outputs.root }}" ` - ${{ matrix.platform.cmake-args }} ` - -DCMAKE_INSTALL_PREFIX=prefix - - name: Build (CMake) - id: build - run: | - cmake --build build/ --config Release --verbose --parallel - - name: Run build-time tests - id: tests - if: ${{ !matrix.platform.notests }} - run: | - $env:SDL_TESTS_QUICK=1 - ctest -VV --test-dir build/ -C Release -j2 - - name: Install (CMake) - run: | - echo "SDL3_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV - cmake --install build/ - - name: Package (CPack) - if: ${{ always() && steps.build.outcome == 'success' }} - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -GNinja ` - -DCMAKE_BUILD_TYPE=Release ` - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} ` - -DCMAKE_C_FLAGS="${{ matrix.platform.cppflags }}" ` - -DCMAKE_CXX_FLAGS="${{ matrix.platform.cppflags }}" ` - -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.platform.ldflags }}" ` - -DCMAKE_SHARED_LINKER_FLAGS="${{ matrix.platform.ldflags }}" ` - -DCMAKE_STATIC_LINKER_FLAGS="${{ matrix.platform.ldflags }}" ` - ${{ matrix.platform.cmake-args }} - cmake --build cmake_config_build --config Release - - name: Add msbuild to PATH - if: ${{ matrix.platform.project != '' }} - uses: microsoft/setup-msbuild@v2 - - name: Build msbuild - if: ${{ matrix.platform.project != '' }} - run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }} - - uses: actions/upload-artifact@v4 - if: ${{ always() && steps.tests.outcome == 'failure' }} - with: - if-no-files-found: ignore - name: '${{ matrix.platform.artifact }}-minidumps' - path: build/**/*.dmp - - uses: actions/upload-artifact@v4 - if: ${{ always() && steps.build.outcome == 'success' }} - with: - if-no-files-found: error - name: ${{ matrix.platform.artifact }} - path: build/dist/SDL3* diff --git a/.github/workflows/n3ds.yml b/.github/workflows/n3ds.yml deleted file mode 100644 index 17025fe6e1c6d..0000000000000 --- a/.github/workflows/n3ds.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Build (Nintendo 3DS) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - n3ds: - runs-on: ubuntu-latest - container: - image: devkitpro/devkitarm:latest - steps: - - uses: actions/checkout@v4 - - name: Install build requirements - run: | - apt update - apt install ninja-build - - name: Configure (CMake) - run: | - cmake -S . -B build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix - - name: Build (CMake) - run: | - cmake --build build --verbose - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build/ - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \ - -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose - - name: Extract CC/CXX/CFLAGS/CXXFLAGS from CMake toolchain - run: | - cmake -S .github/cmake -B /tmp/cmake_extract \ - -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DVAR_PATH=/tmp/n3ds_env.txt - cat /tmp/n3ds_env.txt >> $GITHUB_ENV - - name: Verify sdl3.pc - run: | - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-n3ds - path: build/dist/SDL3* diff --git a/.github/workflows/ppc64le.yml b/.github/workflows/ppc64le.yml deleted file mode 100644 index dc3b9de84e682..0000000000000 --- a/.github/workflows/ppc64le.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Build (PowerPC64) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - ppc64le: - runs-on: ubuntu-latest - container: - image: dockcross/linux-ppc64le:latest - steps: - - uses: actions/checkout@v4 - - name: Install build requirements - run: | - apt-get update -y - apt-get install -y cmake ninja-build - - name: Configure (CMake) - run: | - # FIXME: Enable SDL_WERROR - cmake -S . -B build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DSDL_SHARED=ON \ - -DSDL_STATIC=ON \ - -DSDL_WERROR=OFF \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix - - name: Build (CMake) - run: | - cmake --build build --verbose - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build/ - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DTEST_SHARED=TRUE \ - -DTEST_STATIC=TRUE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - run: | - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-ppc64le - path: build/dist/SDL3* diff --git a/.github/workflows/ps2.yml b/.github/workflows/ps2.yml deleted file mode 100644 index cb5a3c86c9b09..0000000000000 --- a/.github/workflows/ps2.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Build (Sony Playstation 2) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - ps2: - runs-on: ubuntu-latest - container: ps2dev/ps2dev:latest - steps: - - uses: actions/checkout@v4 - - name: Setup dependencies - run: | - apk update - apk add cmake gmp mpc1 mpfr4 ninja pkgconf make git - - - name: Configure (CMake) - run: | - cmake -S . -B build -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DCMAKE_INSTALL_PREFIX=cmake_prefix \ - -DCMAKE_BUILD_TYPE=Release - - name: Build (CMake) - run: cmake --build build --config Release --verbose - - name: Install (CMake) - run: | - set -eu - cmake --install build/ --config Release - echo "SDL3_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV - ( cd cmake_prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \ - -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - run: | - export CC=mips64r5900el-ps2-elf-gcc - export LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/gsKit/lib -L$PS2DEV/ps2sdk/ports/lib" - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-ps2 - path: build/dist/SDL3* diff --git a/.github/workflows/psp.yml b/.github/workflows/psp.yml deleted file mode 100644 index 26fbb4489ece2..0000000000000 --- a/.github/workflows/psp.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Build (Sony Playstation Portable) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - psp: - runs-on: ubuntu-latest - container: pspdev/pspdev:latest - steps: - - uses: actions/checkout@v4 - - name: Setup dependencies - run: | - apk update - apk add cmake gmp mpc1 mpfr4 make pkgconf - - name: Pollute PSP SDK with "bad" SDL headers - run: | - # Create "bad" SDL headers in the PSP SDK. - # SDL sources should not use these. - infixes=". psp psp/sdk" - for infix in $infixes; do - directory="$PSPDEV/$infix/include/SDL3" - echo "Creating directory $directory" - mkdir -p "$directory" - for include in include/SDL3/*.h; do - dest="$PSPDEV/$infix/include/SDL3/$(basename "$include")" - echo "Creating $dest" - echo '#error "System SDL headers must not be used by build system"' >"$dest" - done - done - - name: Configure (CMake) - run: | - cmake -S . -B build \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix - - name: Build (CMake) - run: cmake --build build --config Release --verbose - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build --config Release - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build \ - -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DTEST_SHARED=FALSE \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - run: | - export CC=psp-gcc - export LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib" - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-psp - path: build/dist/SDL3* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9cd89c6968529..21bf742e24ef8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -561,11 +561,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.10' - - name: 'Setup Android NDK' - uses: nttld/setup-ndk@v1 - with: - local-cache: true - ndk-version: r21e - uses: actions/setup-java@v4 with: distribution: 'temurin' diff --git a/.github/workflows/riscos.yml b/.github/workflows/riscos.yml deleted file mode 100644 index 6c521995d7793..0000000000000 --- a/.github/workflows/riscos.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Build (RISC OS) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - Build: - name: ${{ matrix.platform.name }} - runs-on: ubuntu-latest - container: riscosdotinfo/riscos-gccsdk-4.7:latest - - strategy: - fail-fast: false - matrix: - platform: - - { name: CMake } - - steps: - - name: Setup dependencies - run: apt-get update && apt-get install -y cmake ninja-build - - uses: actions/checkout@v4 - - name: Configure (CMake) - if: ${{ contains(matrix.platform.name, 'CMake') }} - run: | - cmake -S . -B build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake \ - -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON \ - -DRISCOS:BOOL=ON \ - -DSDL_GCC_ATOMICS=OFF \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/prefix_cmake - - name: Build (CMake) - if: ${{ contains(matrix.platform.name, 'CMake') }} - run: cmake --build build --verbose - - name: Install (CMake) - if: ${{ contains(matrix.platform.name, 'CMake') }} - run: | - echo "SDL3_DIR=${{ github.workspace }}/prefix_cmake" >> $GITHUB_ENV - cmake --install build/ - ( cd ${{ github.workspace }}/prefix_cmake; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DTEST_SHARED=OFF \ - -DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_BUILD_TYPE=Release \ - ${{ matrix.platform.test_args }} - cmake --build cmake_config_build --verbose - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-riscos - path: build/dist/SDL3* diff --git a/.github/workflows/visionos.yml.disabled b/.github/workflows/visionos.yml.disabled deleted file mode 100644 index d02a74f84a31c..0000000000000 --- a/.github/workflows/visionos.yml.disabled +++ /dev/null @@ -1,22 +0,0 @@ -name: Build (visionOS) - -# FIXME: Enable this workflow once CMake 3.28 becomes available on GitHub -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - Build: - name: visionOS - runs-on: macos-latest - - steps: - - uses: actions/checkout@v4 - - name: Configure - run: | - cmake -B build -GXcode -DCMAKE_SYSTEM_NAME=visionOS - - name: Build - run: | - cmake --build build diff --git a/.github/workflows/vita.yml b/.github/workflows/vita.yml deleted file mode 100644 index 036c939080fb3..0000000000000 --- a/.github/workflows/vita.yml +++ /dev/null @@ -1,138 +0,0 @@ -name: Build (Sony Playstation Vita) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -defaults: - run: - shell: sh - -jobs: - vita: - name: ${{ matrix.platform.name }} - runs-on: ubuntu-latest - container: - image: vitasdk/vitasdk:latest - strategy: - fail-fast: false - matrix: - platform: - - { name: Vita (GLES w/ pib), pib: true, version: 1.1.4, artifact: SDL-vita-pib } - - { name: Vita (GLES w/ PVR_PSP2 + gles4vita), pvr: true, version: 3.9, artifact: SDL-vita-pvr } - - steps: - - uses: actions/checkout@v4 - - name: Install build requirements - run: | - apk update - apk add cmake ninja pkgconf bash tar - - - uses: actions/cache/restore@v4 - id: restore-cache - with: - path: /vita/dependencies - key: ${{ matrix.platform.artifact }}-${{ matrix.platform.version }} - - - name: Download PVR_PSP2 (GLES) - if: ${{ !!matrix.platform.pvr && !steps.restore-cache.outputs.cache-hit }} - run: | - pvr_psp2_version=${{ matrix.platform.version }} - - mkdir -p /vita/dependencies/include - mkdir -p /vita/dependencies/lib - - # Configure PVR_PSP2 headers - wget https://github.com/GrapheneCt/PVR_PSP2/archive/refs/tags/v$pvr_psp2_version.zip -P/tmp - unzip /tmp/v$pvr_psp2_version.zip -d/tmp - cp -r /tmp/PVR_PSP2-$pvr_psp2_version/include/* /vita/dependencies/include - rm /tmp/v$pvr_psp2_version.zip - - # include guard of PVR_PSP2's khrplatform.h does not match the usual one - sed -i -e s/__drvkhrplatform_h_/__khrplatform_h_/ /vita/dependencies/include/KHR/khrplatform.h - - # Configure PVR_PSP2 stub libraries - wget https://github.com/GrapheneCt/PVR_PSP2/releases/download/v$pvr_psp2_version/vitasdk_stubs.zip -P/tmp - unzip /tmp/vitasdk_stubs.zip -d/tmp/pvr_psp2_stubs - find /tmp/pvr_psp2_stubs -type f -name "*.a" -exec cp {} /vita/dependencies/lib \; - rm /tmp/vitasdk_stubs.zip - rm -rf /tmp/pvr_psp2_stubs - - - name: Download gl4es4vita (OpenGL) - if: ${{ !!matrix.platform.pib && !steps.restore-cache.outputs.cache-hit }} - run: | - gl4es4vita_version=${{ matrix.platform.version }} - - mkdir -p /vita/dependencies/include - mkdir -p /vita/dependencies/lib - - # Configure gl4es4vita headers - wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/include.zip -P/tmp - unzip -o /tmp/include.zip -d/vita/dependencies/include - rm /tmp/include.zip - - # Configure gl4es4vita stub libraries - wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/vitasdk_stubs.zip -P/tmp - unzip /tmp/vitasdk_stubs.zip -d/vita/dependencies/lib - - - uses: actions/cache/save@v4 - if: ${{ !steps.restore-cache.outputs.cache-hit }} - with: - path: /vita/dependencies - key: ${{ matrix.platform.artifact }}-${{ matrix.platform.version }} - - - name: Copy PVR_PSP2 (GLES) or gl4es4vita (OpenGL) to vita toolchain dir - run: | - cp -rv /vita/dependencies/* ${VITASDK}/arm-vita-eabi - - - name: Fix vita.toolchain.cmake - run: | - # cache PKG_CONFIG_PATH - sed -i -E 's/set\( PKG_CONFIG_EXECUTABLE "\$\{VITASDK}\/bin\/arm-vita-eabi-pkg-config" )/set( PKG_CONFIG_EXECUTABLE "${VITASDK}\/bin\/arm-vita-eabi-pkg-config" CACHE PATH "Path of pkg-config executable" )/' ${VITASDK}/share/vita.toolchain.cmake - - - name: Configure (CMake) - run: | - cmake -S . -B build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ - -DVIDEO_VITA_PIB=${{ !!matrix.platform.pib }} \ - -DVIDEO_VITA_PVR=${{ !!matrix.platform.pvr }} \ - -DSDL_ARMNEON=ON \ - -DSDL_ARMSIMD=ON \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix - - name: Build (CMake) - run: cmake --build build --verbose - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build/ - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ - -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - run: | - export CC=arm-vita-eabi-gcc - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: ${{ matrix.platform.artifact }} - path: build/dist/SDL3* diff --git a/cmake/sdlcpu.cmake b/cmake/sdlcpu.cmake index 69142bc8322a8..c077fc075f2b6 100644 --- a/cmake/sdlcpu.cmake +++ b/cmake/sdlcpu.cmake @@ -79,6 +79,8 @@ ${src_main} include(CMakePushCheckState) + set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") + cmake_push_check_state(RESET) try_compile(SDL_CPU_CHECK_ALL "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/SDL_detect_arch" From eae6758abe26f5fc8078b3b03bdaf40499f3cabf Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 26 Jul 2024 00:19:18 +0200 Subject: [PATCH 015/253] ci: build haiku as canary --- .github/workflows/build.yml | 12 ++- .github/workflows/create-test-plan.py | 138 ++++++++++++++++---------- 2 files changed, 92 insertions(+), 58 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94fb83ca81bd9..1e1fcc9737c2c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,8 @@ jobs: name: 'Create test plan' runs-on: 'ubuntu-latest' outputs: - platforms: ${{ steps.plan.outputs.platforms }} + platforms-level1: ${{ steps.plan.outputs.platforms-level1 }} + platforms-others: ${{ steps.plan.outputs.platforms-others }} steps: - uses: actions/setup-python@main with: @@ -23,11 +24,16 @@ jobs: id: plan run: | python .github/workflows/create-test-plan.py \ - --github-variable platforms \ + --github-variable-prefix platforms \ --github-ci \ --verbose level1: needs: [controller] uses: './.github/workflows/generic.yml' with: - platforms: ${{ needs.controller.outputs.platforms }} + platforms: ${{ needs.controller.outputs.platforms-level1 }} + level2: + needs: [controller, level1] + uses: './.github/workflows/generic.yml' + with: + platforms: ${{ needs.controller.outputs.platforms-others }} diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py index e9be4a148e677..58d8ff308d34c 100755 --- a/.github/workflows/create-test-plan.py +++ b/.github/workflows/create-test-plan.py @@ -89,43 +89,43 @@ class JobSpec: uwp: bool = False -JOB_SPECS = [ - JobSpec(name="Windows (msys2, mingw32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32", msys2_platform=Msys2Platform.Mingw32, ), - JobSpec(name="Windows (msys2, mingw64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64", msys2_platform=Msys2Platform.Mingw64, ), - JobSpec(name="Windows (msys2, clang32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32-clang", msys2_platform=Msys2Platform.Clang32, ), - JobSpec(name="Windows (msys2, clang64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-clang", msys2_platform=Msys2Platform.Clang64, ), - JobSpec(name="Windows (msys2, ucrt64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-ucrt", msys2_platform=Msys2Platform.Ucrt64, ), - JobSpec(name="Windows (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_project="VisualC/SDL.sln", ), - JobSpec(name="Windows (MSVC, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_project="VisualC/SDL.sln", ), - JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ), - JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ), - JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ), - JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ), - JobSpec(name="UWP (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-UWP", msvc_arch=MsvcArch.X64, msvc_project="VisualC-WinRT/SDL-UWP.sln", uwp=True, ), - JobSpec(name="Ubuntu 20.04", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04", ), - JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", ), - JobSpec(name="Ubuntu 20.04 (Intel oneAPI)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-oneapi", intel=IntelCompiler.Icx, ), - JobSpec(name="Ubuntu 20.04 (Intel Compiler)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-icc", intel=IntelCompiler.Icc, ), - JobSpec(name="MacOS (Framework) (x86_64)", os=JobOs.Macos12, platform=SdlPlatform.MacOS, artifact="SDL-macos-framework", apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ), - JobSpec(name="MacOS (Framework) (arm64)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact=None, apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ), - JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-gnu", apple_framework=False, apple_archs={AppleArch.Aarch64, }, ), - JobSpec(name="Android (CMake)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, ), - JobSpec(name="Android (CMake, lean)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-lean-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, lean=True, ), - JobSpec(name="Android (Android.mk)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_mk=True, ), - JobSpec(name="iOS (xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Ios, artifact=None, no_cmake=True, ), - JobSpec(name="tvOS (xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Tvos, artifact=None, no_cmake=True, ), - JobSpec(name="Android (Gradle)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_gradle=True, ), - JobSpec(name="Emscripten", os=JobOs.UbuntuLatest, platform=SdlPlatform.Emscripten, artifact="SDL-emscripten", ), - JobSpec(name="Haiku", os=JobOs.UbuntuLatest, platform=SdlPlatform.Haiku, artifact="SDL-haiku-x64", container="haiku/cross-compiler:x86_64-r1beta4", ), - JobSpec(name="LoongArch64", os=JobOs.UbuntuLatest, platform=SdlPlatform.LoongArch64, artifact="SDL-loongarch64", ), - JobSpec(name="Nintendo 3DS", os=JobOs.UbuntuLatest, platform=SdlPlatform.N3ds, artifact="SDL-n3ds", container="devkitpro/devkitarm:latest", ), - JobSpec(name="PowerPC64", os=JobOs.UbuntuLatest, platform=SdlPlatform.PowerPC64, artifact="SDL-ppc64le", container="dockcross/linux-ppc64le:latest", ), - JobSpec(name="Sony PlayStation 2", os=JobOs.UbuntuLatest, platform=SdlPlatform.Ps2, artifact="SDL-ps2", container="ps2dev/ps2dev:latest", ), - JobSpec(name="Sony PlayStation Portable", os=JobOs.UbuntuLatest, platform=SdlPlatform.Psp, artifact="SDL-psp", container="pspdev/pspdev:latest", ), - JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ), - JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", ), - JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", ), -] +JOB_SPECS = { + "msys2-mingw32": JobSpec(name="Windows (msys2, mingw32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32", msys2_platform=Msys2Platform.Mingw32, ), + "msys2-mingw64": JobSpec(name="Windows (msys2, mingw64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64", msys2_platform=Msys2Platform.Mingw64, ), + "msys2-clang32": JobSpec(name="Windows (msys2, clang32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32-clang", msys2_platform=Msys2Platform.Clang32, ), + "msys2-clang64": JobSpec(name="Windows (msys2, clang64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-clang", msys2_platform=Msys2Platform.Clang64, ), + "msys2-ucrt64": JobSpec(name="Windows (msys2, ucrt64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-ucrt", msys2_platform=Msys2Platform.Ucrt64, ), + "msvc-x64": JobSpec(name="Windows (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_project="VisualC/SDL.sln", ), + "msvc-x86": JobSpec(name="Windows (MSVC, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_project="VisualC/SDL.sln", ), + "msvc-clang-x64": JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ), + "msvc-clang-x86": JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ), + "msvc-arm32": JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ), + "msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ), + "msvc-uwp-x64": JobSpec(name="UWP (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-UWP", msvc_arch=MsvcArch.X64, msvc_project="VisualC-WinRT/SDL-UWP.sln", uwp=True, ), + "ubuntu-20.04": JobSpec(name="Ubuntu 20.04", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04", ), + "ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", ), + "ubuntu-intel-icx": JobSpec(name="Ubuntu 20.04 (Intel oneAPI)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-oneapi", intel=IntelCompiler.Icx, ), + "ubuntu-intel-icc": JobSpec(name="Ubuntu 20.04 (Intel Compiler)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-icc", intel=IntelCompiler.Icc, ), + "macos-framework-x64": JobSpec(name="MacOS (Framework) (x86_64)", os=JobOs.Macos12, platform=SdlPlatform.MacOS, artifact="SDL-macos-framework", apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ), + "macos-framework-arm64": JobSpec(name="MacOS (Framework) (arm64)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact=None, apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ), + "amcos-gnu-arm64": JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-gnu", apple_framework=False, apple_archs={AppleArch.Aarch64, }, ), + "android-cmake": JobSpec(name="Android (CMake)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, ), + "android-cmake-lean": JobSpec(name="Android (CMake, lean)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-lean-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, lean=True, ), + "android-mk": JobSpec(name="Android (Android.mk)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_mk=True, ), + "android-gradle": JobSpec(name="Android (Gradle)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_gradle=True, ), + "ios-xcode": JobSpec(name="iOS (xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Ios, artifact=None, no_cmake=True, ), + "tvos-xcode": JobSpec(name="tvOS (xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Tvos, artifact=None, no_cmake=True, ), + "emscripten": JobSpec(name="Emscripten", os=JobOs.UbuntuLatest, platform=SdlPlatform.Emscripten, artifact="SDL-emscripten", ), + "haiku": JobSpec(name="Haiku", os=JobOs.UbuntuLatest, platform=SdlPlatform.Haiku, artifact="SDL-haiku-x64", container="haiku/cross-compiler:x86_64-r1beta4", ), + "loongarch64": JobSpec(name="LoongArch64", os=JobOs.UbuntuLatest, platform=SdlPlatform.LoongArch64, artifact="SDL-loongarch64", ), + "n3ds": JobSpec(name="Nintendo 3DS", os=JobOs.UbuntuLatest, platform=SdlPlatform.N3ds, artifact="SDL-n3ds", container="devkitpro/devkitarm:latest", ), + "ppc64": JobSpec(name="PowerPC64", os=JobOs.UbuntuLatest, platform=SdlPlatform.PowerPC64, artifact="SDL-ppc64le", container="dockcross/linux-ppc64le:latest", ), + "ps2": JobSpec(name="Sony PlayStation 2", os=JobOs.UbuntuLatest, platform=SdlPlatform.Ps2, artifact="SDL-ps2", container="ps2dev/ps2dev:latest", ), + "psp": JobSpec(name="Sony PlayStation Portable", os=JobOs.UbuntuLatest, platform=SdlPlatform.Psp, artifact="SDL-psp", container="pspdev/pspdev:latest", ), + "riscos": JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ), + "netbsd": JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", ), + "freebsd": JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", ), +} @dataclasses.dataclass(slots=True) @@ -578,34 +578,62 @@ def tf(b): return job +def specs_to_plaform(specs: tuple[JobSpec, ...]) -> list[dict[str, str|bool]]: + result = [] + for spec in specs: + logger.info("spec=%r", spec) + job = spec_to_job(spec) + logger.info("job=%r", job) + platform = job.to_workflow() + result.append(platform) + logger.info("platform=%r", platform) + return result + + def main(): parser = argparse.ArgumentParser(allow_abbrev=False) - parser.add_argument("--github-variable", default="platforms") + parser.add_argument("--github-variable-prefix", default="platforms") parser.add_argument("--github-ci", action="store_true") parser.add_argument("--verbose", action="store_true") args = parser.parse_args() logging.basicConfig(level=logging.INFO if args.verbose else logging.WARNING) - all_platforms = [] - for spec in JOB_SPECS: - logger.info("spec=%r", spec) - job = spec_to_job(spec) - logger.info("job=%r", job) - platform = job.to_workflow() - logger.info("platform=%r", platform) - all_platforms.append(platform) + remaining_keys = set(JOB_SPECS.keys()) + + all_level_keys = ( + # Level 1 + ( + "haiku", + ), + ) + + all_level_platforms = {} + + for level_i, level_keys in enumerate(all_level_keys, 1): + level_key = f"level{level_i}" + logger.info("Level %d: keys=%r", level_i, level_keys) + assert all(k in remaining_keys for k in level_keys) + level_specs = tuple(JOB_SPECS[key] for key in level_keys) + remaining_keys.difference_update(level_keys) + all_level_platforms[level_key] = specs_to_plaform(level_specs) + logger.info("=" * 80) + + logger.info("Remaining:") + remaining_specs = tuple(JOB_SPECS[key] for key in remaining_keys) + all_level_platforms["others"] = specs_to_plaform(remaining_specs) if args.github_ci: - platforms_json = json.dumps(all_platforms) - txt = f"{args.github_variable}={platforms_json}" - logger.info("%s", txt) - if "GITHUB_OUTPUT" in os.environ: - with open(os.environ["GITHUB_OUTPUT"], "a") as f: - f.write(txt) - f.write("\n") - else: - logger.warning("GITHUB_OUTPUT not defined") + for level, platforms in all_level_platforms.items(): + platforms_json = json.dumps(platforms) + txt = f"{args.github_variable_prefix}-{level}={platforms_json}" + logger.info("%s", txt) + if "GITHUB_OUTPUT" in os.environ: + with open(os.environ["GITHUB_OUTPUT"], "a") as f: + f.write(txt) + f.write("\n") + else: + logger.warning("GITHUB_OUTPUT not defined") return 0 From 12eb1f149709be7b1a2f100b6f5be0d2fca132e1 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 26 Jul 2024 18:48:27 +0200 Subject: [PATCH 016/253] ci: limit jobs by using sdl-ci-filter [sdl-ci-filter msvc-*] --- .github/workflows/build.yml | 10 +++++++++- .github/workflows/create-test-plan.py | 26 +++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e1fcc9737c2c..0d436ee753848 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,10 +23,18 @@ jobs: - name: 'Create plan' id: plan run: | + # Adding [sdl-ci-filter GLOB] to the commit message will limit the jobs + # e.g. [sdl-ci-filter msvc-*] + EOF=$(openssl rand -hex 32) + cat >/tmp/commit_message.txt <<$EOF + ${{ github.event.head_commit.message }} + $EOF + python .github/workflows/create-test-plan.py \ --github-variable-prefix platforms \ --github-ci \ - --verbose + --verbose \ + --commit-message-file /tmp/commit_message.txt level1: needs: [controller] uses: './.github/workflows/generic.yml' diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py index 58d8ff308d34c..77ba2f9c9c369 100755 --- a/.github/workflows/create-test-plan.py +++ b/.github/workflows/create-test-plan.py @@ -1,10 +1,12 @@ #!/usr/bin/env python import argparse import dataclasses +import fnmatch from enum import Enum import json import logging import os +import re from typing import Optional logger = logging.getLogger(__name__) @@ -595,6 +597,7 @@ def main(): parser.add_argument("--github-variable-prefix", default="platforms") parser.add_argument("--github-ci", action="store_true") parser.add_argument("--verbose", action="store_true") + parser.add_argument("--commit-message-file") args = parser.parse_args() logging.basicConfig(level=logging.INFO if args.verbose else logging.WARNING) @@ -608,6 +611,18 @@ def main(): ), ) + filters = [] + if args.commit_message_file: + with open(args.commit_message_file, "r") as f: + commit_message = f.read() + for m in re.finditer(r"\[sdl-ci-filter (.*)]", commit_message, flags=re.M): + filters.append(m.group(1).strip(" \t\n\r\t'\"")) + + if not filters: + filters.append("*") + + logger.info("filters: %r", filters) + all_level_platforms = {} for level_i, level_keys in enumerate(all_level_keys, 1): @@ -619,6 +634,16 @@ def main(): all_level_platforms[level_key] = specs_to_plaform(level_specs) logger.info("=" * 80) + logger.info("Keys before filter: %r", remaining_keys) + + filtered_remaining_keys = set() + for filter in filters: + filtered_remaining_keys.update(fnmatch.filter(remaining_keys, filter)) + + logger.info("Keys after filter: %r", filtered_remaining_keys) + + remaining_keys = filtered_remaining_keys + logger.info("Remaining:") remaining_specs = tuple(JOB_SPECS[key] for key in remaining_keys) all_level_platforms["others"] = specs_to_plaform(remaining_specs) @@ -639,4 +664,3 @@ def main(): if __name__ == "__main__": raise SystemExit(main()) - From 625bc2d2502dc6d70e084493a966024063881b02 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 27 Jul 2024 08:40:31 -0700 Subject: [PATCH 017/253] Fixed getting the initial window safe area Fixes testsprite and testwm on desktop platforms --- src/video/SDL_video.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 49855ab8779ea..049891301638e 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -3860,7 +3860,12 @@ int SDL_GetWindowSafeArea(SDL_Window *window, SDL_Rect *rect) CHECK_WINDOW_MAGIC(window, -1); if (rect) { - SDL_copyp(rect, &window->safe_rect); + if (SDL_RectEmpty(&window->safe_rect)) { + rect->w = window->w; + rect->h = window->h; + } else { + SDL_copyp(rect, &window->safe_rect); + } } return 0; } From 623a90c47d7680fad14f93d76ef41d503b157591 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 27 Jul 2024 08:41:06 -0700 Subject: [PATCH 018/253] testutils: use SDL_asprintf() to simplify path composition --- test/testutils.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/test/testutils.c b/test/testutils.c index c80dd35396b49..b32e436529de7 100644 --- a/test/testutils.c +++ b/test/testutils.c @@ -20,24 +20,18 @@ * * Fails and returns NULL if out of memory. */ -char * -GetNearbyFilename(const char *file) +char *GetNearbyFilename(const char *file) { const char *base = SDL_GetBasePath(); char *path; if (base) { SDL_IOStream *rw; - size_t len = SDL_strlen(base) + SDL_strlen(file) + 1; - path = SDL_malloc(len); - - if (!path) { + if (SDL_asprintf(&path, "%s%s", base, file) < 0) { return NULL; } - (void)SDL_snprintf(path, len, "%s%s", base, file); - rw = SDL_IOFromFile(path, "rb"); if (rw) { SDL_CloseIO(rw); @@ -60,8 +54,7 @@ GetNearbyFilename(const char *file) * * Fails and returns NULL if out of memory. */ -char * -GetResourceFilename(const char *user_specified, const char *def) +char *GetResourceFilename(const char *user_specified, const char *def) { if (user_specified) { return SDL_strdup(user_specified); @@ -79,9 +72,7 @@ GetResourceFilename(const char *user_specified, const char *def) * * If height_out is non-NULL, set it to the texture height. */ -SDL_Texture * -LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent, - int *width_out, int *height_out) +SDL_Texture *LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent, int *width_out, int *height_out) { SDL_Surface *temp = NULL; SDL_Texture *texture = NULL; From 218e45247fe47dce1b99581361b62269a92bb0fe Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 27 Jul 2024 09:06:52 -0700 Subject: [PATCH 019/253] Fixed memory leak when SDL_Init() was called multiple times --- src/filesystem/SDL_filesystem.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/filesystem/SDL_filesystem.c b/src/filesystem/SDL_filesystem.c index 442f5021bc01f..6248792dec1a2 100644 --- a/src/filesystem/SDL_filesystem.c +++ b/src/filesystem/SDL_filesystem.c @@ -450,17 +450,19 @@ char *SDL_GetPrefPath(const char *org, const char *app) void SDL_InitFilesystem(void) { - CachedBasePath = NULL; // just in case. - SDL_zeroa(CachedUserFolders); } void SDL_QuitFilesystem(void) { - SDL_free(CachedBasePath); - CachedBasePath = NULL; + if (CachedBasePath) { + SDL_free(CachedBasePath); + CachedBasePath = NULL; + } for (int i = 0; i < SDL_arraysize(CachedUserFolders); i++) { - SDL_free(CachedUserFolders[i]); - CachedUserFolders[i] = NULL; + if (CachedUserFolders[i]) { + SDL_free(CachedUserFolders[i]); + CachedUserFolders[i] = NULL; + } } } From b854e1fe0b21e1f673d00631d12e2af37f84fd98 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 26 Jul 2024 23:35:30 -0700 Subject: [PATCH 020/253] Fixed some issues found with static analysis --- src/test/SDL_test_common.c | 2 +- src/thread/windows/SDL_sysmutex.c | 3 ++- src/video/SDL_blit_0.c | 30 ++++++++++++++++++++++++------ src/video/SDL_blit_1.c | 10 ++++++++-- test/checkkeys.c | 8 +++++--- test/testautomation_stdlib.c | 2 +- 6 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index fbe1f18e67a1a..2412ea14d412c 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -840,7 +840,7 @@ static void SDLTest_PrintWindowFlag(char *text, size_t maxlen, SDL_WindowFlags f SDL_snprintfcat(text, maxlen, "TRANSPARENT"); break; default: - SDL_snprintfcat(text, maxlen, "0x%8.8x", flag); + SDL_snprintfcat(text, maxlen, "0x%16.16" SDL_PRIx64, flag); break; } } diff --git a/src/thread/windows/SDL_sysmutex.c b/src/thread/windows/SDL_sysmutex.c index 6b1083ef4a5c5..6ad755d7fa2de 100644 --- a/src/thread/windows/SDL_sysmutex.c +++ b/src/thread/windows/SDL_sysmutex.c @@ -146,7 +146,8 @@ static SDL_Mutex *SDL_CreateMutex_cs(void) #ifdef SDL_PLATFORM_WINRT InitializeCriticalSectionEx(&mutex->cs, 2000, 0); #else - InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000); + // This function always succeeds + (void)InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000); #endif } return (SDL_Mutex *)mutex; diff --git a/src/video/SDL_blit_0.c b/src/video/SDL_blit_0.c index ab06e4154426b..5ea34aeae4d1c 100644 --- a/src/video/SDL_blit_0.c +++ b/src/video/SDL_blit_0.c @@ -928,10 +928,16 @@ SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface *surface) if (SDL_PIXELTYPE(surface->format) == SDL_PIXELTYPE_INDEX1) { switch (surface->internal->map.info.flags & ~SDL_COPY_RLE_MASK) { case 0: - return bitmap_blit_1b[which]; + if (which < SDL_arraysize(bitmap_blit_1b)) { + return bitmap_blit_1b[which]; + } + break; case SDL_COPY_COLORKEY: - return colorkey_blit_1b[which]; + if (which < SDL_arraysize(colorkey_blit_1b)) { + return colorkey_blit_1b[which]; + } + break; case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: return which >= 2 ? Blit1btoNAlpha : (SDL_BlitFunc)NULL; @@ -945,10 +951,16 @@ SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface *surface) if (SDL_PIXELTYPE(surface->format) == SDL_PIXELTYPE_INDEX2) { switch (surface->internal->map.info.flags & ~SDL_COPY_RLE_MASK) { case 0: - return bitmap_blit_2b[which]; + if (which < SDL_arraysize(bitmap_blit_2b)) { + return bitmap_blit_2b[which]; + } + break; case SDL_COPY_COLORKEY: - return colorkey_blit_2b[which]; + if (which < SDL_arraysize(colorkey_blit_2b)) { + return colorkey_blit_2b[which]; + } + break; case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: return which >= 2 ? Blit2btoNAlpha : (SDL_BlitFunc)NULL; @@ -962,10 +974,16 @@ SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface *surface) if (SDL_PIXELTYPE(surface->format) == SDL_PIXELTYPE_INDEX4) { switch (surface->internal->map.info.flags & ~SDL_COPY_RLE_MASK) { case 0: - return bitmap_blit_4b[which]; + if (which < SDL_arraysize(bitmap_blit_4b)) { + return bitmap_blit_4b[which]; + } + break; case SDL_COPY_COLORKEY: - return colorkey_blit_4b[which]; + if (which < SDL_arraysize(colorkey_blit_4b)) { + return colorkey_blit_4b[which]; + } + break; case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: return which >= 2 ? Blit4btoNAlpha : (SDL_BlitFunc)NULL; diff --git a/src/video/SDL_blit_1.c b/src/video/SDL_blit_1.c index 0c7cdc099a00d..2c8acbdb1fd01 100644 --- a/src/video/SDL_blit_1.c +++ b/src/video/SDL_blit_1.c @@ -526,10 +526,16 @@ SDL_BlitFunc SDL_CalculateBlit1(SDL_Surface *surface) switch (surface->internal->map.info.flags & ~SDL_COPY_RLE_MASK) { case 0: - return one_blit[which]; + if (which < SDL_arraysize(one_blit)) { + return one_blit[which]; + } + break; case SDL_COPY_COLORKEY: - return one_blitkey[which]; + if (which < SDL_arraysize(one_blitkey)) { + return one_blitkey[which]; + } + break; case SDL_COPY_COLORKEY | SDL_COPY_BLEND: /* this is not super-robust but handles a specific case we found sdl12-compat. */ return (surface->internal->map.info.a == 255) ? one_blitkey[which] : diff --git a/test/checkkeys.c b/test/checkkeys.c index 36aa88d439817..3596605b648e5 100644 --- a/test/checkkeys.c +++ b/test/checkkeys.c @@ -561,10 +561,12 @@ int main(int argc, char *argv[]) #endif done: - for (i = 0; i < state->num_windows; ++i) { - SDLTest_TextWindowDestroy(windowstates[i].textwindow); + if (windowstates) { + for (i = 0; i < state->num_windows; ++i) { + SDLTest_TextWindowDestroy(windowstates[i].textwindow); + } + SDL_free(windowstates); } - SDL_free(windowstates); SDLTest_CleanupTextDrawing(); SDLTest_CommonQuit(state); return 0; diff --git a/test/testautomation_stdlib.c b/test/testautomation_stdlib.c index 701b8f64134e5..c489c58463d80 100644 --- a/test/testautomation_stdlib.c +++ b/test/testautomation_stdlib.c @@ -378,7 +378,7 @@ static int stdlib_swprintf(void *arg) const wchar_t *expected; size_t size; - result = SDL_swprintf(text, sizeof(text), L"%s", "foo"); + result = SDL_swprintf(text, SDL_arraysize(text), L"%s", "foo"); expected = L"foo"; SDLTest_AssertPass("Call to SDL_swprintf(\"%%s\", \"foo\")"); SDLTest_AssertCheck(SDL_wcscmp(text, expected) == 0, "Check text, expected: %S, got: %S", expected, text); From 473feab2a44410f6bf32d9bdf1e9bee3fe901a34 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 26 Jul 2024 22:57:53 -0700 Subject: [PATCH 021/253] Added SDL_unsetenv() --- include/SDL3/SDL_stdinc.h | 1 + include/build_config/SDL_build_config.h.cmake | 2 - .../build_config/SDL_build_config_android.h | 1 - include/build_config/SDL_build_config_ios.h | 1 - src/dynapi/SDL_dynapi.sym | 1 + src/dynapi/SDL_dynapi_overrides.h | 1 + src/dynapi/SDL_dynapi_procs.h | 1 + src/stdlib/SDL_getenv.c | 99 ++++++++++++++++--- test/testautomation_stdlib.c | 63 ++++++++---- 9 files changed, 133 insertions(+), 37 deletions(-) diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index 96cc643a26ed2..83411d3e20842 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -665,6 +665,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumAllocations(void); extern SDL_DECLSPEC const char * SDLCALL SDL_getenv(const char *name); extern SDL_DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); +extern SDL_DECLSPEC int SDLCALL SDL_unsetenv(const char *name); typedef int (SDLCALL *SDL_CompareCallback)(const void *a, const void *b); extern SDL_DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, SDL_CompareCallback compare); diff --git a/include/build_config/SDL_build_config.h.cmake b/include/build_config/SDL_build_config.h.cmake index 0e63c1d645f29..3f01525e9aa51 100644 --- a/include/build_config/SDL_build_config.h.cmake +++ b/include/build_config/SDL_build_config.h.cmake @@ -75,12 +75,10 @@ #cmakedefine HAVE_CALLOC 1 #cmakedefine HAVE_REALLOC 1 #cmakedefine HAVE_FREE 1 -#ifndef SDL_PLATFORM_WIN32 /* Don't use C runtime versions of these on Windows */ #cmakedefine HAVE_GETENV 1 #cmakedefine HAVE_SETENV 1 #cmakedefine HAVE_PUTENV 1 #cmakedefine HAVE_UNSETENV 1 -#endif #cmakedefine HAVE_ABS 1 #cmakedefine HAVE_BCOPY 1 #cmakedefine HAVE_MEMSET 1 diff --git a/include/build_config/SDL_build_config_android.h b/include/build_config/SDL_build_config_android.h index 098e2f5052187..3716c1550f788 100644 --- a/include/build_config/SDL_build_config_android.h +++ b/include/build_config/SDL_build_config_android.h @@ -58,7 +58,6 @@ #define HAVE_REALLOC 1 #define HAVE_FREE 1 #define HAVE_GETENV 1 -#define HAVE_SETENV 1 #define HAVE_PUTENV 1 #define HAVE_SETENV 1 #define HAVE_UNSETENV 1 diff --git a/include/build_config/SDL_build_config_ios.h b/include/build_config/SDL_build_config_ios.h index 93bf3abea84c3..430a9841734d9 100644 --- a/include/build_config/SDL_build_config_ios.h +++ b/include/build_config/SDL_build_config_ios.h @@ -50,7 +50,6 @@ #define HAVE_REALLOC 1 #define HAVE_FREE 1 #define HAVE_GETENV 1 -#define HAVE_SETENV 1 #define HAVE_PUTENV 1 #define HAVE_SETENV 1 #define HAVE_UNSETENV 1 diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 0d518a41279e3..8d789ac74146b 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -1038,6 +1038,7 @@ SDL3_0.0.0 { SDL_uitoa; SDL_ulltoa; SDL_ultoa; + SDL_unsetenv; SDL_utf8strlcpy; SDL_utf8strlen; SDL_utf8strnlen; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 5b87ee5ca62d0..8a17b98052c22 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -1063,6 +1063,7 @@ #define SDL_uitoa SDL_uitoa_REAL #define SDL_ulltoa SDL_ulltoa_REAL #define SDL_ultoa SDL_ultoa_REAL +#define SDL_unsetenv SDL_unsetenv_REAL #define SDL_utf8strlcpy SDL_utf8strlcpy_REAL #define SDL_utf8strlen SDL_utf8strlen_REAL #define SDL_utf8strnlen SDL_utf8strnlen_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 341c70c38f18b..b93fe034512ef 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -1069,6 +1069,7 @@ SDL_DYNAPI_PROC(float,SDL_truncf,(float a),(a),return) SDL_DYNAPI_PROC(char*,SDL_uitoa,(unsigned int a, char *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(char*,SDL_ulltoa,(Uint64 a, char *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(char*,SDL_ultoa,(unsigned long a, char *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_unsetenv,(const char *a),(a),return) SDL_DYNAPI_PROC(size_t,SDL_utf8strlcpy,(SDL_OUT_Z_CAP(c) char *a, const char *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(size_t,SDL_utf8strlen,(const char *a),(a),return) SDL_DYNAPI_PROC(size_t,SDL_utf8strnlen,(const char *a, size_t b),(a,b),return) diff --git a/src/stdlib/SDL_getenv.c b/src/stdlib/SDL_getenv.c index c37568ab877cf..3deea8c681ee2 100644 --- a/src/stdlib/SDL_getenv.c +++ b/src/stdlib/SDL_getenv.c @@ -30,11 +30,12 @@ #include "../core/android/SDL_android.h" #endif -#if (defined(HAVE_GETENV) && defined(HAVE_SETENV)) || \ - (defined(HAVE_GETENV) && defined(HAVE_PUTENV) && defined(HAVE_UNSETENV)) -#define HAVE_LIBC_ENVIRONMENT -#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) +#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) #define HAVE_WIN32_ENVIRONMENT +#elif defined(HAVE_GETENV) && \ + (defined(HAVE_SETENV) || defined(HAVE_PUTENV)) && \ + (defined(HAVE_UNSETENV) || defined(HAVE_PUTENV)) +#define HAVE_LIBC_ENVIRONMENT #else #define HAVE_LOCAL_ENVIRONMENT #endif @@ -64,15 +65,13 @@ int SDL_setenv(const char *name, const char *value, int overwrite) } if (getenv(name) != NULL) { - if (overwrite) { - unsetenv(name); - } else { + if (!overwrite) { return 0; /* leave the existing one there. */ } } /* This leaks. Sorry. Get a better OS so we don't have to do this. */ - SDL_aprintf(&new_variable, "%s=%s", name, value); + SDL_asprintf(&new_variable, "%s=%s", name, value); if (!new_variable) { return -1; } @@ -92,7 +91,7 @@ int SDL_setenv(const char *name, const char *value, int overwrite) return 0; /* asked not to overwrite existing value. */ } } - if (!SetEnvironmentVariableA(name, *value ? value : NULL)) { + if (!SetEnvironmentVariableA(name, value)) { return -1; } return 0; @@ -138,15 +137,13 @@ int SDL_setenv(const char *name, const char *value, int overwrite) len = (value - name); for (; SDL_env[i]; ++i) { if (SDL_strncmp(SDL_env[i], name, len) == 0) { + /* If we found it, just replace the entry */ + SDL_free(SDL_env[i]); + SDL_env[i] = new_variable; + added = 1; break; } } - /* If we found it, just replace the entry */ - if (SDL_env[i]) { - SDL_free(SDL_env[i]); - SDL_env[i] = new_variable; - added = 1; - } } /* Didn't find it in the environment, expand and add */ @@ -165,6 +162,68 @@ int SDL_setenv(const char *name, const char *value, int overwrite) } #endif // HAVE_LIBC_ENVIRONMENT +#ifdef HAVE_LIBC_ENVIRONMENT +#if defined(HAVE_UNSETENV) +int SDL_unsetenv(const char *name) +{ + /* Input validation */ + if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL) { + return -1; + } + + return unsetenv(name); +} +/* We have a real environment table, but no unsetenv? Fake it w/ putenv. */ +#else +int SDL_unsetenv(const char *name) +{ + /* Input validation */ + if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL) { + return -1; + } + + // Hope this environment uses the non-standard extension of removing the environment variable if it has no '=' + return putenv(name); +} +#endif +#elif defined(HAVE_WIN32_ENVIRONMENT) +int SDL_unsetenv(const char *name) +{ + /* Input validation */ + if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL) { + return -1; + } + + if (!SetEnvironmentVariableA(name, NULL)) { + return -1; + } + return 0; +} +#else +int SDL_unsetenv(const char *name) +{ + size_t len, i; + + /* Input validation */ + if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL) { + return -1; + } + + if (SDL_env) { + len = SDL_strlen(name); + for (i = 0; SDL_env[i]; ++i) { + if ((SDL_strncmp(SDL_env[i], name, len) == 0) && + (SDL_env[i][len] == '=')) { + /* Just clear out this entry for now */ + *SDL_env[i] = '\0'; + break; + } + } + } + return 0; +} +#endif // HAVE_LIBC_ENVIRONMENT + /* Retrieve a variable named "name" from the environment */ #ifdef HAVE_LIBC_ENVIRONMENT const char *SDL_getenv(const char *name) @@ -194,6 +253,7 @@ const char *SDL_getenv(const char *name) } for ( ; ; ) { + SetLastError(ERROR_SUCCESS); length = GetEnvironmentVariableA(name, string, maxlen); if (length > maxlen) { @@ -204,6 +264,12 @@ const char *SDL_getenv(const char *name) string = temp; maxlen = length; } else { + if (GetLastError() != ERROR_SUCCESS) { + if (string) { + SDL_free(string); + } + return NULL; + } break; } } @@ -227,10 +293,11 @@ const char *SDL_getenv(const char *name) value = (char *)0; if (SDL_env) { len = SDL_strlen(name); - for (i = 0; SDL_env[i] && !value; ++i) { + for (i = 0; SDL_env[i]; ++i) { if ((SDL_strncmp(SDL_env[i], name, len) == 0) && (SDL_env[i][len] == '=')) { value = &SDL_env[i][len + 1]; + break; } } } diff --git a/test/testautomation_stdlib.c b/test/testautomation_stdlib.c index c489c58463d80..d7072f03c6c0d 100644 --- a/test/testautomation_stdlib.c +++ b/test/testautomation_stdlib.c @@ -624,7 +624,7 @@ static int stdlib_getsetenv(void *arg) text); } - /* Set value 1 without overwrite */ + /* Set value 1 with overwrite */ overwrite = 1; expected = value1; result = SDL_setenv(name, value1, overwrite); @@ -643,6 +643,35 @@ static int stdlib_getsetenv(void *arg) text); } + /* Verify setenv() with empty string vs unsetenv() */ + result = SDL_setenv("FOO", "1", 1); + SDLTest_AssertPass("Call to SDL_setenv('FOO','1', 1)"); + SDLTest_AssertCheck(result == 0, "Check result, expected: 0, got: %i", result); + expected = "1"; + text = SDL_getenv("FOO"); + SDLTest_AssertPass("Call to SDL_getenv('FOO')"); + SDLTest_AssertCheck(text && SDL_strcmp(text, expected) == 0, "Verify returned text, expected: %s, got: %s", expected, text); + result = SDL_setenv("FOO", "", 1); + SDLTest_AssertPass("Call to SDL_setenv('FOO','', 1)"); + SDLTest_AssertCheck(result == 0, "Check result, expected: 0, got: %i", result); + expected = ""; + text = SDL_getenv("FOO"); + SDLTest_AssertPass("Call to SDL_getenv('FOO')"); + SDLTest_AssertCheck(text && SDL_strcmp(text, expected) == 0, "Verify returned text, expected: '%s', got: '%s'", expected, text); + result = SDL_unsetenv("FOO"); + SDLTest_AssertPass("Call to SDL_unsetenv('FOO')"); + SDLTest_AssertCheck(result == 0, "Check result, expected: 0, got: %i", result); + text = SDL_getenv("FOO"); + SDLTest_AssertPass("Call to SDL_getenv('FOO')"); + SDLTest_AssertCheck(text == NULL, "Verify returned text, expected: (null), got: %s", text); + result = SDL_setenv("FOO", "0", 0); + SDLTest_AssertPass("Call to SDL_setenv('FOO','0', 0)"); + SDLTest_AssertCheck(result == 0, "Check result, expected: 0, got: %i", result); + expected = "0"; + text = SDL_getenv("FOO"); + SDLTest_AssertPass("Call to SDL_getenv('FOO')"); + SDLTest_AssertCheck(text && SDL_strcmp(text, expected) == 0, "Verify returned text, expected: %s, got: %s", expected, text); + /* Negative cases */ for (overwrite = 0; overwrite <= 1; overwrite++) { result = SDL_setenv(NULL, value1, overwrite); @@ -1026,35 +1055,35 @@ stdlib_overflow(void *arg) /* ================= Test References ================== */ /* Standard C routine test cases */ -static const SDLTest_TestCaseReference stdlibTest1 = { +static const SDLTest_TestCaseReference stdlibTest_strnlen = { stdlib_strnlen, "stdlib_strnlen", "Call to SDL_strnlen", TEST_ENABLED }; -static const SDLTest_TestCaseReference stdlibTest2 = { +static const SDLTest_TestCaseReference stdlibTest_strlcpy = { stdlib_strlcpy, "stdlib_strlcpy", "Call to SDL_strlcpy", TEST_ENABLED }; -static const SDLTest_TestCaseReference stdlibTest3 = { +static const SDLTest_TestCaseReference stdlibTest_strstr = { stdlib_strstr, "stdlib_strstr", "Call to SDL_strstr", TEST_ENABLED }; -static const SDLTest_TestCaseReference stdlibTest4 = { +static const SDLTest_TestCaseReference stdlibTest_snprintf = { stdlib_snprintf, "stdlib_snprintf", "Call to SDL_snprintf", TEST_ENABLED }; -static const SDLTest_TestCaseReference stdlibTest5 = { +static const SDLTest_TestCaseReference stdlibTest_swprintf = { stdlib_swprintf, "stdlib_swprintf", "Call to SDL_swprintf", TEST_ENABLED }; -static const SDLTest_TestCaseReference stdlibTest6 = { +static const SDLTest_TestCaseReference stdlibTest_getsetenv = { stdlib_getsetenv, "stdlib_getsetenv", "Call to SDL_getenv and SDL_setenv", TEST_ENABLED }; -static const SDLTest_TestCaseReference stdlibTest7 = { +static const SDLTest_TestCaseReference stdlibTest_sscanf = { stdlib_sscanf, "stdlib_sscanf", "Call to SDL_sscanf", TEST_ENABLED }; -static const SDLTest_TestCaseReference stdlibTest8 = { +static const SDLTest_TestCaseReference stdlibTest_aligned_alloc = { stdlib_aligned_alloc, "stdlib_aligned_alloc", "Call to SDL_aligned_alloc", TEST_ENABLED }; @@ -1064,14 +1093,14 @@ static const SDLTest_TestCaseReference stdlibTestOverflow = { /* Sequence of Standard C routine test cases */ static const SDLTest_TestCaseReference *stdlibTests[] = { - &stdlibTest1, - &stdlibTest2, - &stdlibTest3, - &stdlibTest4, - &stdlibTest5, - &stdlibTest6, - &stdlibTest7, - &stdlibTest8, + &stdlibTest_strnlen, + &stdlibTest_strlcpy, + &stdlibTest_strstr, + &stdlibTest_snprintf, + &stdlibTest_swprintf, + &stdlibTest_getsetenv, + &stdlibTest_sscanf, + &stdlibTest_aligned_alloc, &stdlibTestOverflow, NULL }; From 1d5f9c7b92225afac8731c12a159af133a8a5071 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 27 Jul 2024 09:16:29 -0700 Subject: [PATCH 022/253] testaudio: fixed memory leak in SetTitleBar() --- test/testaudio.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/test/testaudio.c b/test/testaudio.c index 3509ee7222c8c..a52bc1f16e557 100644 --- a/test/testaudio.c +++ b/test/testaudio.c @@ -115,7 +115,6 @@ static Uint64 app_ready_ticks = 0; static SDLTest_CommonState *state = NULL; static Thing *things = NULL; -static char *current_titlebar = NULL; static Thing *mouseover_thing = NULL; static Thing *droppable_highlighted_thing = NULL; @@ -135,19 +134,14 @@ static Texture *soundboard_levels_texture = NULL; static void SetTitleBar(const char *fmt, ...) { - char *newstr = NULL; + char *title = NULL; va_list ap; va_start(ap, fmt); - SDL_vasprintf(&newstr, fmt, ap); + SDL_vasprintf(&title, fmt, ap); va_end(ap); - if (newstr && (!current_titlebar || (SDL_strcmp(current_titlebar, newstr) != 0))) { - SDL_SetWindowTitle(state->windows[0], newstr); - SDL_free(current_titlebar); - current_titlebar = newstr; - } else { - SDL_free(newstr); - } + SDL_SetWindowTitle(state->windows[0], title); + SDL_free(title); } static void SetDefaultTitleBar(void) From 9da58e9fb7014a6b069433a1484198032602fda4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 27 Jul 2024 09:34:49 -0700 Subject: [PATCH 023/253] Fixed storing a key in the persistent string hashtable that's about to be freed --- src/SDL_utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SDL_utils.c b/src/SDL_utils.c index aaf721031ac51..b3584c8fbbb0a 100644 --- a/src/SDL_utils.c +++ b/src/SDL_utils.c @@ -352,16 +352,16 @@ const char *SDL_GetPersistentString(const char *string) SDL_SetTLS(&SDL_string_storage, strings, SDL_FreePersistentStrings); } - const void *retval; - if (!SDL_FindInHashTable(strings, string, &retval)) { + const char *retval; + if (!SDL_FindInHashTable(strings, string, (const void **)&retval)) { char *new_string = SDL_strdup(string); if (!new_string) { return NULL; } // If the hash table insert fails, at least we can return the string we allocated + SDL_InsertIntoHashTable(strings, new_string, new_string); retval = new_string; - SDL_InsertIntoHashTable(strings, string, retval); } - return (const char *)retval; + return retval; } From 7cd23bfb6a78abbd1063690e5f39acfad49df14b Mon Sep 17 00:00:00 2001 From: Anthony Date: Sat, 27 Jul 2024 17:10:35 +0100 Subject: [PATCH 024/253] Respect Android's auto-rotate setting when choosing orientation --- .../app/src/main/java/org/libsdl/app/SDLActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index df82f457dffd8..6cfbc904f9598 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -1107,7 +1107,7 @@ public void setOrientationBis(int w, int h, boolean resizable, String hint) /* If set, hint "explicitly controls which UI orientations are allowed". */ if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) { - orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; + orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE; } else if (hint.contains("LandscapeLeft")) { orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; } else if (hint.contains("LandscapeRight")) { @@ -1118,7 +1118,7 @@ public void setOrientationBis(int w, int h, boolean resizable, String hint) boolean contains_Portrait = hint.contains("Portrait ") || hint.endsWith("Portrait"); if (contains_Portrait && hint.contains("PortraitUpsideDown")) { - orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT; + orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT; } else if (contains_Portrait) { orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; } else if (hint.contains("PortraitUpsideDown")) { From da035142b2a842d80edfdc6eec40ac72a06f065a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 27 Jul 2024 10:31:51 -0700 Subject: [PATCH 025/253] Use SDL_InitFlags for the SDL_Init* function implementations --- src/SDL.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SDL.c b/src/SDL.c index 3cbd3b7684684..203358bfd1767 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -215,7 +215,7 @@ static void SDL_QuitMainThread(void) SDL_main_thread_initialized = SDL_FALSE; } -int SDL_InitSubSystem(Uint32 flags) +int SDL_InitSubSystem(SDL_InitFlags flags) { Uint32 flags_initialized = 0; @@ -431,12 +431,12 @@ int SDL_InitSubSystem(Uint32 flags) return -1; } -int SDL_Init(Uint32 flags) +int SDL_Init(SDL_InitFlags flags) { return SDL_InitSubSystem(flags); } -void SDL_QuitSubSystem(Uint32 flags) +void SDL_QuitSubSystem(SDL_InitFlags flags) { /* Shut down requested initialized subsystems */ @@ -527,7 +527,7 @@ void SDL_QuitSubSystem(Uint32 flags) } } -Uint32 SDL_WasInit(Uint32 flags) +Uint32 SDL_WasInit(SDL_InitFlags flags) { int i; int num_subsystems = SDL_arraysize(SDL_SubsystemRefCount); From 7eb260563064c88f11846b4707f188d8a35e2a56 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 27 Jul 2024 13:36:12 -0700 Subject: [PATCH 026/253] Fixed memory leak when a renderer fails to be created The supported texture formats were leaking. In order to catch future issues, we'll just do a full teardown of the renderer in the failure case, and make sure it's safe to do so with a partially initialized renderer. --- src/render/SDL_render.c | 44 +++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 28a0340b46132..b3b31e2cf698b 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -1144,10 +1144,7 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props) #endif if (renderer) { - SDL_SetObjectValid(renderer, SDL_OBJECT_TYPE_RENDERER, SDL_FALSE); - - SDL_free(renderer->texture_formats); - SDL_free(renderer); + SDL_DestroyRenderer(renderer); } return NULL; @@ -5059,10 +5056,15 @@ void SDL_DestroyRendererWithoutFreeing(SDL_Renderer *renderer) renderer->destroyed = SDL_TRUE; - SDL_DestroyProperties(renderer->props); - SDL_DelEventWatch(SDL_RendererEventWatch, renderer); + if (renderer->window) { + SDL_PropertiesID props = SDL_GetWindowProperties(renderer->window); + if (SDL_GetPointerProperty(props, SDL_PROP_WINDOW_RENDERER_POINTER, NULL) == renderer) { + SDL_ClearProperty(props, SDL_PROP_WINDOW_RENDERER_POINTER); + } + } + SDL_DiscardAllCommands(renderer); /* Free existing textures for this renderer */ @@ -5072,18 +5074,27 @@ void SDL_DestroyRendererWithoutFreeing(SDL_Renderer *renderer) SDL_assert(tex != renderer->textures); /* satisfy static analysis. */ } - SDL_free(renderer->vertex_data); - - if (renderer->window) { - SDL_ClearProperty(SDL_GetWindowProperties(renderer->window), SDL_PROP_WINDOW_RENDERER_POINTER); + /* Clean up renderer-specific resources */ + if (renderer->DestroyRenderer) { + renderer->DestroyRenderer(renderer); } - /* Free the target mutex */ - SDL_DestroyMutex(renderer->target_mutex); - renderer->target_mutex = NULL; - - /* Clean up renderer-specific resources */ - renderer->DestroyRenderer(renderer); + if (renderer->target_mutex) { + SDL_DestroyMutex(renderer->target_mutex); + renderer->target_mutex = NULL; + } + if (renderer->vertex_data) { + SDL_free(renderer->vertex_data); + renderer->vertex_data = NULL; + } + if (renderer->texture_formats) { + SDL_free(renderer->texture_formats); + renderer->texture_formats = NULL; + } + if (renderer->props) { + SDL_DestroyProperties(renderer->props); + renderer->props = 0; + } } void SDL_DestroyRenderer(SDL_Renderer *renderer) @@ -5114,7 +5125,6 @@ void SDL_DestroyRenderer(SDL_Renderer *renderer) SDL_SetObjectValid(renderer, SDL_OBJECT_TYPE_RENDERER, SDL_FALSE); // It's no longer magical... - SDL_free(renderer->texture_formats); SDL_free(renderer); } From 91d2dbdc9dfe9c8751edfb69d9c40d7045c6b72e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 27 Jul 2024 13:44:45 -0700 Subject: [PATCH 027/253] Fixed memory leak if joysticks were initialized but gamepads were not If a joystick is connected, SDL_IsGamepad() will be called on it, which adds it to the cache, which then needs to be cleaned up when joysticks quit. --- src/joystick/SDL_gamepad.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c index 4dc94d7cf9d18..0d9648ab0463f 100644 --- a/src/joystick/SDL_gamepad.c +++ b/src/joystick/SDL_gamepad.c @@ -3686,11 +3686,6 @@ void SDL_QuitGamepads(void) SDL_CloseGamepad(SDL_gamepads); } - if (s_gamepadInstanceIDs) { - SDL_DestroyHashTable(s_gamepadInstanceIDs); - s_gamepadInstanceIDs = NULL; - } - SDL_UnlockJoysticks(); } @@ -3710,6 +3705,11 @@ void SDL_QuitGamepadMappings(void) SDL_FreeVIDPIDList(&SDL_allowed_gamepads); SDL_FreeVIDPIDList(&SDL_ignored_gamepads); + + if (s_gamepadInstanceIDs) { + SDL_DestroyHashTable(s_gamepadInstanceIDs); + s_gamepadInstanceIDs = NULL; + } } /* From ebd059e6ebc80abd53556a7efc771dc5c56ba2ee Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 26 Jul 2024 09:22:38 -0700 Subject: [PATCH 028/253] Don't send keys consumed by the IME on macOS This makes the macOS behavior match other platforms where the IME eats keys that are used for composing text. --- src/video/cocoa/SDL_cocoakeyboard.m | 53 ++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index f7fd6f1f3b04b..685d6752df7e7 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -39,9 +39,15 @@ @interface SDL3TranslatorResponder : NSView NSRange _markedRange; NSRange _selectedRange; SDL_Rect _inputRect; + int _pendingRawCode; + SDL_Scancode _pendingScancode; + Uint64 _pendingTimestamp; } - (void)doCommandBySelector:(SEL)myselector; - (void)setInputRect:(const SDL_Rect *)rect; +- (void)setPendingKey:(int)rawcode scancode:(SDL_Scancode)scancode timestamp:(Uint64)timestamp; +- (void)sendPendingKey; +- (void)clearPendingKey; @end @implementation SDL3TranslatorResponder @@ -72,6 +78,9 @@ - (void)insertText:(id)aString replacementRange:(NSRange)replacementRange [self unmarkText]; } + // Deliver the raw key event that generated this text + [self sendPendingKey]; + SDL_SendKeyboardText(str); } @@ -116,6 +125,9 @@ - (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replaceme _selectedRange = selectedRange; _markedRange = NSMakeRange(0, [aString length]); + // This key event was consumed by the IME + [self clearPendingKey]; + SDL_SendEditingText([aString UTF8String], (int)selectedRange.location, (int)selectedRange.length); @@ -127,6 +139,9 @@ - (void)unmarkText { _markedText = nil; + // This key event was consumed by the IME + [self clearPendingKey]; + SDL_SendEditingText("", 0, 0); } @@ -181,6 +196,28 @@ - (NSArray *)validAttributesForMarkedText return [NSArray array]; } +- (void)setPendingKey:(int)rawcode scancode:(SDL_Scancode)scancode timestamp:(Uint64)timestamp +{ + _pendingRawCode = rawcode; + _pendingScancode = scancode; + _pendingTimestamp = timestamp; +} + +- (void)sendPendingKey; +{ + if (_pendingRawCode < 0) { + return; + } + + SDL_SendKeyboardKey(_pendingTimestamp, SDL_DEFAULT_KEYBOARD_ID, _pendingRawCode, _pendingScancode, SDL_PRESSED); + [self clearPendingKey]; +} + +- (void)clearPendingKey; +{ + _pendingRawCode = -1; +} + @end static bool IsModifierKeyPressed(unsigned int flags, @@ -404,9 +441,6 @@ void Cocoa_HandleKeyEvent(SDL_VideoDevice *_this, NSEvent *event) } scancode = [event keyCode]; -#if 0 - const char *text; -#endif if ((scancode == 10 || scancode == 50) && KBGetLayoutType(LMGetKbdType()) == kKeyboardISO) { /* see comments in scancodes_darwin.h */ @@ -427,22 +461,17 @@ void Cocoa_HandleKeyEvent(SDL_VideoDevice *_this, NSEvent *event) UpdateKeymap(data, SDL_TRUE); } - SDL_SendKeyboardKey(Cocoa_GetEventTimestamp([event timestamp]), SDL_DEFAULT_KEYBOARD_ID, scancode, code, SDL_PRESSED); #ifdef DEBUG_SCANCODES if (code == SDL_SCANCODE_UNKNOWN) { SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list or to Christian Walther . Mac virtual key code is %d.\n", scancode); } #endif if (SDL_TextInputActive(SDL_GetKeyboardFocus())) { - /* FIXME CW 2007-08-16: only send those events to the field editor for which we actually want text events, not e.g. esc or function keys. Arrow keys in particular seem to produce crashes sometimes. */ + [data.fieldEdit setPendingKey:scancode scancode:code timestamp:Cocoa_GetEventTimestamp([event timestamp])]; [data.fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]]; -#if 0 - text = [[event characters] UTF8String]; - if(text && *text) { - SDL_SendKeyboardText(text); - [data->fieldEdit setString:@""]; - } -#endif + [data.fieldEdit sendPendingKey]; + } else { + SDL_SendKeyboardKey(Cocoa_GetEventTimestamp([event timestamp]), SDL_DEFAULT_KEYBOARD_ID, scancode, code, SDL_PRESSED); } break; case NSEventTypeKeyUp: From 95dd8781cefa4d045da5854b0172feb14cd3d3da Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 27 Jul 2024 16:19:05 -0700 Subject: [PATCH 029/253] Do a full cleanup if renderer creation fails during autodetection --- src/render/SDL_render.c | 1 + src/render/direct3d/SDL_render_d3d.c | 4 ---- src/render/direct3d11/SDL_render_d3d11.c | 6 ++---- src/render/direct3d12/SDL_render_d3d12.c | 6 ++---- src/render/opengl/SDL_render_gl.c | 4 ---- src/render/opengles2/SDL_render_gles2.c | 4 ---- src/render/ps2/SDL_render_ps2.c | 1 - src/render/software/SDL_render_sw.c | 2 -- src/render/vitagxm/SDL_render_vita_gxm.c | 1 - src/render/vulkan/SDL_render_vulkan.c | 2 -- 10 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index b3b31e2cf698b..5759cd6b898c8 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -1029,6 +1029,7 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props) if (rc == 0) { break; // Yay, we got one! } + SDL_DestroyRendererWithoutFreeing(renderer); SDL_zerop(renderer); // make sure we don't leave function pointers from a previous CreateRenderer() in this struct. } } diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index 9e2e67670abf6..a2b01f40bcf38 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -1703,7 +1703,6 @@ int D3D_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Propertie result = IDirect3D9_GetDeviceCaps(data->d3d, data->adapter, D3DDEVTYPE_HAL, &caps); if (FAILED(result)) { - D3D_DestroyRenderer(renderer); return D3D_SetError("GetDeviceCaps()", result); } @@ -1724,20 +1723,17 @@ int D3D_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Propertie device_flags, &pparams, &data->device); if (FAILED(result)) { - D3D_DestroyRenderer(renderer); return D3D_SetError("CreateDevice()", result); } /* Get presentation parameters to fill info */ result = IDirect3DDevice9_GetSwapChain(data->device, 0, &chain); if (FAILED(result)) { - D3D_DestroyRenderer(renderer); return D3D_SetError("GetSwapChain()", result); } result = IDirect3DSwapChain9_GetPresentParameters(chain, &pparams); if (FAILED(result)) { IDirect3DSwapChain9_Release(chain); - D3D_DestroyRenderer(renderer); return D3D_SetError("GetPresentParameters()", result); } IDirect3DSwapChain9_Release(chain); diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c index e18301d0d9c09..885d66ce148a0 100644 --- a/src/render/direct3d11/SDL_render_d3d11.c +++ b/src/render/direct3d11/SDL_render_d3d11.c @@ -421,8 +421,8 @@ static void D3D11_ReleaseAll(SDL_Renderer *renderer) static void D3D11_DestroyRenderer(SDL_Renderer *renderer) { D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal; - D3D11_ReleaseAll(renderer); if (data) { + D3D11_ReleaseAll(renderer); SDL_free(data); } } @@ -744,7 +744,7 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer) } /* Create samplers to use when drawing textures: */ - static struct + static struct { D3D11_FILTER filter; D3D11_TEXTURE_ADDRESS_MODE address; @@ -2880,11 +2880,9 @@ static int D3D11_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_ /* Initialize Direct3D resources */ if (FAILED(D3D11_CreateDeviceResources(renderer))) { - D3D11_DestroyRenderer(renderer); return -1; } if (FAILED(D3D11_CreateWindowSizeDependentResources(renderer))) { - D3D11_DestroyRenderer(renderer); return -1; } diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index 26a21e5a3e68f..765e082da0892 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -644,9 +644,9 @@ static int D3D12_IssueBatch(D3D12_RenderData *data) static void D3D12_DestroyRenderer(SDL_Renderer *renderer) { D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal; - D3D12_WaitForGPU(data); - D3D12_ReleaseAll(renderer); if (data) { + D3D12_WaitForGPU(data); + D3D12_ReleaseAll(renderer); SDL_free(data); } } @@ -3343,11 +3343,9 @@ int D3D12_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Propert /* Initialize Direct3D resources */ if (FAILED(D3D12_CreateDeviceResources(renderer))) { - D3D12_DestroyRenderer(renderer); return -1; } if (FAILED(D3D12_CreateWindowSizeDependentResources(renderer))) { - D3D12_DestroyRenderer(renderer); return -1; } diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index baaebfb3c5e75..af1a2af7f0562 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1698,12 +1698,10 @@ static int GL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Pro goto error; } if (SDL_GL_MakeCurrent(window, data->context) < 0) { - SDL_GL_DestroyContext(data->context); goto error; } if (GL_LoadFunctions(data) < 0) { - SDL_GL_DestroyContext(data->context); goto error; } @@ -1819,7 +1817,6 @@ static int GL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Pro SDL_GL_GetProcAddress("glCheckFramebufferStatusEXT"); } else { SDL_SetError("Can't create render targets, GL_EXT_framebuffer_object not available"); - SDL_GL_DestroyContext(data->context); goto error; } @@ -1847,7 +1844,6 @@ static int GL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Pro return 0; error: - SDL_free(data); if (changed_window) { /* Uh oh, better try to put it back... */ char *error = SDL_strdup(SDL_GetError()); diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index 8df52b1f15879..f52e56af5b067 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -2133,17 +2133,14 @@ static int GLES2_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_ goto error; } if (SDL_GL_MakeCurrent(window, data->context) < 0) { - SDL_GL_DestroyContext(data->context); goto error; } if (GLES2_LoadFunctions(data) < 0) { - SDL_GL_DestroyContext(data->context); goto error; } if (GLES2_CacheShaders(data) < 0) { - SDL_GL_DestroyContext(data->context); goto error; } @@ -2237,7 +2234,6 @@ static int GLES2_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_ return 0; error: - SDL_free(data); if (changed_window) { /* Uh oh, better try to put it back... */ char *error = SDL_strdup(SDL_GetError()); diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c index a3944bb3f9f76..6d76f1494eec8 100644 --- a/src/render/ps2/SDL_render_ps2.c +++ b/src/render/ps2/SDL_render_ps2.c @@ -643,7 +643,6 @@ static int PS2_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Pr SDL_SetupRendererColorspace(renderer, create_props); if (renderer->output_colorspace != SDL_COLORSPACE_SRGB) { - SDL_free(renderer); return SDL_SetError("Unsupported output colorspace"); } diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c index 1225e756ac3b3..cbabcfff30d99 100644 --- a/src/render/software/SDL_render_sw.c +++ b/src/render/software/SDL_render_sw.c @@ -1124,7 +1124,6 @@ int SW_CreateRendererForSurface(SDL_Renderer *renderer, SDL_Surface *surface, SD data = (SW_RenderData *)SDL_calloc(1, sizeof(*data)); if (!data) { - SW_DestroyRenderer(renderer); return -1; } data->surface = surface; @@ -1162,7 +1161,6 @@ int SW_CreateRendererForSurface(SDL_Renderer *renderer, SDL_Surface *surface, SD SDL_SetupRendererColorspace(renderer, create_props); if (renderer->output_colorspace != SDL_COLORSPACE_SRGB) { - SW_DestroyRenderer(renderer); return SDL_SetError("Unsupported output colorspace"); } diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c index 440e05ea359ef..79142d5dc7f77 100644 --- a/src/render/vitagxm/SDL_render_vita_gxm.c +++ b/src/render/vitagxm/SDL_render_vita_gxm.c @@ -254,7 +254,6 @@ static int VITA_GXM_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, S #endif if (gxm_init(renderer) != 0) { - SDL_free(data); return SDL_SetError("gxm_init failed"); } diff --git a/src/render/vulkan/SDL_render_vulkan.c b/src/render/vulkan/SDL_render_vulkan.c index a3b63d2d67a2c..1d4a22d10511c 100644 --- a/src/render/vulkan/SDL_render_vulkan.c +++ b/src/render/vulkan/SDL_render_vulkan.c @@ -4151,10 +4151,8 @@ static int VULKAN_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL /* Initialize Vulkan resources */ if (VULKAN_CreateDeviceResources(renderer, create_props) != VK_SUCCESS) { - VULKAN_DestroyRenderer(renderer); return -1; } else if (VULKAN_CreateWindowSizeDependentResources(renderer) != VK_SUCCESS) { - VULKAN_DestroyRenderer(renderer); return -1; } From 82c89c0125beef3ea9609f1ae1250487e8c11205 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 27 Jul 2024 16:26:28 -0700 Subject: [PATCH 030/253] Removed redundant subystem quit calls SDL_Quit() quits everything --- src/test/SDL_test_common.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 2412ea14d412c..5372bc8506f2e 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -2506,15 +2506,6 @@ void SDLTest_CommonQuit(SDLTest_CommonState *state) } SDL_free(state->windows); } - if (state->flags & SDL_INIT_CAMERA) { - SDL_QuitSubSystem(SDL_INIT_CAMERA); - } - if (state->flags & SDL_INIT_VIDEO) { - SDL_QuitSubSystem(SDL_INIT_VIDEO); - } - if (state->flags & SDL_INIT_AUDIO) { - SDL_QuitSubSystem(SDL_INIT_AUDIO); - } SDL_Quit(); SDLTest_CommonDestroyState(state); } From f080336fa6feb4995a58ed4937d30cc87874a188 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 27 Jul 2024 16:26:54 -0700 Subject: [PATCH 031/253] Fixed memory leak if logging is done after SDL_Quit() If someone calls SDL_Quit(), then runs an SDL function that implicitly initializes TLS or logging, and then calls SDL_Quit() again, we want to make sure we run through the quit process again. Each of the Init/Quit calls are protected against being called multiple times. --- src/SDL.c | 13 ------------- src/SDL_log.c | 1 + 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/SDL.c b/src/SDL.c index 203358bfd1767..848f89700874e 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -113,7 +113,6 @@ static SDL_bool SDL_MainIsReady = SDL_FALSE; #else static SDL_bool SDL_MainIsReady = SDL_TRUE; #endif -static SDL_bool SDL_main_thread_initialized = SDL_FALSE; static SDL_bool SDL_bInMainQuit = SDL_FALSE; static Uint8 SDL_SubsystemRefCount[32]; @@ -186,33 +185,21 @@ void SDL_SetMainReady(void) /* Initialize all the subsystems that require initialization before threads start */ void SDL_InitMainThread(void) { - if (SDL_main_thread_initialized) { - return; - } - SDL_InitTLSData(); SDL_InitTicks(); SDL_InitFilesystem(); SDL_InitLog(); SDL_InitProperties(); SDL_GetGlobalProperties(); - - SDL_main_thread_initialized = SDL_TRUE; } static void SDL_QuitMainThread(void) { - if (!SDL_main_thread_initialized) { - return; - } - SDL_QuitProperties(); SDL_QuitLog(); SDL_QuitFilesystem(); SDL_QuitTicks(); SDL_QuitTLSData(); - - SDL_main_thread_initialized = SDL_FALSE; } int SDL_InitSubSystem(SDL_InitFlags flags) diff --git a/src/SDL_log.c b/src/SDL_log.c index eef32b350874c..b3d6028a017e3 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -118,6 +118,7 @@ void SDL_InitLog(void) void SDL_QuitLog(void) { SDL_ResetLogPriorities(); + if (log_function_mutex) { SDL_DestroyMutex(log_function_mutex); log_function_mutex = NULL; From 5617ce277d1f85d831e9d50673dcece91488616b Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sat, 27 Jul 2024 20:22:10 -0400 Subject: [PATCH 032/253] wayland: Don't fail to retrieve a system cursor if no window is focused Doing this can leave the cursor data in a weird, corrupt state. --- src/video/wayland/SDL_waylandmouse.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index dda2917c38ea1..078ad471d2e0c 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -328,7 +328,6 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, struct Wayland_C int size = dbus_cursor_size; SDL_Window *focus; - SDL_WindowData *focusdata; /* Fallback envvar if the DBus properties don't exist */ if (size <= 0) { @@ -342,16 +341,15 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, struct Wayland_C } /* First, find the appropriate theme based on the current scale... */ focus = SDL_GetMouse()->focus; - if (!focus) { - /* Nothing to see here, bail. */ - return SDL_FALSE; + if (focus) { + /* Cursors use integer scaling. */ + *scale = SDL_ceilf(focus->internal->windowed_scale_factor); + } else { + *scale = 1.0f; } - focusdata = focus->internal; - /* Cursors use integer scaling. */ - *scale = SDL_ceilf(focusdata->windowed_scale_factor); size *= (int)*scale; - for (int i = 0; i < vdata->num_cursor_themes; i += 1) { + for (int i = 0; i < vdata->num_cursor_themes; ++i) { if (vdata->cursor_themes[i].size == size) { theme = vdata->cursor_themes[i].theme; break; From 44f1f81d6cc1ddd77ce8db1650516fa2d52d05ff Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sun, 28 Jul 2024 00:12:49 +0200 Subject: [PATCH 033/253] ci: add vita job --- .github/actions/setup-vita-gles/action.yml | 93 ++++++++++++++++++++++ .github/workflows/create-test-plan.py | 33 ++++++++ .github/workflows/generic.yml | 8 +- 3 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 .github/actions/setup-vita-gles/action.yml diff --git a/.github/actions/setup-vita-gles/action.yml b/.github/actions/setup-vita-gles/action.yml new file mode 100644 index 0000000000000..aa88e69efc844 --- /dev/null +++ b/.github/actions/setup-vita-gles/action.yml @@ -0,0 +1,93 @@ +name: 'Setup GLES for PlayStation Vita' +description: 'Setup GLES (PVR and PIB)' +inputs: + pib-version: + description: 'PIB version' + default: '1.1.4' + pvr-version: + description: 'PVR_PSP2 version' + default: '3.9' + type: + description: '"pib" or "pvr"' + default: '' +runs: + using: 'composite' + steps: + - name: 'Calculate variables' + id: calc + shell: sh + run: | + if test "x${VITASDK}" = "x"; then + echo "VITASKD must be defined" + exit 1; + fi + case "x${{ inputs.type }}" in + "xpvr") + echo "cache-key=SDL-vita-gles-pvr-${{ inputs.pvr-version}}" >> ${GITHUB_OUTPUT} + ;; + "xpib") + echo "cache-key=SDL-vita-gles-pib-${{ inputs.pib-version}}" >> ${GITHUB_OUTPUT} + ;; + *) + echo "Invalid type. Must be 'pib' or 'pvr'." + exit 1 + ;; + esac + - uses: actions/cache/restore@v4 + id: restore-cache + with: + path: /vita/dependencies + key: '${{ steps.calc.outputs.cache-key }}' + - name: 'Download PVR_PSP2 (GLES)' + if: ${{ !steps.restore-cache.outputs.cache-hit && inputs.type == 'pvr' }} + shell: sh + run: | + pvr_psp2_version=${{ inputs.pvr-version }} + + mkdir -p /vita/dependencies/include + mkdir -p /vita/dependencies/lib + + # Configure PVR_PSP2 headers + wget https://github.com/GrapheneCt/PVR_PSP2/archive/refs/tags/v$pvr_psp2_version.zip -P/tmp + unzip /tmp/v$pvr_psp2_version.zip -d/tmp + cp -r /tmp/PVR_PSP2-$pvr_psp2_version/include/* /vita/dependencies/include + rm /tmp/v$pvr_psp2_version.zip + + # include guard of PVR_PSP2's khrplatform.h does not match the usual one + sed -i -e s/__drvkhrplatform_h_/__khrplatform_h_/ /vita/dependencies/include/KHR/khrplatform.h + + # Configure PVR_PSP2 stub libraries + wget https://github.com/GrapheneCt/PVR_PSP2/releases/download/v$pvr_psp2_version/vitasdk_stubs.zip -P/tmp + unzip /tmp/vitasdk_stubs.zip -d/tmp/pvr_psp2_stubs + find /tmp/pvr_psp2_stubs -type f -name "*.a" -exec cp {} /vita/dependencies/lib \; + rm /tmp/vitasdk_stubs.zip + rm -rf /tmp/pvr_psp2_stubs + + - name: 'Download gl4es4vita (OpenGL)' + if: ${{ !steps.restore-cache.outputs.cache-hit && inputs.type == 'pib' }} + shell: sh + run: | + gl4es4vita_version=${{ inputs.pib-version }} + + mkdir -p /vita/dependencies/include + mkdir -p /vita/dependencies/lib + + # Configure gl4es4vita headers + wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/include.zip -P/tmp + unzip -o /tmp/include.zip -d/vita/dependencies/include + rm /tmp/include.zip + + # Configure gl4es4vita stub libraries + wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/vitasdk_stubs.zip -P/tmp + unzip /tmp/vitasdk_stubs.zip -d/vita/dependencies/lib + + - uses: actions/cache/save@v4 + if: ${{ !steps.restore-cache.outputs.cache-hit }} + with: + path: /vita/dependencies + key: '${{ steps.calc.outputs.cache-key }}' + + - name: Copy PVR_PSP2 (GLES) or gl4es4vita (OpenGL) to vita toolchain dir + shell: sh + run: | + cp -rv /vita/dependencies/* ${VITASDK}/arm-vita-eabi diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py index 77ba2f9c9c369..2501a97fc9c66 100755 --- a/.github/workflows/create-test-plan.py +++ b/.github/workflows/create-test-plan.py @@ -49,6 +49,7 @@ class SdlPlatform(Enum): PowerPC64 = "powerpc64" Ps2 = "ps2" Psp = "psp" + Vita = "vita" Riscos = "riscos" FreeBSD = "freebsd" NetBSD = "netbsd" @@ -67,6 +68,11 @@ class IntelCompiler(Enum): Icx = "icx" +class VitaGLES(Enum): + Pib = "pib" + Pvr = "pvr" + + @dataclasses.dataclass(slots=True) class JobSpec: name: str @@ -89,6 +95,7 @@ class JobSpec: msvc_arch: Optional[MsvcArch] = None clang_cl: bool = False uwp: bool = False + vita_gles: Optional[VitaGLES] = None JOB_SPECS = { @@ -124,6 +131,8 @@ class JobSpec: "ppc64": JobSpec(name="PowerPC64", os=JobOs.UbuntuLatest, platform=SdlPlatform.PowerPC64, artifact="SDL-ppc64le", container="dockcross/linux-ppc64le:latest", ), "ps2": JobSpec(name="Sony PlayStation 2", os=JobOs.UbuntuLatest, platform=SdlPlatform.Ps2, artifact="SDL-ps2", container="ps2dev/ps2dev:latest", ), "psp": JobSpec(name="Sony PlayStation Portable", os=JobOs.UbuntuLatest, platform=SdlPlatform.Psp, artifact="SDL-psp", container="pspdev/pspdev:latest", ), + "vita-pib": JobSpec(name="Sony PlayStation Vita (GLES w/ pib)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pib", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pib, ), + "vita-pvr": JobSpec(name="Sony PlayStation Vita (GLES w/ PVR_PSP2)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pvr", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pvr, ), "riscos": JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ), "netbsd": JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", ), "freebsd": JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", ), @@ -187,6 +196,7 @@ class JobDetails: cpactions_arch: str = "" cpactions_setup_cmd: str = "" cpactions_install_cmd: str = "" + setup_vita_gles_type: str = "" def to_workflow(self) -> dict[str, str|bool]: data = { @@ -242,6 +252,7 @@ def to_workflow(self) -> dict[str, str|bool]: "cpactions-arch": self.cpactions_arch, "cpactions-setup-cmd": self.cpactions_setup_cmd, "cpactions-install-cmd": self.cpactions_install_cmd, + "setup-vita-gles-type": self.setup_vita_gles_type, } return {k: v for k, v in data.items() if v != ""} @@ -476,6 +487,28 @@ def spec_to_job(spec: JobSpec) -> JobDetails: job.cc = "psp-gcc" job.ldflags = ["-L${PSPDEV}/lib", "-L${PSPDEV}/psp/lib", "-L${PSPDEV}/psp/sdk/lib", ] job.pollute_directories = ["${PSPDEV}/include", "${PSPDEV}/psp/include", "${PSPDEV}/psp/sdk/include", ] + case SdlPlatform.Vita: + job.sudo = "" + job.apt_packages = [] + job.apk_packages = ["cmake", "ninja", "pkgconf", "bash", "tar"] + job.cmake_toolchain_file = "${VITASDK}/share/vita.toolchain.cmake" + assert spec.vita_gles is not None + job.setup_vita_gles_type = { + VitaGLES.Pib: "pib", + VitaGLES.Pvr: "pvr", + }[spec.vita_gles] + job.cmake_arguments.extend(( + f"-DVIDEO_VITA_PIB={ 'true' if spec.vita_gles == VitaGLES.Pib else 'false' }", + f"-DVIDEO_VITA_PVR={ 'true' if spec.vita_gles == VitaGLES.Pvr else 'false' }", + "-DSDL_ARMNEON=ON", + "-DSDL_ARMSIMD=ON", + )) + # Fix vita.toolchain.cmake (https://github.com/vitasdk/vita-toolchain/pull/253) + job.source_cmd = "sed -i -E 's/set\( PKG_CONFIG_EXECUTABLE \"\$\{VITASDK}\/bin\/arm-vita-eabi-pkg-config\" )/set( PKG_CONFIG_EXECUTABLE \"${VITASDK}\/bin\/arm-vita-eabi-pkg-config\" CACHE PATH \"Path of pkg-config executable\" )/' ${VITASDK}/share/vita.toolchain.cmake" + job.clang_tidy = False + job.run_tests = False + job.shared = False + job.cc = "arm-vita-eabi-gcc" case SdlPlatform.Haiku: fpic = False job.run_tests = False diff --git a/.github/workflows/generic.yml b/.github/workflows/generic.yml index 917b4b735cba9..44560a668045b 100644 --- a/.github/workflows/generic.yml +++ b/.github/workflows/generic.yml @@ -38,8 +38,7 @@ jobs: - name: 'Set up ninja' if: ${{ matrix.platform.setup-ninja }} uses: ./.github/actions/setup-ninja - - name: 'Set up libusb' - id: libusb + - name: 'Set up libusb for MSVC' if: ${{ matrix.platform.setup-libusb-arch != '' }} uses: ./.github/actions/setup-msvc-libusb with: @@ -114,6 +113,11 @@ jobs: export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew update brew install ${{ matrix.platform.brew-packages }} + - name: 'Set up GLES for VITA' # Must be after apk + if: ${{ matrix.platform.setup-vita-gles-type != '' }} + uses: ./.github/actions/setup-vita-gles + with: + type: ${{ matrix.platform.setup-vita-gles-type }} - name: 'Pollute toolchain with "bad SDL headers' if: ${{ matrix.platform.pollute-directories != '' }} From 35e42d0a254f230bb736cf993a9c3855ea1680a1 Mon Sep 17 00:00:00 2001 From: hwsmm <9151706+hwsmm@users.noreply.github.com> Date: Sun, 28 Jul 2024 14:15:54 +0900 Subject: [PATCH 034/253] Remove SDL_DECLSPEC_FREE before SDL_DECLSPEC in gendynapi --- src/dynapi/gendynapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dynapi/gendynapi.py b/src/dynapi/gendynapi.py index 8c4fd3dfb91a6..091ce0d5ce121 100755 --- a/src/dynapi/gendynapi.py +++ b/src/dynapi/gendynapi.py @@ -196,8 +196,8 @@ def main(): # func_ret = func_ret.replace('extern', ' ') func_ret = func_ret.replace('SDLCALL', ' ') - func_ret = func_ret.replace('SDL_DECLSPEC', ' ') func_ret = func_ret.replace('SDL_DECLSPEC_FREE', ' ') + func_ret = func_ret.replace('SDL_DECLSPEC', ' ') # Remove trailing spaces in front of '*' tmp = "" while func_ret != tmp: From a36fe632fd8bcad23d2d170ee4caf5056f80dfea Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 28 Jul 2024 07:22:46 -0700 Subject: [PATCH 035/253] Added SDL_SetAppMetadata() (#10404) Removed duplicate hints SDL_HINT_APP_NAME, SDL_HINT_APP_ID, and SDL_HINT_AUDIO_DEVICE_APP_NAME. Wired up a few things to use the metadata; more to come! Fixes https://github.com/libsdl-org/SDL/issues/4703 --- docs/README-migration.md | 4 +- include/SDL3/SDL_hints.h | 96 -------------------- include/SDL3/SDL_init.h | 124 ++++++++++++++++++++++++++ src/SDL.c | 57 ++++++++++++ src/audio/jack/SDL_jackaudio.c | 12 +-- src/audio/pipewire/SDL_pipewire.c | 10 +-- src/audio/pulseaudio/SDL_pulseaudio.c | 27 +----- src/core/linux/SDL_dbus.c | 5 +- src/core/unix/SDL_appid.c | 3 +- src/dynapi/SDL_dynapi.sym | 3 + src/dynapi/SDL_dynapi_overrides.h | 3 + src/dynapi/SDL_dynapi_procs.h | 3 + src/video/cocoa/SDL_cocoaevents.m | 17 +++- 13 files changed, 214 insertions(+), 150 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index d6e0b0731c0ac..ad9bc6d4368fc 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -782,10 +782,12 @@ The following hints have been removed: * SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING - SDL now properly handles the 0x406D1388 Exception if no debugger intercepts it, preventing its propagation. * SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 - replaced with SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4, defaulting to SDL_TRUE * SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING +* SDL_HINT_APP_NAME - replaced by either using the appname param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_NAME_STRING with SDL_SetAppMetadataProperty(). +* SDL_HINT_AUDIO_DEVICE_APP_NAME - replaced by either using the appname param to SDL_SetAppMetadata() or using SDL_PROP_APP_METADATA_NAME_STRING in SDL_SetAppMetadataWithProperties() * Renamed hints SDL_HINT_VIDEODRIVER and SDL_HINT_AUDIODRIVER to SDL_HINT_VIDEO_DRIVER and SDL_HINT_AUDIO_DRIVER * Renamed environment variables SDL_VIDEODRIVER and SDL_AUDIODRIVER to SDL_VIDEO_DRIVER and SDL_AUDIO_DRIVER -* The environment variables SDL_VIDEO_X11_WMCLASS and SDL_VIDEO_WAYLAND_WMCLASS have been removed and replaced with the unified hint SDL_HINT_APP_ID +* The environment variables SDL_VIDEO_X11_WMCLASS and SDL_VIDEO_WAYLAND_WMCLASS have been removed and replaced with app metadata (either use the appindentifier param to SDL_SetAppMetadata() or set SDL_PROP_APP_METADATA_IDENTIFIER_STRING with SDL_SetAppMetadataProperty()). The following hints have been renamed: * SDL_HINT_ALLOW_TOPMOST => SDL_HINT_WINDOW_ALLOW_TOPMOST diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 51c629c4f6c6b..c2412e4ba64c3 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -125,79 +125,6 @@ extern "C" { */ #define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON" -/** - * A variable setting the app ID string. - * - * This string is used by desktop compositors to identify and group windows - * together, as well as match applications with associated desktop settings - * and icons. - * - * On Wayland this corresponds to the "app ID" window property and on X11 this - * corresponds to the WM_CLASS property. Windows inherit the value of this - * hint at creation time. Changing this hint after a window has been created - * will not change the app ID or class of existing windows. - * - * For *nix platforms, this string should be formatted in reverse-DNS notation - * and follow some basic rules to be valid: - * - * - The application ID must be composed of two or more elements separated by - * a period (.) character. - * - Each element must contain one or more of the alphanumeric characters - * (A-Z, a-z, 0-9) plus underscore (_) and hyphen (-) and must not start - * with a digit. Note that hyphens, while technically allowed, should not be - * used if possible, as they are not supported by all components that use - * the ID, such as D-Bus. For maximum compatibility, replace hyphens with an - * underscore. - * - The empty string is not a valid element (ie: your application ID may not - * start or end with a period and it is not valid to have two periods in a - * row). - * - The entire ID must be less than 255 characters in length. - * - * Examples of valid app ID strings: - * - * - org.MyOrg.MyApp - * - com.your_company.your_app - * - * Desktops such as GNOME and KDE require that the app ID string matches your - * application's .desktop file name (e.g. if the app ID string is - * 'org.MyOrg.MyApp', your application's .desktop file should be named - * 'org.MyOrg.MyApp.desktop'). - * - * If you plan to package your application in a container such as Flatpak, the - * app ID should match the name of your Flatpak container as well. - * - * If not set, SDL will attempt to use the application executable name. If the - * executable name cannot be retrieved, the generic string "SDL_App" will be - * used. - * - * This hint should be set before SDL is initialized. - * - * \since This hint is available since SDL 3.0.0. - */ -#define SDL_HINT_APP_ID "SDL_APP_ID" - -/** - * Specify an application name. - * - * This hint lets you specify the application name sent to the OS when - * required. For example, this will often appear in volume control applets for - * audio streams, and in lists of applications which are inhibiting the - * screensaver. You should use a string that describes your program ("My Game - * 2: The Revenge") - * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: probably the application's name or "SDL Application" if SDL - * doesn't have any better information. - * - * Note that, for audio streams, this can be overridden with - * SDL_HINT_AUDIO_DEVICE_APP_NAME. - * - * This hint should be set before SDL is initialized. - * - * \since This hint is available since SDL 3.0.0. - */ -#define SDL_HINT_APP_NAME "SDL_APP_NAME" - /** * A variable controlling whether controllers used with the Apple TV generate * UI events. @@ -254,29 +181,6 @@ extern "C" { */ #define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY" -/** - * Specify an application name for an audio device. - * - * Some audio backends (such as PulseAudio) allow you to describe your audio - * stream. Among other things, this description might show up in a system - * control panel that lets the user adjust the volume on specific audio - * streams instead of using one giant master volume slider. - * - * This hints lets you transmit that information to the OS. The contents of - * this hint are used while opening an audio device. You should use a string - * that describes your program ("My Game 2: The Revenge") - * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: this will be the name set with SDL_HINT_APP_NAME, if that hint is - * set. Otherwise, it'll probably the application's name or "SDL Application" - * if SDL doesn't have any better information. - * - * This hint should be set before an audio device is opened. - * - * \since This hint is available since SDL 3.0.0. - */ -#define SDL_HINT_AUDIO_DEVICE_APP_NAME "SDL_AUDIO_DEVICE_APP_NAME" - /** * Specify an application icon name for an audio device. * diff --git a/include/SDL3/SDL_init.h b/include/SDL3/SDL_init.h index 18d5d8956dbff..5b12f77652373 100644 --- a/include/SDL3/SDL_init.h +++ b/include/SDL3/SDL_init.h @@ -105,12 +105,18 @@ typedef Uint32 SDL_InitFlags; * call SDL_Quit() to force shutdown). If a subsystem is already loaded then * this call will increase the ref-count and return. * + * Consider reporting some basic metadata about your application before + * calling SDL_Init, using either SDL_SetAppMetadata() or + * SDL_SetAppMetadataProperty(). + * * \param flags subsystem initialization flags. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. * + * \sa SDL_SetAppMetadata + * \sa SDL_SetAppMetadataProperty * \sa SDL_InitSubSystem * \sa SDL_Quit * \sa SDL_SetMainReady @@ -182,6 +188,124 @@ extern SDL_DECLSPEC SDL_InitFlags SDLCALL SDL_WasInit(SDL_InitFlags flags); */ extern SDL_DECLSPEC void SDLCALL SDL_Quit(void); +/** + * Specify basic metadata about your app. + * + * You can optionally provide metadata about your app to SDL. This is not + * required, but strongly encouraged. + * + * There are several locations where SDL can make use of metadata (an "About" + * box in the macOS menu bar, the name of the app can be shown on some audio + * mixers, etc). Any piece of metadata can be left as NULL, if a specific detail + * doesn't make sense for the app. + * + * This function should be called as early as possible, before SDL_Init. + * Multiple calls to this function are allowed, but various state might not + * change once it has been set up with a previous call to this function. + * + * Passing a NULL removes any previous metadata. + * + * This is a simplified interface for the most important information. You can + * supply significantly more detailed metadata with SDL_SetAppMetadataProperty(). + * + * \param appname The name of the application ("My Game 2: Bad Guy's Revenge!"). + * \param appversion The version of the application ("1.0.0beta5" or a git hash, or whatever makes sense). + * \param appidentifier A unique string in reverse-domain format that identifies this app ("com.example.mygame2"). + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 3.0.0. + * + * \threadsafety It is safe to call this function from any thread. + * + * \sa SDL_SetAppMetadataProperty + */ +extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier); + +/** + * Specify metadata about your app through a set of properties. + * + * You can optionally provide metadata about your app to SDL. This is not + * required, but strongly encouraged. + * + * There are several locations where SDL can make use of metadata (an "About" + * box in the macOS menu bar, the name of the app can be shown on some audio + * mixers, etc). Any piece of metadata can be left out, if a specific detail + * doesn't make sense for the app. + * + * This function should be called as early as possible, before SDL_Init. + * Multiple calls to this function are allowed, but various state might not + * change once it has been set up with a previous call to this function. + * + * Once set, this metadata can be read using SDL_GetMetadataProperty(). + * + * These are the supported properties: + * + * - `SDL_PROP_APP_METADATA_NAME_STRING`: The human-readable name of + * the application, like "My Game 2: Bad Guy's Revenge!". This defaults to "SDL Application". + * - SDL_PROP_APP_METADATA_VERSION_STRING`: The version of the app that + * is running; there are no rules on format, so "1.0.3beta2" and + * "April 22nd, 2024" and a git hash are all valid options. This has no default. + * - `SDL_PROP_APP_METADATA_IDENTIFIER_STRING`: A unique string that + * identifies this app. This must be in reverse-domain format, like + * "com.example.mygame2". This string is used by desktop compositors to + * identify and group windows together, as well as match applications + * with associated desktop settings and icons. This has no default. + * - SDL_PROP_APP_METADATA_CREATOR_STRING`: The human-readable name + * of the creator/developer/maker of this app, like "MojoWorkshop, LLC" + * - SDL_PROP_APP_METADATA_COPYRIGHT_STRING`: The human-readable copyright + * notice, like "Copyright (c) 2024 MojoWorkshop, LLC" or whatnot. Keep + * this to one line, don't paste a copy of a whole software license in + * here. This has no default. + * - SDL_PROP_APP_METADATA_URL_STRING`: A URL to the app on the web. Maybe + * a product page, or a storefront, or even a GitHub repository, for + * user's further information This has no default. + * - SDL_PROP_APP_METADATA_TYPE_STRING`: The type of application this is. + * Currently this string can be "game" for a video game, "mediaplayer" for + * a media player, or generically "application" if nothing else applies. + * Future versions of SDL might add new types. This defaults to "application". + * + * \param name the name of the metadata property to set. + * \param value the value of the property, or NULL to remove that property. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 3.0.0. + * + * \threadsafety It is safe to call this function from any thread. + * + * \sa SDL_GetAppMetadataProperty + * \sa SDL_SetAppMetadata + */ +extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadataProperty(const char *name, const char *value); + +#define SDL_PROP_APP_METADATA_NAME_STRING "SDL.app.metadata.name" +#define SDL_PROP_APP_METADATA_VERSION_STRING "SDL.app.metadata.version" +#define SDL_PROP_APP_METADATA_IDENTIFIER_STRING "SDL.app.metadata.identifier" +#define SDL_PROP_APP_METADATA_CREATOR_STRING "SDL.app.metadata.creator" +#define SDL_PROP_APP_METADATA_COPYRIGHT_STRING "SDL.app.metadata.copyright" +#define SDL_PROP_APP_METADATA_URL_STRING "SDL.app.metadata.url" +#define SDL_PROP_APP_METADATA_TYPE_STRING "SDL.app.metadata.type" + +/** + * Get metadata about your app. + * + * This returns metadata previously set using SDL_SetAppMetadata() or SDL_SetAppMetadataProperty(). See SDL_SetAppMetadataProperty() for the list of available properties and their meanings. + * + * \param name the name of the metadata property to get. + * \returns the current value of the metadata property, or the default if it is not set, NULL for properties with no default. + * + * \since This function is available since SDL 3.0.0. + * + * \threadsafety It is safe to call this function from any thread, although + * the string returned is not protected and could potentially be + * freed if you call SDL_SetAppMetadataProperty() to set that property from another thread. + * + * \sa SDL_SetAppMetadata + * \sa SDL_SetAppMetadataProperty + */ +extern SDL_DECLSPEC const char * SDLCALL SDL_GetAppMetadataProperty(const char *name); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/src/SDL.c b/src/SDL.c index 848f89700874e..654647f653ef1 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -107,6 +107,63 @@ SDL_NORETURN void SDL_ExitProcess(int exitcode) #endif } +/* App metadata */ + +int SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier) +{ + SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_NAME_STRING, appname); + SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_VERSION_STRING, appversion); + SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_IDENTIFIER_STRING, appidentifier); + return 0; +} + +static SDL_bool SDL_ValidMetadataProperty(const char *name) +{ + if (!name || !*name) { + return SDL_FALSE; + } + + if (SDL_strcmp(name, SDL_PROP_APP_METADATA_NAME_STRING) == 0 || + SDL_strcmp(name, SDL_PROP_APP_METADATA_VERSION_STRING) == 0 || + SDL_strcmp(name, SDL_PROP_APP_METADATA_IDENTIFIER_STRING) == 0 || + SDL_strcmp(name, SDL_PROP_APP_METADATA_CREATOR_STRING) == 0 || + SDL_strcmp(name, SDL_PROP_APP_METADATA_COPYRIGHT_STRING) == 0 || + SDL_strcmp(name, SDL_PROP_APP_METADATA_URL_STRING) == 0 || + SDL_strcmp(name, SDL_PROP_APP_METADATA_TYPE_STRING) == 0) { + return SDL_TRUE; + } + return SDL_FALSE; +} + +int SDL_SetAppMetadataProperty(const char *name, const char *value) +{ + if (!SDL_ValidMetadataProperty(name)) { + return SDL_InvalidParamError("name"); + } + + return SDL_SetStringProperty(SDL_GetGlobalProperties(), name, value); +} + +const char *SDL_GetAppMetadataProperty(const char *name) +{ + if (!SDL_ValidMetadataProperty(name)) { + SDL_InvalidParamError("name"); + return NULL; + } + + const SDL_PropertiesID props = SDL_GetGlobalProperties(); + const char *value = SDL_GetStringProperty(props, name, NULL); + if (!value || !*value) { + if (SDL_strcmp(name, SDL_PROP_APP_METADATA_NAME_STRING) == 0) { + value = "SDL Application"; + } else if (SDL_strcmp(name, SDL_PROP_APP_METADATA_TYPE_STRING) == 0) { + value = "application"; + } + } + return value; +} + + /* The initialized subsystems */ #ifdef SDL_MAIN_NEEDED static SDL_bool SDL_MainIsReady = SDL_FALSE; diff --git a/src/audio/jack/SDL_jackaudio.c b/src/audio/jack/SDL_jackaudio.c index 1a15078c6b7e7..d334fb3fc1836 100644 --- a/src/audio/jack/SDL_jackaudio.c +++ b/src/audio/jack/SDL_jackaudio.c @@ -261,18 +261,10 @@ static void JACK_CloseDevice(SDL_AudioDevice *device) } } -// !!! FIXME: unify this (PulseAudio has a getAppName, Pipewire has a thing, etc +// !!! FIXME: unify this (PulseAudio has a getAppName, Pipewire has a thing, etc) static const char *GetJackAppName(void) { - const char *retval = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_APP_NAME); - if (retval && *retval) { - return retval; - } - retval = SDL_GetHint(SDL_HINT_APP_NAME); - if (retval && *retval) { - return retval; - } - return "SDL Application"; + return SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_NAME_STRING); } static int JACK_OpenDevice(SDL_AudioDevice *device) diff --git a/src/audio/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c index 272417aed060e..c22269c8c0770 100644 --- a/src/audio/pipewire/SDL_pipewire.c +++ b/src/audio/pipewire/SDL_pipewire.c @@ -1049,13 +1049,7 @@ static int PIPEWIRE_OpenDevice(SDL_AudioDevice *device) const int min_period = PW_MIN_SAMPLES * SPA_MAX(device->spec.freq / PW_BASE_CLOCK_RATE, 1); // Get the hints for the application name, icon name, stream name and role - app_name = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_APP_NAME); - if (!app_name || *app_name == '\0') { - app_name = SDL_GetHint(SDL_HINT_APP_NAME); - if (!app_name || *app_name == '\0') { - app_name = "SDL Application"; - } - } + app_name = SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_NAME_STRING); icon_name = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_APP_ICON_NAME); if (!icon_name || *icon_name == '\0') { @@ -1063,7 +1057,7 @@ static int PIPEWIRE_OpenDevice(SDL_AudioDevice *device) } // App ID. Default to NULL if not available. - app_id = SDL_GetHint(SDL_HINT_APP_ID); + app_id = SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_IDENTIFIER_STRING); stream_name = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_STREAM_NAME); if (!stream_name || *stream_name == '\0') { diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c index b373ffb70d157..1ba721ec46d73 100644 --- a/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/src/audio/pulseaudio/SDL_pulseaudio.c @@ -264,34 +264,9 @@ static int load_pulseaudio_syms(void) return 0; } -static SDL_INLINE int squashVersion(const int major, const int minor, const int patch) -{ - return ((major & 0xFF) << 16) | ((minor & 0xFF) << 8) | (patch & 0xFF); -} - -// Workaround for older pulse: pa_context_new() must have non-NULL appname static const char *getAppName(void) { - const char *retval = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_APP_NAME); - if (retval && *retval) { - return retval; - } - retval = SDL_GetHint(SDL_HINT_APP_NAME); - if (retval && *retval) { - return retval; - } else { - const char *verstr = PULSEAUDIO_pa_get_library_version(); - retval = "SDL Application"; // the "oh well" default. - if (verstr) { - int maj, min, patch; - if (SDL_sscanf(verstr, "%d.%d.%d", &maj, &min, &patch) == 3) { - if (squashVersion(maj, min, patch) >= squashVersion(0, 9, 15)) { - retval = NULL; // 0.9.15+ handles NULL correctly. - } - } - } - } - return retval; + return SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_NAME_STRING); } static void OperationStateChangeCallback(pa_operation *o, void *userdata) diff --git a/src/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c index 9e6a56b65e1d8..15da60520fdf5 100644 --- a/src/core/linux/SDL_dbus.c +++ b/src/core/linux/SDL_dbus.c @@ -495,11 +495,8 @@ SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit) const char *interface = "org.freedesktop.ScreenSaver"; if (inhibit) { - const char *app = SDL_GetHint(SDL_HINT_APP_NAME); + const char *app = SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_NAME_STRING); const char *reason = SDL_GetHint(SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME); - if (!app || !app[0]) { - app = "My SDL application"; - } if (!reason || !reason[0]) { reason = default_inhibit_reason; } diff --git a/src/core/unix/SDL_appid.c b/src/core/unix/SDL_appid.c index eb4bb4b139954..30eaf16999182 100644 --- a/src/core/unix/SDL_appid.c +++ b/src/core/unix/SDL_appid.c @@ -59,8 +59,7 @@ const char *SDL_GetExeName(void) const char *SDL_GetAppID(void) { - /* Always check the hint, as it may have changed */ - const char *id_str = SDL_GetHint(SDL_HINT_APP_ID); + const char *id_str = SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_NAME_STRING); if (!id_str) { /* If the hint isn't set, try to use the application's executable name */ diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 8d789ac74146b..299fb40380835 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -158,6 +158,7 @@ SDL3_0.0.0 { SDL_GetAndroidInternalStoragePath; SDL_GetAndroidJNIEnv; SDL_GetAndroidSDKVersion; + SDL_GetAppMetadataProperty; SDL_GetAssertionHandler; SDL_GetAssertionReport; SDL_GetAudioDeviceChannelMap; @@ -694,6 +695,8 @@ SDL3_0.0.0 { SDL_SendGamepadEffect; SDL_SendJoystickEffect; SDL_SendJoystickVirtualSensorData; + SDL_SetAppMetadata; + SDL_SetAppMetadataProperty; SDL_SetAssertionHandler; SDL_SetAudioDeviceGain; SDL_SetAudioPostmixCallback; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 8a17b98052c22..6c7b6b158d85b 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -183,6 +183,7 @@ #define SDL_GetAndroidInternalStoragePath SDL_GetAndroidInternalStoragePath_REAL #define SDL_GetAndroidJNIEnv SDL_GetAndroidJNIEnv_REAL #define SDL_GetAndroidSDKVersion SDL_GetAndroidSDKVersion_REAL +#define SDL_GetAppMetadataProperty SDL_GetAppMetadataProperty_REAL #define SDL_GetAssertionHandler SDL_GetAssertionHandler_REAL #define SDL_GetAssertionReport SDL_GetAssertionReport_REAL #define SDL_GetAudioDeviceChannelMap SDL_GetAudioDeviceChannelMap_REAL @@ -719,6 +720,8 @@ #define SDL_SendGamepadEffect SDL_SendGamepadEffect_REAL #define SDL_SendJoystickEffect SDL_SendJoystickEffect_REAL #define SDL_SendJoystickVirtualSensorData SDL_SendJoystickVirtualSensorData_REAL +#define SDL_SetAppMetadata SDL_SetAppMetadata_REAL +#define SDL_SetAppMetadataProperty SDL_SetAppMetadataProperty_REAL #define SDL_SetAssertionHandler SDL_SetAssertionHandler_REAL #define SDL_SetAudioDeviceGain SDL_SetAudioDeviceGain_REAL #define SDL_SetAudioPostmixCallback SDL_SetAudioPostmixCallback_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index b93fe034512ef..1bdb1b0b628d5 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -203,6 +203,7 @@ SDL_DYNAPI_PROC(Uint32,SDL_GetAndroidExternalStorageState,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetAndroidInternalStoragePath,(void),(),return) SDL_DYNAPI_PROC(void*,SDL_GetAndroidJNIEnv,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetAndroidSDKVersion,(void),(),return) +SDL_DYNAPI_PROC(const char*,SDL_GetAppMetadataProperty,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetAssertionHandler,(void **a),(a),return) SDL_DYNAPI_PROC(const SDL_AssertData*,SDL_GetAssertionReport,(void),(),return) SDL_DYNAPI_PROC(int*,SDL_GetAudioDeviceChannelMap,(SDL_AudioDeviceID a, int *b),(a,b),return) @@ -730,6 +731,8 @@ SDL_DYNAPI_PROC(int,SDL_SendAndroidMessage,(Uint32 a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SendGamepadEffect,(SDL_Gamepad *a, const void *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_SendJoystickEffect,(SDL_Joystick *a, const void *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_SendJoystickVirtualSensorData,(SDL_Joystick *a, SDL_SensorType b, Uint64 c, const float *d, int e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(int,SDL_SetAppMetadata,(const char *a, const char *b, const char *c),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_SetAppMetadataProperty,(const char *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_SetAssertionHandler,(SDL_AssertionHandler a, void *b),(a,b),) SDL_DYNAPI_PROC(int,SDL_SetAudioDeviceGain,(SDL_AudioDeviceID a, float b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetAudioPostmixCallback,(SDL_AudioDeviceID a, SDL_AudioPostmixCallback b, void *c),(a,b,c),return) diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index 3ff9a2ee71564..52790a92d4de5 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -362,12 +362,19 @@ - (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app static NSString *GetApplicationName(void) { - NSString *appName; + NSString *appName = nil; + + const char *metaname = SDL_GetStringProperty(SDL_GetGlobalProperties(), SDL_PROP_APP_METADATA_NAME_STRING, NULL); + if (metaname && *metaname) { + appName = [NSString stringWithUTF8String:metaname]; + } /* Determine the application name */ - appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; if (!appName) { - appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]; + appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; + if (!appName) { + appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]; + } } if (![appName length]) { @@ -420,6 +427,10 @@ static void CreateApplicationMenus(void) /* Add menu items */ title = [@"About " stringByAppendingString:appName]; + + // !!! FIXME: Menu items can't take parameters, just a basic selector, so this should instead call a selector + // !!! FIXME: that itself calls -[NSApplication orderFrontStandardAboutPanelWithOptions:optionsDictionary], + // !!! FIXME: filling in that NSDictionary with SDL_GetAppMetadataProperty() [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; [appleMenu addItem:[NSMenuItem separatorItem]]; From 18fe89e0365302221a28159d7a2d7616a25ffeee Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sun, 28 Jul 2024 14:23:13 +0000 Subject: [PATCH 036/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_init.h | 76 +++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/include/SDL3/SDL_init.h b/include/SDL3/SDL_init.h index 5b12f77652373..5d4179ca291a9 100644 --- a/include/SDL3/SDL_init.h +++ b/include/SDL3/SDL_init.h @@ -196,8 +196,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_Quit(void); * * There are several locations where SDL can make use of metadata (an "About" * box in the macOS menu bar, the name of the app can be shown on some audio - * mixers, etc). Any piece of metadata can be left as NULL, if a specific detail - * doesn't make sense for the app. + * mixers, etc). Any piece of metadata can be left as NULL, if a specific + * detail doesn't make sense for the app. * * This function should be called as early as possible, before SDL_Init. * Multiple calls to this function are allowed, but various state might not @@ -206,18 +206,22 @@ extern SDL_DECLSPEC void SDLCALL SDL_Quit(void); * Passing a NULL removes any previous metadata. * * This is a simplified interface for the most important information. You can - * supply significantly more detailed metadata with SDL_SetAppMetadataProperty(). + * supply significantly more detailed metadata with + * SDL_SetAppMetadataProperty(). * - * \param appname The name of the application ("My Game 2: Bad Guy's Revenge!"). - * \param appversion The version of the application ("1.0.0beta5" or a git hash, or whatever makes sense). - * \param appidentifier A unique string in reverse-domain format that identifies this app ("com.example.mygame2"). + * \param appname The name of the application ("My Game 2: Bad Guy's + * Revenge!"). + * \param appversion The version of the application ("1.0.0beta5" or a git + * hash, or whatever makes sense). + * \param appidentifier A unique string in reverse-domain format that + * identifies this app ("com.example.mygame2"). * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.0.0. - * * \threadsafety It is safe to call this function from any thread. * + * \since This function is available since SDL 3.0.0. + * * \sa SDL_SetAppMetadataProperty */ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier); @@ -241,39 +245,41 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const ch * * These are the supported properties: * - * - `SDL_PROP_APP_METADATA_NAME_STRING`: The human-readable name of - * the application, like "My Game 2: Bad Guy's Revenge!". This defaults to "SDL Application". - * - SDL_PROP_APP_METADATA_VERSION_STRING`: The version of the app that - * is running; there are no rules on format, so "1.0.3beta2" and - * "April 22nd, 2024" and a git hash are all valid options. This has no default. + * - `SDL_PROP_APP_METADATA_NAME_STRING`: The human-readable name of the + * application, like "My Game 2: Bad Guy's Revenge!". This defaults to "SDL + * Application". + * - SDL_PROP_APP_METADATA_VERSION_STRING`: The version of the app that is + * running; there are no rules on format, so "1.0.3beta2" and "April 22nd, + * 2024" and a git hash are all valid options. This has no default. * - `SDL_PROP_APP_METADATA_IDENTIFIER_STRING`: A unique string that * identifies this app. This must be in reverse-domain format, like * "com.example.mygame2". This string is used by desktop compositors to - * identify and group windows together, as well as match applications - * with associated desktop settings and icons. This has no default. - * - SDL_PROP_APP_METADATA_CREATOR_STRING`: The human-readable name - * of the creator/developer/maker of this app, like "MojoWorkshop, LLC" + * identify and group windows together, as well as match applications with + * associated desktop settings and icons. This has no default. + * - SDL_PROP_APP_METADATA_CREATOR_STRING`: The human-readable name of the + * creator/developer/maker of this app, like "MojoWorkshop, LLC" * - SDL_PROP_APP_METADATA_COPYRIGHT_STRING`: The human-readable copyright - * notice, like "Copyright (c) 2024 MojoWorkshop, LLC" or whatnot. Keep - * this to one line, don't paste a copy of a whole software license in - * here. This has no default. - * - SDL_PROP_APP_METADATA_URL_STRING`: A URL to the app on the web. Maybe - * a product page, or a storefront, or even a GitHub repository, for - * user's further information This has no default. + * notice, like "Copyright (c) 2024 MojoWorkshop, LLC" or whatnot. Keep this + * to one line, don't paste a copy of a whole software license in here. This + * has no default. + * - SDL_PROP_APP_METADATA_URL_STRING`: A URL to the app on the web. Maybe a + * product page, or a storefront, or even a GitHub repository, for user's + * further information This has no default. * - SDL_PROP_APP_METADATA_TYPE_STRING`: The type of application this is. - * Currently this string can be "game" for a video game, "mediaplayer" for - * a media player, or generically "application" if nothing else applies. - * Future versions of SDL might add new types. This defaults to "application". + * Currently this string can be "game" for a video game, "mediaplayer" for a + * media player, or generically "application" if nothing else applies. + * Future versions of SDL might add new types. This defaults to + * "application". * * \param name the name of the metadata property to set. * \param value the value of the property, or NULL to remove that property. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 3.0.0. - * * \threadsafety It is safe to call this function from any thread. * + * \since This function is available since SDL 3.0.0. + * * \sa SDL_GetAppMetadataProperty * \sa SDL_SetAppMetadata */ @@ -290,16 +296,20 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadataProperty(const char *name, con /** * Get metadata about your app. * - * This returns metadata previously set using SDL_SetAppMetadata() or SDL_SetAppMetadataProperty(). See SDL_SetAppMetadataProperty() for the list of available properties and their meanings. + * This returns metadata previously set using SDL_SetAppMetadata() or + * SDL_SetAppMetadataProperty(). See SDL_SetAppMetadataProperty() for the list + * of available properties and their meanings. * * \param name the name of the metadata property to get. - * \returns the current value of the metadata property, or the default if it is not set, NULL for properties with no default. - * - * \since This function is available since SDL 3.0.0. + * \returns the current value of the metadata property, or the default if it + * is not set, NULL for properties with no default. * * \threadsafety It is safe to call this function from any thread, although * the string returned is not protected and could potentially be - * freed if you call SDL_SetAppMetadataProperty() to set that property from another thread. + * freed if you call SDL_SetAppMetadataProperty() to set that + * property from another thread. + * + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetAppMetadata * \sa SDL_SetAppMetadataProperty From b5ad74998bb9ebb9951621ee0bdf564317cb1e6e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 28 Jul 2024 07:06:22 -0700 Subject: [PATCH 037/253] Removed SDL_DECLSPEC_FREE --- include/SDL3/SDL_audio.h | 10 +++++----- include/SDL3/SDL_begin_code.h | 4 ++-- include/SDL3/SDL_camera.h | 4 ++-- include/SDL3/SDL_clipboard.h | 6 +++--- include/SDL3/SDL_filesystem.h | 4 ++-- include/SDL3/SDL_gamepad.h | 12 ++++++------ include/SDL3/SDL_haptic.h | 2 +- include/SDL3/SDL_joystick.h | 2 +- include/SDL3/SDL_keyboard.h | 2 +- include/SDL3/SDL_locale.h | 2 +- include/SDL3/SDL_mouse.h | 2 +- include/SDL3/SDL_stdinc.h | 6 +++--- include/SDL3/SDL_storage.h | 2 +- include/SDL3/SDL_touch.h | 4 ++-- include/SDL3/SDL_video.h | 8 ++++---- src/dynapi/gendynapi.py | 1 - 16 files changed, 35 insertions(+), 36 deletions(-) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index efd46c0e2e19a..bd3ee14aaae09 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -457,7 +457,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentAudioDriver(void); * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioRecordingDevices */ -extern SDL_DECLSPEC_FREE SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices(int *count); +extern SDL_DECLSPEC SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices(int *count); /** * Get a list of currently-connected audio recording devices. @@ -486,7 +486,7 @@ extern SDL_DECLSPEC_FREE SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioPlaybackDevices */ -extern SDL_DECLSPEC_FREE SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecordingDevices(int *count); +extern SDL_DECLSPEC SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecordingDevices(int *count); /** * Get the human-readable name of a specific audio device. @@ -561,7 +561,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC_FREE int * SDLCALL SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count); +extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count); /** * Open a specific audio device. @@ -1111,7 +1111,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC_FREE int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count); +extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count); /** * Get the current output channel map of an audio stream. @@ -1135,7 +1135,7 @@ extern SDL_DECLSPEC_FREE int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_Aud * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC_FREE int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream *stream, int *count); +extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream *stream, int *count); /** * Set the current input channel map of an audio stream. diff --git a/include/SDL3/SDL_begin_code.h b/include/SDL3/SDL_begin_code.h index 2483533b8e987..ee4c9eab2aa9e 100644 --- a/include/SDL3/SDL_begin_code.h +++ b/include/SDL3/SDL_begin_code.h @@ -69,8 +69,8 @@ #endif /* This is used to mark functions that return memory that need to be freed with SDL_free() */ -#ifndef SDL_DECLSPEC_FREE -#define SDL_DECLSPEC_FREE SDL_DECLSPEC +#ifndef SDL_DECLSPEC +#define SDL_DECLSPEC SDL_DECLSPEC #endif /* By default SDL uses the C calling convention */ diff --git a/include/SDL3/SDL_camera.h b/include/SDL3/SDL_camera.h index 77cfc3551ac83..46dcee1de0ed2 100644 --- a/include/SDL3/SDL_camera.h +++ b/include/SDL3/SDL_camera.h @@ -178,7 +178,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void); * * \sa SDL_OpenCamera */ -extern SDL_DECLSPEC_FREE SDL_CameraID * SDLCALL SDL_GetCameras(int *count); +extern SDL_DECLSPEC SDL_CameraID * SDLCALL SDL_GetCameras(int *count); /** * Get the list of native formats/sizes a camera supports. @@ -217,7 +217,7 @@ extern SDL_DECLSPEC_FREE SDL_CameraID * SDLCALL SDL_GetCameras(int *count); * \sa SDL_GetCameras * \sa SDL_OpenCamera */ -extern SDL_DECLSPEC_FREE SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count); +extern SDL_DECLSPEC SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count); /** * Get the human-readable device name for a camera. diff --git a/include/SDL3/SDL_clipboard.h b/include/SDL3/SDL_clipboard.h index 1c1bd6bd9668e..ccd32011c5d12 100644 --- a/include/SDL3/SDL_clipboard.h +++ b/include/SDL3/SDL_clipboard.h @@ -71,7 +71,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); * \sa SDL_HasClipboardText * \sa SDL_SetClipboardText */ -extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetClipboardText(void); +extern SDL_DECLSPEC char * SDLCALL SDL_GetClipboardText(void); /** * Query whether the clipboard exists and contains a non-empty text string. @@ -114,7 +114,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text); * \sa SDL_HasPrimarySelectionText * \sa SDL_SetPrimarySelectionText */ -extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetPrimarySelectionText(void); +extern SDL_DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void); /** * Query whether the primary selection exists and contains a non-empty text @@ -225,7 +225,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearClipboardData(void); * \sa SDL_HasClipboardData * \sa SDL_SetClipboardData */ -extern SDL_DECLSPEC_FREE void * SDLCALL SDL_GetClipboardData(const char *mime_type, size_t *size); +extern SDL_DECLSPEC void * SDLCALL SDL_GetClipboardData(const char *mime_type, size_t *size); /** * Query whether there is data in the clipboard for the provided mime type. diff --git a/include/SDL3/SDL_filesystem.h b/include/SDL3/SDL_filesystem.h index 34b450472eafe..756a52dcc125f 100644 --- a/include/SDL3/SDL_filesystem.h +++ b/include/SDL3/SDL_filesystem.h @@ -132,7 +132,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetBasePath(void); * * \sa SDL_GetBasePath */ -extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetPrefPath(const char *org, const char *app); +extern SDL_DECLSPEC char * SDLCALL SDL_GetPrefPath(const char *org, const char *app); /** * The type of the OS-provided default folder for a specific purpose. @@ -375,7 +375,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo * * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE char ** SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count); +extern SDL_DECLSPEC char ** SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_gamepad.h b/include/SDL3/SDL_gamepad.h index 1291ae77e506a..cec068446eafa 100644 --- a/include/SDL3/SDL_gamepad.h +++ b/include/SDL3/SDL_gamepad.h @@ -398,7 +398,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReloadGamepadMappings(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE char ** SDLCALL SDL_GetGamepadMappings(int *count); +extern SDL_DECLSPEC char ** SDLCALL SDL_GetGamepadMappings(int *count); /** * Get the gamepad mapping string for a given GUID. @@ -413,7 +413,7 @@ extern SDL_DECLSPEC_FREE char ** SDLCALL SDL_GetGamepadMappings(int *count); * \sa SDL_GetJoystickGUIDForID * \sa SDL_GetJoystickGUID */ -extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID guid); +extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID guid); /** * Get the current mapping of a gamepad. @@ -432,7 +432,7 @@ extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID gu * \sa SDL_GetGamepadMappingForGUID * \sa SDL_SetGamepadMapping */ -extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad); +extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad); /** * Set the current mapping of a joystick or gamepad. @@ -477,7 +477,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasGamepad(void); * \sa SDL_HasGamepad * \sa SDL_OpenGamepad */ -extern SDL_DECLSPEC_FREE SDL_JoystickID * SDLCALL SDL_GetGamepads(int *count); +extern SDL_DECLSPEC SDL_JoystickID * SDLCALL SDL_GetGamepads(int *count); /** * Check if the given joystick is supported by the gamepad interface. @@ -653,7 +653,7 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetRealGamepadTypeForID(SDL_Joys * \sa SDL_GetGamepads * \sa SDL_GetGamepadMapping */ -extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetGamepadMappingForID(SDL_JoystickID instance_id); +extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMappingForID(SDL_JoystickID instance_id); /** * Open a gamepad for use. @@ -1007,7 +1007,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadEventsEnabled(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE SDL_GamepadBinding ** SDLCALL SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count); +extern SDL_DECLSPEC SDL_GamepadBinding ** SDLCALL SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count); /** * Manually pump gamepad updates if not using the loop. diff --git a/include/SDL3/SDL_haptic.h b/include/SDL3/SDL_haptic.h index d288a86a357f7..1d0a54efee750 100644 --- a/include/SDL3/SDL_haptic.h +++ b/include/SDL3/SDL_haptic.h @@ -942,7 +942,7 @@ typedef Uint32 SDL_HapticID; * * \sa SDL_OpenHaptic */ -extern SDL_DECLSPEC_FREE SDL_HapticID * SDLCALL SDL_GetHaptics(int *count); +extern SDL_DECLSPEC SDL_HapticID * SDLCALL SDL_GetHaptics(int *count); /** * Get the implementation dependent name of a haptic device. diff --git a/include/SDL3/SDL_joystick.h b/include/SDL3/SDL_joystick.h index 97130027725f6..1a1707664c10e 100644 --- a/include/SDL3/SDL_joystick.h +++ b/include/SDL3/SDL_joystick.h @@ -212,7 +212,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasJoystick(void); * \sa SDL_HasJoystick * \sa SDL_OpenJoystick */ -extern SDL_DECLSPEC_FREE SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count); +extern SDL_DECLSPEC SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count); /** * Get the implementation dependent name of a joystick. diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index 4c2569ecbbd88..b5453a0a15408 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -84,7 +84,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasKeyboard(void); * \sa SDL_GetKeyboardNameForID * \sa SDL_HasKeyboard */ -extern SDL_DECLSPEC_FREE SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count); +extern SDL_DECLSPEC SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count); /** * Get the name of a keyboard. diff --git a/include/SDL3/SDL_locale.h b/include/SDL3/SDL_locale.h index 121108bc7c9d5..85d77500c41de 100644 --- a/include/SDL3/SDL_locale.h +++ b/include/SDL3/SDL_locale.h @@ -98,7 +98,7 @@ typedef struct SDL_Locale * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE SDL_Locale ** SDLCALL SDL_GetPreferredLocales(int *count); +extern SDL_DECLSPEC SDL_Locale ** SDLCALL SDL_GetPreferredLocales(int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index 074cd9c1a1a35..185757aee9a4f 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -146,7 +146,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasMouse(void); * \sa SDL_GetMouseNameForID * \sa SDL_HasMouse */ -extern SDL_DECLSPEC_FREE SDL_MouseID * SDLCALL SDL_GetMice(int *count); +extern SDL_DECLSPEC SDL_MouseID * SDLCALL SDL_GetMice(int *count); /** * Get the name of a mouse. diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index 83411d3e20842..14e07509952c3 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -527,9 +527,9 @@ extern "C" { #define SDL_stack_free(data) SDL_free(data) #endif -extern SDL_DECLSPEC_FREE SDL_MALLOC void * SDLCALL SDL_malloc(size_t size); -extern SDL_DECLSPEC_FREE SDL_MALLOC SDL_ALLOC_SIZE2(1, 2) void * SDLCALL SDL_calloc(size_t nmemb, size_t size); -extern SDL_DECLSPEC_FREE SDL_ALLOC_SIZE(2) void * SDLCALL SDL_realloc(void *mem, size_t size); +extern SDL_DECLSPEC SDL_MALLOC void * SDLCALL SDL_malloc(size_t size); +extern SDL_DECLSPEC SDL_MALLOC SDL_ALLOC_SIZE2(1, 2) void * SDLCALL SDL_calloc(size_t nmemb, size_t size); +extern SDL_DECLSPEC SDL_ALLOC_SIZE(2) void * SDLCALL SDL_realloc(void *mem, size_t size); extern SDL_DECLSPEC void SDLCALL SDL_free(void *mem); typedef void *(SDLCALL *SDL_malloc_func)(size_t size); diff --git a/include/SDL3/SDL_storage.h b/include/SDL3/SDL_storage.h index 84a90f0e76a63..7fc58a887d676 100644 --- a/include/SDL3/SDL_storage.h +++ b/include/SDL3/SDL_storage.h @@ -419,7 +419,7 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetStorageSpaceRemaining(SDL_Storage *sto * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE char ** SDLCALL SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count); +extern SDL_DECLSPEC char ** SDLCALL SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_touch.h b/include/SDL3/SDL_touch.h index d040680b56cd9..6889f3697205f 100644 --- a/include/SDL3/SDL_touch.h +++ b/include/SDL3/SDL_touch.h @@ -91,7 +91,7 @@ typedef struct SDL_Finger * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE SDL_TouchID * SDLCALL SDL_GetTouchDevices(int *count); +extern SDL_DECLSPEC SDL_TouchID * SDLCALL SDL_GetTouchDevices(int *count); /** * Get the touch device name as reported from the driver. @@ -127,7 +127,7 @@ extern SDL_DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_Touch * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE SDL_Finger ** SDLCALL SDL_GetTouchFingers(SDL_TouchID touchID, int *count); +extern SDL_DECLSPEC SDL_Finger ** SDLCALL SDL_GetTouchFingers(SDL_TouchID touchID, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index f0b0d7755ef49..387f911404e5e 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -395,7 +395,7 @@ extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count); +extern SDL_DECLSPEC SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count); /** * Return the primary display. @@ -560,7 +560,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetDisplayContentScale(SDL_DisplayID displ * * \sa SDL_GetDisplays */ -extern SDL_DECLSPEC_FREE SDL_DisplayMode ** SDLCALL SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count); +extern SDL_DECLSPEC SDL_DisplayMode ** SDLCALL SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count); /** * Get the closest match to the requested display mode. @@ -770,7 +770,7 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode( * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size); +extern SDL_DECLSPEC void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size); /** * Get the pixel format associated with the window. @@ -796,7 +796,7 @@ extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetWindowPixelFormat(SDL_Window * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE SDL_Window ** SDLCALL SDL_GetWindows(int *count); +extern SDL_DECLSPEC SDL_Window ** SDLCALL SDL_GetWindows(int *count); /** * Create a window with the specified dimensions and flags. diff --git a/src/dynapi/gendynapi.py b/src/dynapi/gendynapi.py index 091ce0d5ce121..fb601af9df4e3 100755 --- a/src/dynapi/gendynapi.py +++ b/src/dynapi/gendynapi.py @@ -196,7 +196,6 @@ def main(): # func_ret = func_ret.replace('extern', ' ') func_ret = func_ret.replace('SDLCALL', ' ') - func_ret = func_ret.replace('SDL_DECLSPEC_FREE', ' ') func_ret = func_ret.replace('SDL_DECLSPEC', ' ') # Remove trailing spaces in front of '*' tmp = "" From 728bf363cbc45fe197393d94c68b87b770d672b2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 28 Jul 2024 07:46:44 -0700 Subject: [PATCH 038/253] Make sure we call SDL_Quit() before SDLTest_CommonDestroyState() Otherwise we'll report leaks that will be cleaned up in SDL_Quit() --- include/SDL3/SDL_test_common.h | 2 ++ test/loopwave.c | 1 + test/testaudiorecording.c | 2 +- test/testcamera.c | 1 + test/testevdev.c | 1 + test/testfile.c | 1 + test/testplatform.c | 2 +- test/testqsort.c | 1 + test/testrwlock.c | 2 +- test/testsensor.c | 2 ++ test/teststreaming.c | 1 + test/testthread.c | 2 +- test/testyuv.c | 1 + test/torturethread.c | 1 + 14 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/SDL3/SDL_test_common.h b/include/SDL3/SDL_test_common.h index a7ec4dfca202d..76ea5e45c0090 100644 --- a/include/SDL3/SDL_test_common.h +++ b/include/SDL3/SDL_test_common.h @@ -156,6 +156,8 @@ SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, SDL_InitFlags flags) /** * Free the common state object. * + * You should call SDL_Quit() before calling this function. + * * \param state The common state object to destroy */ void SDLTest_CommonDestroyState(SDLTest_CommonState *state); diff --git a/test/loopwave.c b/test/loopwave.c index 45bc060c83ff4..06bb16800b174 100644 --- a/test/loopwave.c +++ b/test/loopwave.c @@ -134,6 +134,7 @@ void SDL_AppQuit(void *appstate) { SDL_DestroyAudioStream(stream); SDL_free(wave.sound); + SDL_Quit(); SDLTest_CommonDestroyState(state); } diff --git a/test/testaudiorecording.c b/test/testaudiorecording.c index b983143c4392c..cd0dbb63aab56 100644 --- a/test/testaudiorecording.c +++ b/test/testaudiorecording.c @@ -210,8 +210,8 @@ void SDL_AppQuit(void *appstate) SDL_DestroyAudioStream(stream_out); SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); - SDLTest_CommonDestroyState(state); SDL_Quit(); + SDLTest_CommonDestroyState(state); } diff --git a/test/testcamera.c b/test/testcamera.c index a600e447d0260..09d9a48416be3 100644 --- a/test/testcamera.c +++ b/test/testcamera.c @@ -74,6 +74,7 @@ int SDL_AppInit(void **appstate, int argc, char *argv[]) NULL, }; SDLTest_CommonLogUsage(state, argv[0], options); + SDL_Quit(); SDLTest_CommonDestroyState(state); return 1; } diff --git a/test/testevdev.c b/test/testevdev.c index daa0a6a9434e5..e2442e39f672a 100644 --- a/test/testevdev.c +++ b/test/testevdev.c @@ -2243,6 +2243,7 @@ int main(int argc, char *argv[]) result = run_test() ? 0 : 1; + SDL_Quit(); SDLTest_CommonDestroyState(state); return result; } diff --git a/test/testfile.c b/test/testfile.c index a2eab48f86fb9..f975f0cf711d0 100644 --- a/test/testfile.c +++ b/test/testfile.c @@ -58,6 +58,7 @@ iostrm_error_quit(unsigned line, SDL_IOStream *iostrm) SDL_CloseIO(iostrm); } cleanup(); + SDL_Quit(); SDLTest_CommonDestroyState(state); exit(1); /* quit with iostrm error (test failed) */ } diff --git a/test/testplatform.c b/test/testplatform.c index aac7165b1ae84..55cb0134a1369 100644 --- a/test/testplatform.c +++ b/test/testplatform.c @@ -483,8 +483,8 @@ int main(int argc, char *argv[]) status += Test64Bit(verbose); status += TestCPUInfo(verbose); status += TestAssertions(verbose); - SDL_Quit(); + SDL_Quit(); SDLTest_CommonDestroyState(state); return status; diff --git a/test/testqsort.c b/test/testqsort.c index 8ea18c03f1c6f..caa4a05f2ef5b 100644 --- a/test/testqsort.c +++ b/test/testqsort.c @@ -135,6 +135,7 @@ int main(int argc, char *argv[]) test_sort("random sorted", nums, arraylen); } + SDL_Quit(); SDLTest_CommonDestroyState(state); return 0; diff --git a/test/testrwlock.c b/test/testrwlock.c index 0569ada160f1d..328aa6886d708 100644 --- a/test/testrwlock.c +++ b/test/testrwlock.c @@ -171,8 +171,8 @@ int main(int argc, char *argv[]) SDL_Log("Reader threads have terminated, quitting!"); SDL_DestroyRWLock(rwlock); - SDLTest_CommonDestroyState(state); SDL_Quit(); + SDLTest_CommonDestroyState(state); return 0; } diff --git a/test/testsensor.c b/test/testsensor.c index 404c9723bf3c4..1e35fba65c6b0 100644 --- a/test/testsensor.c +++ b/test/testsensor.c @@ -72,6 +72,7 @@ int main(int argc, char **argv) SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); if (!SDLTest_CommonDefaultArgs(state, argc, argv)) { + SDL_Quit(); SDLTest_CommonDestroyState(state); return 1; } @@ -79,6 +80,7 @@ int main(int argc, char **argv) /* Load the SDL library */ if (SDL_Init(SDL_INIT_SENSOR) < 0) { SDL_Log("Couldn't initialize SDL: %s\n", SDL_GetError()); + SDL_Quit(); SDLTest_CommonDestroyState(state); return 1; } diff --git a/test/teststreaming.c b/test/teststreaming.c index 3a511d8a04000..148ca04cd5543 100644 --- a/test/teststreaming.c +++ b/test/teststreaming.c @@ -149,6 +149,7 @@ int main(int argc, char **argv) SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); if (!SDLTest_CommonDefaultArgs(state, argc, argv)) { + SDL_Quit(); SDLTest_CommonDestroyState(state); return 1; } diff --git a/test/testthread.c b/test/testthread.c index dd282e9d4906e..2c50200ca6c9a 100644 --- a/test/testthread.c +++ b/test/testthread.c @@ -28,8 +28,8 @@ static SDLTest_CommonState *state; static void quit(int rc) { - SDLTest_CommonDestroyState(state); SDL_Quit(); + SDLTest_CommonDestroyState(state); /* Let 'main()' return normally */ if (rc != 0) { exit(rc); diff --git a/test/testyuv.c b/test/testyuv.c index cf207119da89f..822d3f157e0e7 100644 --- a/test/testyuv.c +++ b/test/testyuv.c @@ -396,6 +396,7 @@ int main(int argc, char **argv) NULL, }; SDLTest_CommonLogUsage(state, argv[0], options); + SDL_Quit(); SDLTest_CommonDestroyState(state); return 1; } diff --git a/test/torturethread.c b/test/torturethread.c index 83bb76c213a4c..c45f89c9c6953 100644 --- a/test/torturethread.c +++ b/test/torturethread.c @@ -98,6 +98,7 @@ int main(int argc, char *argv[]) } if (!SDLTest_CommonDefaultArgs(state, argc, argv)) { + SDL_Quit(); SDLTest_CommonDestroyState(state); return 1; } From dfe6efcd2df1b7781ce9bbcf86963bafda589b5e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 28 Jul 2024 07:51:31 -0700 Subject: [PATCH 039/253] Fixed memory leak in testthread --- test/testthread.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/testthread.c b/test/testthread.c index 2c50200ca6c9a..4dd8d9c22369f 100644 --- a/test/testthread.c +++ b/test/testthread.c @@ -20,6 +20,7 @@ #include static SDL_TLSID tls; +static SDL_Thread *thread = NULL; static int alive = 0; static int testprio = 0; static SDLTest_CommonState *state; @@ -83,13 +84,13 @@ killed(int sig) SDL_Log("Killed with SIGTERM, waiting 5 seconds to exit\n"); SDL_Delay(5 * 1000); alive = 0; + SDL_WaitThread(thread, NULL); quit(0); } int main(int argc, char *argv[]) { int i; - SDL_Thread *thread; /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, 0); From 5d6333d6ea4103057e03b1939d1244f3181bafe5 Mon Sep 17 00:00:00 2001 From: Arias800 <24809312+Arias800@users.noreply.github.com> Date: Mon, 22 Jul 2024 18:18:09 +0200 Subject: [PATCH 040/253] Add two more mapping for Nvidia controller (2019) 0500b30c550900001472000001000000 is the ID when the controller is connected via Bluetooth and 0300b30c550900001472000011010000 is for USB mode. Tested by setting "SDL_GAMECONTROLLERCONFIG" in some games. --- src/joystick/SDL_gamepad_db.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/joystick/SDL_gamepad_db.h b/src/joystick/SDL_gamepad_db.h index 60914af3b61ed..4d092e067f46a 100644 --- a/src/joystick/SDL_gamepad_db.h +++ b/src/joystick/SDL_gamepad_db.h @@ -622,6 +622,8 @@ static const char *s_GamepadMappings[] = { "030000006b140000010c000010010000,NACON GC-400ES,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,", "03000000550900001472000011010000,NVIDIA Controller v01.04,a:b0,b:b1,back:b14,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b17,leftshoulder:b4,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,", + "0300b30c550900001472000011010000,NVIDIA Controller v01.04,a:b0,b:b1,x:b2,y:b3,dpleft:h0.8,dpright:h0.2,dpup:h0.1,dpdown:h0.4,leftx:a0,lefty:a1,leftstick:b10,rightx:a2,righty:a5,rightstick:b11,leftshoulder:b5,lefttrigger:a3,rightshoulder:b6,righttrigger:a4,back:b7,start:b9,guide:b4,misc1:b8,", + "0500b30c550900001472000001000000,NVIDIA Controller v01.04,a:b0,b:b1,x:b2,y:b3,dpleft:h0.8,dpright:h0.2,dpup:h0.1,dpdown:h0.4,leftx:a0,lefty:a1,leftstick:b10,rightx:a2,righty:a5,rightstick:b11,leftshoulder:b5,lefttrigger:a3,rightshoulder:b6,righttrigger:a4,back:b7,start:b9,guide:b4,misc1:b8,", "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "030000004b120000014d000000010000,NYKO AIRFLO EX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,", "03000000451300000830000010010000,NYKO CORE,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", From 383ccb2b6ab77dd9d3e2a438fb8e4fb5d446a509 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 28 Jul 2024 08:06:20 -0700 Subject: [PATCH 041/253] Finish removing SDL_DECLSPEC_FREE --- include/SDL3/SDL_begin_code.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/SDL3/SDL_begin_code.h b/include/SDL3/SDL_begin_code.h index ee4c9eab2aa9e..f418c6109d855 100644 --- a/include/SDL3/SDL_begin_code.h +++ b/include/SDL3/SDL_begin_code.h @@ -68,11 +68,6 @@ # endif #endif -/* This is used to mark functions that return memory that need to be freed with SDL_free() */ -#ifndef SDL_DECLSPEC -#define SDL_DECLSPEC SDL_DECLSPEC -#endif - /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)) && !defined(__GNUC__) From e35a559442c448ae375ef1faa0ba18f1680eb8ab Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 28 Jul 2024 11:07:59 -0700 Subject: [PATCH 042/253] Revert "Add two more mapping for Nvidia controller (2019)" This reverts commit 5d6333d6ea4103057e03b1939d1244f3181bafe5, which was accidentally committed during testing. --- src/joystick/SDL_gamepad_db.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/joystick/SDL_gamepad_db.h b/src/joystick/SDL_gamepad_db.h index 4d092e067f46a..60914af3b61ed 100644 --- a/src/joystick/SDL_gamepad_db.h +++ b/src/joystick/SDL_gamepad_db.h @@ -622,8 +622,6 @@ static const char *s_GamepadMappings[] = { "030000006b140000010c000010010000,NACON GC-400ES,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,", "03000000550900001472000011010000,NVIDIA Controller v01.04,a:b0,b:b1,back:b14,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b17,leftshoulder:b4,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,", - "0300b30c550900001472000011010000,NVIDIA Controller v01.04,a:b0,b:b1,x:b2,y:b3,dpleft:h0.8,dpright:h0.2,dpup:h0.1,dpdown:h0.4,leftx:a0,lefty:a1,leftstick:b10,rightx:a2,righty:a5,rightstick:b11,leftshoulder:b5,lefttrigger:a3,rightshoulder:b6,righttrigger:a4,back:b7,start:b9,guide:b4,misc1:b8,", - "0500b30c550900001472000001000000,NVIDIA Controller v01.04,a:b0,b:b1,x:b2,y:b3,dpleft:h0.8,dpright:h0.2,dpup:h0.1,dpdown:h0.4,leftx:a0,lefty:a1,leftstick:b10,rightx:a2,righty:a5,rightstick:b11,leftshoulder:b5,lefttrigger:a3,rightshoulder:b6,righttrigger:a4,back:b7,start:b9,guide:b4,misc1:b8,", "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "030000004b120000014d000000010000,NYKO AIRFLO EX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,", "03000000451300000830000010010000,NYKO CORE,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", From 45ecea13466c90af98c1a5b62011fc792daad738 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 28 Jul 2024 11:43:11 -0700 Subject: [PATCH 043/253] Fixed crash when switching a window from using OpenGL to Metal --- src/video/uikit/SDL_uikitview.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index 7fec719b35037..8b4c66e17e404 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -120,6 +120,8 @@ - (void)setSDLWindow:(SDL_Window *)window [data.uiwindow layoutIfNeeded]; } + sdlwindow = window; + /* Add ourself to the new window. */ if (window) { data = (__bridge SDL_UIKitWindowData *)window->internal; @@ -144,8 +146,6 @@ - (void)setSDLWindow:(SDL_Window *)window * layout now to immediately update the bounds. */ [data.uiwindow layoutIfNeeded]; } - - sdlwindow = window; } - (SDL_Window *)getSDLWindow From 94827e0acd1e019936aae93017841746470324ac Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sun, 28 Jul 2024 21:40:40 +0300 Subject: [PATCH 044/253] SDL_mslibc.c: revert PR/10303 changes --- src/stdlib/SDL_mslibc.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/stdlib/SDL_mslibc.c b/src/stdlib/SDL_mslibc.c index 63cd0cefd3f5c..43fec09742215 100644 --- a/src/stdlib/SDL_mslibc.c +++ b/src/stdlib/SDL_mslibc.c @@ -36,7 +36,7 @@ __declspec(selectany) int _fltused = 1; #ifdef _M_IX86 /* Float to long */ -void __declspec(naked) _ftol(void) +void __declspec(naked) _ftol() { /* *INDENT-OFF* */ __asm { @@ -85,18 +85,18 @@ void __declspec(naked) _ftol(void) /* *INDENT-ON* */ } -void _ftol2_sse(void) +void _ftol2_sse() { _ftol(); } -void _ftol2(void) +void _ftol2() { _ftol(); } /* 64-bit math operators for 32-bit systems */ -void __declspec(naked) _allmul(void) +void __declspec(naked) _allmul() { /* *INDENT-OFF* */ __asm { @@ -124,7 +124,7 @@ void __declspec(naked) _allmul(void) /* *INDENT-ON* */ } -void __declspec(naked) _alldiv(void) +void __declspec(naked) _alldiv() { /* *INDENT-OFF* */ __asm { @@ -210,7 +210,7 @@ void __declspec(naked) _alldiv(void) /* *INDENT-ON* */ } -void __declspec(naked) _aulldiv(void) +void __declspec(naked) _aulldiv() { /* *INDENT-OFF* */ __asm { @@ -266,7 +266,7 @@ void __declspec(naked) _aulldiv(void) /* *INDENT-ON* */ } -void __declspec(naked) _allrem(void) +void __declspec(naked) _allrem() { /* *INDENT-OFF* */ __asm { @@ -351,7 +351,7 @@ void __declspec(naked) _allrem(void) /* *INDENT-ON* */ } -void __declspec(naked) _aullrem(void) +void __declspec(naked) _aullrem() { /* *INDENT-OFF* */ __asm { @@ -408,7 +408,7 @@ void __declspec(naked) _aullrem(void) /* *INDENT-ON* */ } -void __declspec(naked) _alldvrm(void) +void __declspec(naked) _alldvrm() { /* *INDENT-OFF* */ __asm { @@ -516,7 +516,7 @@ void __declspec(naked) _alldvrm(void) /* *INDENT-ON* */ } -void __declspec(naked) _aulldvrm(void) +void __declspec(naked) _aulldvrm() { /* *INDENT-OFF* */ __asm { @@ -587,7 +587,7 @@ void __declspec(naked) _aulldvrm(void) /* *INDENT-ON* */ } -void __declspec(naked) _allshl(void) +void __declspec(naked) _allshl() { /* *INDENT-OFF* */ __asm { @@ -612,7 +612,7 @@ void __declspec(naked) _allshl(void) /* *INDENT-ON* */ } -void __declspec(naked) _allshr(void) +void __declspec(naked) _allshr() { /* *INDENT-OFF* */ __asm { @@ -637,7 +637,7 @@ void __declspec(naked) _allshr(void) /* *INDENT-ON* */ } -void __declspec(naked) _aullshr(void) +void __declspec(naked) _aullshr() { /* *INDENT-OFF* */ __asm { From 61a88077a745da72b929c74a01c9c728d7d6c456 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 28 Jul 2024 14:45:38 -0700 Subject: [PATCH 045/253] Re-added SDL_HINT_APP_ID and SDL_HINT_APP_NAME --- docs/README-migration.md | 5 ++--- include/SDL3/SDL_hints.h | 32 ++++++++++++++++++++++++++++++++ include/SDL3/SDL_init.h | 6 +++--- src/SDL.c | 11 +++++++++-- 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index ad9bc6d4368fc..e38fc7cc0d6b4 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -782,12 +782,11 @@ The following hints have been removed: * SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING - SDL now properly handles the 0x406D1388 Exception if no debugger intercepts it, preventing its propagation. * SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 - replaced with SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4, defaulting to SDL_TRUE * SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING -* SDL_HINT_APP_NAME - replaced by either using the appname param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_NAME_STRING with SDL_SetAppMetadataProperty(). -* SDL_HINT_AUDIO_DEVICE_APP_NAME - replaced by either using the appname param to SDL_SetAppMetadata() or using SDL_PROP_APP_METADATA_NAME_STRING in SDL_SetAppMetadataWithProperties() +* SDL_HINT_AUDIO_DEVICE_APP_NAME - replaced by either using the appname param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_NAME_STRING with SDL_SetAppMetadataProperty() * Renamed hints SDL_HINT_VIDEODRIVER and SDL_HINT_AUDIODRIVER to SDL_HINT_VIDEO_DRIVER and SDL_HINT_AUDIO_DRIVER * Renamed environment variables SDL_VIDEODRIVER and SDL_AUDIODRIVER to SDL_VIDEO_DRIVER and SDL_AUDIO_DRIVER -* The environment variables SDL_VIDEO_X11_WMCLASS and SDL_VIDEO_WAYLAND_WMCLASS have been removed and replaced with app metadata (either use the appindentifier param to SDL_SetAppMetadata() or set SDL_PROP_APP_METADATA_IDENTIFIER_STRING with SDL_SetAppMetadataProperty()). +* The environment variables SDL_VIDEO_X11_WMCLASS and SDL_VIDEO_WAYLAND_WMCLASS have been removed and replaced by either using the appindentifier param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_IDENTIFIER_STRING with SDL_SetAppMetadataProperty() The following hints have been renamed: * SDL_HINT_ALLOW_TOPMOST => SDL_HINT_WINDOW_ALLOW_TOPMOST diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index c2412e4ba64c3..d8d8521c3bec9 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -125,6 +125,38 @@ extern "C" { */ #define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON" +/** + * A variable setting the app ID string. + * + * This string is used by desktop compositors to identify and group windows + * together, as well as match applications with associated desktop settings + * and icons. + * + * This will override SDL_PROP_APP_METADATA_IDENTIFIER_STRING, if set by the application. + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_APP_ID "SDL_APP_ID" + +/** + * A variable setting the application name. + * + * This hint lets you specify the application name sent to the OS when + * required. For example, this will often appear in volume control applets for + * audio streams, and in lists of applications which are inhibiting the + * screensaver. You should use a string that describes your program ("My Game + * 2: The Revenge") + * + * This will override SDL_PROP_APP_METADATA_NAME_STRING, if set by the application. + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_APP_NAME "SDL_APP_NAME" + /** * A variable controlling whether controllers used with the Apple TV generate * UI events. diff --git a/include/SDL3/SDL_init.h b/include/SDL3/SDL_init.h index 5d4179ca291a9..a5433949532f5 100644 --- a/include/SDL3/SDL_init.h +++ b/include/SDL3/SDL_init.h @@ -246,8 +246,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const ch * These are the supported properties: * * - `SDL_PROP_APP_METADATA_NAME_STRING`: The human-readable name of the - * application, like "My Game 2: Bad Guy's Revenge!". This defaults to "SDL - * Application". + * application, like "My Game 2: Bad Guy's Revenge!". This will show up anywhere the OS shows the name of the application separately from window titles, such as volume control applets, etc. This defaults to "SDL Application". * - SDL_PROP_APP_METADATA_VERSION_STRING`: The version of the app that is * running; there are no rules on format, so "1.0.3beta2" and "April 22nd, * 2024" and a git hash are all valid options. This has no default. @@ -255,7 +254,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const ch * identifies this app. This must be in reverse-domain format, like * "com.example.mygame2". This string is used by desktop compositors to * identify and group windows together, as well as match applications with - * associated desktop settings and icons. This has no default. + * associated desktop settings and icons. If you plan to package your application in a container such as Flatpak, the + * app ID should match the name of your Flatpak container as well. This has no default. * - SDL_PROP_APP_METADATA_CREATOR_STRING`: The human-readable name of the * creator/developer/maker of this app, like "MojoWorkshop, LLC" * - SDL_PROP_APP_METADATA_COPYRIGHT_STRING`: The human-readable copyright diff --git a/src/SDL.c b/src/SDL.c index 654647f653ef1..798d68fccff9a 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -151,8 +151,15 @@ const char *SDL_GetAppMetadataProperty(const char *name) return NULL; } - const SDL_PropertiesID props = SDL_GetGlobalProperties(); - const char *value = SDL_GetStringProperty(props, name, NULL); + const char *value = NULL; + if (SDL_strcmp(name, SDL_PROP_APP_METADATA_NAME_STRING) == 0) { + value = SDL_GetHint(SDL_HINT_APP_NAME); + } else if (SDL_strcmp(name, SDL_PROP_APP_METADATA_IDENTIFIER_STRING) == 0) { + value = SDL_GetHint(SDL_HINT_APP_ID); + } + if (!value || !*value) { + value = SDL_GetStringProperty(SDL_GetGlobalProperties(), name, NULL); + } if (!value || !*value) { if (SDL_strcmp(name, SDL_PROP_APP_METADATA_NAME_STRING) == 0) { value = "SDL Application"; From 3b01a0b8845edcba191bb1e933b90aa489caa114 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Mon, 29 Jul 2024 11:26:36 +0000 Subject: [PATCH 046/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_hints.h | 6 ++++-- include/SDL3/SDL_init.h | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index d8d8521c3bec9..eb14e7a2c6421 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -132,7 +132,8 @@ extern "C" { * together, as well as match applications with associated desktop settings * and icons. * - * This will override SDL_PROP_APP_METADATA_IDENTIFIER_STRING, if set by the application. + * This will override SDL_PROP_APP_METADATA_IDENTIFIER_STRING, if set by the + * application. * * This hint should be set before SDL is initialized. * @@ -149,7 +150,8 @@ extern "C" { * screensaver. You should use a string that describes your program ("My Game * 2: The Revenge") * - * This will override SDL_PROP_APP_METADATA_NAME_STRING, if set by the application. + * This will override SDL_PROP_APP_METADATA_NAME_STRING, if set by the + * application. * * This hint should be set before SDL is initialized. * diff --git a/include/SDL3/SDL_init.h b/include/SDL3/SDL_init.h index a5433949532f5..6b5181600bd2b 100644 --- a/include/SDL3/SDL_init.h +++ b/include/SDL3/SDL_init.h @@ -246,7 +246,10 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const ch * These are the supported properties: * * - `SDL_PROP_APP_METADATA_NAME_STRING`: The human-readable name of the - * application, like "My Game 2: Bad Guy's Revenge!". This will show up anywhere the OS shows the name of the application separately from window titles, such as volume control applets, etc. This defaults to "SDL Application". + * application, like "My Game 2: Bad Guy's Revenge!". This will show up + * anywhere the OS shows the name of the application separately from window + * titles, such as volume control applets, etc. This defaults to "SDL + * Application". * - SDL_PROP_APP_METADATA_VERSION_STRING`: The version of the app that is * running; there are no rules on format, so "1.0.3beta2" and "April 22nd, * 2024" and a git hash are all valid options. This has no default. @@ -254,8 +257,9 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const ch * identifies this app. This must be in reverse-domain format, like * "com.example.mygame2". This string is used by desktop compositors to * identify and group windows together, as well as match applications with - * associated desktop settings and icons. If you plan to package your application in a container such as Flatpak, the - * app ID should match the name of your Flatpak container as well. This has no default. + * associated desktop settings and icons. If you plan to package your + * application in a container such as Flatpak, the app ID should match the + * name of your Flatpak container as well. This has no default. * - SDL_PROP_APP_METADATA_CREATOR_STRING`: The human-readable name of the * creator/developer/maker of this app, like "MojoWorkshop, LLC" * - SDL_PROP_APP_METADATA_COPYRIGHT_STRING`: The human-readable copyright From 446c05a0010fb0f563359e28c1ffb831e0a8721d Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sun, 28 Jul 2024 13:33:14 +0200 Subject: [PATCH 047/253] ci: update actions descriptions + fix loongarch64 action [sdl-ci-filter *loongarch64*] --- .../setup-loongarch64-toolchain/action.yml | 18 +++++++++++------- .github/actions/setup-msvc-libusb/action.yml | 2 +- .github/actions/setup-ninja/action.yml | 2 +- .github/actions/setup-vita-gles/action.yml | 4 ++-- .github/workflows/generic.yml | 9 --------- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/.github/actions/setup-loongarch64-toolchain/action.yml b/.github/actions/setup-loongarch64-toolchain/action.yml index 9cf53eaf49b53..54698b3a9cb6f 100644 --- a/.github/actions/setup-loongarch64-toolchain/action.yml +++ b/.github/actions/setup-loongarch64-toolchain/action.yml @@ -1,5 +1,5 @@ -name: 'Setup libusb for MSBC' -description: 'Greet someone' +name: 'Setup LoongArch64 toolchain' +description: 'Download Linux LoongArch64 toolchain and set output variables' inputs: version: description: 'LoongArch64 version' @@ -21,13 +21,13 @@ runs: id: restore-cache with: path: /opt/cross-tools - key: loongarch64-${{ matrix.platform.toolchain-version }} + key: loongarch64-${{ inputs.version }} - name: 'Download LoongArch64 gcc+glibc toolchain' if: ${{ !steps.restore-cache.outputs.cache-hit }} shell: bash run: | - url="https://github.com/loongson/build-tools/releases/download/${{ matrix.platform.toolchain-version }}/loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz" + url="https://github.com/loongson/build-tools/releases/download/${{ inputs.version }}/loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz" wget "$url" -O /tmp/toolchain.tar.xz @@ -38,12 +38,16 @@ runs: if: ${{ !steps.restore-cache.outputs.cache-hit }} with: path: /opt/cross-tools - key: loongarch64-${{ matrix.platform.toolchain-version }} + key: loongarch64-${{ inputs.version }} - name: 'Set output vars' id: final shell: bash run: | prefix=/opt/cross-tools echo "prefix=${prefix}" >> $GITHUB_OUTPUT - echo "cc=${prefix}/bin/loongarch64-unknown-linux-gnu-gcc" >> $GITHUB_OUTPUT - echo "cxx=${prefix}/bin/loongarch64-unknown-linux-gnu-g++" >> $GITHUB_OUTPUT + cc="${prefix}/bin/loongarch64-unknown-linux-gnu-gcc" + cxx="${prefix}/bin/loongarch64-unknown-linux-gnu-g++" + echo "cc=${cc}" >> $GITHUB_OUTPUT + echo "cxx=${cxx}" >> $GITHUB_OUTPUT + echo "LOONGARCH64_CC=${cc}" >>$GITHUB_ENV + echo "LOONGARCH64_CXX=${cxx}" >>$GITHUB_ENV diff --git a/.github/actions/setup-msvc-libusb/action.yml b/.github/actions/setup-msvc-libusb/action.yml index fbf451af63595..cbbf0980b577d 100644 --- a/.github/actions/setup-msvc-libusb/action.yml +++ b/.github/actions/setup-msvc-libusb/action.yml @@ -1,5 +1,5 @@ name: 'Setup libusb for MSVC' -description: 'Setup libusb for MSVC' +description: 'Download libusb sdk for MSVC, and set output/environment variables' inputs: version: description: 'libusb version' diff --git a/.github/actions/setup-ninja/action.yml b/.github/actions/setup-ninja/action.yml index bf638eabae32b..e013c8321492f 100644 --- a/.github/actions/setup-ninja/action.yml +++ b/.github/actions/setup-ninja/action.yml @@ -1,5 +1,5 @@ name: 'Setup ninja' -description: 'Setup ninja' +description: 'Download ninja and add it to the PATH environment variable' inputs: version: description: 'Ninja version' diff --git a/.github/actions/setup-vita-gles/action.yml b/.github/actions/setup-vita-gles/action.yml index aa88e69efc844..e263737b31e20 100644 --- a/.github/actions/setup-vita-gles/action.yml +++ b/.github/actions/setup-vita-gles/action.yml @@ -1,5 +1,5 @@ name: 'Setup GLES for PlayStation Vita' -description: 'Setup GLES (PVR and PIB)' +description: 'Download GLES for VITA (PVR or PIB), and copy it into the vita sdk' inputs: pib-version: description: 'PIB version' @@ -18,7 +18,7 @@ runs: shell: sh run: | if test "x${VITASDK}" = "x"; then - echo "VITASKD must be defined" + echo "VITASDK must be defined" exit 1; fi case "x${{ inputs.type }}" in diff --git a/.github/workflows/generic.yml b/.github/workflows/generic.yml index 44560a668045b..58d7e8ef1da76 100644 --- a/.github/workflows/generic.yml +++ b/.github/workflows/generic.yml @@ -72,15 +72,6 @@ jobs: uses: ./.github/actions/setup-loongarch64-toolchain id: setup-loongarch64-toolchain if: ${{ matrix.platform.platform == 'loongarch64' }} - with: - version: '2022.09.0' - - name: 'Configure LoongArch64 variables' - if: ${{ matrix.platform.platform == 'loongarch64' }} - shell: sh - run: | - # We cannot use GitHub expressions in the controller job - echo "LOONGARCH64_CC=${{ steps.setup-loongarch64-toolchain.outputs.cc }}" >>$GITHUB_ENV - echo "LOONGARCH64_CXX=${{ steps.setup-loongarch64-toolchain.outputs.cxx }}" >>$GITHUB_ENV - name: 'Setup Intel oneAPI toolchain' id: intel if: ${{ matrix.platform.intel }} From 691cf15e752fb46c8e9f0588621ad0af1e4009f4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 08:05:36 -0700 Subject: [PATCH 048/253] Removed the ancient Android audio driver OpenSLES is well supported on Android 4.0 and later. --- CMakeLists.txt | 3 - .../java/org/libsdl/app/SDLAudioManager.java | 374 ------------------ include/build_config/SDL_build_config.h.cmake | 1 - .../build_config/SDL_build_config_android.h | 1 - src/audio/SDL_audio.c | 3 - src/audio/SDL_sysaudio.h | 1 - src/audio/android/SDL_androidaudio.c | 191 --------- src/audio/android/SDL_androidaudio.h | 38 -- src/core/android/SDL_android.c | 328 +-------------- src/core/android/SDL_android.h | 6 - 10 files changed, 11 insertions(+), 935 deletions(-) delete mode 100644 src/audio/android/SDL_androidaudio.c delete mode 100644 src/audio/android/SDL_androidaudio.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 89c0e8991687f..688e25fe10a5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1246,9 +1246,6 @@ if(ANDROID) endif() if(SDL_AUDIO) - set(SDL_AUDIO_DRIVER_ANDROID 1) - sdl_glob_sources("${SDL3_SOURCE_DIR}/src/audio/android/*.c") - set(SDL_AUDIO_DRIVER_OPENSLES 1) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/audio/openslES/*.c") diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java b/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java index ed9c959d45a52..6ad2f543bbb1d 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java @@ -3,11 +3,7 @@ import android.content.Context; import android.media.AudioDeviceCallback; import android.media.AudioDeviceInfo; -import android.media.AudioFormat; import android.media.AudioManager; -import android.media.AudioRecord; -import android.media.AudioTrack; -import android.media.MediaRecorder; import android.os.Build; import android.util.Log; @@ -17,15 +13,11 @@ public class SDLAudioManager { protected static final String TAG = "SDLAudio"; - protected static AudioTrack mAudioTrack; - protected static AudioRecord mAudioRecord; protected static Context mContext; private static AudioDeviceCallback mAudioDeviceCallback; public static void initialize() { - mAudioTrack = null; - mAudioRecord = null; mAudioDeviceCallback = null; if(Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) @@ -58,230 +50,6 @@ public static void release(Context context) { // Audio - protected static String getAudioFormatString(int audioFormat) { - switch (audioFormat) { - case AudioFormat.ENCODING_PCM_8BIT: - return "8-bit"; - case AudioFormat.ENCODING_PCM_16BIT: - return "16-bit"; - case AudioFormat.ENCODING_PCM_FLOAT: - return "float"; - default: - return Integer.toString(audioFormat); - } - } - - protected static int[] open(boolean recording, int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) { - int channelConfig; - int sampleSize; - int frameSize; - - Log.v(TAG, "Opening " + (recording ? "recording" : "playback") + ", requested " + desiredFrames + " frames of " + desiredChannels + " channel " + getAudioFormatString(audioFormat) + " audio at " + sampleRate + " Hz"); - - /* On older devices let's use known good settings */ - if (Build.VERSION.SDK_INT < 21 /* Android 5.0 (LOLLIPOP) */) { - if (desiredChannels > 2) { - desiredChannels = 2; - } - } - - /* AudioTrack has sample rate limitation of 48000 (fixed in 5.0.2) */ - if (Build.VERSION.SDK_INT < 22 /* Android 5.1 (LOLLIPOP_MR1) */) { - if (sampleRate < 8000) { - sampleRate = 8000; - } else if (sampleRate > 48000) { - sampleRate = 48000; - } - } - - if (audioFormat == AudioFormat.ENCODING_PCM_FLOAT) { - int minSDKVersion = (recording ? 23 /* Android 6.0 (M) */ : 21 /* Android 5.0 (LOLLIPOP) */); - if (Build.VERSION.SDK_INT < minSDKVersion) { - audioFormat = AudioFormat.ENCODING_PCM_16BIT; - } - } - switch (audioFormat) - { - case AudioFormat.ENCODING_PCM_8BIT: - sampleSize = 1; - break; - case AudioFormat.ENCODING_PCM_16BIT: - sampleSize = 2; - break; - case AudioFormat.ENCODING_PCM_FLOAT: - sampleSize = 4; - break; - default: - Log.v(TAG, "Requested format " + audioFormat + ", getting ENCODING_PCM_16BIT"); - audioFormat = AudioFormat.ENCODING_PCM_16BIT; - sampleSize = 2; - break; - } - - if (recording) { - switch (desiredChannels) { - case 1: - channelConfig = AudioFormat.CHANNEL_IN_MONO; - break; - case 2: - channelConfig = AudioFormat.CHANNEL_IN_STEREO; - break; - default: - Log.v(TAG, "Requested " + desiredChannels + " channels, getting stereo"); - desiredChannels = 2; - channelConfig = AudioFormat.CHANNEL_IN_STEREO; - break; - } - } else { - switch (desiredChannels) { - case 1: - channelConfig = AudioFormat.CHANNEL_OUT_MONO; - break; - case 2: - channelConfig = AudioFormat.CHANNEL_OUT_STEREO; - break; - case 3: - channelConfig = AudioFormat.CHANNEL_OUT_STEREO | AudioFormat.CHANNEL_OUT_FRONT_CENTER; - break; - case 4: - channelConfig = AudioFormat.CHANNEL_OUT_QUAD; - break; - case 5: - channelConfig = AudioFormat.CHANNEL_OUT_QUAD | AudioFormat.CHANNEL_OUT_FRONT_CENTER; - break; - case 6: - channelConfig = AudioFormat.CHANNEL_OUT_5POINT1; - break; - case 7: - channelConfig = AudioFormat.CHANNEL_OUT_5POINT1 | AudioFormat.CHANNEL_OUT_BACK_CENTER; - break; - case 8: - if (Build.VERSION.SDK_INT >= 23 /* Android 6.0 (M) */) { - channelConfig = AudioFormat.CHANNEL_OUT_7POINT1_SURROUND; - } else { - Log.v(TAG, "Requested " + desiredChannels + " channels, getting 5.1 surround"); - desiredChannels = 6; - channelConfig = AudioFormat.CHANNEL_OUT_5POINT1; - } - break; - default: - Log.v(TAG, "Requested " + desiredChannels + " channels, getting stereo"); - desiredChannels = 2; - channelConfig = AudioFormat.CHANNEL_OUT_STEREO; - break; - } - -/* - Log.v(TAG, "Speaker configuration (and order of channels):"); - - if ((channelConfig & 0x00000004) != 0) { - Log.v(TAG, " CHANNEL_OUT_FRONT_LEFT"); - } - if ((channelConfig & 0x00000008) != 0) { - Log.v(TAG, " CHANNEL_OUT_FRONT_RIGHT"); - } - if ((channelConfig & 0x00000010) != 0) { - Log.v(TAG, " CHANNEL_OUT_FRONT_CENTER"); - } - if ((channelConfig & 0x00000020) != 0) { - Log.v(TAG, " CHANNEL_OUT_LOW_FREQUENCY"); - } - if ((channelConfig & 0x00000040) != 0) { - Log.v(TAG, " CHANNEL_OUT_BACK_LEFT"); - } - if ((channelConfig & 0x00000080) != 0) { - Log.v(TAG, " CHANNEL_OUT_BACK_RIGHT"); - } - if ((channelConfig & 0x00000100) != 0) { - Log.v(TAG, " CHANNEL_OUT_FRONT_LEFT_OF_CENTER"); - } - if ((channelConfig & 0x00000200) != 0) { - Log.v(TAG, " CHANNEL_OUT_FRONT_RIGHT_OF_CENTER"); - } - if ((channelConfig & 0x00000400) != 0) { - Log.v(TAG, " CHANNEL_OUT_BACK_CENTER"); - } - if ((channelConfig & 0x00000800) != 0) { - Log.v(TAG, " CHANNEL_OUT_SIDE_LEFT"); - } - if ((channelConfig & 0x00001000) != 0) { - Log.v(TAG, " CHANNEL_OUT_SIDE_RIGHT"); - } -*/ - } - frameSize = (sampleSize * desiredChannels); - - // Let the user pick a larger buffer if they really want -- but ye - // gods they probably shouldn't, the minimums are horrifyingly high - // latency already - int minBufferSize; - if (recording) { - minBufferSize = AudioRecord.getMinBufferSize(sampleRate, channelConfig, audioFormat); - } else { - minBufferSize = AudioTrack.getMinBufferSize(sampleRate, channelConfig, audioFormat); - } - desiredFrames = Math.max(desiredFrames, (minBufferSize + frameSize - 1) / frameSize); - - int[] results = new int[4]; - - if (recording) { - if (mAudioRecord == null) { - mAudioRecord = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, sampleRate, - channelConfig, audioFormat, desiredFrames * frameSize); - - // see notes about AudioTrack state in audioOpen(), above. Probably also applies here. - if (mAudioRecord.getState() != AudioRecord.STATE_INITIALIZED) { - Log.e(TAG, "Failed during initialization of AudioRecord"); - mAudioRecord.release(); - mAudioRecord = null; - return null; - } - - if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */ && deviceId != 0) { - mAudioRecord.setPreferredDevice(getPlaybackAudioDeviceInfo(deviceId)); - } - - mAudioRecord.startRecording(); - } - - results[0] = mAudioRecord.getSampleRate(); - results[1] = mAudioRecord.getAudioFormat(); - results[2] = mAudioRecord.getChannelCount(); - - } else { - if (mAudioTrack == null) { - mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, channelConfig, audioFormat, desiredFrames * frameSize, AudioTrack.MODE_STREAM); - - // Instantiating AudioTrack can "succeed" without an exception and the track may still be invalid - // Ref: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/media/java/android/media/AudioTrack.java - // Ref: http://developer.android.com/reference/android/media/AudioTrack.html#getState() - if (mAudioTrack.getState() != AudioTrack.STATE_INITIALIZED) { - /* Try again, with safer values */ - - Log.e(TAG, "Failed during initialization of Audio Track"); - mAudioTrack.release(); - mAudioTrack = null; - return null; - } - - if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */ && deviceId != 0) { - mAudioTrack.setPreferredDevice(getInputAudioDeviceInfo(deviceId)); - } - - mAudioTrack.play(); - } - - results[0] = mAudioTrack.getSampleRate(); - results[1] = mAudioTrack.getAudioFormat(); - results[2] = mAudioTrack.getChannelCount(); - } - results[3] = desiredFrames; - - Log.v(TAG, "Opening " + (recording ? "recording" : "playback") + ", got " + results[3] + " frames of " + results[2] + " channel " + getAudioFormatString(results[1]) + " audio at " + results[0] + " Hz"); - - return results; - } - private static AudioDeviceInfo getInputAudioDeviceInfo(int deviceId) { if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) { AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); @@ -330,148 +98,6 @@ public static void unregisterAudioDeviceCallback() { } } - /** - * This method is called by SDL using JNI. - */ - public static int[] audioOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) { - return open(false, sampleRate, audioFormat, desiredChannels, desiredFrames, deviceId); - } - - /** - * This method is called by SDL using JNI. - */ - public static void audioWriteFloatBuffer(float[] buffer) { - if (mAudioTrack == null) { - Log.e(TAG, "Attempted to make audio call with uninitialized audio!"); - return; - } - - if (android.os.Build.VERSION.SDK_INT < 21 /* Android 5.0 (LOLLIPOP) */) { - Log.e(TAG, "Attempted to make an incompatible audio call with uninitialized audio! (floating-point output is supported since Android 5.0 Lollipop)"); - return; - } - - for (int i = 0; i < buffer.length;) { - int result = mAudioTrack.write(buffer, i, buffer.length - i, AudioTrack.WRITE_BLOCKING); - if (result > 0) { - i += result; - } else if (result == 0) { - try { - Thread.sleep(1); - } catch(InterruptedException e) { - // Nom nom - } - } else { - Log.w(TAG, "SDL audio: error return from write(float)"); - return; - } - } - } - - /** - * This method is called by SDL using JNI. - */ - public static void audioWriteShortBuffer(short[] buffer) { - if (mAudioTrack == null) { - Log.e(TAG, "Attempted to make audio call with uninitialized audio!"); - return; - } - - for (int i = 0; i < buffer.length;) { - int result = mAudioTrack.write(buffer, i, buffer.length - i); - if (result > 0) { - i += result; - } else if (result == 0) { - try { - Thread.sleep(1); - } catch(InterruptedException e) { - // Nom nom - } - } else { - Log.w(TAG, "SDL audio: error return from write(short)"); - return; - } - } - } - - /** - * This method is called by SDL using JNI. - */ - public static void audioWriteByteBuffer(byte[] buffer) { - if (mAudioTrack == null) { - Log.e(TAG, "Attempted to make audio call with uninitialized audio!"); - return; - } - - for (int i = 0; i < buffer.length; ) { - int result = mAudioTrack.write(buffer, i, buffer.length - i); - if (result > 0) { - i += result; - } else if (result == 0) { - try { - Thread.sleep(1); - } catch(InterruptedException e) { - // Nom nom - } - } else { - Log.w(TAG, "SDL audio: error return from write(byte)"); - return; - } - } - } - - /** - * This method is called by SDL using JNI. - */ - public static int[] recordingOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) { - return open(true, sampleRate, audioFormat, desiredChannels, desiredFrames, deviceId); - } - - /** This method is called by SDL using JNI. */ - public static int recordingReadFloatBuffer(float[] buffer, boolean blocking) { - if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) { - return 0; - } else { - return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING); - } - } - - /** This method is called by SDL using JNI. */ - public static int recordingReadShortBuffer(short[] buffer, boolean blocking) { - if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) { - return mAudioRecord.read(buffer, 0, buffer.length); - } else { - return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING); - } - } - - /** This method is called by SDL using JNI. */ - public static int recordingReadByteBuffer(byte[] buffer, boolean blocking) { - if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) { - return mAudioRecord.read(buffer, 0, buffer.length); - } else { - return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING); - } - } - - /** This method is called by SDL using JNI. */ - public static void audioClose() { - if (mAudioTrack != null) { - mAudioTrack.stop(); - mAudioTrack.release(); - mAudioTrack = null; - } - } - - /** This method is called by SDL using JNI. */ - public static void recordingClose() { - if (mAudioRecord != null) { - mAudioRecord.stop(); - mAudioRecord.release(); - mAudioRecord = null; - } - } - /** This method is called by SDL using JNI. */ public static void audioSetThreadPriority(boolean recording, int device_id) { try { diff --git a/include/build_config/SDL_build_config.h.cmake b/include/build_config/SDL_build_config.h.cmake index 3f01525e9aa51..0e3645e293809 100644 --- a/include/build_config/SDL_build_config.h.cmake +++ b/include/build_config/SDL_build_config.h.cmake @@ -266,7 +266,6 @@ /* Enable various audio drivers */ #cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@ #cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@ #cmakedefine SDL_AUDIO_DRIVER_OPENSLES @SDL_AUDIO_DRIVER_OPENSLES@ #cmakedefine SDL_AUDIO_DRIVER_AAUDIO @SDL_AUDIO_DRIVER_AAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@ diff --git a/include/build_config/SDL_build_config_android.h b/include/build_config/SDL_build_config_android.h index 3716c1550f788..926cff8df2b0f 100644 --- a/include/build_config/SDL_build_config_android.h +++ b/include/build_config/SDL_build_config_android.h @@ -144,7 +144,6 @@ /* Enable various audio drivers */ #ifndef SDL_AUDIO_DISABLED -#define SDL_AUDIO_DRIVER_ANDROID 1 #define SDL_AUDIO_DRIVER_OPENSLES 1 #define SDL_AUDIO_DRIVER_AAUDIO 1 #endif /* SDL_AUDIO_DISABLED */ diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 2394865f2f241..d97c9d0e77b81 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -62,9 +62,6 @@ static const AudioBootStrap *const bootstrap[] = { #ifdef SDL_AUDIO_DRIVER_OPENSLES &OPENSLES_bootstrap, #endif -#ifdef SDL_AUDIO_DRIVER_ANDROID - &ANDROIDAUDIO_bootstrap, -#endif #ifdef SDL_AUDIO_DRIVER_PS2 &PS2AUDIO_bootstrap, #endif diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h index d21a6e3c6a8f4..4f6c189178f84 100644 --- a/src/audio/SDL_sysaudio.h +++ b/src/audio/SDL_sysaudio.h @@ -372,7 +372,6 @@ extern AudioBootStrap DISKAUDIO_bootstrap; extern AudioBootStrap DUMMYAUDIO_bootstrap; extern AudioBootStrap AAUDIO_bootstrap; extern AudioBootStrap OPENSLES_bootstrap; -extern AudioBootStrap ANDROIDAUDIO_bootstrap; extern AudioBootStrap PS2AUDIO_bootstrap; extern AudioBootStrap PSPAUDIO_bootstrap; extern AudioBootStrap VITAAUD_bootstrap; diff --git a/src/audio/android/SDL_androidaudio.c b/src/audio/android/SDL_androidaudio.c deleted file mode 100644 index e15cd4ccfb72b..0000000000000 --- a/src/audio/android/SDL_androidaudio.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2024 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "SDL_internal.h" - -#ifdef SDL_AUDIO_DRIVER_ANDROID - -// Output audio to Android (legacy interface) - -#include "../SDL_sysaudio.h" -#include "SDL_androidaudio.h" - -#include "../../core/android/SDL_android.h" -#include - - -struct SDL_PrivateAudioData -{ - int resume; // Resume device if it was paused automatically -}; - -static SDL_AudioDevice *playbackDevice = NULL; -static SDL_AudioDevice *recordingDevice = NULL; - -static int ANDROIDAUDIO_OpenDevice(SDL_AudioDevice *device) -{ - device->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*device->hidden)); - if (!device->hidden) { - return -1; - } - - const SDL_bool recording = device->recording; - - if (recording) { - if (recordingDevice) { - return SDL_SetError("An audio recording device is already opened"); - } - recordingDevice = device; - } else { - if (playbackDevice) { - return SDL_SetError("An audio playback device is already opened"); - } - playbackDevice = device; - } - - SDL_AudioFormat test_format; - const SDL_AudioFormat *closefmts = SDL_ClosestAudioFormats(device->spec.format); - while ((test_format = *(closefmts++)) != 0) { - if ((test_format == SDL_AUDIO_U8) || - (test_format == SDL_AUDIO_S16) || - (test_format == SDL_AUDIO_F32)) { - device->spec.format = test_format; - break; - } - } - - if (!test_format) { - return SDL_SetError("android: Unsupported audio format"); - } - - if (Android_JNI_OpenAudioDevice(device) < 0) { - return -1; - } - - SDL_UpdatedAudioDeviceFormat(device); - - return 0; -} - -// !!! FIXME: this needs a WaitDevice implementation. - -static int ANDROIDAUDIO_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int buflen) -{ - Android_JNI_WriteAudioBuffer(); - return 0; -} - -static Uint8 *ANDROIDAUDIO_GetDeviceBuf(SDL_AudioDevice *device, int *buffer_size) -{ - return Android_JNI_GetAudioBuffer(); -} - -static int ANDROIDAUDIO_RecordDevice(SDL_AudioDevice *device, void *buffer, int buflen) -{ - return Android_JNI_RecordAudioBuffer(buffer, buflen); -} - -static void ANDROIDAUDIO_FlushRecording(SDL_AudioDevice *device) -{ - Android_JNI_FlushRecordedAudio(); -} - -static void ANDROIDAUDIO_CloseDevice(SDL_AudioDevice *device) -{ - /* At this point SDL_CloseAudioDevice via close_audio_device took care of terminating the audio thread - so it's safe to terminate the Java side buffer and AudioTrack - */ - if (device->hidden) { - Android_JNI_CloseAudioDevice(device->recording); - if (device->recording) { - SDL_assert(recordingDevice == device); - recordingDevice = NULL; - } else { - SDL_assert(playbackDevice == device); - playbackDevice = NULL; - } - SDL_free(device->hidden); - device->hidden = NULL; - } -} - -// Pause (block) all non already paused audio devices by taking their mixer lock -void ANDROIDAUDIO_PauseDevices(void) -{ - // TODO: Handle multiple devices? - struct SDL_PrivateAudioData *hidden; - if (playbackDevice && playbackDevice->hidden) { - hidden = (struct SDL_PrivateAudioData *)playbackDevice->hidden; - SDL_LockMutex(playbackDevice->lock); - hidden->resume = SDL_TRUE; - } - - if (recordingDevice && recordingDevice->hidden) { - hidden = (struct SDL_PrivateAudioData *)recordingDevice->hidden; - SDL_LockMutex(recordingDevice->lock); - hidden->resume = SDL_TRUE; - } -} - -// Resume (unblock) all non already paused audio devices by releasing their mixer lock -void ANDROIDAUDIO_ResumeDevices(void) -{ - // TODO: Handle multiple devices? - struct SDL_PrivateAudioData *hidden; - if (playbackDevice && playbackDevice->hidden) { - hidden = (struct SDL_PrivateAudioData *)playbackDevice->hidden; - if (hidden->resume) { - hidden->resume = SDL_FALSE; - SDL_UnlockMutex(playbackDevice->lock); - } - } - - if (recordingDevice && recordingDevice->hidden) { - hidden = (struct SDL_PrivateAudioData *)recordingDevice->hidden; - if (hidden->resume) { - hidden->resume = SDL_FALSE; - SDL_UnlockMutex(recordingDevice->lock); - } - } -} - -static SDL_bool ANDROIDAUDIO_Init(SDL_AudioDriverImpl *impl) -{ - // !!! FIXME: if on Android API < 24, DetectDevices and Deinitialize should be NULL and OnlyHasDefaultPlaybackDevice and OnlyHasDefaultRecordingDevice should be SDL_TRUE, since audio device enum and hotplug appears to require Android 7.0+. - impl->ThreadInit = Android_AudioThreadInit; - impl->DetectDevices = Android_StartAudioHotplug; - impl->DeinitializeStart = Android_StopAudioHotplug; - impl->OpenDevice = ANDROIDAUDIO_OpenDevice; - impl->PlayDevice = ANDROIDAUDIO_PlayDevice; - impl->GetDeviceBuf = ANDROIDAUDIO_GetDeviceBuf; - impl->CloseDevice = ANDROIDAUDIO_CloseDevice; - impl->RecordDevice = ANDROIDAUDIO_RecordDevice; - impl->FlushRecording = ANDROIDAUDIO_FlushRecording; - - impl->HasRecordingSupport = SDL_TRUE; - - return SDL_TRUE; -} - -AudioBootStrap ANDROIDAUDIO_bootstrap = { - "android", "SDL Android audio driver", ANDROIDAUDIO_Init, SDL_FALSE -}; - -#endif // SDL_AUDIO_DRIVER_ANDROID diff --git a/src/audio/android/SDL_androidaudio.h b/src/audio/android/SDL_androidaudio.h deleted file mode 100644 index ba00e61510f04..0000000000000 --- a/src/audio/android/SDL_androidaudio.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2024 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "SDL_internal.h" - -#ifndef SDL_androidaudio_h_ -#define SDL_androidaudio_h_ - -#ifdef SDL_AUDIO_DRIVER_ANDROID - -void ANDROIDAUDIO_ResumeDevices(void); -void ANDROIDAUDIO_PauseDevices(void); - -#else - -static void ANDROIDAUDIO_ResumeDevices(void) {} -static void ANDROIDAUDIO_PauseDevices(void) {} - -#endif - -#endif // SDL_androidaudio_h_ diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 6824289351bb6..6c38308daaead 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -364,16 +364,6 @@ static jclass mAudioManagerClass; /* method signatures */ static jmethodID midRegisterAudioDeviceCallback; static jmethodID midUnregisterAudioDeviceCallback; -static jmethodID midAudioOpen; -static jmethodID midAudioWriteByteBuffer; -static jmethodID midAudioWriteShortBuffer; -static jmethodID midAudioWriteFloatBuffer; -static jmethodID midAudioClose; -static jmethodID midRecordingOpen; -static jmethodID midRecordingReadByteBuffer; -static jmethodID midRecordingReadShortBuffer; -static jmethodID midRecordingReadFloatBuffer; -static jmethodID midRecordingClose; static jmethodID midAudioSetThreadPriority; /* controller manager */ @@ -710,34 +700,10 @@ JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)(JNIEnv *env, jcl midUnregisterAudioDeviceCallback = (*env)->GetStaticMethodID(env, mAudioManagerClass, "unregisterAudioDeviceCallback", "()V"); - midAudioOpen = (*env)->GetStaticMethodID(env, mAudioManagerClass, - "audioOpen", "(IIIII)[I"); - midAudioWriteByteBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, - "audioWriteByteBuffer", "([B)V"); - midAudioWriteShortBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, - "audioWriteShortBuffer", "([S)V"); - midAudioWriteFloatBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, - "audioWriteFloatBuffer", "([F)V"); - midAudioClose = (*env)->GetStaticMethodID(env, mAudioManagerClass, - "audioClose", "()V"); - midRecordingOpen = (*env)->GetStaticMethodID(env, mAudioManagerClass, - "recordingOpen", "(IIIII)[I"); - midRecordingReadByteBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, - "recordingReadByteBuffer", "([BZ)I"); - midRecordingReadShortBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, - "recordingReadShortBuffer", "([SZ)I"); - midRecordingReadFloatBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, - "recordingReadFloatBuffer", "([FZ)I"); - midRecordingClose = (*env)->GetStaticMethodID(env, mAudioManagerClass, - "recordingClose", "()V"); midAudioSetThreadPriority = (*env)->GetStaticMethodID(env, mAudioManagerClass, "audioSetThreadPriority", "(ZI)V"); - if (!midRegisterAudioDeviceCallback || !midUnregisterAudioDeviceCallback || !midAudioOpen || - !midAudioWriteByteBuffer || !midAudioWriteShortBuffer || !midAudioWriteFloatBuffer || - !midAudioClose || - !midRecordingOpen || !midRecordingReadByteBuffer || !midRecordingReadShortBuffer || - !midRecordingReadFloatBuffer || !midRecordingClose || !midAudioSetThreadPriority) { + if (!midRegisterAudioDeviceCallback || !midUnregisterAudioDeviceCallback || !midAudioSetThreadPriority) { __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLAudioManager.java?"); } @@ -1642,6 +1608,16 @@ void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint) (*env)->DeleteLocalRef(env, jhint); } +SDL_DisplayOrientation Android_JNI_GetDisplayNaturalOrientation(void) +{ + return displayNaturalOrientation; +} + +SDL_DisplayOrientation Android_JNI_GetDisplayCurrentOrientation(void) +{ + return displayCurrentOrientation; +} + void Android_JNI_MinizeWindow(void) { JNIEnv *env = Android_JNI_GetEnv(); @@ -1673,12 +1649,6 @@ SDL_bool Android_JNI_GetAccelerometerValues(float values[3]) /* * Audio support */ -static int audioBufferFormat = 0; -static jobject audioBuffer = NULL; -static void *audioBufferPinned = NULL; -static int recordingBufferFormat = 0; -static jobject recordingBuffer = NULL; - void Android_StartAudioHotplug(SDL_AudioDevice **default_playback, SDL_AudioDevice **default_recording) { JNIEnv *env = Android_JNI_GetEnv(); @@ -1693,282 +1663,6 @@ void Android_StopAudioHotplug(void) (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midUnregisterAudioDeviceCallback); } -int Android_JNI_OpenAudioDevice(SDL_AudioDevice *device) -{ - const SDL_bool recording = device->recording; - SDL_AudioSpec *spec = &device->spec; - const int device_id = (int) ((size_t) device->handle); - int audioformat; - jobject jbufobj = NULL; - jobject result; - int *resultElements; - jboolean isCopy; - - JNIEnv *env = Android_JNI_GetEnv(); - - switch (spec->format) { - case SDL_AUDIO_U8: - audioformat = ENCODING_PCM_8BIT; - break; - case SDL_AUDIO_S16: - audioformat = ENCODING_PCM_16BIT; - break; - case SDL_AUDIO_F32: - audioformat = ENCODING_PCM_FLOAT; - break; - default: - return SDL_SetError("Unsupported audio format: 0x%x", spec->format); - } - - if (recording) { - __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device for recording"); - result = (*env)->CallStaticObjectMethod(env, mAudioManagerClass, midRecordingOpen, spec->freq, audioformat, spec->channels, device->sample_frames, device_id); - } else { - __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device for playback"); - result = (*env)->CallStaticObjectMethod(env, mAudioManagerClass, midAudioOpen, spec->freq, audioformat, spec->channels, device->sample_frames, device_id); - } - if (!result) { - /* Error during audio initialization, error printed from Java */ - return SDL_SetError("Java-side initialization failed"); - } - - if ((*env)->GetArrayLength(env, (jintArray)result) != 4) { - return SDL_SetError("Unexpected results from Java, expected 4, got %d", (*env)->GetArrayLength(env, (jintArray)result)); - } - isCopy = JNI_FALSE; - resultElements = (*env)->GetIntArrayElements(env, (jintArray)result, &isCopy); - spec->freq = resultElements[0]; - audioformat = resultElements[1]; - switch (audioformat) { - case ENCODING_PCM_8BIT: - spec->format = SDL_AUDIO_U8; - break; - case ENCODING_PCM_16BIT: - spec->format = SDL_AUDIO_S16; - break; - case ENCODING_PCM_FLOAT: - spec->format = SDL_AUDIO_F32; - break; - default: - return SDL_SetError("Unexpected audio format from Java: %d", audioformat); - } - spec->channels = resultElements[2]; - device->sample_frames = resultElements[3]; - (*env)->ReleaseIntArrayElements(env, (jintArray)result, resultElements, JNI_ABORT); - (*env)->DeleteLocalRef(env, result); - - /* Allocating the audio buffer from the Java side and passing it as the return value for audioInit no longer works on - * Android >= 4.2 due to a "stale global reference" error. So now we allocate this buffer directly from this side. */ - switch (audioformat) { - case ENCODING_PCM_8BIT: - { - jbyteArray audioBufferLocal = (*env)->NewByteArray(env, device->sample_frames * spec->channels); - if (audioBufferLocal) { - jbufobj = (*env)->NewGlobalRef(env, audioBufferLocal); - (*env)->DeleteLocalRef(env, audioBufferLocal); - } - } break; - case ENCODING_PCM_16BIT: - { - jshortArray audioBufferLocal = (*env)->NewShortArray(env, device->sample_frames * spec->channels); - if (audioBufferLocal) { - jbufobj = (*env)->NewGlobalRef(env, audioBufferLocal); - (*env)->DeleteLocalRef(env, audioBufferLocal); - } - } break; - case ENCODING_PCM_FLOAT: - { - jfloatArray audioBufferLocal = (*env)->NewFloatArray(env, device->sample_frames * spec->channels); - if (audioBufferLocal) { - jbufobj = (*env)->NewGlobalRef(env, audioBufferLocal); - (*env)->DeleteLocalRef(env, audioBufferLocal); - } - } break; - default: - return SDL_SetError("Unexpected audio format from Java: %d\n", audioformat); - } - - if (!jbufobj) { - __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: could not allocate an audio buffer"); - return SDL_OutOfMemory(); - } - - if (recording) { - recordingBufferFormat = audioformat; - recordingBuffer = jbufobj; - } else { - audioBufferFormat = audioformat; - audioBuffer = jbufobj; - } - - if (!recording) { - isCopy = JNI_FALSE; - - switch (audioformat) { - case ENCODING_PCM_8BIT: - audioBufferPinned = (*env)->GetByteArrayElements(env, (jbyteArray)audioBuffer, &isCopy); - break; - case ENCODING_PCM_16BIT: - audioBufferPinned = (*env)->GetShortArrayElements(env, (jshortArray)audioBuffer, &isCopy); - break; - case ENCODING_PCM_FLOAT: - audioBufferPinned = (*env)->GetFloatArrayElements(env, (jfloatArray)audioBuffer, &isCopy); - break; - default: - return SDL_SetError("Unexpected audio format from Java: %d\n", audioformat); - } - } - return 0; -} - -SDL_DisplayOrientation Android_JNI_GetDisplayNaturalOrientation(void) -{ - return displayNaturalOrientation; -} - -SDL_DisplayOrientation Android_JNI_GetDisplayCurrentOrientation(void) -{ - return displayCurrentOrientation; -} - -void *Android_JNI_GetAudioBuffer(void) -{ - return audioBufferPinned; -} - -void Android_JNI_WriteAudioBuffer(void) -{ - JNIEnv *env = Android_JNI_GetEnv(); - - switch (audioBufferFormat) { - case ENCODING_PCM_8BIT: - (*env)->ReleaseByteArrayElements(env, (jbyteArray)audioBuffer, (jbyte *)audioBufferPinned, JNI_COMMIT); - (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioWriteByteBuffer, (jbyteArray)audioBuffer); - break; - case ENCODING_PCM_16BIT: - (*env)->ReleaseShortArrayElements(env, (jshortArray)audioBuffer, (jshort *)audioBufferPinned, JNI_COMMIT); - (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioWriteShortBuffer, (jshortArray)audioBuffer); - break; - case ENCODING_PCM_FLOAT: - (*env)->ReleaseFloatArrayElements(env, (jfloatArray)audioBuffer, (jfloat *)audioBufferPinned, JNI_COMMIT); - (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioWriteFloatBuffer, (jfloatArray)audioBuffer); - break; - default: - __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: unhandled audio buffer format"); - break; - } - - /* JNI_COMMIT means the changes are committed to the VM but the buffer remains pinned */ -} - -int Android_JNI_RecordAudioBuffer(void *buffer, int buflen) -{ - JNIEnv *env = Android_JNI_GetEnv(); - jboolean isCopy = JNI_FALSE; - jint br = -1; - - switch (recordingBufferFormat) { - case ENCODING_PCM_8BIT: - SDL_assert((*env)->GetArrayLength(env, (jshortArray)recordingBuffer) == buflen); - br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midRecordingReadByteBuffer, (jbyteArray)recordingBuffer, JNI_TRUE); - if (br > 0) { - jbyte *ptr = (*env)->GetByteArrayElements(env, (jbyteArray)recordingBuffer, &isCopy); - SDL_memcpy(buffer, ptr, br); - (*env)->ReleaseByteArrayElements(env, (jbyteArray)recordingBuffer, ptr, JNI_ABORT); - } - break; - case ENCODING_PCM_16BIT: - SDL_assert((*env)->GetArrayLength(env, (jshortArray)recordingBuffer) == (buflen / sizeof(Sint16))); - br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midRecordingReadShortBuffer, (jshortArray)recordingBuffer, JNI_TRUE); - if (br > 0) { - jshort *ptr = (*env)->GetShortArrayElements(env, (jshortArray)recordingBuffer, &isCopy); - br *= sizeof(Sint16); - SDL_memcpy(buffer, ptr, br); - (*env)->ReleaseShortArrayElements(env, (jshortArray)recordingBuffer, ptr, JNI_ABORT); - } - break; - case ENCODING_PCM_FLOAT: - SDL_assert((*env)->GetArrayLength(env, (jfloatArray)recordingBuffer) == (buflen / sizeof(float))); - br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midRecordingReadFloatBuffer, (jfloatArray)recordingBuffer, JNI_TRUE); - if (br > 0) { - jfloat *ptr = (*env)->GetFloatArrayElements(env, (jfloatArray)recordingBuffer, &isCopy); - br *= sizeof(float); - SDL_memcpy(buffer, ptr, br); - (*env)->ReleaseFloatArrayElements(env, (jfloatArray)recordingBuffer, ptr, JNI_ABORT); - } - break; - default: - __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: unhandled recording buffer format"); - break; - } - return br; -} - -void Android_JNI_FlushRecordedAudio(void) -{ - JNIEnv *env = Android_JNI_GetEnv(); -#if 0 /* !!! FIXME: this needs API 23, or it'll do blocking reads and never end. */ - switch (recordingBufferFormat) { - case ENCODING_PCM_8BIT: - { - const jint len = (*env)->GetArrayLength(env, (jbyteArray)recordingBuffer); - while ((*env)->CallStaticIntMethod(env, mActivityClass, midRecordingReadByteBuffer, (jbyteArray)recordingBuffer, JNI_FALSE) == len) { /* spin */ } - } - break; - case ENCODING_PCM_16BIT: - { - const jint len = (*env)->GetArrayLength(env, (jshortArray)recordingBuffer); - while ((*env)->CallStaticIntMethod(env, mActivityClass, midRecordingReadShortBuffer, (jshortArray)recordingBuffer, JNI_FALSE) == len) { /* spin */ } - } - break; - case ENCODING_PCM_FLOAT: - { - const jint len = (*env)->GetArrayLength(env, (jfloatArray)recordingBuffer); - while ((*env)->CallStaticIntMethod(env, mActivityClass, midRecordingReadFloatBuffer, (jfloatArray)recordingBuffer, JNI_FALSE) == len) { /* spin */ } - } - break; - default: - __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: flushing unhandled recording buffer format"); - break; - } -#else - switch (recordingBufferFormat) { - case ENCODING_PCM_8BIT: - (*env)->CallStaticIntMethod(env, mAudioManagerClass, midRecordingReadByteBuffer, (jbyteArray)recordingBuffer, JNI_FALSE); - break; - case ENCODING_PCM_16BIT: - (*env)->CallStaticIntMethod(env, mAudioManagerClass, midRecordingReadShortBuffer, (jshortArray)recordingBuffer, JNI_FALSE); - break; - case ENCODING_PCM_FLOAT: - (*env)->CallStaticIntMethod(env, mAudioManagerClass, midRecordingReadFloatBuffer, (jfloatArray)recordingBuffer, JNI_FALSE); - break; - default: - __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: flushing unhandled recording buffer format"); - break; - } -#endif -} - -void Android_JNI_CloseAudioDevice(const int recording) -{ - JNIEnv *env = Android_JNI_GetEnv(); - - if (recording) { - (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midRecordingClose); - if (recordingBuffer) { - (*env)->DeleteGlobalRef(env, recordingBuffer); - recordingBuffer = NULL; - } - } else { - (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioClose); - if (audioBuffer) { - (*env)->DeleteGlobalRef(env, audioBuffer); - audioBuffer = NULL; - audioBufferPinned = NULL; - } - } -} - static void Android_JNI_AudioSetThreadPriority(int recording, int device_id) { JNIEnv *env = Android_JNI_GetEnv(); diff --git a/src/core/android/SDL_android.h b/src/core/android/SDL_android.h index 9461ea0c5dcf6..ef0df18e30b19 100644 --- a/src/core/android/SDL_android.h +++ b/src/core/android/SDL_android.h @@ -75,12 +75,6 @@ extern SDL_DisplayOrientation Android_JNI_GetDisplayCurrentOrientation(void); void Android_StartAudioHotplug(SDL_AudioDevice **default_playback, SDL_AudioDevice **default_recording); void Android_StopAudioHotplug(void); extern void Android_AudioThreadInit(SDL_AudioDevice *device); -extern int Android_JNI_OpenAudioDevice(SDL_AudioDevice *device); -extern void *Android_JNI_GetAudioBuffer(void); -extern void Android_JNI_WriteAudioBuffer(void); -extern int Android_JNI_RecordAudioBuffer(void *buffer, int buflen); -extern void Android_JNI_FlushRecordedAudio(void); -extern void Android_JNI_CloseAudioDevice(const int recording); /* Detecting device type */ extern SDL_bool Android_IsDeXMode(void); From 9d35f178a6851fb3b721e02e3e5d55c0c91589a9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 08:06:43 -0700 Subject: [PATCH 049/253] Follow up to removing the ancient Android audio driver --- src/video/android/SDL_androidevents.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/video/android/SDL_androidevents.c b/src/video/android/SDL_androidevents.c index 3b250b4927bf7..63abf92b331bb 100644 --- a/src/video/android/SDL_androidevents.c +++ b/src/video/android/SDL_androidevents.c @@ -28,7 +28,6 @@ #include "../SDL_sysvideo.h" #include "../../events/SDL_events_c.h" -#include "../../audio/android/SDL_androidaudio.h" #include "../../audio/aaudio/SDL_aaudio.h" #include "../../audio/openslES/SDL_openslES.h" @@ -99,7 +98,6 @@ void Android_InitEvents(void) static void Android_PauseAudio(void) { - ANDROIDAUDIO_PauseDevices(); OPENSLES_PauseDevices(); AAUDIO_PauseDevices(); Android_PausedAudio = SDL_TRUE; @@ -108,7 +106,6 @@ static void Android_PauseAudio(void) static void Android_ResumeAudio(void) { if (Android_PausedAudio) { - ANDROIDAUDIO_ResumeDevices(); OPENSLES_ResumeDevices(); AAUDIO_ResumeDevices(); Android_PausedAudio = SDL_FALSE; From 5318e30ee52282b8a476851989a1d17559b6e76e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 08:17:10 -0700 Subject: [PATCH 050/253] Pause and resume Android audio without taking device locks The AAudio driver implemented pause/resume by dangerously locking the audio devices. If there was an audio hotplug event or a background thread tried to interact with the audio system, this could cause deadlocks. --- src/audio/aaudio/SDL_aaudio.c | 22 ++++++++++++---------- src/audio/aaudio/SDL_aaudio.h | 13 ++----------- src/audio/openslES/SDL_openslES.c | 15 +++++++++++++-- src/audio/openslES/SDL_openslES.h | 13 ++----------- 4 files changed, 29 insertions(+), 34 deletions(-) diff --git a/src/audio/aaudio/SDL_aaudio.c b/src/audio/aaudio/SDL_aaudio.c index 0053cbd70e94f..91d51245a0628 100644 --- a/src/audio/aaudio/SDL_aaudio.c +++ b/src/audio/aaudio/SDL_aaudio.c @@ -43,7 +43,6 @@ struct SDL_PrivateAudioData size_t processed_bytes; SDL_Semaphore *semaphore; SDL_AtomicInt error_callback_triggered; - SDL_bool resume; // Resume device if it was paused automatically }; // Debug @@ -165,7 +164,18 @@ static Uint8 *AAUDIO_GetDeviceBuf(SDL_AudioDevice *device, int *bufsize) static int AAUDIO_WaitDevice(SDL_AudioDevice *device) { - SDL_WaitSemaphore(device->hidden->semaphore); + while (!SDL_AtomicGet(&device->shutdown)) { + // this semaphore won't fire when the app is in the background (AAUDIO_PauseDevices was called). + const int rc = SDL_WaitSemaphoreTimeout(device->hidden->semaphore, 100); + if (rc == -1) { // uh, what? + return -1; + } else if (rc == 0) { + return 0; // semaphore was signaled, let's go! + } else { + SDL_assert(rc == SDL_MUTEX_TIMEDOUT); + } + // Still waiting on the semaphore (or the system), check other things then wait again. + } return 0; } @@ -439,9 +449,6 @@ static SDL_bool PauseOneDevice(SDL_AudioDevice *device, void *userdata) LOGI("SDL Failed AAudioStream_requestPause %d", res); SDL_SetError("%s : %s", __func__, ctx.AAudio_convertResultToText(res)); } - - SDL_LockMutex(device->lock); - hidden->resume = SDL_TRUE; } } return SDL_FALSE; // keep enumerating. @@ -460,11 +467,6 @@ static SDL_bool ResumeOneDevice(SDL_AudioDevice *device, void *userdata) { struct SDL_PrivateAudioData *hidden = device->hidden; if (hidden) { - if (hidden->resume) { - hidden->resume = SDL_FALSE; - SDL_UnlockMutex(device->lock); - } - if (hidden->stream) { aaudio_result_t res = ctx.AAudioStream_requestStart(hidden->stream); if (res != AAUDIO_OK) { diff --git a/src/audio/aaudio/SDL_aaudio.h b/src/audio/aaudio/SDL_aaudio.h index 3354304a1fc00..eb3b4925f1682 100644 --- a/src/audio/aaudio/SDL_aaudio.h +++ b/src/audio/aaudio/SDL_aaudio.h @@ -23,16 +23,7 @@ #ifndef SDL_aaudio_h_ #define SDL_aaudio_h_ -#ifdef SDL_AUDIO_DRIVER_AAUDIO - -void AAUDIO_ResumeDevices(void); -void AAUDIO_PauseDevices(void); - -#else - -#define AAUDIO_ResumeDevices() -#define AAUDIO_PauseDevices() - -#endif +extern void AAUDIO_ResumeDevices(void); +extern void AAUDIO_PauseDevices(void); #endif // SDL_aaudio_h_ diff --git a/src/audio/openslES/SDL_openslES.c b/src/audio/openslES/SDL_openslES.c index cfbf0a3b04408..f2a8caec2cb10 100644 --- a/src/audio/openslES/SDL_openslES.c +++ b/src/audio/openslES/SDL_openslES.c @@ -652,8 +652,19 @@ static int OPENSLES_WaitDevice(SDL_AudioDevice *device) LOGV("OPENSLES_WaitDevice()"); - // Wait for an audio chunk to finish - return SDL_WaitSemaphore(audiodata->playsem); + while (!SDL_AtomicGet(&device->shutdown)) { + // this semaphore won't fire when the app is in the background (OPENSLES_PauseDevices was called). + const int rc = SDL_WaitSemaphoreTimeout(audiodata->playsem, 100); + if (rc == -1) { // uh, what? + return -1; + } else if (rc == 0) { + return 0; // semaphore was signaled, let's go! + } else { + SDL_assert(rc == SDL_MUTEX_TIMEDOUT); + } + // Still waiting on the semaphore (or the system), check other things then wait again. + } + return 0; } static int OPENSLES_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int buflen) diff --git a/src/audio/openslES/SDL_openslES.h b/src/audio/openslES/SDL_openslES.h index 9d65a7dabfeec..6574b5a285134 100644 --- a/src/audio/openslES/SDL_openslES.h +++ b/src/audio/openslES/SDL_openslES.h @@ -23,16 +23,7 @@ #ifndef SDL_openslesaudio_h_ #define SDL_openslesaudio_h_ -#ifdef SDL_AUDIO_DRIVER_OPENSLES - -void OPENSLES_ResumeDevices(void); -void OPENSLES_PauseDevices(void); - -#else - -static void OPENSLES_ResumeDevices(void) {} -static void OPENSLES_PauseDevices(void) {} - -#endif +extern void OPENSLES_ResumeDevices(void); +extern void OPENSLES_PauseDevices(void); #endif // SDL_openslesaudio_h_ From 5637cd009aeab9d05c8869861f7a85f9c1d09e88 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 09:15:55 -0700 Subject: [PATCH 051/253] Don't assert or change window draggable state if SDL isn't managing hit testing Fixes an assert if the application has set up its own hit testing on macOS --- src/video/cocoa/SDL_cocoawindow.m | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 7dc8ae50fc416..cbd01c90822c0 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1526,8 +1526,6 @@ - (BOOL)processHitTest:(NSEvent *)theEvent { SDL_Window *window = _data.window; - SDL_assert(isDragAreaRunning == [_data.nswindow isMovableByWindowBackground]); - if (window->hit_test) { /* if no hit-test, skip this. */ const NSPoint location = [theEvent locationInWindow]; const SDL_Point point = { (int)location.x, window->h - (((int)location.y) - 1) }; @@ -1538,15 +1536,15 @@ - (BOOL)processHitTest:(NSEvent *)theEvent [_data.nswindow setMovableByWindowBackground:YES]; } return YES; /* dragging! */ + } else { + if (isDragAreaRunning) { + isDragAreaRunning = NO; + [_data.nswindow setMovableByWindowBackground:NO]; + return YES; /* was dragging, drop event. */ + } } } - if (isDragAreaRunning) { - isDragAreaRunning = NO; - [_data.nswindow setMovableByWindowBackground:NO]; - return YES; /* was dragging, drop event. */ - } - return NO; /* not a special area, carry on. */ } @@ -2381,16 +2379,16 @@ void Cocoa_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window) /* isZoomed always returns true if the window is not resizable */ if (!(window->flags & SDL_WINDOW_RESIZABLE) || !Cocoa_IsZoomed(window)) { if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { - int x, y; - NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; + int x, y; + NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; /* Cocoa will resize the window from the bottom-left rather than the * top-left when -[nswindow setContentSize:] is used, so we must set the * entire frame based on the new size, in order to preserve the position. */ SDL_RelativeToGlobalForWindow(window, window->floating.x, window->floating.y, &x, &y); - rect.origin.x = x; - rect.origin.y = y; + rect.origin.x = x; + rect.origin.y = y; rect.size.width = window->floating.w; rect.size.height = window->floating.h; ConvertNSRect(&rect); From 51cccf3fa2f026242ac43f8387b29adf6d32ea66 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Mon, 29 Jul 2024 12:39:18 -0400 Subject: [PATCH 052/253] video: Disable relative warp emulation when warping the cursor after a fullscreen transition Otherwise, relative mode can be accidentally activated if the cursor is hidden. --- src/video/SDL_video.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 049891301638e..650fae22362fd 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1716,10 +1716,16 @@ extern SDL_WindowFlags WINRT_DetectWindowFlags(SDL_Window *window); static void SDL_RestoreMousePosition(SDL_Window *window) { float x, y; + SDL_Mouse *mouse = SDL_GetMouse(); if (window == SDL_GetMouseFocus()) { + const SDL_bool prev_warp_val = mouse->warp_emulation_prohibited; SDL_GetMouseState(&x, &y); + + /* Disable the warp emulation so it isn't accidentally activated on a fullscreen transitions. */ + mouse->warp_emulation_prohibited = SDL_TRUE; SDL_WarpMouseInWindow(window, x, y); + mouse->warp_emulation_prohibited = prev_warp_val; } } From 062caeaa4b7ab05ed852121271b35205a9b9721c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 10:39:29 -0700 Subject: [PATCH 053/253] Fixed Android build with audio disabled These functions are called by the Android event code regardless of whether audio is enabled Fixes https://github.com/libsdl-org/SDL/issues/10418 --- src/audio/aaudio/SDL_aaudio.h | 9 +++++++++ src/audio/openslES/SDL_openslES.h | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/audio/aaudio/SDL_aaudio.h b/src/audio/aaudio/SDL_aaudio.h index eb3b4925f1682..1047c9873b206 100644 --- a/src/audio/aaudio/SDL_aaudio.h +++ b/src/audio/aaudio/SDL_aaudio.h @@ -23,7 +23,16 @@ #ifndef SDL_aaudio_h_ #define SDL_aaudio_h_ +#ifdef SDL_AUDIO_DRIVER_AAUDIO + extern void AAUDIO_ResumeDevices(void); extern void AAUDIO_PauseDevices(void); +#else + +#define AAUDIO_ResumeDevices() +#define AAUDIO_PauseDevices() + +#endif + #endif // SDL_aaudio_h_ diff --git a/src/audio/openslES/SDL_openslES.h b/src/audio/openslES/SDL_openslES.h index 6574b5a285134..9148c7909e3d9 100644 --- a/src/audio/openslES/SDL_openslES.h +++ b/src/audio/openslES/SDL_openslES.h @@ -23,7 +23,16 @@ #ifndef SDL_openslesaudio_h_ #define SDL_openslesaudio_h_ +#ifdef SDL_AUDIO_DRIVER_OPENSLES + extern void OPENSLES_ResumeDevices(void); extern void OPENSLES_PauseDevices(void); +#else + +#define OPENSLES_ResumeDevices() +#define OPENSLES_PauseDevices() + +#endif + #endif // SDL_openslesaudio_h_ From c4582a65364acbc390673c531e1aba206a1efe78 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 11:56:28 -0700 Subject: [PATCH 054/253] Fixed warning building on tvOS --- src/render/metal/SDL_render_metal.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index b6061f48c353f..db7308f4f9274 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -702,7 +702,7 @@ static int METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL } if (surface) { - if (@available(iOS 11.0, *)) { + if (@available(iOS 11.0, tvOS 11.0, *)) { mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc iosurface:surface plane:0]; } } else { @@ -735,7 +735,7 @@ static int METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL if (yuv || nv12) { if (surface) { - if (@available(iOS 11.0, *)) { + if (@available(iOS 11.0, tvOS 11.0, *)) { mtltextureUv = [data.mtldevice newTextureWithDescriptor:mtltexdesc iosurface:surface plane:1]; } } else { From 930d83aed27eda5075c97997950f95ccb90477e6 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 12:01:53 -0700 Subject: [PATCH 055/253] Fixed warning: implicit conversion loses integer precision: 'VkDeviceSize' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') --- src/render/vulkan/SDL_render_vulkan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/vulkan/SDL_render_vulkan.c b/src/render/vulkan/SDL_render_vulkan.c index 1d4a22d10511c..81ca222114600 100644 --- a/src/render/vulkan/SDL_render_vulkan.c +++ b/src/render/vulkan/SDL_render_vulkan.c @@ -2763,7 +2763,7 @@ static VkResult VULKAN_UpdateTextureInternal(VULKAN_RenderData *rendererData, Vk length = pitch; } for (VkDeviceSize row = h; row--; ) { - SDL_memcpy(dst, src, length); + SDL_memcpy(dst, src, (size_t)length); src += pitch; dst += length; } From 299d1819848e1e97179125ff0bbf34d1db497515 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 12:04:08 -0700 Subject: [PATCH 056/253] Fixed warning: result of comparison of constant 9223372035 with expression of type '__kernel_old_time_t' (aka 'long') is always true --- src/time/unix/SDL_systime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/time/unix/SDL_systime.c b/src/time/unix/SDL_systime.c index 8f3cb7fc6edcb..0a9353415a457 100644 --- a/src/time/unix/SDL_systime.c +++ b/src/time/unix/SDL_systime.c @@ -107,7 +107,7 @@ int SDL_GetCurrentTime(SDL_Time *ticks) struct timespec tp; if (clock_gettime(CLOCK_REALTIME, &tp) == 0) { - tp.tv_sec = SDL_min(tp.tv_sec, SDL_NS_TO_SECONDS(SDL_MAX_TIME) - 1); + //tp.tv_sec = SDL_min(tp.tv_sec, SDL_NS_TO_SECONDS(SDL_MAX_TIME) - 1); *ticks = SDL_SECONDS_TO_NS(tp.tv_sec) + tp.tv_nsec; return 0; } From 614a88ca3b16b30f49aae31deefebe69142fb2b5 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 29 Jul 2024 14:50:57 -0400 Subject: [PATCH 057/253] SDL_IOFromFile: Apple targets no longer use the app bundle's resources dir. Fixes #8403. --- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 16 ------ docs/README-migration.md | 2 + src/file/SDL_iostream.c | 9 +-- src/file/cocoa/SDL_iostreambundlesupport.h | 30 ---------- src/file/cocoa/SDL_iostreambundlesupport.m | 65 ---------------------- 5 files changed, 3 insertions(+), 119 deletions(-) delete mode 100644 src/file/cocoa/SDL_iostreambundlesupport.h delete mode 100644 src/file/cocoa/SDL_iostreambundlesupport.m diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index f13182b501b4a..cb0d184592006 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -229,8 +229,6 @@ A7D8B58723E2514300DCD162 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A7D023E2513E00DCD162 /* SDL_joystick_c.h */; }; A7D8B5B723E2514300DCD162 /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A7D923E2513E00DCD162 /* controller_type.h */; }; A7D8B5BD23E2514300DCD162 /* SDL_iostream.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7DB23E2513F00DCD162 /* SDL_iostream.c */; }; - A7D8B5C323E2514300DCD162 /* SDL_iostreambundlesupport.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A7DD23E2513F00DCD162 /* SDL_iostreambundlesupport.h */; }; - A7D8B5C923E2514300DCD162 /* SDL_iostreambundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7DE23E2513F00DCD162 /* SDL_iostreambundlesupport.m */; }; A7D8B5CF23E2514300DCD162 /* SDL_syspower.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7E123E2513F00DCD162 /* SDL_syspower.m */; }; A7D8B5D523E2514300DCD162 /* SDL_syspower.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A7E223E2513F00DCD162 /* SDL_syspower.h */; }; A7D8B5E723E2514300DCD162 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7E723E2513F00DCD162 /* SDL_power.c */; }; @@ -789,8 +787,6 @@ A7D8A7D023E2513E00DCD162 /* SDL_joystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_joystick_c.h; sourceTree = ""; }; A7D8A7D923E2513E00DCD162 /* controller_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = controller_type.h; sourceTree = ""; }; A7D8A7DB23E2513F00DCD162 /* SDL_iostream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_iostream.c; sourceTree = ""; }; - A7D8A7DD23E2513F00DCD162 /* SDL_iostreambundlesupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_iostreambundlesupport.h; sourceTree = ""; }; - A7D8A7DE23E2513F00DCD162 /* SDL_iostreambundlesupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_iostreambundlesupport.m; sourceTree = ""; }; A7D8A7E123E2513F00DCD162 /* SDL_syspower.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_syspower.m; sourceTree = ""; }; A7D8A7E223E2513F00DCD162 /* SDL_syspower.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syspower.h; sourceTree = ""; }; A7D8A7E723E2513F00DCD162 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_power.c; sourceTree = ""; }; @@ -1884,21 +1880,11 @@ A7D8A7DA23E2513E00DCD162 /* file */ = { isa = PBXGroup; children = ( - A7D8A7DC23E2513F00DCD162 /* cocoa */, A7D8A7DB23E2513F00DCD162 /* SDL_iostream.c */, ); path = file; sourceTree = ""; }; - A7D8A7DC23E2513F00DCD162 /* cocoa */ = { - isa = PBXGroup; - children = ( - A7D8A7DD23E2513F00DCD162 /* SDL_iostreambundlesupport.h */, - A7D8A7DE23E2513F00DCD162 /* SDL_iostreambundlesupport.m */, - ); - path = cocoa; - sourceTree = ""; - }; A7D8A7DF23E2513F00DCD162 /* power */ = { isa = PBXGroup; children = ( @@ -2462,7 +2448,6 @@ F3F7D9152933074E00816151 /* SDL_revision.h in Headers */, A7D8BA3123E2514400DCD162 /* SDL_rotate.h in Headers */, F3F7D9652933074E00816151 /* SDL_iostream.h in Headers */, - A7D8B5C323E2514300DCD162 /* SDL_iostreambundlesupport.h in Headers */, F3F7D9492933074E00816151 /* SDL_scancode.h in Headers */, F3F7D94D2933074E00816151 /* SDL_sensor.h in Headers */, A7D8A98D23E2514000DCD162 /* SDL_sensor_c.h in Headers */, @@ -2877,7 +2862,6 @@ F3F528CD2C29E1C300E6CC26 /* s_isnan.c in Sources */, F3F07D5A269640160074468B /* SDL_hidapi_luna.c in Sources */, A7D8BBD523E2574800DCD162 /* SDL_uikitclipboard.m in Sources */, - A7D8B5C923E2514300DCD162 /* SDL_iostreambundlesupport.m in Sources */, F386F6F92884663E001840AA /* SDL_utils.c in Sources */, E4F7981E2AD8D86A00669F54 /* SDL_render_unsupported.c in Sources */, A7D8AC0F23E2514100DCD162 /* SDL_video.c in Sources */, diff --git a/docs/README-migration.md b/docs/README-migration.md index e38fc7cc0d6b4..1e69aa85ed2f1 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -1510,6 +1510,8 @@ SDL_IOStream *SDL_RWFromFP(FILE *fp, SDL_bool autoclose) The internal `FILE *` is available through a standard SDL_IOStream property, for streams made through SDL_IOFromFile() that use stdio behind the scenes; apps use this pointer at their own risk and should make sure that SDL and the app are using the same C runtime. +On Apple platforms, SDL_RWFromFile (now called SDL_IOFromFile) no longer tries to read from inside the app bundle's resource directory, instead now using the specified path unchanged. One can use SDL_GetBasePath() to find the resource directory on these platforms. + The functions SDL_ReadU8(), SDL_ReadU16LE(), SDL_ReadU16BE(), SDL_ReadU32LE(), SDL_ReadU32BE(), SDL_ReadU64LE(), and SDL_ReadU64BE() now return SDL_TRUE if the read succeeded and SDL_FALSE if it didn't, and store the data in a pointer passed in as a parameter. diff --git a/src/file/SDL_iostream.c b/src/file/SDL_iostream.c index 0b0ecdfe5c861..ef1d21d240c57 100644 --- a/src/file/SDL_iostream.c +++ b/src/file/SDL_iostream.c @@ -44,11 +44,6 @@ struct SDL_IOStream SDL_PropertiesID props; }; - -#ifdef SDL_PLATFORM_APPLE -#include "cocoa/SDL_iostreambundlesupport.h" -#endif /* SDL_PLATFORM_APPLE */ - #ifdef SDL_PLATFORM_3DS #include "n3ds/SDL_iostreamromfs.h" #endif /* SDL_PLATFORM_3DS */ @@ -650,9 +645,7 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode) #elif defined(HAVE_STDIO_H) { - #if defined(SDL_PLATFORM_APPLE) - FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode); - #elif defined(SDL_PLATFORM_WINRT) + #if defined(SDL_PLATFORM_WINRT) FILE *fp = NULL; fopen_s(&fp, file, mode); #elif defined(SDL_PLATFORM_3DS) diff --git a/src/file/cocoa/SDL_iostreambundlesupport.h b/src/file/cocoa/SDL_iostreambundlesupport.h deleted file mode 100644 index e7b337a75ae4e..0000000000000 --- a/src/file/cocoa/SDL_iostreambundlesupport.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2024 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifdef SDL_PLATFORM_APPLE - -#include - -#ifndef SDL_iostreambundlesupport_h -#define SDL_iostreambundlesupport_h -FILE *SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode); -#endif -#endif diff --git a/src/file/cocoa/SDL_iostreambundlesupport.m b/src/file/cocoa/SDL_iostreambundlesupport.m deleted file mode 100644 index 93a7b4349a2af..0000000000000 --- a/src/file/cocoa/SDL_iostreambundlesupport.m +++ /dev/null @@ -1,65 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2024 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "SDL_internal.h" - -#ifdef SDL_PLATFORM_APPLE -#import - -#include "SDL_iostreambundlesupport.h" - -/* For proper macOS applications, the resources are contained inside the application bundle. - So the strategy is to first check the application bundle for the file, then fallback to the current working directory. - Note: One additional corner-case is if the resource is in a framework's resource bundle instead of the app. - We might want to use bundle identifiers, e.g. org.libsdl.sdl to get the bundle for the framework, - but we would somehow need to know what the bundle identifiers we need to search are. - Also, note the bundle layouts are different for iPhone and Mac. -*/ -FILE *SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode) -{ - @autoreleasepool { - FILE *fp = NULL; - NSFileManager *file_manager; - NSString *resource_path; - NSString *ns_string_file_component; - NSString *full_path_with_file_to_try; - - /* If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only. */ - if (SDL_strchr(mode, 'r') == NULL) { - return fopen(file, mode); - } - - file_manager = [NSFileManager defaultManager]; - resource_path = [[NSBundle mainBundle] resourcePath]; - - ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)]; - - full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component]; - if ([file_manager fileExistsAtPath:full_path_with_file_to_try]) { - fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode); - } else { - fp = fopen(file, mode); - } - - return fp; - } -} - -#endif /* SDL_PLATFORM_APPLE */ From 67b973b5fad633b3be76d4daf4fd9fece292c25f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 12:52:03 -0700 Subject: [PATCH 058/253] Fixed whitespace --- src/joystick/SDL_joystick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index e03537079ddc8..8564f94e1f550 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -390,7 +390,7 @@ static Uint32 initial_wheel_devices[] = { MAKE_VIDPID(0x2433, 0xf301), /* Asetek SimSports Forte Wheelbase */ MAKE_VIDPID(0x2433, 0xf303), /* Asetek SimSports La Prima Wheelbase */ MAKE_VIDPID(0x2433, 0xf306), /* Asetek SimSports Tony Kannan Wheelbase */ - MAKE_VIDPID(0x3416, 0x0301), /* Cammus C5 Wheelbase */ + MAKE_VIDPID(0x3416, 0x0301), /* Cammus C5 Wheelbase */ MAKE_VIDPID(0x346e, 0x0000), /* Moza R16/R21 Wheelbase */ MAKE_VIDPID(0x346e, 0x0002), /* Moza R9 Wheelbase */ MAKE_VIDPID(0x346e, 0x0004), /* Moza R5 Wheelbase */ From 0a924b185d2f459a2efbe54484394a17b97f1632 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 12:48:40 -0700 Subject: [PATCH 059/253] Fixed crash with joystick rumble after disconnection This prevents continuing a rumble after the first one fails, and fixes a long standing crash issue if rumble is started immediately before the controller is disconnected. Thanks to @AntTheAlchemist for the key bug report that showed what was happening here. Fixes https://github.com/libsdl-org/SDL/issues/10422 --- src/joystick/SDL_joystick.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 8564f94e1f550..419ef5a7fd878 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1733,7 +1733,14 @@ int SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint retval = 0; } else { retval = joystick->driver->Rumble(joystick, low_frequency_rumble, high_frequency_rumble); - joystick->rumble_resend = SDL_GetTicks() + SDL_RUMBLE_RESEND_MS; + if (retval == 0) { + joystick->rumble_resend = SDL_GetTicks() + SDL_RUMBLE_RESEND_MS; + if (joystick->rumble_resend == 0) { + joystick->rumble_resend = 1; + } + } else { + joystick->rumble_resend = 0; + } } if (retval == 0) { @@ -2408,12 +2415,14 @@ void SDL_UpdateJoysticks(void) #endif /* SDL_JOYSTICK_HIDAPI */ for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { - if (joystick->attached) { - joystick->driver->Update(joystick); + if (!joystick->attached) { + continue; + } - if (joystick->delayed_guide_button) { - SDL_GamepadHandleDelayedGuideButton(joystick); - } + joystick->driver->Update(joystick); + + if (joystick->delayed_guide_button) { + SDL_GamepadHandleDelayedGuideButton(joystick); } now = SDL_GetTicks(); From 8caebf823af69d72dbf1d0bf9beba2900a0522d9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 14:44:02 -0700 Subject: [PATCH 060/253] Revert "Fixed warning: result of comparison of constant 9223372035 with expression of type '__kernel_old_time_t' (aka 'long') is always true" This reverts commit 299d1819848e1e97179125ff0bbf34d1db497515. --- src/time/unix/SDL_systime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/time/unix/SDL_systime.c b/src/time/unix/SDL_systime.c index 0a9353415a457..8f3cb7fc6edcb 100644 --- a/src/time/unix/SDL_systime.c +++ b/src/time/unix/SDL_systime.c @@ -107,7 +107,7 @@ int SDL_GetCurrentTime(SDL_Time *ticks) struct timespec tp; if (clock_gettime(CLOCK_REALTIME, &tp) == 0) { - //tp.tv_sec = SDL_min(tp.tv_sec, SDL_NS_TO_SECONDS(SDL_MAX_TIME) - 1); + tp.tv_sec = SDL_min(tp.tv_sec, SDL_NS_TO_SECONDS(SDL_MAX_TIME) - 1); *ticks = SDL_SECONDS_TO_NS(tp.tv_sec) + tp.tv_nsec; return 0; } From 61e78830d09441bb6cc6c3b22d001a3406875392 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 14:45:03 -0700 Subject: [PATCH 061/253] Revert "Revert "Fixed warning: result of comparison of constant 9223372035 with expression of type '__kernel_old_time_t' (aka 'long') is always true"" This reverts commit 8caebf823af69d72dbf1d0bf9beba2900a0522d9. --- src/time/unix/SDL_systime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/time/unix/SDL_systime.c b/src/time/unix/SDL_systime.c index 8f3cb7fc6edcb..0a9353415a457 100644 --- a/src/time/unix/SDL_systime.c +++ b/src/time/unix/SDL_systime.c @@ -107,7 +107,7 @@ int SDL_GetCurrentTime(SDL_Time *ticks) struct timespec tp; if (clock_gettime(CLOCK_REALTIME, &tp) == 0) { - tp.tv_sec = SDL_min(tp.tv_sec, SDL_NS_TO_SECONDS(SDL_MAX_TIME) - 1); + //tp.tv_sec = SDL_min(tp.tv_sec, SDL_NS_TO_SECONDS(SDL_MAX_TIME) - 1); *ticks = SDL_SECONDS_TO_NS(tp.tv_sec) + tp.tv_nsec; return 0; } From 9fac7d7eb051238717acf3376c6a2902d0a81de8 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 17:18:45 -0700 Subject: [PATCH 062/253] metal: set the shader input type based on the colorspace, not the pixel format Fixes https://github.com/libsdl-org/SDL/issues/10402 --- src/render/metal/SDL_render_metal.m | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index db7308f4f9274..ed7137fa794ae 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -1348,29 +1348,29 @@ static void SetupShaderConstants(SDL_Renderer *renderer, const SDL_RenderCommand case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: constants->texture_type = TEXTURETYPE_YUV; - constants->input_type = INPUTTYPE_SRGB; break; case SDL_PIXELFORMAT_NV12: constants->texture_type = TEXTURETYPE_NV12; - constants->input_type = INPUTTYPE_SRGB; break; case SDL_PIXELFORMAT_NV21: constants->texture_type = TEXTURETYPE_NV21; - constants->input_type = INPUTTYPE_SRGB; break; case SDL_PIXELFORMAT_P010: constants->texture_type = TEXTURETYPE_NV12; - constants->input_type = INPUTTYPE_HDR10; break; default: constants->texture_type = TEXTURETYPE_RGB; - if (texture->colorspace == SDL_COLORSPACE_SRGB_LINEAR) { - constants->input_type = INPUTTYPE_SCRGB; - } else if (texture->colorspace == SDL_COLORSPACE_HDR10) { - constants->input_type = INPUTTYPE_HDR10; - } else { - constants->input_type = INPUTTYPE_UNSPECIFIED; - } + } + + switch (SDL_COLORSPACETRANSFER(texture->colorspace)) { + case SDL_TRANSFER_CHARACTERISTICS_LINEAR: + constants->input_type = INPUTTYPE_SCRGB; + break; + case SDL_TRANSFER_CHARACTERISTICS_PQ: + constants->input_type = INPUTTYPE_HDR10; + break; + default: + constants->input_type = INPUTTYPE_SRGB; break; } From de209c81d1780859dafe35b2bd397f6bcc8ec25b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 29 Jul 2024 17:38:59 -0700 Subject: [PATCH 063/253] Fixed macOS build --- src/render/metal/SDL_render_metal.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index ed7137fa794ae..b349a97a8ccac 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -1300,7 +1300,7 @@ static int METAL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S static const float TEXTURETYPE_NV21 = 3; static const float TEXTURETYPE_YUV = 4; -static const float INPUTTYPE_UNSPECIFIED = 0; +//static const float INPUTTYPE_UNSPECIFIED = 0; static const float INPUTTYPE_SRGB = 1; static const float INPUTTYPE_SCRGB = 2; static const float INPUTTYPE_HDR10 = 3; From 949765a3b0311dea09c619080c6d8838ae585866 Mon Sep 17 00:00:00 2001 From: Semphris Date: Mon, 29 Jul 2024 18:22:04 -0400 Subject: [PATCH 064/253] Stylize examples/template.html --- examples/template.html | 155 +++++++++++++++++++++++++++++++---------- 1 file changed, 120 insertions(+), 35 deletions(-) diff --git a/examples/template.html b/examples/template.html index c047d615b3199..f76a73e5f4611 100644 --- a/examples/template.html +++ b/examples/template.html @@ -5,63 +5,148 @@ @project_name@ Example: @category_name@/@example_name@ -
- +
+ +
+
+
- -
@htmlified_source_code@
+
+
@htmlified_source_code@
+
From b881e1989688c6e6344196f95cd31fff91a3243c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Ky=C3=B6stil=C3=A4?= Date: Wed, 31 Jul 2024 02:00:43 +1000 Subject: [PATCH 072/253] android: Update window/surface pointers on change When the native window or surface backing the SDL window changes, e.g., when the activity is resumed, we should also update the corresponding window pointer properties (SDL_PROP_WINDOW_ANDROID_{WINDOW,SURFACE} _POINTER) so that they remain in sync. --- src/core/android/SDL_android.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 6c38308daaead..cc096924f75fb 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -1211,6 +1211,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceCreated)(JNIEnv *env, j SDL_WindowData *data = Android_Window->internal; data->native_window = Android_JNI_GetNativeWindow(); + SDL_SetPointerProperty(SDL_GetWindowProperties(Android_Window), SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER, data->native_window); if (data->native_window == NULL) { SDL_SetError("Could not fetch native window from UI thread"); } @@ -1232,6 +1233,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j /* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */ if (data->egl_surface == EGL_NO_SURFACE) { data->egl_surface = SDL_EGL_CreateSurface(_this, Android_Window, (NativeWindowType)data->native_window); + SDL_SetPointerProperty(SDL_GetWindowProperties(Android_Window), SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER, data->egl_surface); } /* GL Context handling is done in the event loop because this function is run from the Java thread */ From 69a2d7960cef29d1cda4283c9744c6d349e5e0b3 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 30 Jul 2024 13:18:37 -0400 Subject: [PATCH 073/253] examples: first shot at description text at top of page. Not working yet. --- build-scripts/build-web-examples.pl | 7 +++---- examples/template.html | 11 ++++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/build-scripts/build-web-examples.pl b/build-scripts/build-web-examples.pl index 6f4351b326302..516fe853ea2d9 100755 --- a/build-scripts/build-web-examples.pl +++ b/build-scripts/build-web-examples.pl @@ -103,16 +103,15 @@ sub handle_example_dir { my $jsdst = "$dst/$jsfname"; my $wasmdst = "$dst/$wasmfname"; - my $print_description = ''; + my $description = ''; if (open(my $readmetxth, '<', "$examples_dir/$category/$example/README.txt")) { my $spc = ''; while (<$readmetxth>) { chomp; s/\"/\\"/g; - $print_description .= "${spc}Module.print(\"$_\");"; + $description .= "$spc$_"; $spc = ' '; } - $print_description .= "${spc}Module.print(\"\");"; close($readmetxth); } @@ -155,7 +154,7 @@ sub handle_example_dir { s/\@example_name\@/$example/g; s/\@javascript_file\@/$jsfname/g; s/\@htmlified_source_code\@/$htmlified_source_code/g; - s/\@print_description\@/$print_description/g; + s/\@description\@/$description/g; $html .= $_; } close($htmltemplate); diff --git a/examples/template.html b/examples/template.html index c1284e2b7445a..268d0c4a20eb3 100644 --- a/examples/template.html +++ b/examples/template.html @@ -133,10 +133,20 @@ height: 100%; overflow: scroll; } + + #example-description { + background: black; + color: white; + height: 100%; + align-items: center; + } +
+ @description@ +
@@ -201,7 +211,6 @@ if (text) console.error('[post-exception status] ' + text); }; }; - @print_description@ From dbb4e05c28b65f7d7b397d4732bd1b08a5fdea6b Mon Sep 17 00:00:00 2001 From: Dylam De La Torre Date: Tue, 30 Jul 2024 18:55:35 +0200 Subject: [PATCH 074/253] Add "Snake" game example --- examples/CMakeLists.txt | 1 + examples/game/01-snake/main.c | 161 +++++++++++++++++++++++++++++++++ examples/game/01-snake/snake.c | 154 +++++++++++++++++++++++++++++++ examples/game/01-snake/snake.h | 51 +++++++++++ 4 files changed, 367 insertions(+) create mode 100644 examples/game/01-snake/main.c create mode 100644 examples/game/01-snake/snake.c create mode 100644 examples/game/01-snake/snake.h diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 4f82aa934e2e1..50364cc90ab05 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -186,6 +186,7 @@ add_sdl_example_executable(renderer-primitives SOURCES renderer/02-primitives/re add_sdl_example_executable(audio-simple-playback SOURCES audio/01-simple-playback/simple-playback.c) add_sdl_example_executable(audio-simple-playback-callback SOURCES audio/02-simple-playback-callback/simple-playback-callback.c) add_sdl_example_executable(audio-load-wav SOURCES audio/03-load-wav/load-wav.c DATAFILES ${CMAKE_CURRENT_SOURCE_DIR}/../test/sample.wav) +add_sdl_example_executable(snake SOURCES game/01-snake/main.c game/01-snake/snake.c) if(PSP) diff --git a/examples/game/01-snake/main.c b/examples/game/01-snake/main.c new file mode 100644 index 0000000000000..37c873bcfb47a --- /dev/null +++ b/examples/game/01-snake/main.c @@ -0,0 +1,161 @@ +/* + * This example code implements a Snake game that showcases some of the + * functionalities of SDL, such as timer callbacks and event handling. + * + * This code is public domain. Feel free to use it for any purpose! + */ +#define SDL_MAIN_USE_CALLBACKS 1 /* use the callbacks instead of main() */ +#include +#include +#include /* malloc(), free() */ + +#include "snake.h" + +#define STEP_RATE_IN_MILLISECONDS 125 +#define SNAKE_BLOCK_SIZE_IN_PIXELS 24 +#define SDL_WINDOW_WIDTH (SNAKE_BLOCK_SIZE_IN_PIXELS * SNAKE_GAME_WIDTH) +#define SDL_WINDOW_HEIGHT (SNAKE_BLOCK_SIZE_IN_PIXELS * SNAKE_GAME_HEIGHT) + +typedef struct +{ + SDL_Window *window; + SDL_Renderer *renderer; + SDL_TimerID step_timer; + SnakeContext snake_ctx; +} AppState; + +static Uint32 sdl_timer_callback_(void *payload, SDL_TimerID timer_id, Uint32 interval) +{ + SDL_Event e; + SDL_UserEvent ue; + /* NOTE: snake_step is not called here directly for multithreaded concerns. */ + (void)payload; + ue.type = SDL_EVENT_USER; + ue.code = 0; + ue.data1 = NULL; + ue.data2 = NULL; + e.type = SDL_EVENT_USER; + e.user = ue; + SDL_PushEvent(&e); + return interval; +} + +static int handle_key_event_(SnakeContext *ctx, SDL_Scancode key_code) +{ + switch (key_code) { + /* Quit. */ + case SDL_SCANCODE_ESCAPE: + case SDL_SCANCODE_Q: + return SDL_APP_SUCCESS; + /* Restart the game as if the program was launched. */ + case SDL_SCANCODE_R: + snake_initialize(ctx, SDL_rand); + break; + /* Decide new direction of the snake. */ + case SDL_SCANCODE_RIGHT: + snake_redir(ctx, SNAKE_DIR_RIGHT); + break; + case SDL_SCANCODE_UP: + snake_redir(ctx, SNAKE_DIR_UP); + break; + case SDL_SCANCODE_LEFT: + snake_redir(ctx, SNAKE_DIR_LEFT); + break; + case SDL_SCANCODE_DOWN: + snake_redir(ctx, SNAKE_DIR_DOWN); + break; + default: + break; + } + return SDL_APP_CONTINUE; +} + +static void set_rect_xy_(SDL_FRect *r, short x, short y) +{ + r->x = x * SNAKE_BLOCK_SIZE_IN_PIXELS; + r->y = y * SNAKE_BLOCK_SIZE_IN_PIXELS; +} + +int SDL_AppIterate(void *appstate) +{ + AppState *as; + SnakeContext *ctx; + SDL_FRect r; + unsigned i; + unsigned j; + int ct; + as = (AppState *)appstate; + ctx = &as->snake_ctx; + r.w = r.h = SNAKE_BLOCK_SIZE_IN_PIXELS; + SDL_SetRenderDrawColor(as->renderer, 0, 0, 0, 255); + SDL_RenderClear(as->renderer); + for (i = 0; i < SNAKE_GAME_WIDTH; i++) { + for (j = 0; j < SNAKE_GAME_HEIGHT; j++) { + ct = snake_cell_at(ctx, i, j); + if (ct == SNAKE_CELL_NOTHING) + continue; + set_rect_xy_(&r, i, j); + if (ct == SNAKE_CELL_FOOD) + SDL_SetRenderDrawColor(as->renderer, 0, 0, 128, 255); + else /* body */ + SDL_SetRenderDrawColor(as->renderer, 0, 128, 0, 255); + SDL_RenderFillRect(as->renderer, &r); + } + } + SDL_SetRenderDrawColor(as->renderer, 255, 255, 0, 255); /*head*/ + set_rect_xy_(&r, ctx->head_xpos, ctx->head_ypos); + SDL_RenderFillRect(as->renderer, &r); + SDL_RenderPresent(as->renderer); + return SDL_APP_CONTINUE; +} + +int SDL_AppInit(void **appstate, int argc, char *argv[]) +{ + (void)argc; + (void)argv; + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) { + return SDL_APP_FAILURE; + } + SDL_SetHint("SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR", "0"); + AppState *as = malloc(sizeof(AppState)); + *appstate = as; + as->step_timer = 0; + if (SDL_CreateWindowAndRenderer("examples/game/snake", SDL_WINDOW_WIDTH, SDL_WINDOW_HEIGHT, 0, &as->window, &as->renderer) == -1) { + return SDL_APP_FAILURE; + } + snake_initialize(&as->snake_ctx, SDL_rand); + as->step_timer = SDL_AddTimer( + STEP_RATE_IN_MILLISECONDS, + sdl_timer_callback_, + NULL); + if (as->step_timer == 0) { + return SDL_APP_FAILURE; + } + return SDL_APP_CONTINUE; +} + +int SDL_AppEvent(void *appstate, const SDL_Event *event) +{ + SnakeContext *ctx = &((AppState *)appstate)->snake_ctx; + switch (event->type) { + case SDL_EVENT_QUIT: + return SDL_APP_SUCCESS; + case SDL_EVENT_USER: + snake_step(ctx, SDL_rand); + break; + case SDL_EVENT_KEY_DOWN: + return handle_key_event_(ctx, event->key.scancode); + } + return SDL_APP_CONTINUE; +} + +void SDL_AppQuit(void *appstate) +{ + if (appstate != NULL) { + AppState *as = (AppState *)appstate; + SDL_RemoveTimer(as->step_timer); + SDL_DestroyRenderer(as->renderer); + SDL_DestroyWindow(as->window); + free(as); + } +} diff --git a/examples/game/01-snake/snake.c b/examples/game/01-snake/snake.c new file mode 100644 index 0000000000000..1f5a9c61fe9f7 --- /dev/null +++ b/examples/game/01-snake/snake.c @@ -0,0 +1,154 @@ +/* + * Logic implementation of the Snake game. It is designed to efficiently + * represent in memory the state of the game. + * + * This code is public domain. Feel free to use it for any purpose! + */ +#include "snake.h" + +#include /* CHAR_BIT, CHAR_MAX */ +#include /* memcpy() */ + +#define THREE_BITS 0x7U /* ~CHAR_MAX >> (CHAR_BIT - SNAKE_CELL_MAX_BITS) */ +#define SHIFT(x, y) (((x) + ((y) * SNAKE_GAME_WIDTH)) * SNAKE_CELL_MAX_BITS) + +static void put_cell_at_(SnakeContext *ctx, char x, char y, SnakeCell ct) +{ + const int shift = SHIFT(x, y); + const int adjust = shift % CHAR_BIT; + unsigned char *const pos = ctx->cells + (shift / CHAR_BIT); + unsigned short range; + memcpy(&range, pos, sizeof(range)); + range &= ~(THREE_BITS << adjust); /* clear bits */ + range |= (ct & THREE_BITS) << adjust; + memcpy(pos, &range, sizeof(range)); +} + +static int are_cells_full_(SnakeContext *ctx) +{ + return ctx->occupied_cells == SNAKE_GAME_WIDTH * SNAKE_GAME_HEIGHT; +} + +static void new_food_pos_(SnakeContext *ctx, RandFunc rand) +{ + char x; + char y; + for (;;) { + x = rand(SNAKE_GAME_WIDTH); + y = rand(SNAKE_GAME_HEIGHT); + if (snake_cell_at(ctx, x, y) == SNAKE_CELL_NOTHING) { + put_cell_at_(ctx, x, y, SNAKE_CELL_FOOD); + break; + } + } +} + +void snake_initialize(SnakeContext *ctx, RandFunc rand) +{ + int i; + memset(ctx, 0, sizeof ctx->cells); + ctx->head_xpos = ctx->tail_xpos = SNAKE_GAME_WIDTH / 2; + ctx->head_ypos = ctx->tail_ypos = SNAKE_GAME_HEIGHT / 2; + ctx->next_dir = SNAKE_DIR_RIGHT; + ctx->inhibit_tail_step = ctx->occupied_cells = 4; + --ctx->occupied_cells; + put_cell_at_(ctx, ctx->tail_xpos, ctx->tail_ypos, SNAKE_CELL_SRIGHT); + for (i = 0; i < 4; i++) { + new_food_pos_(ctx, rand); + ++ctx->occupied_cells; + } +} + +void snake_redir(SnakeContext *ctx, SnakeDirection dir) +{ + SnakeCell ct = snake_cell_at(ctx, ctx->head_xpos, ctx->head_ypos); + if ((dir == SNAKE_DIR_RIGHT && ct != SNAKE_CELL_SLEFT) || + (dir == SNAKE_DIR_UP && ct != SNAKE_CELL_SDOWN) || + (dir == SNAKE_DIR_LEFT && ct != SNAKE_CELL_SRIGHT) || + (dir == SNAKE_DIR_DOWN && ct != SNAKE_CELL_SUP)) + ctx->next_dir = dir; +} + +static void wrap_around_(char *val, char max) +{ + if (*val < 0) + *val = max - 1; + if (*val > max - 1) + *val = 0; +} + +void snake_step(SnakeContext *ctx, RandFunc rand) +{ + const SnakeCell dir_as_cell = (SnakeCell)(ctx->next_dir + 1); + SnakeCell ct; + char prev_xpos; + char prev_ypos; + /* Move tail forward */ + if (--ctx->inhibit_tail_step == 0) { + ++ctx->inhibit_tail_step; + ct = snake_cell_at(ctx, ctx->tail_xpos, ctx->tail_ypos); + put_cell_at_(ctx, ctx->tail_xpos, ctx->tail_ypos, SNAKE_CELL_NOTHING); + switch (ct) { + case SNAKE_CELL_SRIGHT: + ctx->tail_xpos++; + break; + case SNAKE_CELL_SUP: + ctx->tail_ypos--; + break; + case SNAKE_CELL_SLEFT: + ctx->tail_xpos--; + break; + case SNAKE_CELL_SDOWN: + ctx->tail_ypos++; + break; + default: + break; + } + wrap_around_(&ctx->tail_xpos, SNAKE_GAME_WIDTH); + wrap_around_(&ctx->tail_ypos, SNAKE_GAME_HEIGHT); + } + /* Move head forward */ + prev_xpos = ctx->head_xpos; + prev_ypos = ctx->head_ypos; + switch (ctx->next_dir) { + case SNAKE_DIR_RIGHT: + ++ctx->head_xpos; + break; + case SNAKE_DIR_UP: + --ctx->head_ypos; + break; + case SNAKE_DIR_LEFT: + --ctx->head_xpos; + break; + case SNAKE_DIR_DOWN: + ++ctx->head_ypos; + break; + } + wrap_around_(&ctx->head_xpos, SNAKE_GAME_WIDTH); + wrap_around_(&ctx->head_ypos, SNAKE_GAME_HEIGHT); + /* Collisions */ + ct = snake_cell_at(ctx, ctx->head_xpos, ctx->head_ypos); + if (ct != SNAKE_CELL_NOTHING && ct != SNAKE_CELL_FOOD) { + snake_initialize(ctx, rand); + return; + } + put_cell_at_(ctx, prev_xpos, prev_ypos, dir_as_cell); + put_cell_at_(ctx, ctx->head_xpos, ctx->head_ypos, dir_as_cell); + if (ct == SNAKE_CELL_FOOD) { + if (are_cells_full_(ctx)) { + snake_initialize(ctx, rand); + return; + } + new_food_pos_(ctx, rand); + ++ctx->inhibit_tail_step; + ++ctx->occupied_cells; + } +} + +SnakeCell snake_cell_at(const SnakeContext *ctx, char x, char y) +{ + const int shift = SHIFT(x, y); + unsigned short range; + memcpy(&range, ctx->cells + (shift / CHAR_BIT), sizeof(range)); + return (SnakeCell)((range >> (shift % CHAR_BIT)) & THREE_BITS); +} diff --git a/examples/game/01-snake/snake.h b/examples/game/01-snake/snake.h new file mode 100644 index 0000000000000..71b395dcfdb33 --- /dev/null +++ b/examples/game/01-snake/snake.h @@ -0,0 +1,51 @@ +/* + * Interface definition of the Snake game. + * + * This code is public domain. Feel free to use it for any purpose! + */ +#ifndef SNAKE_H +#define SNAKE_H +#define SNAKE_GAME_WIDTH 24U +#define SNAKE_GAME_HEIGHT 18U +#define SNAKE_MATRIX_SIZE (SNAKE_GAME_WIDTH * SNAKE_GAME_HEIGHT) + +typedef enum +{ + SNAKE_CELL_NOTHING = 0U, + SNAKE_CELL_SRIGHT = 1U, + SNAKE_CELL_SUP = 2U, + SNAKE_CELL_SLEFT = 3U, + SNAKE_CELL_SDOWN = 4U, + SNAKE_CELL_FOOD = 5U +} SnakeCell; + +#define SNAKE_CELL_MAX_BITS 3U /* floor(log2(SNAKE_CELL_FOOD)) + 1 */ + +typedef enum +{ + SNAKE_DIR_RIGHT, + SNAKE_DIR_UP, + SNAKE_DIR_LEFT, + SNAKE_DIR_DOWN +} SnakeDirection; + +typedef struct +{ + unsigned char cells[(SNAKE_MATRIX_SIZE * SNAKE_CELL_MAX_BITS) / 8U]; + char head_xpos; + char head_ypos; + char tail_xpos; + char tail_ypos; + char next_dir; + char inhibit_tail_step; + unsigned occupied_cells; +} SnakeContext; + +typedef int (*RandFunc)(int n); + +void snake_initialize(SnakeContext *ctx, RandFunc rand); +void snake_redir(SnakeContext *ctx, SnakeDirection dir); +void snake_step(SnakeContext *ctx, RandFunc rand); +SnakeCell snake_cell_at(const SnakeContext *ctx, char x, char y); + +#endif /* SNAKE_H */ From bc8b768b9a3cd7830d78af1ede49fac8dfc1971e Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 30 Jul 2024 13:39:35 -0400 Subject: [PATCH 075/253] examples/snake: Fix up build. --- examples/CMakeLists.txt | 2 +- examples/game/01-snake/snake.c | 4 ++-- examples/game/01-snake/snake.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 50364cc90ab05..298596feda716 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -186,7 +186,7 @@ add_sdl_example_executable(renderer-primitives SOURCES renderer/02-primitives/re add_sdl_example_executable(audio-simple-playback SOURCES audio/01-simple-playback/simple-playback.c) add_sdl_example_executable(audio-simple-playback-callback SOURCES audio/02-simple-playback-callback/simple-playback-callback.c) add_sdl_example_executable(audio-load-wav SOURCES audio/03-load-wav/load-wav.c DATAFILES ${CMAKE_CURRENT_SOURCE_DIR}/../test/sample.wav) -add_sdl_example_executable(snake SOURCES game/01-snake/main.c game/01-snake/snake.c) +add_sdl_example_executable(game-snake SOURCES game/01-snake/main.c game/01-snake/snake.c) if(PSP) diff --git a/examples/game/01-snake/snake.c b/examples/game/01-snake/snake.c index 1f5a9c61fe9f7..294edff1699c7 100644 --- a/examples/game/01-snake/snake.c +++ b/examples/game/01-snake/snake.c @@ -34,8 +34,8 @@ static void new_food_pos_(SnakeContext *ctx, RandFunc rand) char x; char y; for (;;) { - x = rand(SNAKE_GAME_WIDTH); - y = rand(SNAKE_GAME_HEIGHT); + x = (char) rand(SNAKE_GAME_WIDTH); + y = (char) rand(SNAKE_GAME_HEIGHT); if (snake_cell_at(ctx, x, y) == SNAKE_CELL_NOTHING) { put_cell_at_(ctx, x, y, SNAKE_CELL_FOOD); break; diff --git a/examples/game/01-snake/snake.h b/examples/game/01-snake/snake.h index 71b395dcfdb33..16566b42e0c6c 100644 --- a/examples/game/01-snake/snake.h +++ b/examples/game/01-snake/snake.h @@ -41,7 +41,7 @@ typedef struct unsigned occupied_cells; } SnakeContext; -typedef int (*RandFunc)(int n); +typedef Sint32 SDLCALL (*RandFunc)(Sint32 n); void snake_initialize(SnakeContext *ctx, RandFunc rand); void snake_redir(SnakeContext *ctx, SnakeDirection dir); From 883576beb858ccc2a1721c6f788ff43c4f39853e Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 30 Jul 2024 13:40:09 -0400 Subject: [PATCH 076/253] examples: Improve source code output when there are multiple files. --- build-scripts/build-web-examples.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/build-scripts/build-web-examples.pl b/build-scripts/build-web-examples.pl index 516fe853ea2d9..7b07f999aa1f8 100755 --- a/build-scripts/build-web-examples.pl +++ b/build-scripts/build-web-examples.pl @@ -80,12 +80,13 @@ sub handle_example_dir { opendir(my $dh, "$examples_dir/$category/$example") or die("Couldn't opendir '$examples_dir/$category/$example': $!\n"); my $spc = ''; while (readdir($dh)) { - next if not /\.c\Z/; # only care about .c files. my $path = "$examples_dir/$category/$example/$_"; next if not -f $path; # only care about files. - push @files, $path; - $files_str .= "$spc$path"; - $spc = ' '; + push @files, $path if /\.[ch]\Z/; # add .c and .h files to source code. + if (/\.c\Z/) { # only care about .c files for compiling. + $files_str .= "$spc$path"; + $spc = ' '; + } } closedir($dh); @@ -124,7 +125,7 @@ sub handle_example_dir { my $pid = open2(my $child_out, my $child_in, $highlight_cmd); my $htmlified_source_code = ''; - foreach (@files) { + foreach (sort(@files)) { my $path = $_; open my $srccode, '<', $path or die("Couldn't open '$path': $!\n"); my $fname = "$path"; @@ -133,6 +134,7 @@ sub handle_example_dir { while (<$srccode>) { print $child_in $_; } + print $child_in "\n\n\n"; close($srccode); } From 3b5c3d6cc89076d43eaa4ed38e5f0b4f3527040f Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 30 Jul 2024 13:43:03 -0400 Subject: [PATCH 077/253] examples/snake: Actually fixed build this time. --- examples/game/01-snake/snake.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/game/01-snake/snake.h b/examples/game/01-snake/snake.h index 16566b42e0c6c..5ca93fab4cd83 100644 --- a/examples/game/01-snake/snake.h +++ b/examples/game/01-snake/snake.h @@ -5,6 +5,9 @@ */ #ifndef SNAKE_H #define SNAKE_H + +#include + #define SNAKE_GAME_WIDTH 24U #define SNAKE_GAME_HEIGHT 18U #define SNAKE_MATRIX_SIZE (SNAKE_GAME_WIDTH * SNAKE_GAME_HEIGHT) From 6aca7280565287ecdcf22598e15f850c0046ff93 Mon Sep 17 00:00:00 2001 From: Semphris Date: Tue, 30 Jul 2024 13:24:49 -0400 Subject: [PATCH 078/253] Fix examples description CSS --- examples/template.html | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/template.html b/examples/template.html index 268d0c4a20eb3..e8be678b31fe5 100644 --- a/examples/template.html +++ b/examples/template.html @@ -135,21 +135,20 @@ } #example-description { - background: black; color: white; - height: 100%; - align-items: center; + text-align: center; + position: relative; /* required for proper positioning */ } -
- @description@ -
+
+ @description@ +
From b24bfc2c98decf02e3f2edfbd39d7e89516a1cea Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Tue, 30 Jul 2024 21:15:04 +0300 Subject: [PATCH 079/253] fix RandFunc typedef --- examples/game/01-snake/snake.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/game/01-snake/snake.h b/examples/game/01-snake/snake.h index 5ca93fab4cd83..dd2d507c850d5 100644 --- a/examples/game/01-snake/snake.h +++ b/examples/game/01-snake/snake.h @@ -44,7 +44,7 @@ typedef struct unsigned occupied_cells; } SnakeContext; -typedef Sint32 SDLCALL (*RandFunc)(Sint32 n); +typedef Sint32 (SDLCALL *RandFunc)(Sint32 n); void snake_initialize(SnakeContext *ctx, RandFunc rand); void snake_redir(SnakeContext *ctx, SnakeDirection dir); From afabccd4d0dad50937b960a237633ce621a06ad5 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 30 Jul 2024 15:37:46 -0400 Subject: [PATCH 080/253] examples: Split up description text by line breaks. --- build-scripts/build-web-examples.pl | 7 +++---- examples/game/01-snake/README.txt | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 examples/game/01-snake/README.txt diff --git a/build-scripts/build-web-examples.pl b/build-scripts/build-web-examples.pl index 7b07f999aa1f8..c11589e73a398 100755 --- a/build-scripts/build-web-examples.pl +++ b/build-scripts/build-web-examples.pl @@ -106,12 +106,11 @@ sub handle_example_dir { my $description = ''; if (open(my $readmetxth, '<', "$examples_dir/$category/$example/README.txt")) { - my $spc = ''; while (<$readmetxth>) { chomp; - s/\"/\\"/g; - $description .= "$spc$_"; - $spc = ' '; + s/\A\s+//; + s/\s+\Z//; + $description .= "$_
"; } close($readmetxth); } diff --git a/examples/game/01-snake/README.txt b/examples/game/01-snake/README.txt new file mode 100644 index 0000000000000..1cf97846ac7b9 --- /dev/null +++ b/examples/game/01-snake/README.txt @@ -0,0 +1 @@ +A complete game of Snake, written in SDL. From 1ef3263ad491c8f723805c2d1b0d016c524b625c Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 30 Jul 2024 13:58:38 +0200 Subject: [PATCH 081/253] ci: only upload artifacts in libsdl-org GitHub organization --- .github/workflows/build.yml | 1 + .github/workflows/create-test-plan.py | 37 +++++++++++++++------------ .github/workflows/generic.yml | 16 ++++++------ 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d436ee753848..5a33d55adfaa0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,7 @@ jobs: --github-variable-prefix platforms \ --github-ci \ --verbose \ + ${{ github.repository_owner != 'libsdl-org' && '--no-artifact' }} \ --commit-message-file /tmp/commit_message.txt level1: needs: [controller] diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py index 2501a97fc9c66..d0f877aacb460 100755 --- a/.github/workflows/create-test-plan.py +++ b/.github/workflows/create-test-plan.py @@ -198,13 +198,14 @@ class JobDetails: cpactions_install_cmd: str = "" setup_vita_gles_type: str = "" - def to_workflow(self) -> dict[str, str|bool]: + def to_workflow(self, enable_artifacts) -> dict[str, str|bool]: data = { "name": self.name, "os": self.os, "container": self.container if self.container else "", "platform": self.platform, "artifact": self.artifact, + "enable-artifacts": enable_artifacts, "shell": self.shell, "msys2-msystem": self.msys2_msystem, "msys2-env": self.msys2_env, @@ -504,7 +505,7 @@ def spec_to_job(spec: JobSpec) -> JobDetails: "-DSDL_ARMSIMD=ON", )) # Fix vita.toolchain.cmake (https://github.com/vitasdk/vita-toolchain/pull/253) - job.source_cmd = "sed -i -E 's/set\( PKG_CONFIG_EXECUTABLE \"\$\{VITASDK}\/bin\/arm-vita-eabi-pkg-config\" )/set( PKG_CONFIG_EXECUTABLE \"${VITASDK}\/bin\/arm-vita-eabi-pkg-config\" CACHE PATH \"Path of pkg-config executable\" )/' ${VITASDK}/share/vita.toolchain.cmake" + job.source_cmd = r"""sed -i -E "s#set\\( PKG_CONFIG_EXECUTABLE \"\\$\\{VITASDK}/bin/arm-vita-eabi-pkg-config\" \\)#set\\( PKG_CONFIG_EXECUTABLE \"${VITASDK}/bin/arm-vita-eabi-pkg-config\" CACHE PATH \"Path of pkg-config executable\" \\)#" ${VITASDK}/share/vita.toolchain.cmake""" job.clang_tidy = False job.run_tests = False job.shared = False @@ -613,16 +614,13 @@ def tf(b): return job -def specs_to_plaform(specs: tuple[JobSpec, ...]) -> list[dict[str, str|bool]]: - result = [] - for spec in specs: - logger.info("spec=%r", spec) - job = spec_to_job(spec) - logger.info("job=%r", job) - platform = job.to_workflow() - result.append(platform) - logger.info("platform=%r", platform) - return result +def spec_to_platform(spec: JobSpec, enable_artifacts: bool) -> dict[str, str|bool]: + logger.info("spec=%r", spec) + job = spec_to_job(spec) + logger.info("job=%r", job) + platform = job.to_workflow(enable_artifacts=enable_artifacts) + logger.info("platform=%r", platform) + return platform def main(): @@ -631,6 +629,7 @@ def main(): parser.add_argument("--github-ci", action="store_true") parser.add_argument("--verbose", action="store_true") parser.add_argument("--commit-message-file") + parser.add_argument("--no-artifact", dest="enable_artifacts", action="store_false") args = parser.parse_args() logging.basicConfig(level=logging.INFO if args.verbose else logging.WARNING) @@ -651,6 +650,9 @@ def main(): for m in re.finditer(r"\[sdl-ci-filter (.*)]", commit_message, flags=re.M): filters.append(m.group(1).strip(" \t\n\r\t'\"")) + if re.search(r"\[sdl-ci-artifacts?]", commit_message, flags=re.M): + args.enable_artifacts = True + if not filters: filters.append("*") @@ -658,13 +660,15 @@ def main(): all_level_platforms = {} + all_platforms = {k: spec_to_platform(spec, enable_artifacts=args.enable_artifacts) for k, spec in JOB_SPECS.items()} + for level_i, level_keys in enumerate(all_level_keys, 1): level_key = f"level{level_i}" logger.info("Level %d: keys=%r", level_i, level_keys) assert all(k in remaining_keys for k in level_keys) - level_specs = tuple(JOB_SPECS[key] for key in level_keys) + level_platforms = tuple(all_platforms[key] for key in level_keys) remaining_keys.difference_update(level_keys) - all_level_platforms[level_key] = specs_to_plaform(level_specs) + all_level_platforms[level_key] = level_platforms logger.info("=" * 80) logger.info("Keys before filter: %r", remaining_keys) @@ -677,9 +681,8 @@ def main(): remaining_keys = filtered_remaining_keys - logger.info("Remaining:") - remaining_specs = tuple(JOB_SPECS[key] for key in remaining_keys) - all_level_platforms["others"] = specs_to_plaform(remaining_specs) + logger.info("Remaining: %r", remaining_keys) + all_level_platforms["others"] = tuple(all_platforms[key] for key in remaining_keys) if args.github_ci: for level, platforms in all_level_platforms.items(): diff --git a/.github/workflows/generic.yml b/.github/workflows/generic.yml index 58d7e8ef1da76..0deb5f34c9805 100644 --- a/.github/workflows/generic.yml +++ b/.github/workflows/generic.yml @@ -273,13 +273,6 @@ jobs: rm -rf build/dist/_CPack_Packages rm -rf build/CMakeFiles rm -rf build/docs - - name: "Upload Android test apk's" - uses: actions/upload-artifact@v4 - if: ${{ always() && matrix.platform.artifact != '' && steps.apks.outcome == 'success' }} - with: - if-no-files-found: error - name: '${{ matrix.platform.artifact }}-apks' - path: build/test/*.apk - name: Add msbuild to PATH id: setup-msbuild if: ${{ matrix.platform.msvc-project != '' }} @@ -322,7 +315,7 @@ jobs: xcodebuild -project Xcode/SDL/SDL.xcodeproj -target SDL3 -configuration Release -sdk ${{ matrix.platform.xcode-sdk }} clean build - name: 'Upload binary package' uses: actions/upload-artifact@v4 - if: ${{ always() && matrix.platform.artifact != '' && (steps.package.outcome == 'success' || steps.cpactions.outcome == 'success') }} + if: ${{ always() && matrix.platform.artifact != '' && (steps.package.outcome == 'success' || steps.cpactions.outcome == 'success') && (matrix.platform.enable-artifacts || steps.tests.outcome == 'failure') }} with: if-no-files-found: error name: '${{ matrix.platform.artifact }}' @@ -334,3 +327,10 @@ jobs: if-no-files-found: ignore name: '${{ matrix.platform.artifact }}-minidumps' path: build/**/*.dmp + - name: "Upload Android test apk's" + uses: actions/upload-artifact@v4 + if: ${{ matrix.platform.enable-artifacts && always() && matrix.platform.artifact != '' && steps.apks.outcome == 'success' }} + with: + if-no-files-found: error + name: '${{ matrix.platform.artifact }}-apks' + path: build/test/*.apk \ No newline at end of file From bc8f4a1d0bea98bd51d584d73ccc4f9f740bd8e4 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 30 Jul 2024 22:55:36 +0200 Subject: [PATCH 082/253] ci: fix artifacts on libsdl-org repo --- .github/workflows/build.yml | 2 +- .github/workflows/create-test-plan.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5a33d55adfaa0..09652e024817c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,7 @@ jobs: --github-variable-prefix platforms \ --github-ci \ --verbose \ - ${{ github.repository_owner != 'libsdl-org' && '--no-artifact' }} \ + ${{ (github.repository_owner != 'libsdl-org' && '--no-artifact') || '' }} \ --commit-message-file /tmp/commit_message.txt level1: needs: [controller] diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py index d0f877aacb460..c51df834971e8 100755 --- a/.github/workflows/create-test-plan.py +++ b/.github/workflows/create-test-plan.py @@ -198,7 +198,7 @@ class JobDetails: cpactions_install_cmd: str = "" setup_vita_gles_type: str = "" - def to_workflow(self, enable_artifacts) -> dict[str, str|bool]: + def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]: data = { "name": self.name, "os": self.os, From 4c00433b69986f04832fa0356c0fc4ee8f220ca1 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 27 Jul 2024 20:02:43 +0200 Subject: [PATCH 083/253] SDL_test: format tracked allocation names during report generation --- src/test/SDL_test_memory.c | 66 ++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/src/test/SDL_test_memory.c b/src/test/SDL_test_memory.c index 2d655a18da213..2cc610c8c5049 100644 --- a/src/test/SDL_test_memory.c +++ b/src/test/SDL_test_memory.c @@ -56,7 +56,6 @@ typedef struct SDL_tracked_allocation void *mem; size_t size; Uint64 stack[MAXIMUM_TRACKED_STACK_DEPTH]; - char stack_names[MAXIMUM_TRACKED_STACK_DEPTH][256]; struct SDL_tracked_allocation *next; } SDL_tracked_allocation; @@ -130,15 +129,11 @@ static void SDL_TrackAllocation(void *mem, size_t size) stack_index = 0; while (unw_step(&cursor) > 0) { - unw_word_t offset, pc; - char sym[236]; + unw_word_t pc; unw_get_reg(&cursor, UNW_REG_IP, &pc); entry->stack[stack_index] = pc; - if (unw_get_proc_name(&cursor, sym, sizeof(sym), &offset) == 0) { - SDL_snprintf(entry->stack_names[stack_index], sizeof(entry->stack_names[stack_index]), "%s+0x%llx", sym, (unsigned long long)offset); - } ++stack_index; if (stack_index == SDL_arraysize(entry->stack)) { @@ -156,28 +151,7 @@ static void SDL_TrackAllocation(void *mem, size_t size) count = SDL_min(count, MAXIMUM_TRACKED_STACK_DEPTH); for (i = 0; i < count; i++) { - char symbol_buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)]; - PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)symbol_buffer; - DWORD64 dwDisplacement = 0; - DWORD lineColumn = 0; - pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO); - pSymbol->MaxNameLen = MAX_SYM_NAME; - IMAGEHLP_LINE64 line; - line.SizeOfStruct = sizeof(line); - entry->stack[i] = (Uint64)(uintptr_t)frames[i]; - if (dyn_dbghelp.module) { - if (!dyn_dbghelp.pSymFromAddr(GetCurrentProcess(), (DWORD64)(uintptr_t)frames[i], &dwDisplacement, pSymbol)) { - SDL_strlcpy(pSymbol->Name, "???", MAX_SYM_NAME); - dwDisplacement = 0; - } - if (!dyn_dbghelp.pSymGetLineFromAddr64(GetCurrentProcess(), (DWORD64)(uintptr_t)frames[i], &lineColumn, &line)) { - line.FileName = ""; - line.LineNumber = 0; - } - - SDL_snprintf(entry->stack_names[i], sizeof(entry->stack_names[i]), "%s+0x%I64x %s:%u", pSymbol->Name, dwDisplacement, line.FileName, (Uint32)line.LineNumber); - } } } #endif /* HAVE_LIBUNWIND_H */ @@ -369,10 +343,46 @@ void SDLTest_LogAllocations(void) ADD_LINE(); /* Start at stack index 1 to skip our tracking functions */ for (stack_index = 1; stack_index < SDL_arraysize(entry->stack); ++stack_index) { + char stack_entry_description[256] = "???"; + if (!entry->stack[stack_index]) { break; } - (void)SDL_snprintf(line, sizeof(line), "\t0x%" SDL_PRIx64 ": %s\n", entry->stack[stack_index], entry->stack_names[stack_index]); +#ifdef HAVE_LIBUNWIND_H + { +#ifdef unw_get_proc_name_by_ip + unw_word_t offset = 0; + char name[256] = "???"; + unw_get_proc_name_by_ip(unw_local_addr_space, entry->stack[stack_index], name, sizeof(name), &offset, NULL); + (void)SDL_snprintf(stack_entry_description, sizeof(stack_entry_description), "%s+0x%llx", name, (long long unsigned int)offset); +#endif + } +#elif defined(SDL_PLATFORM_WIN32) + { + DWORD64 dwDisplacement = 0; + char symbol_buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)]; + PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)symbol_buffer; + DWORD lineColumn = 0; + pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO); + pSymbol->MaxNameLen = MAX_SYM_NAME; + IMAGEHLP_LINE64 dbg_line; + dbg_line.SizeOfStruct = sizeof(dbg_line); + + if (dyn_dbghelp.module) { + if (!dyn_dbghelp.pSymFromAddr(GetCurrentProcess(), entry->stack[stack_index], &dwDisplacement, pSymbol)) { + SDL_strlcpy(pSymbol->Name, "???", MAX_SYM_NAME); + dwDisplacement = 0; + } + if (!dyn_dbghelp.pSymGetLineFromAddr64(GetCurrentProcess(), (DWORD64)entry->stack[stack_index], &lineColumn, &dbg_line)) { + dbg_line.FileName = ""; + dbg_line.LineNumber = 0; + } + } + SDL_snprintf(stack_entry_description, sizeof(stack_entry_description), "%s+0x%I64x %s:%u", pSymbol->Name, dwDisplacement, dbg_line.FileName, (Uint32)dbg_line.LineNumber); + } +#endif + (void)SDL_snprintf(line, sizeof(line), "\t0x%" SDL_PRIx64 ": %s\n", entry->stack[stack_index], stack_entry_description); + ADD_LINE(); } total_allocated += entry->size; From c7a18765367cc4702817fb5123a7a860458aa94c Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 30 Jul 2024 12:28:08 +0200 Subject: [PATCH 084/253] SDL_test: use mutex based on SDL_AtomicInt in memory tracking SDL_Mutex or SDL_SpinLock cannot be used as these use SDL_malloc internally. ff --- src/test/SDL_test_memory.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/SDL_test_memory.c b/src/test/SDL_test_memory.c index 2cc610c8c5049..ac8e823325efe 100644 --- a/src/test/SDL_test_memory.c +++ b/src/test/SDL_test_memory.c @@ -67,6 +67,16 @@ static SDL_free_func SDL_free_orig = NULL; static int s_previous_allocations = 0; static SDL_tracked_allocation *s_tracked_allocations[256]; static SDL_bool s_randfill_allocations = SDL_FALSE; +static SDL_AtomicInt s_lock; + +#define LOCK_ALLOCATOR() \ + do { \ + if (SDL_AtomicCompareAndSwap(&s_lock, 0, 1)) { \ + break; \ + } \ + SDL_CPUPauseInstruction(); \ + } while (SDL_TRUE) +#define UNLOCK_ALLOCATOR() do { SDL_AtomicSet(&s_lock, 0); } while (0) static unsigned int get_allocation_bucket(void *mem) { @@ -80,12 +90,15 @@ static unsigned int get_allocation_bucket(void *mem) static SDL_tracked_allocation* SDL_GetTrackedAllocation(void *mem) { SDL_tracked_allocation *entry; + LOCK_ALLOCATOR(); int index = get_allocation_bucket(mem); for (entry = s_tracked_allocations[index]; entry; entry = entry->next) { if (mem == entry->mem) { + UNLOCK_ALLOCATOR(); return entry; } } + UNLOCK_ALLOCATOR(); return NULL; } @@ -113,6 +126,7 @@ static void SDL_TrackAllocation(void *mem, size_t size) if (!entry) { return; } + LOCK_ALLOCATOR(); entry->mem = mem; entry->size = size; @@ -158,6 +172,7 @@ static void SDL_TrackAllocation(void *mem, size_t size) entry->next = s_tracked_allocations[index]; s_tracked_allocations[index] = entry; + UNLOCK_ALLOCATOR(); } static void SDL_UntrackAllocation(void *mem) @@ -165,6 +180,7 @@ static void SDL_UntrackAllocation(void *mem) SDL_tracked_allocation *entry, *prev; int index = get_allocation_bucket(mem); + LOCK_ALLOCATOR(); prev = NULL; for (entry = s_tracked_allocations[index]; entry; entry = entry->next) { if (mem == entry->mem) { @@ -174,10 +190,12 @@ static void SDL_UntrackAllocation(void *mem) s_tracked_allocations[index] = entry->next; } SDL_free_orig(entry); + UNLOCK_ALLOCATOR(); return; } prev = entry; } + UNLOCK_ALLOCATOR(); } static void rand_fill_memory(void* ptr, size_t start, size_t end) From b68ac011e0bce42b2c5142e200c1441f846b4faa Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sun, 28 Jul 2024 17:19:49 +0200 Subject: [PATCH 085/253] ctest: fail if there are outstanding allocations --- .github/workflows/generic.yml | 1 + test/CMakeLists.txt | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generic.yml b/.github/workflows/generic.yml index 0deb5f34c9805..9a05ff16d2fd1 100644 --- a/.github/workflows/generic.yml +++ b/.github/workflows/generic.yml @@ -138,6 +138,7 @@ jobs: -DSDL_WERROR=${{ matrix.platform.werror }} \ -DSDL_EXAMPLES=${{ matrix.platform.build-tests }} \ -DSDL_TESTS=${{ matrix.platform.build-tests }} \ + -DSDLTEST_TRACKMEM=ON \ -DSDL_INSTALL_TESTS=${{ matrix.platform.build-tests }} \ -DSDL_CLANG_TIDY=${{ matrix.platform.clang-tidy }} \ -DSDL_DISABLE_INSTALL_DOCS=OFF \ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 713b45b3e114e..70efce63f1154 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -38,6 +38,8 @@ target_link_libraries(sdltests_utils PRIVATE SDL3::Headers) file(GLOB RESOURCE_FILES *.bmp *.wav *.hex moose.dat utf8.txt) +option(SDLTEST_TRACKMEM "Run tests with --trackmem" OFF) + if(WIN32 AND NOT WINDOWS_STORE) option(SDLTEST_PROCDUMP "Run tests using sdlprocdump for minidump generation" OFF) add_executable(sdlprocdump win32/sdlprocdump.c) @@ -97,7 +99,7 @@ if(WINDOWS_STORE) endif() macro(add_sdl_test_executable TARGET) - cmake_parse_arguments(AST "BUILD_DEPENDENT;NONINTERACTIVE;NEEDS_RESOURCES;TESTUTILS;NO_C90;MAIN_CALLBACKS" "" "NONINTERACTIVE_TIMEOUT;NONINTERACTIVE_ARGS;SOURCES" ${ARGN}) + cmake_parse_arguments(AST "BUILD_DEPENDENT;NONINTERACTIVE;NEEDS_RESOURCES;TESTUTILS;NO_C90;MAIN_CALLBACKS;NOTRACKMEM" "" "NONINTERACTIVE_TIMEOUT;NONINTERACTIVE_ARGS;SOURCES" ${ARGN}) if(AST_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown argument(s): ${AST_UNPARSED_ARGUMENTS}") endif() @@ -151,6 +153,7 @@ macro(add_sdl_test_executable TARGET) endif() list(APPEND SDL_TEST_EXECUTABLES ${TARGET}) + set_property(TARGET ${TARGET} PROPERTY SDL_NOTRACKMEM ${AST_NOTRACKMEM}) if(AST_NONINTERACTIVE) set_property(TARGET ${TARGET} PROPERTY SDL_NONINTERACTIVE 1) endif() @@ -409,7 +412,7 @@ add_sdl_test_executable(testspritesurface SOURCES testspritesurface.c ${icon_bmp add_sdl_test_executable(teststreaming NEEDS_RESOURCES TESTUTILS SOURCES teststreaming.c) add_sdl_test_executable(testtimer NONINTERACTIVE NONINTERACTIVE_ARGS --no-interactive NONINTERACTIVE_TIMEOUT 60 SOURCES testtimer.c) add_sdl_test_executable(testurl SOURCES testurl.c) -add_sdl_test_executable(testver NONINTERACTIVE SOURCES testver.c) +add_sdl_test_executable(testver NONINTERACTIVE NOTRACKMEM SOURCES testver.c) add_sdl_test_executable(testcamera MAIN_CALLBACKS SOURCES testcamera.c) add_sdl_test_executable(testviewport NEEDS_RESOURCES TESTUTILS SOURCES testviewport.c) add_sdl_test_executable(testwm SOURCES testwm.c) @@ -610,11 +613,20 @@ function(add_sdl_test TEST TARGET) if(noninteractive_arguments) list(APPEND command ${noninteractive_arguments}) endif() + if(SDLTEST_TRACKMEM) + get_property(notrackmem TARGET ${TARGET} PROPERTY SDL_NOTRACKMEM) + if(NOT notrackmem) + list(APPEND command --trackmem) + endif() + endif() add_test( NAME ${TEST} COMMAND ${command} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) + if(NOT notrackmem) + set_property(TEST ${TEST} PROPERTY FAIL_REGULAR_EXPRESSION "Total: [0-9]+\\.[0-9]+ Kb in [1-9][0-9]* allocations") + endif() set_tests_properties(${TEST} PROPERTIES ENVIRONMENT "${TESTS_ENVIRONMENT}") get_property(noninteractive_timeout TARGET ${TARGET} PROPERTY SDL_NONINTERACTIVE_TIMEOUT) if(NOT noninteractive_timeout) From 89de8e2110d81bf708ef02c46c52601f116e213e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 30 Jul 2024 17:29:21 -0700 Subject: [PATCH 086/253] Fixed infinite loop searching for matching video modes (thanks @Synt4xErr0r4!) --- src/video/SDL_video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 650fae22362fd..484f84f13ef0f 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1141,7 +1141,7 @@ static const SDL_DisplayMode *SDL_GetFullscreenModeMatch(const SDL_DisplayMode * /* Search for an exact match */ if (!mode) { - for (int i = 0; display->num_fullscreen_modes; ++i) { + for (int i = 0; i < display->num_fullscreen_modes; ++i) { if (SDL_memcmp(&fullscreen_mode, &display->fullscreen_modes[i], sizeof(fullscreen_mode)) == 0) { mode = &display->fullscreen_modes[i]; break; @@ -1151,7 +1151,7 @@ static const SDL_DisplayMode *SDL_GetFullscreenModeMatch(const SDL_DisplayMode * /* Search for a mode with the same characteristics */ if (!mode) { - for (int i = 0; display->num_fullscreen_modes; ++i) { + for (int i = 0; i < display->num_fullscreen_modes; ++i) { if (cmpmodes(&fullscreen_mode, &display->fullscreen_modes[i]) == 0) { mode = &display->fullscreen_modes[i]; break; From 80f5f0b1fbb6543ffddc0e95a8c69834181ff4b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Ky=C3=B6stil=C3=A4?= Date: Wed, 31 Jul 2024 12:28:13 +1000 Subject: [PATCH 087/253] android: Fix activity pause/resume with external graphics context This patch fixes two issues with pausing and resuming the Android activity when an external graphics context[1] is used: 1. When pausing, don't wait for the EGL context to be backed up if a context wasn't created in the first place. 2. When resuming, don't recreate the EGL surface unless one was requested by the user when originally creating the window. [1] SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN --- src/core/android/SDL_android.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index cc096924f75fb..c0c73bcf6ceb4 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -1226,7 +1226,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j SDL_LockMutex(Android_ActivityMutex); #ifdef SDL_VIDEO_OPENGL_EGL - if (Android_Window) { + if (Android_Window && (Android_Window->flags & SDL_WINDOW_OPENGL)) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); SDL_WindowData *data = Android_Window->internal; @@ -1256,7 +1256,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)(JNIEnv *env, SDL_WindowData *data = Android_Window->internal; /* Wait for Main thread being paused and context un-activated to release 'egl_surface' */ - if (!data->backup_done) { + if ((Android_Window->flags & SDL_WINDOW_OPENGL) && !data->backup_done) { nb_attempt -= 1; if (nb_attempt == 0) { SDL_SetError("Try to release egl_surface with context probably still active"); From 364bbd545d8d42b56adbd6b0d833d4e90f49f0f8 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 26 May 2024 13:53:36 -0400 Subject: [PATCH 088/253] audio: SDL_ClosestAudioFormats now favors float32 and native byte order. Fixes #9581. --- src/audio/SDL_audio.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index d97c9d0e77b81..505a8a22570b2 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -2138,18 +2138,30 @@ int SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream) return SDL_ResumeAudioDevice(devid); } +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define NATIVE(type) SDL_AUDIO_##type##LE +#define SWAPPED(type) SDL_AUDIO_##type##BE +#else +#define NATIVE(type) SDL_AUDIO_##type##BE +#define SWAPPED(type) SDL_AUDIO_##type##LE +#endif + #define NUM_FORMATS 8 +// always favor Float32 in native byte order, since we're probably going to convert to that for processing anyhow. static const SDL_AudioFormat format_list[NUM_FORMATS][NUM_FORMATS + 1] = { - { SDL_AUDIO_U8, SDL_AUDIO_S8, SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, 0 }, - { SDL_AUDIO_S8, SDL_AUDIO_U8, SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, 0 }, - { SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, - { SDL_AUDIO_S16BE, SDL_AUDIO_S16LE, SDL_AUDIO_S32BE, SDL_AUDIO_S32LE, SDL_AUDIO_F32BE, SDL_AUDIO_F32LE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, - { SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, - { SDL_AUDIO_S32BE, SDL_AUDIO_S32LE, SDL_AUDIO_F32BE, SDL_AUDIO_F32LE, SDL_AUDIO_S16BE, SDL_AUDIO_S16LE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, - { SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, - { SDL_AUDIO_F32BE, SDL_AUDIO_F32LE, SDL_AUDIO_S32BE, SDL_AUDIO_S32LE, SDL_AUDIO_S16BE, SDL_AUDIO_S16LE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, + { SDL_AUDIO_U8, NATIVE(F32), SWAPPED(F32), SDL_AUDIO_S8, NATIVE(S16), SWAPPED(S16), NATIVE(S32), SWAPPED(S32), 0 }, + { SDL_AUDIO_S8, NATIVE(F32), SWAPPED(F32), SDL_AUDIO_U8, NATIVE(S16), SWAPPED(S16), NATIVE(S32), SWAPPED(S32), 0 }, + { NATIVE(S16), NATIVE(F32), SWAPPED(F32), SWAPPED(S16), NATIVE(S32), SWAPPED(S32), SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, + { SWAPPED(S16), NATIVE(F32), SWAPPED(F32), NATIVE(S16), SWAPPED(S32), NATIVE(S32), SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, + { NATIVE(S32), NATIVE(F32), SWAPPED(F32), SWAPPED(S32), NATIVE(S16), SWAPPED(S16), SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, + { SWAPPED(S32), NATIVE(F32), SWAPPED(F32), NATIVE(S32), SWAPPED(S16), NATIVE(S16), SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, + { NATIVE(F32), SWAPPED(F32), NATIVE(S32), SWAPPED(S32), NATIVE(S16), SWAPPED(S16), SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, + { SWAPPED(F32), NATIVE(F32), SWAPPED(S32), NATIVE(S32), SWAPPED(S16), NATIVE(S16), SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, }; +#undef NATIVE +#undef SWAPPED + const SDL_AudioFormat *SDL_ClosestAudioFormats(SDL_AudioFormat format) { for (int i = 0; i < NUM_FORMATS; i++) { From c5a99f1515eaf36e786926b72a6f496ba5ead831 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 31 Jul 2024 16:36:47 -0700 Subject: [PATCH 089/253] Fixed detecting wrapping Windows message time It's possible to get message times out of order when processing the Windows message queue, so this passes those times through unchanged, while still detecting when the message tick wraps. --- src/video/windows/SDL_windowsevents.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index bdd19c8c2eaa8..fd41ab15bc8fe 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -124,17 +124,12 @@ static Uint64 timestamp_offset; static void WIN_SetMessageTick(DWORD tick) { - if (message_tick) { - if (tick < message_tick && timestamp_offset) { - /* The tick counter rolled over, bump our offset */ - timestamp_offset += SDL_MS_TO_NS(0x100000000LL); - } - } message_tick = tick; } static Uint64 WIN_GetEventTimestamp(void) { + const Uint64 TIMESTAMP_WRAP_OFFSET = SDL_MS_TO_NS(0x100000000LL); Uint64 timestamp, now; if (!SDL_processing_messages) { @@ -144,13 +139,20 @@ static Uint64 WIN_GetEventTimestamp(void) now = SDL_GetTicksNS(); timestamp = SDL_MS_TO_NS(message_tick); - + timestamp += timestamp_offset; if (!timestamp_offset) { + // Initializing timestamp offset + //SDL_Log("Initializing timestamp offset\n"); timestamp_offset = (now - timestamp); - } - timestamp += timestamp_offset; - - if (timestamp > now) { + timestamp = now; + } else if ((Sint64)(now - timestamp - TIMESTAMP_WRAP_OFFSET) >= 0) { + // The windows message tick wrapped + //SDL_Log("Adjusting timestamp offset for wrapping tick\n"); + timestamp_offset += TIMESTAMP_WRAP_OFFSET; + timestamp += TIMESTAMP_WRAP_OFFSET; + } else if (timestamp > now) { + // We got a newer timestamp, but it can't be newer than now, so adjust our offset + //SDL_Log("Adjusting timestamp offset, %.2f ms newer\n", (double)(timestamp - now) / SDL_NS_PER_MS); timestamp_offset -= (timestamp - now); timestamp = now; } From 55e9a8ca45b12064036e90738c6ef9be70e3072c Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Wed, 31 Jul 2024 20:18:57 -0400 Subject: [PATCH 090/253] d3d12: Import DirectX-Headers, use local d3d12.h in SDL_render. This avoids lots of build issues with the various D3D12 headers out there (MinGW, old Windows SDKs, etc) and also opens the door for WSL2 libd3d12.so support. Note that the build system has not been changed; technically _all_ platforms now have d3d12.h but we should only enable the backend when it's actually expected to work. --- src/render/direct3d12/SDL_render_d3d12.c | 13 +- src/render/direct3d12/SDL_shaders_d3d12.c | 12 +- src/video/directx/d3d12.h | 34938 ++++++++++++++++++++ src/video/directx/d3d12sdklayers.h | 4263 +++ 4 files changed, 39224 insertions(+), 2 deletions(-) create mode 100644 src/video/directx/d3d12.h create mode 100644 src/video/directx/d3d12sdklayers.h diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index 765e082da0892..06c5d0a8e1543 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -38,7 +38,18 @@ #define D3D12_TEXTURE_DATA_PITCH_ALIGNMENT 256 #endif #else -#include + +/* From the DirectX-Headers build system: + * "MinGW has RPC headers which define old versions, and complain if D3D + * headers are included before the RPC headers, since D3D headers were + * generated with new MIDL and "require" new RPC headers." + */ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#ifndef WINAPI_PARTITION_GAMES +#define WINAPI_PARTITION_GAMES 0 +#endif /* WINAPI_PARTITION_GAMES */ +#include "../../video/directx/d3d12.h" + #include #include #include diff --git a/src/render/direct3d12/SDL_shaders_d3d12.c b/src/render/direct3d12/SDL_shaders_d3d12.c index 913d975d9500c..bddd46e8e37ee 100644 --- a/src/render/direct3d12/SDL_shaders_d3d12.c +++ b/src/render/direct3d12/SDL_shaders_d3d12.c @@ -23,7 +23,17 @@ #if SDL_VIDEO_RENDER_D3D12 && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) #include "../../core/windows/SDL_windows.h" -#include + +/* From the DirectX-Headers build system: + * "MinGW has RPC headers which define old versions, and complain if D3D + * headers are included before the RPC headers, since D3D headers were + * generated with new MIDL and "require" new RPC headers." + */ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#ifndef WINAPI_PARTITION_GAMES +#define WINAPI_PARTITION_GAMES 0 +#endif /* WINAPI_PARTITION_GAMES */ +#include "../../video/directx/d3d12.h" #include "SDL_shaders_d3d12.h" diff --git a/src/video/directx/d3d12.h b/src/video/directx/d3d12.h new file mode 100644 index 0000000000000..684ef13d7b6bf --- /dev/null +++ b/src/video/directx/d3d12.h @@ -0,0 +1,34938 @@ +/*------------------------------------------------------------------------------------- + * + * Copyright (c) Microsoft Corporation + * Licensed under the MIT license + * + *-------------------------------------------------------------------------------------*/ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.01.0628 */ + + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 500 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCNDR_H_VERSION__ */ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3d12_h__ +#define __d3d12_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#ifndef DECLSPEC_XFGVIRT +#if defined(_CONTROL_FLOW_GUARD_XFG) +#define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func)) +#else +#define DECLSPEC_XFGVIRT(base, func) +#endif +#endif + +/* Forward Declarations */ + +#ifndef __ID3D12Object_FWD_DEFINED__ +#define __ID3D12Object_FWD_DEFINED__ +typedef interface ID3D12Object ID3D12Object; + +#endif /* __ID3D12Object_FWD_DEFINED__ */ + + +#ifndef __ID3D12DeviceChild_FWD_DEFINED__ +#define __ID3D12DeviceChild_FWD_DEFINED__ +typedef interface ID3D12DeviceChild ID3D12DeviceChild; + +#endif /* __ID3D12DeviceChild_FWD_DEFINED__ */ + + +#ifndef __ID3D12RootSignature_FWD_DEFINED__ +#define __ID3D12RootSignature_FWD_DEFINED__ +typedef interface ID3D12RootSignature ID3D12RootSignature; + +#endif /* __ID3D12RootSignature_FWD_DEFINED__ */ + + +#ifndef __ID3D12RootSignatureDeserializer_FWD_DEFINED__ +#define __ID3D12RootSignatureDeserializer_FWD_DEFINED__ +typedef interface ID3D12RootSignatureDeserializer ID3D12RootSignatureDeserializer; + +#endif /* __ID3D12RootSignatureDeserializer_FWD_DEFINED__ */ + + +#ifndef __ID3D12VersionedRootSignatureDeserializer_FWD_DEFINED__ +#define __ID3D12VersionedRootSignatureDeserializer_FWD_DEFINED__ +typedef interface ID3D12VersionedRootSignatureDeserializer ID3D12VersionedRootSignatureDeserializer; + +#endif /* __ID3D12VersionedRootSignatureDeserializer_FWD_DEFINED__ */ + + +#ifndef __ID3D12Pageable_FWD_DEFINED__ +#define __ID3D12Pageable_FWD_DEFINED__ +typedef interface ID3D12Pageable ID3D12Pageable; + +#endif /* __ID3D12Pageable_FWD_DEFINED__ */ + + +#ifndef __ID3D12Heap_FWD_DEFINED__ +#define __ID3D12Heap_FWD_DEFINED__ +typedef interface ID3D12Heap ID3D12Heap; + +#endif /* __ID3D12Heap_FWD_DEFINED__ */ + + +#ifndef __ID3D12Resource_FWD_DEFINED__ +#define __ID3D12Resource_FWD_DEFINED__ +typedef interface ID3D12Resource ID3D12Resource; + +#endif /* __ID3D12Resource_FWD_DEFINED__ */ + + +#ifndef __ID3D12CommandAllocator_FWD_DEFINED__ +#define __ID3D12CommandAllocator_FWD_DEFINED__ +typedef interface ID3D12CommandAllocator ID3D12CommandAllocator; + +#endif /* __ID3D12CommandAllocator_FWD_DEFINED__ */ + + +#ifndef __ID3D12Fence_FWD_DEFINED__ +#define __ID3D12Fence_FWD_DEFINED__ +typedef interface ID3D12Fence ID3D12Fence; + +#endif /* __ID3D12Fence_FWD_DEFINED__ */ + + +#ifndef __ID3D12Fence1_FWD_DEFINED__ +#define __ID3D12Fence1_FWD_DEFINED__ +typedef interface ID3D12Fence1 ID3D12Fence1; + +#endif /* __ID3D12Fence1_FWD_DEFINED__ */ + + +#ifndef __ID3D12PipelineState_FWD_DEFINED__ +#define __ID3D12PipelineState_FWD_DEFINED__ +typedef interface ID3D12PipelineState ID3D12PipelineState; + +#endif /* __ID3D12PipelineState_FWD_DEFINED__ */ + + +#ifndef __ID3D12DescriptorHeap_FWD_DEFINED__ +#define __ID3D12DescriptorHeap_FWD_DEFINED__ +typedef interface ID3D12DescriptorHeap ID3D12DescriptorHeap; + +#endif /* __ID3D12DescriptorHeap_FWD_DEFINED__ */ + + +#ifndef __ID3D12QueryHeap_FWD_DEFINED__ +#define __ID3D12QueryHeap_FWD_DEFINED__ +typedef interface ID3D12QueryHeap ID3D12QueryHeap; + +#endif /* __ID3D12QueryHeap_FWD_DEFINED__ */ + + +#ifndef __ID3D12CommandSignature_FWD_DEFINED__ +#define __ID3D12CommandSignature_FWD_DEFINED__ +typedef interface ID3D12CommandSignature ID3D12CommandSignature; + +#endif /* __ID3D12CommandSignature_FWD_DEFINED__ */ + + +#ifndef __ID3D12CommandList_FWD_DEFINED__ +#define __ID3D12CommandList_FWD_DEFINED__ +typedef interface ID3D12CommandList ID3D12CommandList; + +#endif /* __ID3D12CommandList_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList ID3D12GraphicsCommandList; + +#endif /* __ID3D12GraphicsCommandList_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList1_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList1_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList1 ID3D12GraphicsCommandList1; + +#endif /* __ID3D12GraphicsCommandList1_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList2_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList2_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList2 ID3D12GraphicsCommandList2; + +#endif /* __ID3D12GraphicsCommandList2_FWD_DEFINED__ */ + + +#ifndef __ID3D12CommandQueue_FWD_DEFINED__ +#define __ID3D12CommandQueue_FWD_DEFINED__ +typedef interface ID3D12CommandQueue ID3D12CommandQueue; + +#endif /* __ID3D12CommandQueue_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device_FWD_DEFINED__ +#define __ID3D12Device_FWD_DEFINED__ +typedef interface ID3D12Device ID3D12Device; + +#endif /* __ID3D12Device_FWD_DEFINED__ */ + + +#ifndef __ID3D12PipelineLibrary_FWD_DEFINED__ +#define __ID3D12PipelineLibrary_FWD_DEFINED__ +typedef interface ID3D12PipelineLibrary ID3D12PipelineLibrary; + +#endif /* __ID3D12PipelineLibrary_FWD_DEFINED__ */ + + +#ifndef __ID3D12PipelineLibrary1_FWD_DEFINED__ +#define __ID3D12PipelineLibrary1_FWD_DEFINED__ +typedef interface ID3D12PipelineLibrary1 ID3D12PipelineLibrary1; + +#endif /* __ID3D12PipelineLibrary1_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device1_FWD_DEFINED__ +#define __ID3D12Device1_FWD_DEFINED__ +typedef interface ID3D12Device1 ID3D12Device1; + +#endif /* __ID3D12Device1_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device2_FWD_DEFINED__ +#define __ID3D12Device2_FWD_DEFINED__ +typedef interface ID3D12Device2 ID3D12Device2; + +#endif /* __ID3D12Device2_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device3_FWD_DEFINED__ +#define __ID3D12Device3_FWD_DEFINED__ +typedef interface ID3D12Device3 ID3D12Device3; + +#endif /* __ID3D12Device3_FWD_DEFINED__ */ + + +#ifndef __ID3D12ProtectedSession_FWD_DEFINED__ +#define __ID3D12ProtectedSession_FWD_DEFINED__ +typedef interface ID3D12ProtectedSession ID3D12ProtectedSession; + +#endif /* __ID3D12ProtectedSession_FWD_DEFINED__ */ + + +#ifndef __ID3D12ProtectedResourceSession_FWD_DEFINED__ +#define __ID3D12ProtectedResourceSession_FWD_DEFINED__ +typedef interface ID3D12ProtectedResourceSession ID3D12ProtectedResourceSession; + +#endif /* __ID3D12ProtectedResourceSession_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device4_FWD_DEFINED__ +#define __ID3D12Device4_FWD_DEFINED__ +typedef interface ID3D12Device4 ID3D12Device4; + +#endif /* __ID3D12Device4_FWD_DEFINED__ */ + + +#ifndef __ID3D12LifetimeOwner_FWD_DEFINED__ +#define __ID3D12LifetimeOwner_FWD_DEFINED__ +typedef interface ID3D12LifetimeOwner ID3D12LifetimeOwner; + +#endif /* __ID3D12LifetimeOwner_FWD_DEFINED__ */ + + +#ifndef __ID3D12SwapChainAssistant_FWD_DEFINED__ +#define __ID3D12SwapChainAssistant_FWD_DEFINED__ +typedef interface ID3D12SwapChainAssistant ID3D12SwapChainAssistant; + +#endif /* __ID3D12SwapChainAssistant_FWD_DEFINED__ */ + + +#ifndef __ID3D12LifetimeTracker_FWD_DEFINED__ +#define __ID3D12LifetimeTracker_FWD_DEFINED__ +typedef interface ID3D12LifetimeTracker ID3D12LifetimeTracker; + +#endif /* __ID3D12LifetimeTracker_FWD_DEFINED__ */ + + +#ifndef __ID3D12StateObject_FWD_DEFINED__ +#define __ID3D12StateObject_FWD_DEFINED__ +typedef interface ID3D12StateObject ID3D12StateObject; + +#endif /* __ID3D12StateObject_FWD_DEFINED__ */ + + +#ifndef __ID3D12StateObjectProperties_FWD_DEFINED__ +#define __ID3D12StateObjectProperties_FWD_DEFINED__ +typedef interface ID3D12StateObjectProperties ID3D12StateObjectProperties; + +#endif /* __ID3D12StateObjectProperties_FWD_DEFINED__ */ + + +#ifndef __ID3D12StateObjectProperties1_FWD_DEFINED__ +#define __ID3D12StateObjectProperties1_FWD_DEFINED__ +typedef interface ID3D12StateObjectProperties1 ID3D12StateObjectProperties1; + +#endif /* __ID3D12StateObjectProperties1_FWD_DEFINED__ */ + + +#ifndef __ID3D12WorkGraphProperties_FWD_DEFINED__ +#define __ID3D12WorkGraphProperties_FWD_DEFINED__ +typedef interface ID3D12WorkGraphProperties ID3D12WorkGraphProperties; + +#endif /* __ID3D12WorkGraphProperties_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device5_FWD_DEFINED__ +#define __ID3D12Device5_FWD_DEFINED__ +typedef interface ID3D12Device5 ID3D12Device5; + +#endif /* __ID3D12Device5_FWD_DEFINED__ */ + + +#ifndef __ID3D12DeviceRemovedExtendedDataSettings_FWD_DEFINED__ +#define __ID3D12DeviceRemovedExtendedDataSettings_FWD_DEFINED__ +typedef interface ID3D12DeviceRemovedExtendedDataSettings ID3D12DeviceRemovedExtendedDataSettings; + +#endif /* __ID3D12DeviceRemovedExtendedDataSettings_FWD_DEFINED__ */ + + +#ifndef __ID3D12DeviceRemovedExtendedDataSettings1_FWD_DEFINED__ +#define __ID3D12DeviceRemovedExtendedDataSettings1_FWD_DEFINED__ +typedef interface ID3D12DeviceRemovedExtendedDataSettings1 ID3D12DeviceRemovedExtendedDataSettings1; + +#endif /* __ID3D12DeviceRemovedExtendedDataSettings1_FWD_DEFINED__ */ + + +#ifndef __ID3D12DeviceRemovedExtendedDataSettings2_FWD_DEFINED__ +#define __ID3D12DeviceRemovedExtendedDataSettings2_FWD_DEFINED__ +typedef interface ID3D12DeviceRemovedExtendedDataSettings2 ID3D12DeviceRemovedExtendedDataSettings2; + +#endif /* __ID3D12DeviceRemovedExtendedDataSettings2_FWD_DEFINED__ */ + + +#ifndef __ID3D12DeviceRemovedExtendedData_FWD_DEFINED__ +#define __ID3D12DeviceRemovedExtendedData_FWD_DEFINED__ +typedef interface ID3D12DeviceRemovedExtendedData ID3D12DeviceRemovedExtendedData; + +#endif /* __ID3D12DeviceRemovedExtendedData_FWD_DEFINED__ */ + + +#ifndef __ID3D12DeviceRemovedExtendedData1_FWD_DEFINED__ +#define __ID3D12DeviceRemovedExtendedData1_FWD_DEFINED__ +typedef interface ID3D12DeviceRemovedExtendedData1 ID3D12DeviceRemovedExtendedData1; + +#endif /* __ID3D12DeviceRemovedExtendedData1_FWD_DEFINED__ */ + + +#ifndef __ID3D12DeviceRemovedExtendedData2_FWD_DEFINED__ +#define __ID3D12DeviceRemovedExtendedData2_FWD_DEFINED__ +typedef interface ID3D12DeviceRemovedExtendedData2 ID3D12DeviceRemovedExtendedData2; + +#endif /* __ID3D12DeviceRemovedExtendedData2_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device6_FWD_DEFINED__ +#define __ID3D12Device6_FWD_DEFINED__ +typedef interface ID3D12Device6 ID3D12Device6; + +#endif /* __ID3D12Device6_FWD_DEFINED__ */ + + +#ifndef __ID3D12ProtectedResourceSession1_FWD_DEFINED__ +#define __ID3D12ProtectedResourceSession1_FWD_DEFINED__ +typedef interface ID3D12ProtectedResourceSession1 ID3D12ProtectedResourceSession1; + +#endif /* __ID3D12ProtectedResourceSession1_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device7_FWD_DEFINED__ +#define __ID3D12Device7_FWD_DEFINED__ +typedef interface ID3D12Device7 ID3D12Device7; + +#endif /* __ID3D12Device7_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device8_FWD_DEFINED__ +#define __ID3D12Device8_FWD_DEFINED__ +typedef interface ID3D12Device8 ID3D12Device8; + +#endif /* __ID3D12Device8_FWD_DEFINED__ */ + + +#ifndef __ID3D12Resource1_FWD_DEFINED__ +#define __ID3D12Resource1_FWD_DEFINED__ +typedef interface ID3D12Resource1 ID3D12Resource1; + +#endif /* __ID3D12Resource1_FWD_DEFINED__ */ + + +#ifndef __ID3D12Resource2_FWD_DEFINED__ +#define __ID3D12Resource2_FWD_DEFINED__ +typedef interface ID3D12Resource2 ID3D12Resource2; + +#endif /* __ID3D12Resource2_FWD_DEFINED__ */ + + +#ifndef __ID3D12Heap1_FWD_DEFINED__ +#define __ID3D12Heap1_FWD_DEFINED__ +typedef interface ID3D12Heap1 ID3D12Heap1; + +#endif /* __ID3D12Heap1_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList3_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList3_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList3 ID3D12GraphicsCommandList3; + +#endif /* __ID3D12GraphicsCommandList3_FWD_DEFINED__ */ + + +#ifndef __ID3D12MetaCommand_FWD_DEFINED__ +#define __ID3D12MetaCommand_FWD_DEFINED__ +typedef interface ID3D12MetaCommand ID3D12MetaCommand; + +#endif /* __ID3D12MetaCommand_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList4_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList4_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList4 ID3D12GraphicsCommandList4; + +#endif /* __ID3D12GraphicsCommandList4_FWD_DEFINED__ */ + + +#ifndef __ID3D12ShaderCacheSession_FWD_DEFINED__ +#define __ID3D12ShaderCacheSession_FWD_DEFINED__ +typedef interface ID3D12ShaderCacheSession ID3D12ShaderCacheSession; + +#endif /* __ID3D12ShaderCacheSession_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device9_FWD_DEFINED__ +#define __ID3D12Device9_FWD_DEFINED__ +typedef interface ID3D12Device9 ID3D12Device9; + +#endif /* __ID3D12Device9_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device10_FWD_DEFINED__ +#define __ID3D12Device10_FWD_DEFINED__ +typedef interface ID3D12Device10 ID3D12Device10; + +#endif /* __ID3D12Device10_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device11_FWD_DEFINED__ +#define __ID3D12Device11_FWD_DEFINED__ +typedef interface ID3D12Device11 ID3D12Device11; + +#endif /* __ID3D12Device11_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device12_FWD_DEFINED__ +#define __ID3D12Device12_FWD_DEFINED__ +typedef interface ID3D12Device12 ID3D12Device12; + +#endif /* __ID3D12Device12_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device13_FWD_DEFINED__ +#define __ID3D12Device13_FWD_DEFINED__ +typedef interface ID3D12Device13 ID3D12Device13; + +#endif /* __ID3D12Device13_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device14_FWD_DEFINED__ +#define __ID3D12Device14_FWD_DEFINED__ +typedef interface ID3D12Device14 ID3D12Device14; + +#endif /* __ID3D12Device14_FWD_DEFINED__ */ + + +#ifndef __ID3D12VirtualizationGuestDevice_FWD_DEFINED__ +#define __ID3D12VirtualizationGuestDevice_FWD_DEFINED__ +typedef interface ID3D12VirtualizationGuestDevice ID3D12VirtualizationGuestDevice; + +#endif /* __ID3D12VirtualizationGuestDevice_FWD_DEFINED__ */ + + +#ifndef __ID3D12Tools_FWD_DEFINED__ +#define __ID3D12Tools_FWD_DEFINED__ +typedef interface ID3D12Tools ID3D12Tools; + +#endif /* __ID3D12Tools_FWD_DEFINED__ */ + + +#ifndef __ID3D12SDKConfiguration_FWD_DEFINED__ +#define __ID3D12SDKConfiguration_FWD_DEFINED__ +typedef interface ID3D12SDKConfiguration ID3D12SDKConfiguration; + +#endif /* __ID3D12SDKConfiguration_FWD_DEFINED__ */ + + +#ifndef __ID3D12SDKConfiguration1_FWD_DEFINED__ +#define __ID3D12SDKConfiguration1_FWD_DEFINED__ +typedef interface ID3D12SDKConfiguration1 ID3D12SDKConfiguration1; + +#endif /* __ID3D12SDKConfiguration1_FWD_DEFINED__ */ + + +#ifndef __ID3D12DeviceFactory_FWD_DEFINED__ +#define __ID3D12DeviceFactory_FWD_DEFINED__ +typedef interface ID3D12DeviceFactory ID3D12DeviceFactory; + +#endif /* __ID3D12DeviceFactory_FWD_DEFINED__ */ + + +#ifndef __ID3D12DeviceConfiguration_FWD_DEFINED__ +#define __ID3D12DeviceConfiguration_FWD_DEFINED__ +typedef interface ID3D12DeviceConfiguration ID3D12DeviceConfiguration; + +#endif /* __ID3D12DeviceConfiguration_FWD_DEFINED__ */ + + +#ifndef __ID3D12DeviceConfiguration1_FWD_DEFINED__ +#define __ID3D12DeviceConfiguration1_FWD_DEFINED__ +typedef interface ID3D12DeviceConfiguration1 ID3D12DeviceConfiguration1; + +#endif /* __ID3D12DeviceConfiguration1_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList5_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList5_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList5 ID3D12GraphicsCommandList5; + +#endif /* __ID3D12GraphicsCommandList5_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList6_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList6_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList6 ID3D12GraphicsCommandList6; + +#endif /* __ID3D12GraphicsCommandList6_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList7_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList7_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList7 ID3D12GraphicsCommandList7; + +#endif /* __ID3D12GraphicsCommandList7_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList8_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList8_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList8 ID3D12GraphicsCommandList8; + +#endif /* __ID3D12GraphicsCommandList8_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList9_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList9_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList9 ID3D12GraphicsCommandList9; + +#endif /* __ID3D12GraphicsCommandList9_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList10_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList10_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList10 ID3D12GraphicsCommandList10; + +#endif /* __ID3D12GraphicsCommandList10_FWD_DEFINED__ */ + + +#ifndef __ID3D12GBVDiagnostics_FWD_DEFINED__ +#define __ID3D12GBVDiagnostics_FWD_DEFINED__ +typedef interface ID3D12GBVDiagnostics ID3D12GBVDiagnostics; + +#endif /* __ID3D12GBVDiagnostics_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "dxgicommon.h" +#include "dxgiformat.h" +#include "d3dcommon.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3d12_0000_0000 */ +/* [local] */ + +#include +#pragma region App Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) +#ifndef _D3D12_CONSTANTS +#define _D3D12_CONSTANTS +#define D3D12_16BIT_INDEX_STRIP_CUT_VALUE ( 0xffff ) + +#define D3D12_32BIT_INDEX_STRIP_CUT_VALUE ( 0xffffffff ) + +#define D3D12_8BIT_INDEX_STRIP_CUT_VALUE ( 0xff ) + +#define D3D12_APPEND_ALIGNED_ELEMENT ( 0xffffffff ) + +#define D3D12_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT ( 9 ) + +#define D3D12_CLIP_OR_CULL_DISTANCE_COUNT ( 8 ) + +#define D3D12_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT ( 2 ) + +#define D3D12_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT ( 14 ) + +#define D3D12_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS ( 4 ) + +#define D3D12_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT ( 15 ) + +#define D3D12_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT ( 16 ) + +#define D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT ( 15 ) + +#define D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST ( 1 ) + +#define D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT ( 64 ) + +#define D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT ( 1 ) + +#define D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST ( 1 ) + +#define D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT ( 128 ) + +#define D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST ( 1 ) + +#define D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT ( 128 ) + +#define D3D12_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_COMMONSHADER_SAMPLER_REGISTER_COUNT ( 16 ) + +#define D3D12_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST ( 1 ) + +#define D3D12_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_COMMONSHADER_SAMPLER_SLOT_COUNT ( 16 ) + +#define D3D12_COMMONSHADER_SUBROUTINE_NESTING_LIMIT ( 32 ) + +#define D3D12_COMMONSHADER_TEMP_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_COMMONSHADER_TEMP_REGISTER_COUNT ( 4096 ) + +#define D3D12_COMMONSHADER_TEMP_REGISTER_READS_PER_INST ( 3 ) + +#define D3D12_COMMONSHADER_TEMP_REGISTER_READ_PORTS ( 3 ) + +#define D3D12_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX ( 10 ) + +#define D3D12_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN ( -10 ) + +#define D3D12_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE ( -8 ) + +#define D3D12_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE ( 7 ) + +#define D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT ( 256 ) + +#define D3D12_CS_4_X_BUCKET00_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 256 ) + +#define D3D12_CS_4_X_BUCKET00_MAX_NUM_THREADS_PER_GROUP ( 64 ) + +#define D3D12_CS_4_X_BUCKET01_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 240 ) + +#define D3D12_CS_4_X_BUCKET01_MAX_NUM_THREADS_PER_GROUP ( 68 ) + +#define D3D12_CS_4_X_BUCKET02_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 224 ) + +#define D3D12_CS_4_X_BUCKET02_MAX_NUM_THREADS_PER_GROUP ( 72 ) + +#define D3D12_CS_4_X_BUCKET03_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 208 ) + +#define D3D12_CS_4_X_BUCKET03_MAX_NUM_THREADS_PER_GROUP ( 76 ) + +#define D3D12_CS_4_X_BUCKET04_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 192 ) + +#define D3D12_CS_4_X_BUCKET04_MAX_NUM_THREADS_PER_GROUP ( 84 ) + +#define D3D12_CS_4_X_BUCKET05_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 176 ) + +#define D3D12_CS_4_X_BUCKET05_MAX_NUM_THREADS_PER_GROUP ( 92 ) + +#define D3D12_CS_4_X_BUCKET06_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 160 ) + +#define D3D12_CS_4_X_BUCKET06_MAX_NUM_THREADS_PER_GROUP ( 100 ) + +#define D3D12_CS_4_X_BUCKET07_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 144 ) + +#define D3D12_CS_4_X_BUCKET07_MAX_NUM_THREADS_PER_GROUP ( 112 ) + +#define D3D12_CS_4_X_BUCKET08_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 128 ) + +#define D3D12_CS_4_X_BUCKET08_MAX_NUM_THREADS_PER_GROUP ( 128 ) + +#define D3D12_CS_4_X_BUCKET09_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 112 ) + +#define D3D12_CS_4_X_BUCKET09_MAX_NUM_THREADS_PER_GROUP ( 144 ) + +#define D3D12_CS_4_X_BUCKET10_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 96 ) + +#define D3D12_CS_4_X_BUCKET10_MAX_NUM_THREADS_PER_GROUP ( 168 ) + +#define D3D12_CS_4_X_BUCKET11_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 80 ) + +#define D3D12_CS_4_X_BUCKET11_MAX_NUM_THREADS_PER_GROUP ( 204 ) + +#define D3D12_CS_4_X_BUCKET12_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 64 ) + +#define D3D12_CS_4_X_BUCKET12_MAX_NUM_THREADS_PER_GROUP ( 256 ) + +#define D3D12_CS_4_X_BUCKET13_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 48 ) + +#define D3D12_CS_4_X_BUCKET13_MAX_NUM_THREADS_PER_GROUP ( 340 ) + +#define D3D12_CS_4_X_BUCKET14_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 32 ) + +#define D3D12_CS_4_X_BUCKET14_MAX_NUM_THREADS_PER_GROUP ( 512 ) + +#define D3D12_CS_4_X_BUCKET15_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 16 ) + +#define D3D12_CS_4_X_BUCKET15_MAX_NUM_THREADS_PER_GROUP ( 768 ) + +#define D3D12_CS_4_X_DISPATCH_MAX_THREAD_GROUPS_IN_Z_DIMENSION ( 1 ) + +#define D3D12_CS_4_X_RAW_UAV_BYTE_ALIGNMENT ( 256 ) + +#define D3D12_CS_4_X_THREAD_GROUP_MAX_THREADS_PER_GROUP ( 768 ) + +#define D3D12_CS_4_X_THREAD_GROUP_MAX_X ( 768 ) + +#define D3D12_CS_4_X_THREAD_GROUP_MAX_Y ( 768 ) + +#define D3D12_CS_4_X_UAV_REGISTER_COUNT ( 1 ) + +#define D3D12_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION ( 65535 ) + +#define D3D12_CS_TGSM_REGISTER_COUNT ( 8192 ) + +#define D3D12_CS_TGSM_REGISTER_READS_PER_INST ( 1 ) + +#define D3D12_CS_TGSM_RESOURCE_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_CS_TGSM_RESOURCE_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_CS_THREADGROUPID_REGISTER_COMPONENTS ( 3 ) + +#define D3D12_CS_THREADGROUPID_REGISTER_COUNT ( 1 ) + +#define D3D12_CS_THREADIDINGROUPFLATTENED_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_CS_THREADIDINGROUPFLATTENED_REGISTER_COUNT ( 1 ) + +#define D3D12_CS_THREADIDINGROUP_REGISTER_COMPONENTS ( 3 ) + +#define D3D12_CS_THREADIDINGROUP_REGISTER_COUNT ( 1 ) + +#define D3D12_CS_THREADID_REGISTER_COMPONENTS ( 3 ) + +#define D3D12_CS_THREADID_REGISTER_COUNT ( 1 ) + +#define D3D12_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP ( 1024 ) + +#define D3D12_CS_THREAD_GROUP_MAX_X ( 1024 ) + +#define D3D12_CS_THREAD_GROUP_MAX_Y ( 1024 ) + +#define D3D12_CS_THREAD_GROUP_MAX_Z ( 64 ) + +#define D3D12_CS_THREAD_GROUP_MIN_X ( 1 ) + +#define D3D12_CS_THREAD_GROUP_MIN_Y ( 1 ) + +#define D3D12_CS_THREAD_GROUP_MIN_Z ( 1 ) + +#define D3D12_CS_THREAD_LOCAL_TEMP_REGISTER_POOL ( 16384 ) + +#define D3D12_DEFAULT_BLEND_FACTOR_ALPHA ( 1.0f ) +#define D3D12_DEFAULT_BLEND_FACTOR_BLUE ( 1.0f ) +#define D3D12_DEFAULT_BLEND_FACTOR_GREEN ( 1.0f ) +#define D3D12_DEFAULT_BLEND_FACTOR_RED ( 1.0f ) +#define D3D12_DEFAULT_BORDER_COLOR_COMPONENT ( 0.0f ) +#define D3D12_DEFAULT_DEPTH_BIAS ( 0 ) + +#define D3D12_DEFAULT_DEPTH_BIAS_CLAMP ( 0.0f ) +#define D3D12_DEFAULT_MAX_ANISOTROPY ( 16 ) + +#define D3D12_DEFAULT_MIP_LOD_BIAS ( 0.0f ) +#define D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT ( 4194304 ) + +#define D3D12_DEFAULT_RENDER_TARGET_ARRAY_INDEX ( 0 ) + +#define D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT ( 65536 ) + +#define D3D12_DEFAULT_SAMPLE_MASK ( 0xffffffff ) + +#define D3D12_DEFAULT_SCISSOR_ENDX ( 0 ) + +#define D3D12_DEFAULT_SCISSOR_ENDY ( 0 ) + +#define D3D12_DEFAULT_SCISSOR_STARTX ( 0 ) + +#define D3D12_DEFAULT_SCISSOR_STARTY ( 0 ) + +#define D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS ( 0.0f ) +#define D3D12_DEFAULT_STENCIL_READ_MASK ( 0xff ) + +#define D3D12_DEFAULT_STENCIL_REFERENCE ( 0 ) + +#define D3D12_DEFAULT_STENCIL_WRITE_MASK ( 0xff ) + +#define D3D12_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX ( 0 ) + +#define D3D12_DEFAULT_VIEWPORT_HEIGHT ( 0 ) + +#define D3D12_DEFAULT_VIEWPORT_MAX_DEPTH ( 0.0f ) +#define D3D12_DEFAULT_VIEWPORT_MIN_DEPTH ( 0.0f ) +#define D3D12_DEFAULT_VIEWPORT_TOPLEFTX ( 0 ) + +#define D3D12_DEFAULT_VIEWPORT_TOPLEFTY ( 0 ) + +#define D3D12_DEFAULT_VIEWPORT_WIDTH ( 0 ) + +#define D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND ( 0xffffffff ) + +#define D3D12_DRIVER_RESERVED_REGISTER_SPACE_VALUES_END ( 0xfffffff7 ) + +#define D3D12_DRIVER_RESERVED_REGISTER_SPACE_VALUES_START ( 0xfffffff0 ) + +#define D3D12_DS_INPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS ( 3968 ) + +#define D3D12_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_DS_INPUT_CONTROL_POINT_REGISTER_COUNT ( 32 ) + +#define D3D12_DS_INPUT_CONTROL_POINT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_DS_INPUT_CONTROL_POINT_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENTS ( 3 ) + +#define D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_COUNT ( 1 ) + +#define D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_COUNT ( 32 ) + +#define D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_COUNT ( 1 ) + +#define D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_DS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_DS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_DS_OUTPUT_REGISTER_COUNT ( 32 ) + +#define D3D12_FLOAT16_FUSED_TOLERANCE_IN_ULP ( 0.6 ) +#define D3D12_FLOAT32_MAX ( 3.402823466e+38f ) +#define D3D12_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP ( 0.6f ) +#define D3D12_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR ( 2.4f ) +#define D3D12_FLOAT_TO_SRGB_EXPONENT_NUMERATOR ( 1.0f ) +#define D3D12_FLOAT_TO_SRGB_OFFSET ( 0.055f ) +#define D3D12_FLOAT_TO_SRGB_SCALE_1 ( 12.92f ) +#define D3D12_FLOAT_TO_SRGB_SCALE_2 ( 1.055f ) +#define D3D12_FLOAT_TO_SRGB_THRESHOLD ( 0.0031308f ) +#define D3D12_FTOI_INSTRUCTION_MAX_INPUT ( 2147483647.999f ) +#define D3D12_FTOI_INSTRUCTION_MIN_INPUT ( -2147483648.999f ) +#define D3D12_FTOU_INSTRUCTION_MAX_INPUT ( 4294967295.999f ) +#define D3D12_FTOU_INSTRUCTION_MIN_INPUT ( 0.0f ) +#define D3D12_GS_INPUT_INSTANCE_ID_READS_PER_INST ( 2 ) + +#define D3D12_GS_INPUT_INSTANCE_ID_READ_PORTS ( 1 ) + +#define D3D12_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_GS_INPUT_INSTANCE_ID_REGISTER_COUNT ( 1 ) + +#define D3D12_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_GS_INPUT_PRIM_CONST_REGISTER_COUNT ( 1 ) + +#define D3D12_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_GS_INPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_GS_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D12_GS_INPUT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_GS_INPUT_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_GS_INPUT_REGISTER_VERTICES ( 32 ) + +#define D3D12_GS_MAX_INSTANCE_COUNT ( 32 ) + +#define D3D12_GS_MAX_OUTPUT_VERTEX_COUNT_ACROSS_INSTANCES ( 1024 ) + +#define D3D12_GS_OUTPUT_ELEMENTS ( 32 ) + +#define D3D12_GS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_GS_OUTPUT_REGISTER_COUNT ( 32 ) + +#define D3D12_HS_CONTROL_POINT_PHASE_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D12_HS_CONTROL_POINT_PHASE_OUTPUT_REGISTER_COUNT ( 32 ) + +#define D3D12_HS_CONTROL_POINT_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_HS_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_HS_CONTROL_POINT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_HS_CONTROL_POINT_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_HS_FORK_PHASE_INSTANCE_COUNT_UPPER_BOUND ( 0xffffffff ) + +#define D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COUNT ( 1 ) + +#define D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COUNT ( 1 ) + +#define D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_COUNT ( 1 ) + +#define D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_HS_JOIN_PHASE_INSTANCE_COUNT_UPPER_BOUND ( 0xffffffff ) + +#define D3D12_HS_MAXTESSFACTOR_LOWER_BOUND ( 1.0f ) +#define D3D12_HS_MAXTESSFACTOR_UPPER_BOUND ( 64.0f ) +#define D3D12_HS_OUTPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS ( 3968 ) + +#define D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COUNT ( 1 ) + +#define D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COUNT ( 32 ) + +#define D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_SCALAR_COMPONENTS ( 128 ) + +#define D3D12_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES ( 0 ) + +#define D3D12_IA_DEFAULT_PRIMITIVE_TOPOLOGY ( 0 ) + +#define D3D12_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES ( 0 ) + +#define D3D12_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT ( 1 ) + +#define D3D12_IA_INSTANCE_ID_BIT_COUNT ( 32 ) + +#define D3D12_IA_INTEGER_ARITHMETIC_BIT_COUNT ( 32 ) + +#define D3D12_IA_PATCH_MAX_CONTROL_POINT_COUNT ( 32 ) + +#define D3D12_IA_PRIMITIVE_ID_BIT_COUNT ( 32 ) + +#define D3D12_IA_VERTEX_ID_BIT_COUNT ( 32 ) + +#define D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ( 32 ) + +#define D3D12_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS ( 128 ) + +#define D3D12_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ( 32 ) + +#define D3D12_INTEGER_DIVIDE_BY_ZERO_QUOTIENT ( 0xffffffff ) + +#define D3D12_INTEGER_DIVIDE_BY_ZERO_REMAINDER ( 0xffffffff ) + +#define D3D12_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL ( 0xffffffff ) + +#define D3D12_KEEP_UNORDERED_ACCESS_VIEWS ( 0xffffffff ) + +#define D3D12_LINEAR_GAMMA ( 1.0f ) +#define D3D12_MAJOR_VERSION ( 12 ) + +#define D3D12_MAX_BORDER_COLOR_COMPONENT ( 1.0f ) +#define D3D12_MAX_DEPTH ( 1.0f ) +#define D3D12_MAX_LIVE_STATIC_SAMPLERS ( 2032 ) + +#define D3D12_MAX_MAXANISOTROPY ( 16 ) + +#define D3D12_MAX_MULTISAMPLE_SAMPLE_COUNT ( 32 ) + +#define D3D12_MAX_POSITION_VALUE ( 3.402823466e+34f ) +#define D3D12_MAX_ROOT_COST ( 64 ) + +#define D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1 ( 1000000 ) + +#define D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_2 ( 1000000 ) + +#define D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE ( 2048 ) + +#define D3D12_MAX_TEXTURE_DIMENSION_2_TO_EXP ( 17 ) + +#define D3D12_MAX_VIEW_INSTANCE_COUNT ( 4 ) + +#define D3D12_MINOR_VERSION ( 0 ) + +#define D3D12_MIN_BORDER_COLOR_COMPONENT ( 0.0f ) +#define D3D12_MIN_DEPTH ( 0.0f ) +#define D3D12_MIN_MAXANISOTROPY ( 0 ) + +#define D3D12_MIP_LOD_BIAS_MAX ( 15.99f ) +#define D3D12_MIP_LOD_BIAS_MIN ( -16.0f ) +#define D3D12_MIP_LOD_FRACTIONAL_BIT_COUNT ( 8 ) + +#define D3D12_MIP_LOD_RANGE_BIT_COUNT ( 8 ) + +#define D3D12_MULTISAMPLE_ANTIALIAS_LINE_WIDTH ( 1.4f ) +#define D3D12_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT ( 0 ) + +#define D3D12_OS_RESERVED_REGISTER_SPACE_VALUES_END ( 0xffffffff ) + +#define D3D12_OS_RESERVED_REGISTER_SPACE_VALUES_START ( 0xfffffff8 ) + +#define D3D12_PACKED_TILE ( 0xffffffff ) + +#define D3D12_PIXEL_ADDRESS_RANGE_BIT_COUNT ( 15 ) + +#define D3D12_PREVIEW_SDK_VERSION ( 714 ) + +#define D3D12_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT ( 16 ) + +#define D3D12_PS_CS_UAV_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_PS_CS_UAV_REGISTER_COUNT ( 8 ) + +#define D3D12_PS_CS_UAV_REGISTER_READS_PER_INST ( 1 ) + +#define D3D12_PS_CS_UAV_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_PS_FRONTFACING_DEFAULT_VALUE ( 0xffffffff ) + +#define D3D12_PS_FRONTFACING_FALSE_VALUE ( 0 ) + +#define D3D12_PS_FRONTFACING_TRUE_VALUE ( 0xffffffff ) + +#define D3D12_PS_INPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_PS_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D12_PS_INPUT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_PS_INPUT_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT ( 0.0f ) +#define D3D12_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_PS_OUTPUT_DEPTH_REGISTER_COUNT ( 1 ) + +#define D3D12_PS_OUTPUT_MASK_REGISTER_COMPONENTS ( 1 ) + +#define D3D12_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_PS_OUTPUT_MASK_REGISTER_COUNT ( 1 ) + +#define D3D12_PS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_PS_OUTPUT_REGISTER_COUNT ( 8 ) + +#define D3D12_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT ( 0.5f ) +#define D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT ( 16 ) + +#define D3D12_RAYTRACING_AABB_BYTE_ALIGNMENT ( 8 ) + +#define D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BYTE_ALIGNMENT ( 256 ) + +#define D3D12_RAYTRACING_INSTANCE_DESCS_BYTE_ALIGNMENT ( 16 ) + +#define D3D12_RAYTRACING_MAX_ATTRIBUTE_SIZE_IN_BYTES ( 32 ) + +#define D3D12_RAYTRACING_MAX_DECLARABLE_TRACE_RECURSION_DEPTH ( 31 ) + +#define D3D12_RAYTRACING_MAX_GEOMETRIES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE ( 16777216 ) + +#define D3D12_RAYTRACING_MAX_INSTANCES_PER_TOP_LEVEL_ACCELERATION_STRUCTURE ( 16777216 ) + +#define D3D12_RAYTRACING_MAX_PRIMITIVES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE ( 536870912 ) + +#define D3D12_RAYTRACING_MAX_RAY_GENERATION_SHADER_THREADS ( 1073741824 ) + +#define D3D12_RAYTRACING_MAX_SHADER_RECORD_STRIDE ( 4096 ) + +#define D3D12_RAYTRACING_SHADER_RECORD_BYTE_ALIGNMENT ( 32 ) + +#define D3D12_RAYTRACING_SHADER_TABLE_BYTE_ALIGNMENT ( 64 ) + +#define D3D12_RAYTRACING_TRANSFORM3X4_BYTE_ALIGNMENT ( 16 ) + +#define D3D12_REQ_BLEND_OBJECT_COUNT_PER_DEVICE ( 4096 ) + +#define D3D12_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP ( 27 ) + +#define D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT ( 4096 ) + +#define D3D12_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_DEVICE ( 4096 ) + +#define D3D12_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP ( 32 ) + +#define D3D12_REQ_DRAW_VERTEX_COUNT_2_TO_EXP ( 32 ) + +#define D3D12_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION ( 16384 ) + +#define D3D12_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT ( 1024 ) + +#define D3D12_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT ( 4096 ) + +#define D3D12_REQ_MAXANISOTROPY ( 16 ) + +#define D3D12_REQ_MIP_LEVELS ( 15 ) + +#define D3D12_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES ( 2048 ) + +#define D3D12_REQ_RASTERIZER_OBJECT_COUNT_PER_DEVICE ( 4096 ) + +#define D3D12_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH ( 16384 ) + +#define D3D12_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM ( 128 ) + +#define D3D12_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM ( 0.25f ) +#define D3D12_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_C_TERM ( 2048 ) + +#define D3D12_REQ_RESOURCE_VIEW_COUNT_PER_DEVICE_2_TO_EXP ( 20 ) + +#define D3D12_REQ_SAMPLER_OBJECT_COUNT_PER_DEVICE ( 4096 ) + +#define D3D12_REQ_SUBRESOURCES ( 30720 ) + +#define D3D12_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION ( 2048 ) + +#define D3D12_REQ_TEXTURE1D_U_DIMENSION ( 16384 ) + +#define D3D12_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION ( 2048 ) + +#define D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION ( 16384 ) + +#define D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ( 2048 ) + +#define D3D12_REQ_TEXTURECUBE_DIMENSION ( 16384 ) + +#define D3D12_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL ( 0 ) + +#define D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES ( 0xffffffff ) + +#define D3D12_RS_SET_SHADING_RATE_COMBINER_COUNT ( 2 ) + +#define D3D12_SDK_VERSION ( 614 ) + +#define D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES ( 32 ) + +#define D3D12_SHADER_MAJOR_VERSION ( 5 ) + +#define D3D12_SHADER_MAX_INSTANCES ( 65535 ) + +#define D3D12_SHADER_MAX_INTERFACES ( 253 ) + +#define D3D12_SHADER_MAX_INTERFACE_CALL_SITES ( 4096 ) + +#define D3D12_SHADER_MAX_TYPES ( 65535 ) + +#define D3D12_SHADER_MINOR_VERSION ( 1 ) + +#define D3D12_SHIFT_INSTRUCTION_PAD_VALUE ( 0 ) + +#define D3D12_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT ( 5 ) + +#define D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT ( 8 ) + +#define D3D12_SMALL_MSAA_RESOURCE_PLACEMENT_ALIGNMENT ( 65536 ) + +#define D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT ( 4096 ) + +#define D3D12_SO_BUFFER_MAX_STRIDE_IN_BYTES ( 2048 ) + +#define D3D12_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES ( 512 ) + +#define D3D12_SO_BUFFER_SLOT_COUNT ( 4 ) + +#define D3D12_SO_DDI_REGISTER_INDEX_DENOTING_GAP ( 0xffffffff ) + +#define D3D12_SO_NO_RASTERIZED_STREAM ( 0xffffffff ) + +#define D3D12_SO_OUTPUT_COMPONENT_COUNT ( 128 ) + +#define D3D12_SO_STREAM_COUNT ( 4 ) + +#define D3D12_SPEC_DATE_DAY ( 14 ) + +#define D3D12_SPEC_DATE_MONTH ( 11 ) + +#define D3D12_SPEC_DATE_YEAR ( 2014 ) + +#define D3D12_SPEC_VERSION ( 1.16 ) +#define D3D12_SRGB_GAMMA ( 2.2f ) +#define D3D12_SRGB_TO_FLOAT_DENOMINATOR_1 ( 12.92f ) +#define D3D12_SRGB_TO_FLOAT_DENOMINATOR_2 ( 1.055f ) +#define D3D12_SRGB_TO_FLOAT_EXPONENT ( 2.4f ) +#define D3D12_SRGB_TO_FLOAT_OFFSET ( 0.055f ) +#define D3D12_SRGB_TO_FLOAT_THRESHOLD ( 0.04045f ) +#define D3D12_SRGB_TO_FLOAT_TOLERANCE_IN_ULP ( 0.5f ) +#define D3D12_STANDARD_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_STANDARD_COMPONENT_BIT_COUNT_DOUBLED ( 64 ) + +#define D3D12_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE ( 4 ) + +#define D3D12_STANDARD_PIXEL_COMPONENT_COUNT ( 128 ) + +#define D3D12_STANDARD_PIXEL_ELEMENT_COUNT ( 32 ) + +#define D3D12_STANDARD_VECTOR_SIZE ( 4 ) + +#define D3D12_STANDARD_VERTEX_ELEMENT_COUNT ( 32 ) + +#define D3D12_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT ( 64 ) + +#define D3D12_SUBPIXEL_FRACTIONAL_BIT_COUNT ( 8 ) + +#define D3D12_SUBTEXEL_FRACTIONAL_BIT_COUNT ( 8 ) + +#define D3D12_SYSTEM_RESERVED_REGISTER_SPACE_VALUES_END ( 0xffffffff ) + +#define D3D12_SYSTEM_RESERVED_REGISTER_SPACE_VALUES_START ( 0xfffffff0 ) + +#define D3D12_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR ( 64 ) + +#define D3D12_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR ( 64 ) + +#define D3D12_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR ( 63 ) + +#define D3D12_TESSELLATOR_MAX_TESSELLATION_FACTOR ( 64 ) + +#define D3D12_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR ( 2 ) + +#define D3D12_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR ( 1 ) + +#define D3D12_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR ( 1 ) + +#define D3D12_TEXEL_ADDRESS_RANGE_BIT_COUNT ( 16 ) + +#define D3D12_TEXTURE_DATA_PITCH_ALIGNMENT ( 256 ) + +#define D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT ( 512 ) + +#define D3D12_TILED_RESOURCE_TILE_SIZE_IN_BYTES ( 65536 ) + +#define D3D12_TRACKED_WORKLOAD_MAX_INSTANCES ( 32 ) + +#define D3D12_UAV_COUNTER_PLACEMENT_ALIGNMENT ( 4096 ) + +#define D3D12_UAV_SLOT_COUNT ( 64 ) + +#define D3D12_UNBOUND_MEMORY_ACCESS_RESULT ( 0 ) + +#define D3D12_VIDEO_DECODE_MAX_ARGUMENTS ( 10 ) + +#define D3D12_VIDEO_DECODE_MAX_HISTOGRAM_COMPONENTS ( 4 ) + +#define D3D12_VIDEO_DECODE_MIN_BITSTREAM_OFFSET_ALIGNMENT ( 256 ) + +#define D3D12_VIDEO_DECODE_MIN_HISTOGRAM_OFFSET_ALIGNMENT ( 256 ) + +#define D3D12_VIDEO_DECODE_STATUS_MACROBLOCKS_AFFECTED_UNKNOWN ( 0xffffffff ) + +#define D3D12_VIDEO_ENCODER_AV1_INVALID_DPB_RESOURCE_INDEX ( 0xff ) + +#define D3D12_VIDEO_ENCODER_AV1_MAX_TILE_COLS ( 64 ) + +#define D3D12_VIDEO_ENCODER_AV1_MAX_TILE_ROWS ( 64 ) + +#define D3D12_VIDEO_ENCODER_AV1_SUPERRES_DENOM_MIN ( 9 ) + +#define D3D12_VIDEO_ENCODER_AV1_SUPERRES_NUM ( 8 ) + +#define D3D12_VIDEO_PROCESS_MAX_FILTERS ( 32 ) + +#define D3D12_VIDEO_PROCESS_STEREO_VIEWS ( 2 ) + +#define D3D12_VIEWPORT_AND_SCISSORRECT_MAX_INDEX ( 15 ) + +#define D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE ( 16 ) + +#define D3D12_VIEWPORT_BOUNDS_MAX ( 32767 ) + +#define D3D12_VIEWPORT_BOUNDS_MIN ( -32768 ) + +#define D3D12_VS_INPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_VS_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D12_VS_INPUT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D12_VS_INPUT_REGISTER_READ_PORTS ( 1 ) + +#define D3D12_VS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D12_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D12_VS_OUTPUT_REGISTER_COUNT ( 32 ) + +#define D3D12_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT ( 10 ) + +#define D3D12_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP ( 25 ) + +#define D3D12_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP ( 25 ) + +#define D3D12_WORK_GRAPHS_BACKING_MEMORY_ALIGNMENT_IN_BYTES ( 8 ) + +#define D3D12_WORK_GRAPHS_MAX_NODE_DEPTH ( 32 ) + +#endif + +typedef UINT64 D3D12_GPU_VIRTUAL_ADDRESS; + +typedef +enum D3D12_COMMAND_LIST_TYPE + { + D3D12_COMMAND_LIST_TYPE_DIRECT = 0, + D3D12_COMMAND_LIST_TYPE_BUNDLE = 1, + D3D12_COMMAND_LIST_TYPE_COMPUTE = 2, + D3D12_COMMAND_LIST_TYPE_COPY = 3, + D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE = 4, + D3D12_COMMAND_LIST_TYPE_VIDEO_PROCESS = 5, + D3D12_COMMAND_LIST_TYPE_VIDEO_ENCODE = 6, + D3D12_COMMAND_LIST_TYPE_NONE = -1 + } D3D12_COMMAND_LIST_TYPE; + +typedef +enum D3D12_COMMAND_QUEUE_FLAGS + { + D3D12_COMMAND_QUEUE_FLAG_NONE = 0, + D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT = 0x1 + } D3D12_COMMAND_QUEUE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMMAND_QUEUE_FLAGS ) +typedef +enum D3D12_COMMAND_QUEUE_PRIORITY + { + D3D12_COMMAND_QUEUE_PRIORITY_NORMAL = 0, + D3D12_COMMAND_QUEUE_PRIORITY_HIGH = 100, + D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME = 10000 + } D3D12_COMMAND_QUEUE_PRIORITY; + +typedef struct D3D12_COMMAND_QUEUE_DESC + { + D3D12_COMMAND_LIST_TYPE Type; + INT Priority; + D3D12_COMMAND_QUEUE_FLAGS Flags; + UINT NodeMask; + } D3D12_COMMAND_QUEUE_DESC; + +typedef +enum D3D12_PRIMITIVE_TOPOLOGY_TYPE + { + D3D12_PRIMITIVE_TOPOLOGY_TYPE_UNDEFINED = 0, + D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT = 1, + D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE = 2, + D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE = 3, + D3D12_PRIMITIVE_TOPOLOGY_TYPE_PATCH = 4 + } D3D12_PRIMITIVE_TOPOLOGY_TYPE; + +typedef +enum D3D12_INPUT_CLASSIFICATION + { + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA = 0, + D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA = 1 + } D3D12_INPUT_CLASSIFICATION; + +typedef struct D3D12_INPUT_ELEMENT_DESC + { + LPCSTR SemanticName; + UINT SemanticIndex; + DXGI_FORMAT Format; + UINT InputSlot; + UINT AlignedByteOffset; + D3D12_INPUT_CLASSIFICATION InputSlotClass; + UINT InstanceDataStepRate; + } D3D12_INPUT_ELEMENT_DESC; + +typedef +enum D3D12_FILL_MODE + { + D3D12_FILL_MODE_WIREFRAME = 2, + D3D12_FILL_MODE_SOLID = 3 + } D3D12_FILL_MODE; + +typedef D3D_PRIMITIVE_TOPOLOGY D3D12_PRIMITIVE_TOPOLOGY; + +typedef D3D_PRIMITIVE D3D12_PRIMITIVE; + +typedef +enum D3D12_CULL_MODE + { + D3D12_CULL_MODE_NONE = 1, + D3D12_CULL_MODE_FRONT = 2, + D3D12_CULL_MODE_BACK = 3 + } D3D12_CULL_MODE; + +typedef struct D3D12_SO_DECLARATION_ENTRY + { + UINT Stream; + LPCSTR SemanticName; + UINT SemanticIndex; + BYTE StartComponent; + BYTE ComponentCount; + BYTE OutputSlot; + } D3D12_SO_DECLARATION_ENTRY; + +typedef struct D3D12_VIEWPORT + { + FLOAT TopLeftX; + FLOAT TopLeftY; + FLOAT Width; + FLOAT Height; + FLOAT MinDepth; + FLOAT MaxDepth; + } D3D12_VIEWPORT; + +typedef RECT D3D12_RECT; + +typedef struct D3D12_BOX + { + UINT left; + UINT top; + UINT front; + UINT right; + UINT bottom; + UINT back; + } D3D12_BOX; + +typedef +enum D3D12_COMPARISON_FUNC + { + D3D12_COMPARISON_FUNC_NONE = 0, + D3D12_COMPARISON_FUNC_NEVER = 1, + D3D12_COMPARISON_FUNC_LESS = 2, + D3D12_COMPARISON_FUNC_EQUAL = 3, + D3D12_COMPARISON_FUNC_LESS_EQUAL = 4, + D3D12_COMPARISON_FUNC_GREATER = 5, + D3D12_COMPARISON_FUNC_NOT_EQUAL = 6, + D3D12_COMPARISON_FUNC_GREATER_EQUAL = 7, + D3D12_COMPARISON_FUNC_ALWAYS = 8 + } D3D12_COMPARISON_FUNC; + +typedef +enum D3D12_DEPTH_WRITE_MASK + { + D3D12_DEPTH_WRITE_MASK_ZERO = 0, + D3D12_DEPTH_WRITE_MASK_ALL = 1 + } D3D12_DEPTH_WRITE_MASK; + +typedef +enum D3D12_STENCIL_OP + { + D3D12_STENCIL_OP_KEEP = 1, + D3D12_STENCIL_OP_ZERO = 2, + D3D12_STENCIL_OP_REPLACE = 3, + D3D12_STENCIL_OP_INCR_SAT = 4, + D3D12_STENCIL_OP_DECR_SAT = 5, + D3D12_STENCIL_OP_INVERT = 6, + D3D12_STENCIL_OP_INCR = 7, + D3D12_STENCIL_OP_DECR = 8 + } D3D12_STENCIL_OP; + +typedef struct D3D12_DEPTH_STENCILOP_DESC + { + D3D12_STENCIL_OP StencilFailOp; + D3D12_STENCIL_OP StencilDepthFailOp; + D3D12_STENCIL_OP StencilPassOp; + D3D12_COMPARISON_FUNC StencilFunc; + } D3D12_DEPTH_STENCILOP_DESC; + +typedef struct D3D12_DEPTH_STENCIL_DESC + { + BOOL DepthEnable; + D3D12_DEPTH_WRITE_MASK DepthWriteMask; + D3D12_COMPARISON_FUNC DepthFunc; + BOOL StencilEnable; + UINT8 StencilReadMask; + UINT8 StencilWriteMask; + D3D12_DEPTH_STENCILOP_DESC FrontFace; + D3D12_DEPTH_STENCILOP_DESC BackFace; + } D3D12_DEPTH_STENCIL_DESC; + +typedef struct D3D12_DEPTH_STENCIL_DESC1 + { + BOOL DepthEnable; + D3D12_DEPTH_WRITE_MASK DepthWriteMask; + D3D12_COMPARISON_FUNC DepthFunc; + BOOL StencilEnable; + UINT8 StencilReadMask; + UINT8 StencilWriteMask; + D3D12_DEPTH_STENCILOP_DESC FrontFace; + D3D12_DEPTH_STENCILOP_DESC BackFace; + BOOL DepthBoundsTestEnable; + } D3D12_DEPTH_STENCIL_DESC1; + +typedef struct D3D12_DEPTH_STENCILOP_DESC1 + { + D3D12_STENCIL_OP StencilFailOp; + D3D12_STENCIL_OP StencilDepthFailOp; + D3D12_STENCIL_OP StencilPassOp; + D3D12_COMPARISON_FUNC StencilFunc; + UINT8 StencilReadMask; + UINT8 StencilWriteMask; + } D3D12_DEPTH_STENCILOP_DESC1; + +typedef struct D3D12_DEPTH_STENCIL_DESC2 + { + BOOL DepthEnable; + D3D12_DEPTH_WRITE_MASK DepthWriteMask; + D3D12_COMPARISON_FUNC DepthFunc; + BOOL StencilEnable; + D3D12_DEPTH_STENCILOP_DESC1 FrontFace; + D3D12_DEPTH_STENCILOP_DESC1 BackFace; + BOOL DepthBoundsTestEnable; + } D3D12_DEPTH_STENCIL_DESC2; + +typedef +enum D3D12_BLEND + { + D3D12_BLEND_ZERO = 1, + D3D12_BLEND_ONE = 2, + D3D12_BLEND_SRC_COLOR = 3, + D3D12_BLEND_INV_SRC_COLOR = 4, + D3D12_BLEND_SRC_ALPHA = 5, + D3D12_BLEND_INV_SRC_ALPHA = 6, + D3D12_BLEND_DEST_ALPHA = 7, + D3D12_BLEND_INV_DEST_ALPHA = 8, + D3D12_BLEND_DEST_COLOR = 9, + D3D12_BLEND_INV_DEST_COLOR = 10, + D3D12_BLEND_SRC_ALPHA_SAT = 11, + D3D12_BLEND_BLEND_FACTOR = 14, + D3D12_BLEND_INV_BLEND_FACTOR = 15, + D3D12_BLEND_SRC1_COLOR = 16, + D3D12_BLEND_INV_SRC1_COLOR = 17, + D3D12_BLEND_SRC1_ALPHA = 18, + D3D12_BLEND_INV_SRC1_ALPHA = 19, + D3D12_BLEND_ALPHA_FACTOR = 20, + D3D12_BLEND_INV_ALPHA_FACTOR = 21 + } D3D12_BLEND; + +typedef +enum D3D12_BLEND_OP + { + D3D12_BLEND_OP_ADD = 1, + D3D12_BLEND_OP_SUBTRACT = 2, + D3D12_BLEND_OP_REV_SUBTRACT = 3, + D3D12_BLEND_OP_MIN = 4, + D3D12_BLEND_OP_MAX = 5 + } D3D12_BLEND_OP; + +typedef +enum D3D12_COLOR_WRITE_ENABLE + { + D3D12_COLOR_WRITE_ENABLE_RED = 1, + D3D12_COLOR_WRITE_ENABLE_GREEN = 2, + D3D12_COLOR_WRITE_ENABLE_BLUE = 4, + D3D12_COLOR_WRITE_ENABLE_ALPHA = 8, + D3D12_COLOR_WRITE_ENABLE_ALL = ( ( ( D3D12_COLOR_WRITE_ENABLE_RED | D3D12_COLOR_WRITE_ENABLE_GREEN ) | D3D12_COLOR_WRITE_ENABLE_BLUE ) | D3D12_COLOR_WRITE_ENABLE_ALPHA ) + } D3D12_COLOR_WRITE_ENABLE; + +typedef +enum D3D12_LOGIC_OP + { + D3D12_LOGIC_OP_CLEAR = 0, + D3D12_LOGIC_OP_SET = ( D3D12_LOGIC_OP_CLEAR + 1 ) , + D3D12_LOGIC_OP_COPY = ( D3D12_LOGIC_OP_SET + 1 ) , + D3D12_LOGIC_OP_COPY_INVERTED = ( D3D12_LOGIC_OP_COPY + 1 ) , + D3D12_LOGIC_OP_NOOP = ( D3D12_LOGIC_OP_COPY_INVERTED + 1 ) , + D3D12_LOGIC_OP_INVERT = ( D3D12_LOGIC_OP_NOOP + 1 ) , + D3D12_LOGIC_OP_AND = ( D3D12_LOGIC_OP_INVERT + 1 ) , + D3D12_LOGIC_OP_NAND = ( D3D12_LOGIC_OP_AND + 1 ) , + D3D12_LOGIC_OP_OR = ( D3D12_LOGIC_OP_NAND + 1 ) , + D3D12_LOGIC_OP_NOR = ( D3D12_LOGIC_OP_OR + 1 ) , + D3D12_LOGIC_OP_XOR = ( D3D12_LOGIC_OP_NOR + 1 ) , + D3D12_LOGIC_OP_EQUIV = ( D3D12_LOGIC_OP_XOR + 1 ) , + D3D12_LOGIC_OP_AND_REVERSE = ( D3D12_LOGIC_OP_EQUIV + 1 ) , + D3D12_LOGIC_OP_AND_INVERTED = ( D3D12_LOGIC_OP_AND_REVERSE + 1 ) , + D3D12_LOGIC_OP_OR_REVERSE = ( D3D12_LOGIC_OP_AND_INVERTED + 1 ) , + D3D12_LOGIC_OP_OR_INVERTED = ( D3D12_LOGIC_OP_OR_REVERSE + 1 ) + } D3D12_LOGIC_OP; + +typedef struct D3D12_RENDER_TARGET_BLEND_DESC + { + BOOL BlendEnable; + BOOL LogicOpEnable; + D3D12_BLEND SrcBlend; + D3D12_BLEND DestBlend; + D3D12_BLEND_OP BlendOp; + D3D12_BLEND SrcBlendAlpha; + D3D12_BLEND DestBlendAlpha; + D3D12_BLEND_OP BlendOpAlpha; + D3D12_LOGIC_OP LogicOp; + UINT8 RenderTargetWriteMask; + } D3D12_RENDER_TARGET_BLEND_DESC; + +typedef struct D3D12_BLEND_DESC + { + BOOL AlphaToCoverageEnable; + BOOL IndependentBlendEnable; + D3D12_RENDER_TARGET_BLEND_DESC RenderTarget[ 8 ]; + } D3D12_BLEND_DESC; + +/* Note, the array size for RenderTarget[] above is D3D12_SIMULTANEOUS_RENDERTARGET_COUNT. + IDL processing/generation of this header replaces the define; this comment is merely explaining what happened. */ +typedef +enum D3D12_CONSERVATIVE_RASTERIZATION_MODE + { + D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF = 0, + D3D12_CONSERVATIVE_RASTERIZATION_MODE_ON = 1 + } D3D12_CONSERVATIVE_RASTERIZATION_MODE; + +typedef struct D3D12_RASTERIZER_DESC + { + D3D12_FILL_MODE FillMode; + D3D12_CULL_MODE CullMode; + BOOL FrontCounterClockwise; + INT DepthBias; + FLOAT DepthBiasClamp; + FLOAT SlopeScaledDepthBias; + BOOL DepthClipEnable; + BOOL MultisampleEnable; + BOOL AntialiasedLineEnable; + UINT ForcedSampleCount; + D3D12_CONSERVATIVE_RASTERIZATION_MODE ConservativeRaster; + } D3D12_RASTERIZER_DESC; + +typedef struct D3D12_RASTERIZER_DESC1 + { + D3D12_FILL_MODE FillMode; + D3D12_CULL_MODE CullMode; + BOOL FrontCounterClockwise; + FLOAT DepthBias; + FLOAT DepthBiasClamp; + FLOAT SlopeScaledDepthBias; + BOOL DepthClipEnable; + BOOL MultisampleEnable; + BOOL AntialiasedLineEnable; + UINT ForcedSampleCount; + D3D12_CONSERVATIVE_RASTERIZATION_MODE ConservativeRaster; + } D3D12_RASTERIZER_DESC1; + +typedef +enum D3D12_LINE_RASTERIZATION_MODE + { + D3D12_LINE_RASTERIZATION_MODE_ALIASED = 0, + D3D12_LINE_RASTERIZATION_MODE_ALPHA_ANTIALIASED = ( D3D12_LINE_RASTERIZATION_MODE_ALIASED + 1 ) , + D3D12_LINE_RASTERIZATION_MODE_QUADRILATERAL_WIDE = ( D3D12_LINE_RASTERIZATION_MODE_ALPHA_ANTIALIASED + 1 ) , + D3D12_LINE_RASTERIZATION_MODE_QUADRILATERAL_NARROW = ( D3D12_LINE_RASTERIZATION_MODE_QUADRILATERAL_WIDE + 1 ) + } D3D12_LINE_RASTERIZATION_MODE; + +typedef struct D3D12_RASTERIZER_DESC2 + { + D3D12_FILL_MODE FillMode; + D3D12_CULL_MODE CullMode; + BOOL FrontCounterClockwise; + FLOAT DepthBias; + FLOAT DepthBiasClamp; + FLOAT SlopeScaledDepthBias; + BOOL DepthClipEnable; + D3D12_LINE_RASTERIZATION_MODE LineRasterizationMode; + UINT ForcedSampleCount; + D3D12_CONSERVATIVE_RASTERIZATION_MODE ConservativeRaster; + } D3D12_RASTERIZER_DESC2; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D12Object_INTERFACE_DEFINED__ +#define __ID3D12Object_INTERFACE_DEFINED__ + +/* interface ID3D12Object */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Object; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("c4fec28f-7966-4e95-9f94-f431cb56c3b8") + ID3D12Object : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetPrivateData( + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateData( + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetName( + _In_z_ LPCWSTR Name) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12ObjectVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Object * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Object * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Object * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Object * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Object * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Object * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Object * This, + _In_z_ LPCWSTR Name); + + END_INTERFACE + } ID3D12ObjectVtbl; + + interface ID3D12Object + { + CONST_VTBL struct ID3D12ObjectVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Object_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Object_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Object_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Object_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Object_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Object_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Object_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Object_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12DeviceChild_INTERFACE_DEFINED__ +#define __ID3D12DeviceChild_INTERFACE_DEFINED__ + +/* interface ID3D12DeviceChild */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DeviceChild; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("905db94b-a00c-4140-9df5-2b64ca9ea357") + ID3D12DeviceChild : public ID3D12Object + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDevice( + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DeviceChildVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DeviceChild * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DeviceChild * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DeviceChild * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12DeviceChild * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12DeviceChild * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12DeviceChild * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12DeviceChild * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12DeviceChild * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + END_INTERFACE + } ID3D12DeviceChildVtbl; + + interface ID3D12DeviceChild + { + CONST_VTBL struct ID3D12DeviceChildVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DeviceChild_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DeviceChild_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DeviceChild_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DeviceChild_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12DeviceChild_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12DeviceChild_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12DeviceChild_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12DeviceChild_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DeviceChild_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12RootSignature_INTERFACE_DEFINED__ +#define __ID3D12RootSignature_INTERFACE_DEFINED__ + +/* interface ID3D12RootSignature */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12RootSignature; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("c54a6b66-72df-4ee8-8be5-a946a1429214") + ID3D12RootSignature : public ID3D12DeviceChild + { + public: + }; + + +#else /* C style interface */ + + typedef struct ID3D12RootSignatureVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12RootSignature * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12RootSignature * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12RootSignature * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12RootSignature * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12RootSignature * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12RootSignature * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12RootSignature * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12RootSignature * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + END_INTERFACE + } ID3D12RootSignatureVtbl; + + interface ID3D12RootSignature + { + CONST_VTBL struct ID3D12RootSignatureVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12RootSignature_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12RootSignature_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12RootSignature_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12RootSignature_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12RootSignature_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12RootSignature_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12RootSignature_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12RootSignature_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12RootSignature_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0001 */ +/* [local] */ + +typedef struct D3D12_SHADER_BYTECODE + { + _Field_size_bytes_full_(BytecodeLength) const void *pShaderBytecode; + SIZE_T BytecodeLength; + } D3D12_SHADER_BYTECODE; + +typedef struct D3D12_STREAM_OUTPUT_DESC + { + _Field_size_full_(NumEntries) const D3D12_SO_DECLARATION_ENTRY *pSODeclaration; + UINT NumEntries; + _Field_size_full_(NumStrides) const UINT *pBufferStrides; + UINT NumStrides; + UINT RasterizedStream; + } D3D12_STREAM_OUTPUT_DESC; + +typedef struct D3D12_INPUT_LAYOUT_DESC + { + _Field_size_full_(NumElements) const D3D12_INPUT_ELEMENT_DESC *pInputElementDescs; + UINT NumElements; + } D3D12_INPUT_LAYOUT_DESC; + +typedef +enum D3D12_INDEX_BUFFER_STRIP_CUT_VALUE + { + D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_DISABLED = 0, + D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFF = 1, + D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFFFFFF = 2 + } D3D12_INDEX_BUFFER_STRIP_CUT_VALUE; + +typedef +enum D3D12_STANDARD_MULTISAMPLE_QUALITY_LEVELS + { + D3D12_STANDARD_MULTISAMPLE_PATTERN = 0xffffffff, + D3D12_CENTER_MULTISAMPLE_PATTERN = 0xfffffffe + } D3D12_STANDARD_MULTISAMPLE_QUALITY_LEVELS; + +typedef struct D3D12_CACHED_PIPELINE_STATE + { + _Field_size_bytes_full_(CachedBlobSizeInBytes) const void *pCachedBlob; + SIZE_T CachedBlobSizeInBytes; + } D3D12_CACHED_PIPELINE_STATE; + +typedef +enum D3D12_PIPELINE_STATE_FLAGS + { + D3D12_PIPELINE_STATE_FLAG_NONE = 0, + D3D12_PIPELINE_STATE_FLAG_TOOL_DEBUG = 0x1, + D3D12_PIPELINE_STATE_FLAG_DYNAMIC_DEPTH_BIAS = 0x4, + D3D12_PIPELINE_STATE_FLAG_DYNAMIC_INDEX_BUFFER_STRIP_CUT = 0x8 + } D3D12_PIPELINE_STATE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_PIPELINE_STATE_FLAGS ) +typedef struct D3D12_GRAPHICS_PIPELINE_STATE_DESC + { + ID3D12RootSignature *pRootSignature; + D3D12_SHADER_BYTECODE VS; + D3D12_SHADER_BYTECODE PS; + D3D12_SHADER_BYTECODE DS; + D3D12_SHADER_BYTECODE HS; + D3D12_SHADER_BYTECODE GS; + D3D12_STREAM_OUTPUT_DESC StreamOutput; + D3D12_BLEND_DESC BlendState; + UINT SampleMask; + D3D12_RASTERIZER_DESC RasterizerState; + D3D12_DEPTH_STENCIL_DESC DepthStencilState; + D3D12_INPUT_LAYOUT_DESC InputLayout; + D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue; + D3D12_PRIMITIVE_TOPOLOGY_TYPE PrimitiveTopologyType; + UINT NumRenderTargets; + DXGI_FORMAT RTVFormats[ 8 ]; + DXGI_FORMAT DSVFormat; + DXGI_SAMPLE_DESC SampleDesc; + UINT NodeMask; + D3D12_CACHED_PIPELINE_STATE CachedPSO; + D3D12_PIPELINE_STATE_FLAGS Flags; + } D3D12_GRAPHICS_PIPELINE_STATE_DESC; + +typedef struct D3D12_COMPUTE_PIPELINE_STATE_DESC + { + ID3D12RootSignature *pRootSignature; + D3D12_SHADER_BYTECODE CS; + UINT NodeMask; + D3D12_CACHED_PIPELINE_STATE CachedPSO; + D3D12_PIPELINE_STATE_FLAGS Flags; + } D3D12_COMPUTE_PIPELINE_STATE_DESC; + +struct D3D12_RT_FORMAT_ARRAY + { + DXGI_FORMAT RTFormats[ 8 ]; + UINT NumRenderTargets; + } ; +typedef struct D3D12_PIPELINE_STATE_STREAM_DESC + { + _In_ SIZE_T SizeInBytes; + _In_reads_(_Inexpressible_("Dependent on size of subobjects")) void *pPipelineStateSubobjectStream; + } D3D12_PIPELINE_STATE_STREAM_DESC; + +typedef +enum D3D12_PIPELINE_STATE_SUBOBJECT_TYPE + { + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE = 0, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_HS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_GS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_HS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_GS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_STREAM_OUTPUT = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_BLEND = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_STREAM_OUTPUT + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_MASK = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_BLEND + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_MASK + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_IB_STRIP_CUT_VALUE = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_IB_STRIP_CUT_VALUE + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL_FORMAT = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_DESC = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL_FORMAT + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_DESC + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CACHED_PSO = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CACHED_PSO + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1 = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1 + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_AS = 24, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_MS = 25, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL2 = 26, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER1 = 27, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER2 = 28, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_MAX_VALID = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER2 + 1 ) + } D3D12_PIPELINE_STATE_SUBOBJECT_TYPE; + +typedef +enum D3D12_FEATURE + { + D3D12_FEATURE_D3D12_OPTIONS = 0, + D3D12_FEATURE_ARCHITECTURE = 1, + D3D12_FEATURE_FEATURE_LEVELS = 2, + D3D12_FEATURE_FORMAT_SUPPORT = 3, + D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS = 4, + D3D12_FEATURE_FORMAT_INFO = 5, + D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = 6, + D3D12_FEATURE_SHADER_MODEL = 7, + D3D12_FEATURE_D3D12_OPTIONS1 = 8, + D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_SUPPORT = 10, + D3D12_FEATURE_ROOT_SIGNATURE = 12, + D3D12_FEATURE_ARCHITECTURE1 = 16, + D3D12_FEATURE_D3D12_OPTIONS2 = 18, + D3D12_FEATURE_SHADER_CACHE = 19, + D3D12_FEATURE_COMMAND_QUEUE_PRIORITY = 20, + D3D12_FEATURE_D3D12_OPTIONS3 = 21, + D3D12_FEATURE_EXISTING_HEAPS = 22, + D3D12_FEATURE_D3D12_OPTIONS4 = 23, + D3D12_FEATURE_SERIALIZATION = 24, + D3D12_FEATURE_CROSS_NODE = 25, + D3D12_FEATURE_D3D12_OPTIONS5 = 27, + D3D12_FEATURE_DISPLAYABLE = 28, + D3D12_FEATURE_D3D12_OPTIONS6 = 30, + D3D12_FEATURE_QUERY_META_COMMAND = 31, + D3D12_FEATURE_D3D12_OPTIONS7 = 32, + D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPE_COUNT = 33, + D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_TYPES = 34, + D3D12_FEATURE_D3D12_OPTIONS8 = 36, + D3D12_FEATURE_D3D12_OPTIONS9 = 37, + D3D12_FEATURE_D3D12_OPTIONS10 = 39, + D3D12_FEATURE_D3D12_OPTIONS11 = 40, + D3D12_FEATURE_D3D12_OPTIONS12 = 41, + D3D12_FEATURE_D3D12_OPTIONS13 = 42, + D3D12_FEATURE_D3D12_OPTIONS14 = 43, + D3D12_FEATURE_D3D12_OPTIONS15 = 44, + D3D12_FEATURE_D3D12_OPTIONS16 = 45, + D3D12_FEATURE_D3D12_OPTIONS17 = 46, + D3D12_FEATURE_D3D12_OPTIONS18 = 47, + D3D12_FEATURE_D3D12_OPTIONS19 = 48, + D3D12_FEATURE_D3D12_OPTIONS20 = 49, + D3D12_FEATURE_PREDICATION = 50, + D3D12_FEATURE_PLACED_RESOURCE_SUPPORT_INFO = 51, + D3D12_FEATURE_HARDWARE_COPY = 52, + D3D12_FEATURE_D3D12_OPTIONS21 = 53 + } D3D12_FEATURE; + +typedef +enum D3D12_SHADER_MIN_PRECISION_SUPPORT + { + D3D12_SHADER_MIN_PRECISION_SUPPORT_NONE = 0, + D3D12_SHADER_MIN_PRECISION_SUPPORT_10_BIT = 0x1, + D3D12_SHADER_MIN_PRECISION_SUPPORT_16_BIT = 0x2 + } D3D12_SHADER_MIN_PRECISION_SUPPORT; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_SHADER_MIN_PRECISION_SUPPORT ) +typedef +enum D3D12_TILED_RESOURCES_TIER + { + D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED = 0, + D3D12_TILED_RESOURCES_TIER_1 = 1, + D3D12_TILED_RESOURCES_TIER_2 = 2, + D3D12_TILED_RESOURCES_TIER_3 = 3, + D3D12_TILED_RESOURCES_TIER_4 = 4 + } D3D12_TILED_RESOURCES_TIER; + +typedef +enum D3D12_RESOURCE_BINDING_TIER + { + D3D12_RESOURCE_BINDING_TIER_1 = 1, + D3D12_RESOURCE_BINDING_TIER_2 = 2, + D3D12_RESOURCE_BINDING_TIER_3 = 3 + } D3D12_RESOURCE_BINDING_TIER; + +typedef +enum D3D12_CONSERVATIVE_RASTERIZATION_TIER + { + D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED = 0, + D3D12_CONSERVATIVE_RASTERIZATION_TIER_1 = 1, + D3D12_CONSERVATIVE_RASTERIZATION_TIER_2 = 2, + D3D12_CONSERVATIVE_RASTERIZATION_TIER_3 = 3 + } D3D12_CONSERVATIVE_RASTERIZATION_TIER; + +typedef +enum D3D12_FORMAT_SUPPORT1 + { + D3D12_FORMAT_SUPPORT1_NONE = 0, + D3D12_FORMAT_SUPPORT1_BUFFER = 0x1, + D3D12_FORMAT_SUPPORT1_IA_VERTEX_BUFFER = 0x2, + D3D12_FORMAT_SUPPORT1_IA_INDEX_BUFFER = 0x4, + D3D12_FORMAT_SUPPORT1_SO_BUFFER = 0x8, + D3D12_FORMAT_SUPPORT1_TEXTURE1D = 0x10, + D3D12_FORMAT_SUPPORT1_TEXTURE2D = 0x20, + D3D12_FORMAT_SUPPORT1_TEXTURE3D = 0x40, + D3D12_FORMAT_SUPPORT1_TEXTURECUBE = 0x80, + D3D12_FORMAT_SUPPORT1_SHADER_LOAD = 0x100, + D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE = 0x200, + D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE_COMPARISON = 0x400, + D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE_MONO_TEXT = 0x800, + D3D12_FORMAT_SUPPORT1_MIP = 0x1000, + D3D12_FORMAT_SUPPORT1_RENDER_TARGET = 0x4000, + D3D12_FORMAT_SUPPORT1_BLENDABLE = 0x8000, + D3D12_FORMAT_SUPPORT1_DEPTH_STENCIL = 0x10000, + D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RESOLVE = 0x40000, + D3D12_FORMAT_SUPPORT1_DISPLAY = 0x80000, + D3D12_FORMAT_SUPPORT1_CAST_WITHIN_BIT_LAYOUT = 0x100000, + D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RENDERTARGET = 0x200000, + D3D12_FORMAT_SUPPORT1_MULTISAMPLE_LOAD = 0x400000, + D3D12_FORMAT_SUPPORT1_SHADER_GATHER = 0x800000, + D3D12_FORMAT_SUPPORT1_BACK_BUFFER_CAST = 0x1000000, + D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW = 0x2000000, + D3D12_FORMAT_SUPPORT1_SHADER_GATHER_COMPARISON = 0x4000000, + D3D12_FORMAT_SUPPORT1_DECODER_OUTPUT = 0x8000000, + D3D12_FORMAT_SUPPORT1_VIDEO_PROCESSOR_OUTPUT = 0x10000000, + D3D12_FORMAT_SUPPORT1_VIDEO_PROCESSOR_INPUT = 0x20000000, + D3D12_FORMAT_SUPPORT1_VIDEO_ENCODER = 0x40000000 + } D3D12_FORMAT_SUPPORT1; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_FORMAT_SUPPORT1 ) +typedef +enum D3D12_FORMAT_SUPPORT2 + { + D3D12_FORMAT_SUPPORT2_NONE = 0, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_ADD = 0x1, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS = 0x2, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = 0x4, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE = 0x8, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX = 0x10, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = 0x20, + D3D12_FORMAT_SUPPORT2_UAV_TYPED_LOAD = 0x40, + D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE = 0x80, + D3D12_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP = 0x100, + D3D12_FORMAT_SUPPORT2_TILED = 0x200, + D3D12_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = 0x4000, + D3D12_FORMAT_SUPPORT2_SAMPLER_FEEDBACK = 0x8000 + } D3D12_FORMAT_SUPPORT2; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_FORMAT_SUPPORT2 ) +typedef +enum D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS + { + D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE = 0, + D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_TILED_RESOURCE = 0x1 + } D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS ) +typedef +enum D3D12_CROSS_NODE_SHARING_TIER + { + D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED = 0, + D3D12_CROSS_NODE_SHARING_TIER_1_EMULATED = 1, + D3D12_CROSS_NODE_SHARING_TIER_1 = 2, + D3D12_CROSS_NODE_SHARING_TIER_2 = 3, + D3D12_CROSS_NODE_SHARING_TIER_3 = 4 + } D3D12_CROSS_NODE_SHARING_TIER; + +typedef +enum D3D12_RESOURCE_HEAP_TIER + { + D3D12_RESOURCE_HEAP_TIER_1 = 1, + D3D12_RESOURCE_HEAP_TIER_2 = 2 + } D3D12_RESOURCE_HEAP_TIER; + +typedef +enum D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER + { + D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_NOT_SUPPORTED = 0, + D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_1 = 1, + D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_2 = 2 + } D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER; + +typedef +enum D3D12_VIEW_INSTANCING_TIER + { + D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED = 0, + D3D12_VIEW_INSTANCING_TIER_1 = 1, + D3D12_VIEW_INSTANCING_TIER_2 = 2, + D3D12_VIEW_INSTANCING_TIER_3 = 3 + } D3D12_VIEW_INSTANCING_TIER; + +typedef +enum D3D12_WORK_GRAPHS_TIER + { + D3D12_WORK_GRAPHS_TIER_NOT_SUPPORTED = 0, + D3D12_WORK_GRAPHS_TIER_1_0 = 10 + } D3D12_WORK_GRAPHS_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS + { + _Out_ BOOL DoublePrecisionFloatShaderOps; + _Out_ BOOL OutputMergerLogicOp; + _Out_ D3D12_SHADER_MIN_PRECISION_SUPPORT MinPrecisionSupport; + _Out_ D3D12_TILED_RESOURCES_TIER TiledResourcesTier; + _Out_ D3D12_RESOURCE_BINDING_TIER ResourceBindingTier; + _Out_ BOOL PSSpecifiedStencilRefSupported; + _Out_ BOOL TypedUAVLoadAdditionalFormats; + _Out_ BOOL ROVsSupported; + _Out_ D3D12_CONSERVATIVE_RASTERIZATION_TIER ConservativeRasterizationTier; + _Out_ UINT MaxGPUVirtualAddressBitsPerResource; + _Out_ BOOL StandardSwizzle64KBSupported; + _Out_ D3D12_CROSS_NODE_SHARING_TIER CrossNodeSharingTier; + _Out_ BOOL CrossAdapterRowMajorTextureSupported; + _Out_ BOOL VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation; + _Out_ D3D12_RESOURCE_HEAP_TIER ResourceHeapTier; + } D3D12_FEATURE_DATA_D3D12_OPTIONS; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS1 + { + _Out_ BOOL WaveOps; + _Out_ UINT WaveLaneCountMin; + _Out_ UINT WaveLaneCountMax; + _Out_ UINT TotalLaneCount; + _Out_ BOOL ExpandedComputeResourceStates; + _Out_ BOOL Int64ShaderOps; + } D3D12_FEATURE_DATA_D3D12_OPTIONS1; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS2 + { + _Out_ BOOL DepthBoundsTestSupported; + _Out_ D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER ProgrammableSamplePositionsTier; + } D3D12_FEATURE_DATA_D3D12_OPTIONS2; + +typedef +enum D3D_ROOT_SIGNATURE_VERSION + { + D3D_ROOT_SIGNATURE_VERSION_1 = 0x1, + D3D_ROOT_SIGNATURE_VERSION_1_0 = 0x1, + D3D_ROOT_SIGNATURE_VERSION_1_1 = 0x2, + D3D_ROOT_SIGNATURE_VERSION_1_2 = 0x3 + } D3D_ROOT_SIGNATURE_VERSION; + +typedef struct D3D12_FEATURE_DATA_ROOT_SIGNATURE + { + _Inout_ D3D_ROOT_SIGNATURE_VERSION HighestVersion; + } D3D12_FEATURE_DATA_ROOT_SIGNATURE; + +typedef struct D3D12_FEATURE_DATA_ARCHITECTURE + { + _In_ UINT NodeIndex; + _Out_ BOOL TileBasedRenderer; + _Out_ BOOL UMA; + _Out_ BOOL CacheCoherentUMA; + } D3D12_FEATURE_DATA_ARCHITECTURE; + +typedef struct D3D12_FEATURE_DATA_ARCHITECTURE1 + { + _In_ UINT NodeIndex; + _Out_ BOOL TileBasedRenderer; + _Out_ BOOL UMA; + _Out_ BOOL CacheCoherentUMA; + _Out_ BOOL IsolatedMMU; + } D3D12_FEATURE_DATA_ARCHITECTURE1; + +typedef struct D3D12_FEATURE_DATA_FEATURE_LEVELS + { + _In_ UINT NumFeatureLevels; + _In_reads_(NumFeatureLevels) const D3D_FEATURE_LEVEL *pFeatureLevelsRequested; + _Out_ D3D_FEATURE_LEVEL MaxSupportedFeatureLevel; + } D3D12_FEATURE_DATA_FEATURE_LEVELS; + +typedef +enum D3D_SHADER_MODEL + { + D3D_SHADER_MODEL_NONE = 0, + D3D_SHADER_MODEL_5_1 = 0x51, + D3D_SHADER_MODEL_6_0 = 0x60, + D3D_SHADER_MODEL_6_1 = 0x61, + D3D_SHADER_MODEL_6_2 = 0x62, + D3D_SHADER_MODEL_6_3 = 0x63, + D3D_SHADER_MODEL_6_4 = 0x64, + D3D_SHADER_MODEL_6_5 = 0x65, + D3D_SHADER_MODEL_6_6 = 0x66, + D3D_SHADER_MODEL_6_7 = 0x67, + D3D_SHADER_MODEL_6_8 = 0x68, + D3D_SHADER_MODEL_6_9 = 0x69, + D3D_HIGHEST_SHADER_MODEL = D3D_SHADER_MODEL_6_9 + } D3D_SHADER_MODEL; + +typedef struct D3D12_FEATURE_DATA_SHADER_MODEL + { + _Inout_ D3D_SHADER_MODEL HighestShaderModel; + } D3D12_FEATURE_DATA_SHADER_MODEL; + +typedef struct D3D12_FEATURE_DATA_FORMAT_SUPPORT + { + _In_ DXGI_FORMAT Format; + _Out_ D3D12_FORMAT_SUPPORT1 Support1; + _Out_ D3D12_FORMAT_SUPPORT2 Support2; + } D3D12_FEATURE_DATA_FORMAT_SUPPORT; + +typedef struct D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS + { + _In_ DXGI_FORMAT Format; + _In_ UINT SampleCount; + _In_ D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS Flags; + _Out_ UINT NumQualityLevels; + } D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS; + +typedef struct D3D12_FEATURE_DATA_FORMAT_INFO + { + DXGI_FORMAT Format; + UINT8 PlaneCount; + } D3D12_FEATURE_DATA_FORMAT_INFO; + +typedef struct D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT + { + UINT MaxGPUVirtualAddressBitsPerResource; + UINT MaxGPUVirtualAddressBitsPerProcess; + } D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT; + +typedef +enum D3D12_SHADER_CACHE_SUPPORT_FLAGS + { + D3D12_SHADER_CACHE_SUPPORT_NONE = 0, + D3D12_SHADER_CACHE_SUPPORT_SINGLE_PSO = 0x1, + D3D12_SHADER_CACHE_SUPPORT_LIBRARY = 0x2, + D3D12_SHADER_CACHE_SUPPORT_AUTOMATIC_INPROC_CACHE = 0x4, + D3D12_SHADER_CACHE_SUPPORT_AUTOMATIC_DISK_CACHE = 0x8, + D3D12_SHADER_CACHE_SUPPORT_DRIVER_MANAGED_CACHE = 0x10, + D3D12_SHADER_CACHE_SUPPORT_SHADER_CONTROL_CLEAR = 0x20, + D3D12_SHADER_CACHE_SUPPORT_SHADER_SESSION_DELETE = 0x40 + } D3D12_SHADER_CACHE_SUPPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_SHADER_CACHE_SUPPORT_FLAGS ) +typedef struct D3D12_FEATURE_DATA_SHADER_CACHE + { + _Out_ D3D12_SHADER_CACHE_SUPPORT_FLAGS SupportFlags; + } D3D12_FEATURE_DATA_SHADER_CACHE; + +typedef struct D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY + { + _In_ D3D12_COMMAND_LIST_TYPE CommandListType; + _In_ UINT Priority; + _Out_ BOOL PriorityForTypeIsSupported; + } D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY; + +typedef +enum D3D12_COMMAND_LIST_SUPPORT_FLAGS + { + D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE = 0, + D3D12_COMMAND_LIST_SUPPORT_FLAG_DIRECT = ( 1 << D3D12_COMMAND_LIST_TYPE_DIRECT ) , + D3D12_COMMAND_LIST_SUPPORT_FLAG_BUNDLE = ( 1 << D3D12_COMMAND_LIST_TYPE_BUNDLE ) , + D3D12_COMMAND_LIST_SUPPORT_FLAG_COMPUTE = ( 1 << D3D12_COMMAND_LIST_TYPE_COMPUTE ) , + D3D12_COMMAND_LIST_SUPPORT_FLAG_COPY = ( 1 << D3D12_COMMAND_LIST_TYPE_COPY ) , + D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_DECODE = ( 1 << D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE ) , + D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_PROCESS = ( 1 << D3D12_COMMAND_LIST_TYPE_VIDEO_PROCESS ) , + D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_ENCODE = ( 1 << D3D12_COMMAND_LIST_TYPE_VIDEO_ENCODE ) + } D3D12_COMMAND_LIST_SUPPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMMAND_LIST_SUPPORT_FLAGS ) +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS3 + { + _Out_ BOOL CopyQueueTimestampQueriesSupported; + _Out_ BOOL CastingFullyTypedFormatSupported; + _Out_ D3D12_COMMAND_LIST_SUPPORT_FLAGS WriteBufferImmediateSupportFlags; + _Out_ D3D12_VIEW_INSTANCING_TIER ViewInstancingTier; + _Out_ BOOL BarycentricsSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS3; + +typedef struct D3D12_FEATURE_DATA_EXISTING_HEAPS + { + _Out_ BOOL Supported; + } D3D12_FEATURE_DATA_EXISTING_HEAPS; + +typedef +enum D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER + { + D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0 = 0, + D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_1 = ( D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0 + 1 ) , + D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_2 = ( D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_1 + 1 ) + } D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER; + +typedef struct D3D12_FEATURE_DATA_DISPLAYABLE + { + _Out_ BOOL DisplayableTexture; + _Out_ D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER SharedResourceCompatibilityTier; + } D3D12_FEATURE_DATA_DISPLAYABLE; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS4 + { + _Out_ BOOL MSAA64KBAlignedTextureSupported; + _Out_ D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER SharedResourceCompatibilityTier; + _Out_ BOOL Native16BitShaderOpsSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS4; + +typedef +enum D3D12_HEAP_SERIALIZATION_TIER + { + D3D12_HEAP_SERIALIZATION_TIER_0 = 0, + D3D12_HEAP_SERIALIZATION_TIER_10 = 10 + } D3D12_HEAP_SERIALIZATION_TIER; + +typedef struct D3D12_FEATURE_DATA_SERIALIZATION + { + _In_ UINT NodeIndex; + _Out_ D3D12_HEAP_SERIALIZATION_TIER HeapSerializationTier; + } D3D12_FEATURE_DATA_SERIALIZATION; + +typedef struct D3D12_FEATURE_DATA_CROSS_NODE + { + D3D12_CROSS_NODE_SHARING_TIER SharingTier; + BOOL AtomicShaderInstructions; + } D3D12_FEATURE_DATA_CROSS_NODE; + +typedef +enum D3D12_RENDER_PASS_TIER + { + D3D12_RENDER_PASS_TIER_0 = 0, + D3D12_RENDER_PASS_TIER_1 = 1, + D3D12_RENDER_PASS_TIER_2 = 2 + } D3D12_RENDER_PASS_TIER; + +typedef +enum D3D12_RAYTRACING_TIER + { + D3D12_RAYTRACING_TIER_NOT_SUPPORTED = 0, + D3D12_RAYTRACING_TIER_1_0 = 10, + D3D12_RAYTRACING_TIER_1_1 = 11 + } D3D12_RAYTRACING_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS5 + { + _Out_ BOOL SRVOnlyTiledResourceTier3; + _Out_ D3D12_RENDER_PASS_TIER RenderPassesTier; + _Out_ D3D12_RAYTRACING_TIER RaytracingTier; + } D3D12_FEATURE_DATA_D3D12_OPTIONS5; + +typedef +enum D3D12_VARIABLE_SHADING_RATE_TIER + { + D3D12_VARIABLE_SHADING_RATE_TIER_NOT_SUPPORTED = 0, + D3D12_VARIABLE_SHADING_RATE_TIER_1 = 1, + D3D12_VARIABLE_SHADING_RATE_TIER_2 = 2 + } D3D12_VARIABLE_SHADING_RATE_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS6 + { + _Out_ BOOL AdditionalShadingRatesSupported; + _Out_ BOOL PerPrimitiveShadingRateSupportedWithViewportIndexing; + _Out_ D3D12_VARIABLE_SHADING_RATE_TIER VariableShadingRateTier; + _Out_ UINT ShadingRateImageTileSize; + _Out_ BOOL BackgroundProcessingSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS6; + +typedef +enum D3D12_MESH_SHADER_TIER + { + D3D12_MESH_SHADER_TIER_NOT_SUPPORTED = 0, + D3D12_MESH_SHADER_TIER_1 = 10 + } D3D12_MESH_SHADER_TIER; + +typedef +enum D3D12_SAMPLER_FEEDBACK_TIER + { + D3D12_SAMPLER_FEEDBACK_TIER_NOT_SUPPORTED = 0, + D3D12_SAMPLER_FEEDBACK_TIER_0_9 = 90, + D3D12_SAMPLER_FEEDBACK_TIER_1_0 = 100 + } D3D12_SAMPLER_FEEDBACK_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS7 + { + _Out_ D3D12_MESH_SHADER_TIER MeshShaderTier; + _Out_ D3D12_SAMPLER_FEEDBACK_TIER SamplerFeedbackTier; + } D3D12_FEATURE_DATA_D3D12_OPTIONS7; + +typedef struct D3D12_FEATURE_DATA_QUERY_META_COMMAND + { + _In_ GUID CommandId; + _In_ UINT NodeMask; + _Field_size_bytes_full_opt_( QueryInputDataSizeInBytes ) const void *pQueryInputData; + _In_ SIZE_T QueryInputDataSizeInBytes; + _Field_size_bytes_full_( QueryOutputDataSizeInBytes ) void *pQueryOutputData; + _In_ SIZE_T QueryOutputDataSizeInBytes; + } D3D12_FEATURE_DATA_QUERY_META_COMMAND; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS8 + { + _Out_ BOOL UnalignedBlockTexturesSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS8; + +typedef +enum D3D12_WAVE_MMA_TIER + { + D3D12_WAVE_MMA_TIER_NOT_SUPPORTED = 0, + D3D12_WAVE_MMA_TIER_1_0 = 10 + } D3D12_WAVE_MMA_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS9 + { + _Out_ BOOL MeshShaderPipelineStatsSupported; + _Out_ BOOL MeshShaderSupportsFullRangeRenderTargetArrayIndex; + _Out_ BOOL AtomicInt64OnTypedResourceSupported; + _Out_ BOOL AtomicInt64OnGroupSharedSupported; + _Out_ BOOL DerivativesInMeshAndAmplificationShadersSupported; + _Out_ D3D12_WAVE_MMA_TIER WaveMMATier; + } D3D12_FEATURE_DATA_D3D12_OPTIONS9; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS10 + { + _Out_ BOOL VariableRateShadingSumCombinerSupported; + _Out_ BOOL MeshShaderPerPrimitiveShadingRateSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS10; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS11 + { + _Out_ BOOL AtomicInt64OnDescriptorHeapResourceSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS11; + +typedef +enum D3D12_TRI_STATE + { + D3D12_TRI_STATE_UNKNOWN = -1, + D3D12_TRI_STATE_FALSE = 0, + D3D12_TRI_STATE_TRUE = 1 + } D3D12_TRI_STATE; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS12 + { + _Out_ D3D12_TRI_STATE MSPrimitivesPipelineStatisticIncludesCulledPrimitives; + _Out_ BOOL EnhancedBarriersSupported; + _Out_ BOOL RelaxedFormatCastingSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS12; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS13 + { + _Out_ BOOL UnrestrictedBufferTextureCopyPitchSupported; + _Out_ BOOL UnrestrictedVertexElementAlignmentSupported; + _Out_ BOOL InvertedViewportHeightFlipsYSupported; + _Out_ BOOL InvertedViewportDepthFlipsZSupported; + _Out_ BOOL TextureCopyBetweenDimensionsSupported; + _Out_ BOOL AlphaBlendFactorSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS13; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS14 + { + _Out_ BOOL AdvancedTextureOpsSupported; + _Out_ BOOL WriteableMSAATexturesSupported; + _Out_ BOOL IndependentFrontAndBackStencilRefMaskSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS14; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS15 + { + _Out_ BOOL TriangleFanSupported; + _Out_ BOOL DynamicIndexBufferStripCutSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS15; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS16 + { + _Out_ BOOL DynamicDepthBiasSupported; + _Out_ BOOL GPUUploadHeapSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS16; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS17 + { + _Out_ BOOL NonNormalizedCoordinateSamplersSupported; + _Out_ BOOL ManualWriteTrackingResourceSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS17; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS18 + { + _Out_ BOOL RenderPassesValid; + } D3D12_FEATURE_DATA_D3D12_OPTIONS18; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS19 + { + BOOL MismatchingOutputDimensionsSupported; + UINT SupportedSampleCountsWithNoOutputs; + BOOL PointSamplingAddressesNeverRoundUp; + BOOL RasterizerDesc2Supported; + BOOL NarrowQuadrilateralLinesSupported; + BOOL AnisoFilterWithPointMipSupported; + UINT MaxSamplerDescriptorHeapSize; + UINT MaxSamplerDescriptorHeapSizeWithStaticSamplers; + UINT MaxViewDescriptorHeapSize; + _Out_ BOOL ComputeOnlyCustomHeapSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS19; + +typedef +enum D3D12_RECREATE_AT_TIER + { + D3D12_RECREATE_AT_TIER_NOT_SUPPORTED = 0, + D3D12_RECREATE_AT_TIER_1 = 1 + } D3D12_RECREATE_AT_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS20 + { + _Out_ BOOL ComputeOnlyWriteWatchSupported; + D3D12_RECREATE_AT_TIER RecreateAtTier; + } D3D12_FEATURE_DATA_D3D12_OPTIONS20; + +typedef +enum D3D12_EXECUTE_INDIRECT_TIER + { + D3D12_EXECUTE_INDIRECT_TIER_1_0 = 10, + D3D12_EXECUTE_INDIRECT_TIER_1_1 = 11 + } D3D12_EXECUTE_INDIRECT_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS21 + { + _Out_ D3D12_WORK_GRAPHS_TIER WorkGraphsTier; + _Out_ D3D12_EXECUTE_INDIRECT_TIER ExecuteIndirectTier; + _Out_ BOOL SampleCmpGradientAndBiasSupported; + _Out_ BOOL ExtendedCommandInfoSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS21; + +typedef struct D3D12_FEATURE_DATA_PREDICATION + { + _Out_ BOOL Supported; + } D3D12_FEATURE_DATA_PREDICATION; + +typedef struct D3D12_FEATURE_DATA_HARDWARE_COPY + { + _Out_ BOOL Supported; + } D3D12_FEATURE_DATA_HARDWARE_COPY; + +typedef struct D3D12_RESOURCE_ALLOCATION_INFO + { + UINT64 SizeInBytes; + UINT64 Alignment; + } D3D12_RESOURCE_ALLOCATION_INFO; + +typedef struct D3D12_RESOURCE_ALLOCATION_INFO1 + { + UINT64 Offset; + UINT64 Alignment; + UINT64 SizeInBytes; + } D3D12_RESOURCE_ALLOCATION_INFO1; + +typedef +enum D3D12_HEAP_TYPE + { + D3D12_HEAP_TYPE_DEFAULT = 1, + D3D12_HEAP_TYPE_UPLOAD = 2, + D3D12_HEAP_TYPE_READBACK = 3, + D3D12_HEAP_TYPE_CUSTOM = 4, + D3D12_HEAP_TYPE_GPU_UPLOAD = 5 + } D3D12_HEAP_TYPE; + +typedef +enum D3D12_CPU_PAGE_PROPERTY + { + D3D12_CPU_PAGE_PROPERTY_UNKNOWN = 0, + D3D12_CPU_PAGE_PROPERTY_NOT_AVAILABLE = 1, + D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE = 2, + D3D12_CPU_PAGE_PROPERTY_WRITE_BACK = 3 + } D3D12_CPU_PAGE_PROPERTY; + +typedef +enum D3D12_MEMORY_POOL + { + D3D12_MEMORY_POOL_UNKNOWN = 0, + D3D12_MEMORY_POOL_L0 = 1, + D3D12_MEMORY_POOL_L1 = 2 + } D3D12_MEMORY_POOL; + +typedef struct D3D12_HEAP_PROPERTIES + { + D3D12_HEAP_TYPE Type; + D3D12_CPU_PAGE_PROPERTY CPUPageProperty; + D3D12_MEMORY_POOL MemoryPoolPreference; + UINT CreationNodeMask; + UINT VisibleNodeMask; + } D3D12_HEAP_PROPERTIES; + +typedef +enum D3D12_HEAP_FLAGS + { + D3D12_HEAP_FLAG_NONE = 0, + D3D12_HEAP_FLAG_SHARED = 0x1, + D3D12_HEAP_FLAG_DENY_BUFFERS = 0x4, + D3D12_HEAP_FLAG_ALLOW_DISPLAY = 0x8, + D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER = 0x20, + D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES = 0x40, + D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES = 0x80, + D3D12_HEAP_FLAG_HARDWARE_PROTECTED = 0x100, + D3D12_HEAP_FLAG_ALLOW_WRITE_WATCH = 0x200, + D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS = 0x400, + D3D12_HEAP_FLAG_CREATE_NOT_RESIDENT = 0x800, + D3D12_HEAP_FLAG_CREATE_NOT_ZEROED = 0x1000, + D3D12_HEAP_FLAG_TOOLS_USE_MANUAL_WRITE_TRACKING = 0x2000, + D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES = 0, + D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS = 0xc0, + D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES = 0x44, + D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES = 0x84 + } D3D12_HEAP_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_HEAP_FLAGS ) +typedef struct D3D12_HEAP_DESC + { + UINT64 SizeInBytes; + D3D12_HEAP_PROPERTIES Properties; + UINT64 Alignment; + D3D12_HEAP_FLAGS Flags; + } D3D12_HEAP_DESC; + +typedef +enum D3D12_RESOURCE_DIMENSION + { + D3D12_RESOURCE_DIMENSION_UNKNOWN = 0, + D3D12_RESOURCE_DIMENSION_BUFFER = 1, + D3D12_RESOURCE_DIMENSION_TEXTURE1D = 2, + D3D12_RESOURCE_DIMENSION_TEXTURE2D = 3, + D3D12_RESOURCE_DIMENSION_TEXTURE3D = 4 + } D3D12_RESOURCE_DIMENSION; + +typedef struct D3D12_FEATURE_DATA_PLACED_RESOURCE_SUPPORT_INFO + { + _In_ DXGI_FORMAT Format; + _In_ D3D12_RESOURCE_DIMENSION Dimension; + _In_ D3D12_HEAP_PROPERTIES DestHeapProperties; + _Out_ BOOL Supported; + } D3D12_FEATURE_DATA_PLACED_RESOURCE_SUPPORT_INFO; + +typedef +enum D3D12_TEXTURE_LAYOUT + { + D3D12_TEXTURE_LAYOUT_UNKNOWN = 0, + D3D12_TEXTURE_LAYOUT_ROW_MAJOR = 1, + D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE = 2, + D3D12_TEXTURE_LAYOUT_64KB_STANDARD_SWIZZLE = 3 + } D3D12_TEXTURE_LAYOUT; + +typedef +enum D3D12_RESOURCE_FLAGS + { + D3D12_RESOURCE_FLAG_NONE = 0, + D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET = 0x1, + D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL = 0x2, + D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS = 0x4, + D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE = 0x8, + D3D12_RESOURCE_FLAG_ALLOW_CROSS_ADAPTER = 0x10, + D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS = 0x20, + D3D12_RESOURCE_FLAG_VIDEO_DECODE_REFERENCE_ONLY = 0x40, + D3D12_RESOURCE_FLAG_VIDEO_ENCODE_REFERENCE_ONLY = 0x80, + D3D12_RESOURCE_FLAG_RAYTRACING_ACCELERATION_STRUCTURE = 0x100 + } D3D12_RESOURCE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RESOURCE_FLAGS ) +typedef struct D3D12_MIP_REGION + { + UINT Width; + UINT Height; + UINT Depth; + } D3D12_MIP_REGION; + +typedef struct D3D12_RESOURCE_DESC + { + D3D12_RESOURCE_DIMENSION Dimension; + UINT64 Alignment; + UINT64 Width; + UINT Height; + UINT16 DepthOrArraySize; + UINT16 MipLevels; + DXGI_FORMAT Format; + DXGI_SAMPLE_DESC SampleDesc; + D3D12_TEXTURE_LAYOUT Layout; + D3D12_RESOURCE_FLAGS Flags; + } D3D12_RESOURCE_DESC; + +typedef struct D3D12_RESOURCE_DESC1 + { + D3D12_RESOURCE_DIMENSION Dimension; + UINT64 Alignment; + UINT64 Width; + UINT Height; + UINT16 DepthOrArraySize; + UINT16 MipLevels; + DXGI_FORMAT Format; + DXGI_SAMPLE_DESC SampleDesc; + D3D12_TEXTURE_LAYOUT Layout; + D3D12_RESOURCE_FLAGS Flags; + D3D12_MIP_REGION SamplerFeedbackMipRegion; + } D3D12_RESOURCE_DESC1; + +typedef struct D3D12_DEPTH_STENCIL_VALUE + { + FLOAT Depth; + UINT8 Stencil; + } D3D12_DEPTH_STENCIL_VALUE; + +typedef struct D3D12_CLEAR_VALUE + { + DXGI_FORMAT Format; + union + { + FLOAT Color[ 4 ]; + D3D12_DEPTH_STENCIL_VALUE DepthStencil; + } ; + } D3D12_CLEAR_VALUE; + +typedef struct D3D12_RANGE + { + SIZE_T Begin; + SIZE_T End; + } D3D12_RANGE; + +typedef struct D3D12_RANGE_UINT64 + { + UINT64 Begin; + UINT64 End; + } D3D12_RANGE_UINT64; + +typedef struct D3D12_SUBRESOURCE_RANGE_UINT64 + { + UINT Subresource; + D3D12_RANGE_UINT64 Range; + } D3D12_SUBRESOURCE_RANGE_UINT64; + +typedef struct D3D12_SUBRESOURCE_INFO + { + UINT64 Offset; + UINT RowPitch; + UINT DepthPitch; + } D3D12_SUBRESOURCE_INFO; + +typedef struct D3D12_TILED_RESOURCE_COORDINATE + { + UINT X; + UINT Y; + UINT Z; + UINT Subresource; + } D3D12_TILED_RESOURCE_COORDINATE; + +typedef struct D3D12_TILE_REGION_SIZE + { + UINT NumTiles; + BOOL UseBox; + UINT Width; + UINT16 Height; + UINT16 Depth; + } D3D12_TILE_REGION_SIZE; + +typedef +enum D3D12_TILE_RANGE_FLAGS + { + D3D12_TILE_RANGE_FLAG_NONE = 0, + D3D12_TILE_RANGE_FLAG_NULL = 1, + D3D12_TILE_RANGE_FLAG_SKIP = 2, + D3D12_TILE_RANGE_FLAG_REUSE_SINGLE_TILE = 4 + } D3D12_TILE_RANGE_FLAGS; + +typedef struct D3D12_SUBRESOURCE_TILING + { + UINT WidthInTiles; + UINT16 HeightInTiles; + UINT16 DepthInTiles; + UINT StartTileIndexInOverallResource; + } D3D12_SUBRESOURCE_TILING; + +typedef struct D3D12_TILE_SHAPE + { + UINT WidthInTexels; + UINT HeightInTexels; + UINT DepthInTexels; + } D3D12_TILE_SHAPE; + +typedef struct D3D12_PACKED_MIP_INFO + { + UINT8 NumStandardMips; + UINT8 NumPackedMips; + UINT NumTilesForPackedMips; + UINT StartTileIndexInOverallResource; + } D3D12_PACKED_MIP_INFO; + +typedef +enum D3D12_TILE_MAPPING_FLAGS + { + D3D12_TILE_MAPPING_FLAG_NONE = 0, + D3D12_TILE_MAPPING_FLAG_NO_HAZARD = 0x1 + } D3D12_TILE_MAPPING_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_TILE_MAPPING_FLAGS ) +typedef +enum D3D12_TILE_COPY_FLAGS + { + D3D12_TILE_COPY_FLAG_NONE = 0, + D3D12_TILE_COPY_FLAG_NO_HAZARD = 0x1, + D3D12_TILE_COPY_FLAG_LINEAR_BUFFER_TO_SWIZZLED_TILED_RESOURCE = 0x2, + D3D12_TILE_COPY_FLAG_SWIZZLED_TILED_RESOURCE_TO_LINEAR_BUFFER = 0x4 + } D3D12_TILE_COPY_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_TILE_COPY_FLAGS ) +typedef +enum D3D12_RESOURCE_STATES + { + D3D12_RESOURCE_STATE_COMMON = 0, + D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER = 0x1, + D3D12_RESOURCE_STATE_INDEX_BUFFER = 0x2, + D3D12_RESOURCE_STATE_RENDER_TARGET = 0x4, + D3D12_RESOURCE_STATE_UNORDERED_ACCESS = 0x8, + D3D12_RESOURCE_STATE_DEPTH_WRITE = 0x10, + D3D12_RESOURCE_STATE_DEPTH_READ = 0x20, + D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE = 0x40, + D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE = 0x80, + D3D12_RESOURCE_STATE_STREAM_OUT = 0x100, + D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT = 0x200, + D3D12_RESOURCE_STATE_COPY_DEST = 0x400, + D3D12_RESOURCE_STATE_COPY_SOURCE = 0x800, + D3D12_RESOURCE_STATE_RESOLVE_DEST = 0x1000, + D3D12_RESOURCE_STATE_RESOLVE_SOURCE = 0x2000, + D3D12_RESOURCE_STATE_RAYTRACING_ACCELERATION_STRUCTURE = 0x400000, + D3D12_RESOURCE_STATE_SHADING_RATE_SOURCE = 0x1000000, + D3D12_RESOURCE_STATE_RESERVED_INTERNAL_8000 = 0x8000, + D3D12_RESOURCE_STATE_RESERVED_INTERNAL_4000 = 0x4000, + D3D12_RESOURCE_STATE_RESERVED_INTERNAL_100000 = 0x100000, + D3D12_RESOURCE_STATE_RESERVED_INTERNAL_40000000 = 0x40000000, + D3D12_RESOURCE_STATE_RESERVED_INTERNAL_80000000 = 0x80000000, + D3D12_RESOURCE_STATE_GENERIC_READ = ( ( ( ( ( 0x1 | 0x2 ) | 0x40 ) | 0x80 ) | 0x200 ) | 0x800 ) , + D3D12_RESOURCE_STATE_ALL_SHADER_RESOURCE = ( 0x40 | 0x80 ) , + D3D12_RESOURCE_STATE_PRESENT = 0, + D3D12_RESOURCE_STATE_PREDICATION = 0x200, + D3D12_RESOURCE_STATE_VIDEO_DECODE_READ = 0x10000, + D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE = 0x20000, + D3D12_RESOURCE_STATE_VIDEO_PROCESS_READ = 0x40000, + D3D12_RESOURCE_STATE_VIDEO_PROCESS_WRITE = 0x80000, + D3D12_RESOURCE_STATE_VIDEO_ENCODE_READ = 0x200000, + D3D12_RESOURCE_STATE_VIDEO_ENCODE_WRITE = 0x800000 + } D3D12_RESOURCE_STATES; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RESOURCE_STATES ) +typedef +enum D3D12_RESOURCE_BARRIER_TYPE + { + D3D12_RESOURCE_BARRIER_TYPE_TRANSITION = 0, + D3D12_RESOURCE_BARRIER_TYPE_ALIASING = ( D3D12_RESOURCE_BARRIER_TYPE_TRANSITION + 1 ) , + D3D12_RESOURCE_BARRIER_TYPE_UAV = ( D3D12_RESOURCE_BARRIER_TYPE_ALIASING + 1 ) + } D3D12_RESOURCE_BARRIER_TYPE; + + +typedef struct D3D12_RESOURCE_TRANSITION_BARRIER + { + ID3D12Resource *pResource; + UINT Subresource; + D3D12_RESOURCE_STATES StateBefore; + D3D12_RESOURCE_STATES StateAfter; + } D3D12_RESOURCE_TRANSITION_BARRIER; + +typedef struct D3D12_RESOURCE_ALIASING_BARRIER + { + ID3D12Resource *pResourceBefore; + ID3D12Resource *pResourceAfter; + } D3D12_RESOURCE_ALIASING_BARRIER; + +typedef struct D3D12_RESOURCE_UAV_BARRIER + { + ID3D12Resource *pResource; + } D3D12_RESOURCE_UAV_BARRIER; + +typedef +enum D3D12_RESOURCE_BARRIER_FLAGS + { + D3D12_RESOURCE_BARRIER_FLAG_NONE = 0, + D3D12_RESOURCE_BARRIER_FLAG_BEGIN_ONLY = 0x1, + D3D12_RESOURCE_BARRIER_FLAG_END_ONLY = 0x2 + } D3D12_RESOURCE_BARRIER_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RESOURCE_BARRIER_FLAGS ) +typedef struct D3D12_RESOURCE_BARRIER + { + D3D12_RESOURCE_BARRIER_TYPE Type; + D3D12_RESOURCE_BARRIER_FLAGS Flags; + union + { + D3D12_RESOURCE_TRANSITION_BARRIER Transition; + D3D12_RESOURCE_ALIASING_BARRIER Aliasing; + D3D12_RESOURCE_UAV_BARRIER UAV; + } ; + } D3D12_RESOURCE_BARRIER; + +typedef struct D3D12_SUBRESOURCE_FOOTPRINT + { + DXGI_FORMAT Format; + UINT Width; + UINT Height; + UINT Depth; + UINT RowPitch; + } D3D12_SUBRESOURCE_FOOTPRINT; + +typedef struct D3D12_PLACED_SUBRESOURCE_FOOTPRINT + { + UINT64 Offset; + D3D12_SUBRESOURCE_FOOTPRINT Footprint; + } D3D12_PLACED_SUBRESOURCE_FOOTPRINT; + +typedef +enum D3D12_TEXTURE_COPY_TYPE + { + D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX = 0, + D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT = 1 + } D3D12_TEXTURE_COPY_TYPE; + +typedef struct D3D12_TEXTURE_COPY_LOCATION + { + ID3D12Resource *pResource; + D3D12_TEXTURE_COPY_TYPE Type; + union + { + D3D12_PLACED_SUBRESOURCE_FOOTPRINT PlacedFootprint; + UINT SubresourceIndex; + } ; + } D3D12_TEXTURE_COPY_LOCATION; + +typedef +enum D3D12_RESOLVE_MODE + { + D3D12_RESOLVE_MODE_DECOMPRESS = 0, + D3D12_RESOLVE_MODE_MIN = 1, + D3D12_RESOLVE_MODE_MAX = 2, + D3D12_RESOLVE_MODE_AVERAGE = 3, + D3D12_RESOLVE_MODE_ENCODE_SAMPLER_FEEDBACK = 4, + D3D12_RESOLVE_MODE_DECODE_SAMPLER_FEEDBACK = 5 + } D3D12_RESOLVE_MODE; + +typedef struct D3D12_SAMPLE_POSITION + { + INT8 X; + INT8 Y; + } D3D12_SAMPLE_POSITION; + +typedef struct D3D12_VIEW_INSTANCE_LOCATION + { + UINT ViewportArrayIndex; + UINT RenderTargetArrayIndex; + } D3D12_VIEW_INSTANCE_LOCATION; + +typedef +enum D3D12_VIEW_INSTANCING_FLAGS + { + D3D12_VIEW_INSTANCING_FLAG_NONE = 0, + D3D12_VIEW_INSTANCING_FLAG_ENABLE_VIEW_INSTANCE_MASKING = 0x1 + } D3D12_VIEW_INSTANCING_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_VIEW_INSTANCING_FLAGS ) +typedef struct D3D12_VIEW_INSTANCING_DESC + { + UINT ViewInstanceCount; + _Field_size_full_(ViewInstanceCount) const D3D12_VIEW_INSTANCE_LOCATION *pViewInstanceLocations; + D3D12_VIEW_INSTANCING_FLAGS Flags; + } D3D12_VIEW_INSTANCING_DESC; + +typedef +enum D3D12_SHADER_COMPONENT_MAPPING + { + D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0 = 0, + D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1 = 1, + D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2 = 2, + D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3 = 3, + D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0 = 4, + D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1 = 5 + } D3D12_SHADER_COMPONENT_MAPPING; + +#define D3D12_SHADER_COMPONENT_MAPPING_MASK 0x7 +#define D3D12_SHADER_COMPONENT_MAPPING_SHIFT 3 +#define D3D12_SHADER_COMPONENT_MAPPING_ALWAYS_SET_BIT_AVOIDING_ZEROMEM_MISTAKES (1<<(D3D12_SHADER_COMPONENT_MAPPING_SHIFT*4)) +#define D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(Src0,Src1,Src2,Src3) ((((Src0)&D3D12_SHADER_COMPONENT_MAPPING_MASK)| \ + (((Src1)&D3D12_SHADER_COMPONENT_MAPPING_MASK)<> (D3D12_SHADER_COMPONENT_MAPPING_SHIFT*ComponentToExtract) & D3D12_SHADER_COMPONENT_MAPPING_MASK)) +#define D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(0,1,2,3) +typedef +enum D3D12_BUFFER_SRV_FLAGS + { + D3D12_BUFFER_SRV_FLAG_NONE = 0, + D3D12_BUFFER_SRV_FLAG_RAW = 0x1 + } D3D12_BUFFER_SRV_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_BUFFER_SRV_FLAGS ) +typedef struct D3D12_BUFFER_SRV + { + UINT64 FirstElement; + UINT NumElements; + UINT StructureByteStride; + D3D12_BUFFER_SRV_FLAGS Flags; + } D3D12_BUFFER_SRV; + +typedef struct D3D12_TEX1D_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + FLOAT ResourceMinLODClamp; + } D3D12_TEX1D_SRV; + +typedef struct D3D12_TEX1D_ARRAY_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; + FLOAT ResourceMinLODClamp; + } D3D12_TEX1D_ARRAY_SRV; + +typedef struct D3D12_TEX2D_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + UINT PlaneSlice; + FLOAT ResourceMinLODClamp; + } D3D12_TEX2D_SRV; + +typedef struct D3D12_TEX2D_ARRAY_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; + UINT PlaneSlice; + FLOAT ResourceMinLODClamp; + } D3D12_TEX2D_ARRAY_SRV; + +typedef struct D3D12_TEX3D_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + FLOAT ResourceMinLODClamp; + } D3D12_TEX3D_SRV; + +typedef struct D3D12_TEXCUBE_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + FLOAT ResourceMinLODClamp; + } D3D12_TEXCUBE_SRV; + +typedef struct D3D12_TEXCUBE_ARRAY_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + UINT First2DArrayFace; + UINT NumCubes; + FLOAT ResourceMinLODClamp; + } D3D12_TEXCUBE_ARRAY_SRV; + +typedef struct D3D12_TEX2DMS_SRV + { + UINT UnusedField_NothingToDefine; + } D3D12_TEX2DMS_SRV; + +typedef struct D3D12_TEX2DMS_ARRAY_SRV + { + UINT FirstArraySlice; + UINT ArraySize; + } D3D12_TEX2DMS_ARRAY_SRV; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV + { + D3D12_GPU_VIRTUAL_ADDRESS Location; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV; + +typedef +enum D3D12_SRV_DIMENSION + { + D3D12_SRV_DIMENSION_UNKNOWN = 0, + D3D12_SRV_DIMENSION_BUFFER = 1, + D3D12_SRV_DIMENSION_TEXTURE1D = 2, + D3D12_SRV_DIMENSION_TEXTURE1DARRAY = 3, + D3D12_SRV_DIMENSION_TEXTURE2D = 4, + D3D12_SRV_DIMENSION_TEXTURE2DARRAY = 5, + D3D12_SRV_DIMENSION_TEXTURE2DMS = 6, + D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D12_SRV_DIMENSION_TEXTURE3D = 8, + D3D12_SRV_DIMENSION_TEXTURECUBE = 9, + D3D12_SRV_DIMENSION_TEXTURECUBEARRAY = 10, + D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE = 11 + } D3D12_SRV_DIMENSION; + +typedef struct D3D12_SHADER_RESOURCE_VIEW_DESC + { + DXGI_FORMAT Format; + D3D12_SRV_DIMENSION ViewDimension; + UINT Shader4ComponentMapping; + union + { + D3D12_BUFFER_SRV Buffer; + D3D12_TEX1D_SRV Texture1D; + D3D12_TEX1D_ARRAY_SRV Texture1DArray; + D3D12_TEX2D_SRV Texture2D; + D3D12_TEX2D_ARRAY_SRV Texture2DArray; + D3D12_TEX2DMS_SRV Texture2DMS; + D3D12_TEX2DMS_ARRAY_SRV Texture2DMSArray; + D3D12_TEX3D_SRV Texture3D; + D3D12_TEXCUBE_SRV TextureCube; + D3D12_TEXCUBE_ARRAY_SRV TextureCubeArray; + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV RaytracingAccelerationStructure; + } ; + } D3D12_SHADER_RESOURCE_VIEW_DESC; + +typedef struct D3D12_CONSTANT_BUFFER_VIEW_DESC + { + D3D12_GPU_VIRTUAL_ADDRESS BufferLocation; + UINT SizeInBytes; + } D3D12_CONSTANT_BUFFER_VIEW_DESC; + +typedef +enum D3D12_FILTER + { + D3D12_FILTER_MIN_MAG_MIP_POINT = 0, + D3D12_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, + D3D12_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, + D3D12_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, + D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, + D3D12_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, + D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, + D3D12_FILTER_MIN_MAG_MIP_LINEAR = 0x15, + D3D12_FILTER_MIN_MAG_ANISOTROPIC_MIP_POINT = 0x54, + D3D12_FILTER_ANISOTROPIC = 0x55, + D3D12_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, + D3D12_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, + D3D12_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, + D3D12_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, + D3D12_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, + D3D12_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, + D3D12_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, + D3D12_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, + D3D12_FILTER_COMPARISON_MIN_MAG_ANISOTROPIC_MIP_POINT = 0xd4, + D3D12_FILTER_COMPARISON_ANISOTROPIC = 0xd5, + D3D12_FILTER_MINIMUM_MIN_MAG_MIP_POINT = 0x100, + D3D12_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x101, + D3D12_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x104, + D3D12_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x105, + D3D12_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x110, + D3D12_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x111, + D3D12_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x114, + D3D12_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR = 0x115, + D3D12_FILTER_MINIMUM_MIN_MAG_ANISOTROPIC_MIP_POINT = 0x154, + D3D12_FILTER_MINIMUM_ANISOTROPIC = 0x155, + D3D12_FILTER_MAXIMUM_MIN_MAG_MIP_POINT = 0x180, + D3D12_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x181, + D3D12_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x184, + D3D12_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x185, + D3D12_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x190, + D3D12_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x191, + D3D12_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x194, + D3D12_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = 0x195, + D3D12_FILTER_MAXIMUM_MIN_MAG_ANISOTROPIC_MIP_POINT = 0x1d4, + D3D12_FILTER_MAXIMUM_ANISOTROPIC = 0x1d5 + } D3D12_FILTER; + +typedef +enum D3D12_FILTER_TYPE + { + D3D12_FILTER_TYPE_POINT = 0, + D3D12_FILTER_TYPE_LINEAR = 1 + } D3D12_FILTER_TYPE; + +typedef +enum D3D12_FILTER_REDUCTION_TYPE + { + D3D12_FILTER_REDUCTION_TYPE_STANDARD = 0, + D3D12_FILTER_REDUCTION_TYPE_COMPARISON = 1, + D3D12_FILTER_REDUCTION_TYPE_MINIMUM = 2, + D3D12_FILTER_REDUCTION_TYPE_MAXIMUM = 3 + } D3D12_FILTER_REDUCTION_TYPE; + +#define D3D12_FILTER_REDUCTION_TYPE_MASK ( 0x3 ) + +#define D3D12_FILTER_REDUCTION_TYPE_SHIFT ( 7 ) + +#define D3D12_FILTER_TYPE_MASK ( 0x3 ) + +#define D3D12_MIN_FILTER_SHIFT ( 4 ) + +#define D3D12_MAG_FILTER_SHIFT ( 2 ) + +#define D3D12_MIP_FILTER_SHIFT ( 0 ) + +#define D3D12_ANISOTROPIC_FILTERING_BIT ( 0x40 ) + +#define D3D12_ENCODE_BASIC_FILTER( min, mag, mip, reduction ) \ + ( ( D3D12_FILTER ) ( \ + ( ( ( min ) & D3D12_FILTER_TYPE_MASK ) << D3D12_MIN_FILTER_SHIFT ) | \ + ( ( ( mag ) & D3D12_FILTER_TYPE_MASK ) << D3D12_MAG_FILTER_SHIFT ) | \ + ( ( ( mip ) & D3D12_FILTER_TYPE_MASK ) << D3D12_MIP_FILTER_SHIFT ) | \ + ( ( ( reduction ) & D3D12_FILTER_REDUCTION_TYPE_MASK ) << D3D12_FILTER_REDUCTION_TYPE_SHIFT ) ) ) +#define D3D12_ENCODE_ANISOTROPIC_FILTER( reduction ) \ + ( ( D3D12_FILTER ) ( \ + D3D12_ANISOTROPIC_FILTERING_BIT | \ + D3D12_ENCODE_BASIC_FILTER( D3D12_FILTER_TYPE_LINEAR, \ + D3D12_FILTER_TYPE_LINEAR, \ + D3D12_FILTER_TYPE_LINEAR, \ + reduction ) ) ) +#define D3D12_ENCODE_MIN_MAG_ANISOTROPIC_MIP_POINT_FILTER( reduction ) \ + ( ( D3D12_FILTER ) ( \ + D3D12_ANISOTROPIC_FILTERING_BIT | \ + D3D12_ENCODE_BASIC_FILTER( D3D12_FILTER_TYPE_LINEAR, \ + D3D12_FILTER_TYPE_LINEAR, \ + D3D12_FILTER_TYPE_POINT, \ + reduction ) ) ) +#define D3D12_DECODE_MIN_FILTER( D3D12Filter ) \ + ( ( D3D12_FILTER_TYPE ) \ + ( ( ( D3D12Filter ) >> D3D12_MIN_FILTER_SHIFT ) & D3D12_FILTER_TYPE_MASK ) ) +#define D3D12_DECODE_MAG_FILTER( D3D12Filter ) \ + ( ( D3D12_FILTER_TYPE ) \ + ( ( ( D3D12Filter ) >> D3D12_MAG_FILTER_SHIFT ) & D3D12_FILTER_TYPE_MASK ) ) +#define D3D12_DECODE_MIP_FILTER( D3D12Filter ) \ + ( ( D3D12_FILTER_TYPE ) \ + ( ( ( D3D12Filter ) >> D3D12_MIP_FILTER_SHIFT ) & D3D12_FILTER_TYPE_MASK ) ) +#define D3D12_DECODE_FILTER_REDUCTION( D3D12Filter ) \ + ( ( D3D12_FILTER_REDUCTION_TYPE ) \ + ( ( ( D3D12Filter ) >> D3D12_FILTER_REDUCTION_TYPE_SHIFT ) & D3D12_FILTER_REDUCTION_TYPE_MASK ) ) +#define D3D12_DECODE_IS_COMPARISON_FILTER( D3D12Filter ) \ + ( D3D12_DECODE_FILTER_REDUCTION( D3D12Filter ) == D3D12_FILTER_REDUCTION_TYPE_COMPARISON ) +#define D3D12_DECODE_IS_ANISOTROPIC_FILTER( D3D12Filter ) \ + ( ( ( D3D12Filter ) & D3D12_ANISOTROPIC_FILTERING_BIT ) && \ + ( D3D12_FILTER_TYPE_LINEAR == D3D12_DECODE_MIN_FILTER( D3D12Filter ) ) && \ + ( D3D12_FILTER_TYPE_LINEAR == D3D12_DECODE_MAG_FILTER( D3D12Filter ) ) ) +typedef +enum D3D12_TEXTURE_ADDRESS_MODE + { + D3D12_TEXTURE_ADDRESS_MODE_WRAP = 1, + D3D12_TEXTURE_ADDRESS_MODE_MIRROR = 2, + D3D12_TEXTURE_ADDRESS_MODE_CLAMP = 3, + D3D12_TEXTURE_ADDRESS_MODE_BORDER = 4, + D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE = 5 + } D3D12_TEXTURE_ADDRESS_MODE; + +typedef struct D3D12_SAMPLER_DESC + { + D3D12_FILTER Filter; + D3D12_TEXTURE_ADDRESS_MODE AddressU; + D3D12_TEXTURE_ADDRESS_MODE AddressV; + D3D12_TEXTURE_ADDRESS_MODE AddressW; + FLOAT MipLODBias; + UINT MaxAnisotropy; + D3D12_COMPARISON_FUNC ComparisonFunc; + FLOAT BorderColor[ 4 ]; + FLOAT MinLOD; + FLOAT MaxLOD; + } D3D12_SAMPLER_DESC; + +typedef +enum D3D12_SAMPLER_FLAGS + { + D3D12_SAMPLER_FLAG_NONE = 0, + D3D12_SAMPLER_FLAG_UINT_BORDER_COLOR = 0x1, + D3D12_SAMPLER_FLAG_NON_NORMALIZED_COORDINATES = 0x2 + } D3D12_SAMPLER_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_SAMPLER_FLAGS ) +typedef struct D3D12_SAMPLER_DESC2 + { + D3D12_FILTER Filter; + D3D12_TEXTURE_ADDRESS_MODE AddressU; + D3D12_TEXTURE_ADDRESS_MODE AddressV; + D3D12_TEXTURE_ADDRESS_MODE AddressW; + FLOAT MipLODBias; + UINT MaxAnisotropy; + D3D12_COMPARISON_FUNC ComparisonFunc; + union + { + FLOAT FloatBorderColor[ 4 ]; + UINT UintBorderColor[ 4 ]; + } ; + FLOAT MinLOD; + FLOAT MaxLOD; + D3D12_SAMPLER_FLAGS Flags; + } D3D12_SAMPLER_DESC2; + +typedef +enum D3D12_BUFFER_UAV_FLAGS + { + D3D12_BUFFER_UAV_FLAG_NONE = 0, + D3D12_BUFFER_UAV_FLAG_RAW = 0x1 + } D3D12_BUFFER_UAV_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_BUFFER_UAV_FLAGS ) +typedef struct D3D12_BUFFER_UAV + { + UINT64 FirstElement; + UINT NumElements; + UINT StructureByteStride; + UINT64 CounterOffsetInBytes; + D3D12_BUFFER_UAV_FLAGS Flags; + } D3D12_BUFFER_UAV; + +typedef struct D3D12_TEX1D_UAV + { + UINT MipSlice; + } D3D12_TEX1D_UAV; + +typedef struct D3D12_TEX1D_ARRAY_UAV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D12_TEX1D_ARRAY_UAV; + +typedef struct D3D12_TEX2D_UAV + { + UINT MipSlice; + UINT PlaneSlice; + } D3D12_TEX2D_UAV; + +typedef struct D3D12_TEX2D_ARRAY_UAV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + UINT PlaneSlice; + } D3D12_TEX2D_ARRAY_UAV; + +typedef struct D3D12_TEX2DMS_UAV + { + UINT UnusedField_NothingToDefine; + } D3D12_TEX2DMS_UAV; + +typedef struct D3D12_TEX2DMS_ARRAY_UAV + { + UINT FirstArraySlice; + UINT ArraySize; + } D3D12_TEX2DMS_ARRAY_UAV; + +typedef struct D3D12_TEX3D_UAV + { + UINT MipSlice; + UINT FirstWSlice; + UINT WSize; + } D3D12_TEX3D_UAV; + +typedef +enum D3D12_UAV_DIMENSION + { + D3D12_UAV_DIMENSION_UNKNOWN = 0, + D3D12_UAV_DIMENSION_BUFFER = 1, + D3D12_UAV_DIMENSION_TEXTURE1D = 2, + D3D12_UAV_DIMENSION_TEXTURE1DARRAY = 3, + D3D12_UAV_DIMENSION_TEXTURE2D = 4, + D3D12_UAV_DIMENSION_TEXTURE2DARRAY = 5, + D3D12_UAV_DIMENSION_TEXTURE2DMS = 6, + D3D12_UAV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D12_UAV_DIMENSION_TEXTURE3D = 8 + } D3D12_UAV_DIMENSION; + +typedef struct D3D12_UNORDERED_ACCESS_VIEW_DESC + { + DXGI_FORMAT Format; + D3D12_UAV_DIMENSION ViewDimension; + union + { + D3D12_BUFFER_UAV Buffer; + D3D12_TEX1D_UAV Texture1D; + D3D12_TEX1D_ARRAY_UAV Texture1DArray; + D3D12_TEX2D_UAV Texture2D; + D3D12_TEX2D_ARRAY_UAV Texture2DArray; + D3D12_TEX2DMS_UAV Texture2DMS; + D3D12_TEX2DMS_ARRAY_UAV Texture2DMSArray; + D3D12_TEX3D_UAV Texture3D; + } ; + } D3D12_UNORDERED_ACCESS_VIEW_DESC; + +typedef struct D3D12_BUFFER_RTV + { + UINT64 FirstElement; + UINT NumElements; + } D3D12_BUFFER_RTV; + +typedef struct D3D12_TEX1D_RTV + { + UINT MipSlice; + } D3D12_TEX1D_RTV; + +typedef struct D3D12_TEX1D_ARRAY_RTV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D12_TEX1D_ARRAY_RTV; + +typedef struct D3D12_TEX2D_RTV + { + UINT MipSlice; + UINT PlaneSlice; + } D3D12_TEX2D_RTV; + +typedef struct D3D12_TEX2DMS_RTV + { + UINT UnusedField_NothingToDefine; + } D3D12_TEX2DMS_RTV; + +typedef struct D3D12_TEX2D_ARRAY_RTV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + UINT PlaneSlice; + } D3D12_TEX2D_ARRAY_RTV; + +typedef struct D3D12_TEX2DMS_ARRAY_RTV + { + UINT FirstArraySlice; + UINT ArraySize; + } D3D12_TEX2DMS_ARRAY_RTV; + +typedef struct D3D12_TEX3D_RTV + { + UINT MipSlice; + UINT FirstWSlice; + UINT WSize; + } D3D12_TEX3D_RTV; + +typedef +enum D3D12_RTV_DIMENSION + { + D3D12_RTV_DIMENSION_UNKNOWN = 0, + D3D12_RTV_DIMENSION_BUFFER = 1, + D3D12_RTV_DIMENSION_TEXTURE1D = 2, + D3D12_RTV_DIMENSION_TEXTURE1DARRAY = 3, + D3D12_RTV_DIMENSION_TEXTURE2D = 4, + D3D12_RTV_DIMENSION_TEXTURE2DARRAY = 5, + D3D12_RTV_DIMENSION_TEXTURE2DMS = 6, + D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D12_RTV_DIMENSION_TEXTURE3D = 8 + } D3D12_RTV_DIMENSION; + +typedef struct D3D12_RENDER_TARGET_VIEW_DESC + { + DXGI_FORMAT Format; + D3D12_RTV_DIMENSION ViewDimension; + union + { + D3D12_BUFFER_RTV Buffer; + D3D12_TEX1D_RTV Texture1D; + D3D12_TEX1D_ARRAY_RTV Texture1DArray; + D3D12_TEX2D_RTV Texture2D; + D3D12_TEX2D_ARRAY_RTV Texture2DArray; + D3D12_TEX2DMS_RTV Texture2DMS; + D3D12_TEX2DMS_ARRAY_RTV Texture2DMSArray; + D3D12_TEX3D_RTV Texture3D; + } ; + } D3D12_RENDER_TARGET_VIEW_DESC; + +typedef struct D3D12_TEX1D_DSV + { + UINT MipSlice; + } D3D12_TEX1D_DSV; + +typedef struct D3D12_TEX1D_ARRAY_DSV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D12_TEX1D_ARRAY_DSV; + +typedef struct D3D12_TEX2D_DSV + { + UINT MipSlice; + } D3D12_TEX2D_DSV; + +typedef struct D3D12_TEX2D_ARRAY_DSV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D12_TEX2D_ARRAY_DSV; + +typedef struct D3D12_TEX2DMS_DSV + { + UINT UnusedField_NothingToDefine; + } D3D12_TEX2DMS_DSV; + +typedef struct D3D12_TEX2DMS_ARRAY_DSV + { + UINT FirstArraySlice; + UINT ArraySize; + } D3D12_TEX2DMS_ARRAY_DSV; + +typedef +enum D3D12_DSV_FLAGS + { + D3D12_DSV_FLAG_NONE = 0, + D3D12_DSV_FLAG_READ_ONLY_DEPTH = 0x1, + D3D12_DSV_FLAG_READ_ONLY_STENCIL = 0x2 + } D3D12_DSV_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_DSV_FLAGS ) +typedef +enum D3D12_DSV_DIMENSION + { + D3D12_DSV_DIMENSION_UNKNOWN = 0, + D3D12_DSV_DIMENSION_TEXTURE1D = 1, + D3D12_DSV_DIMENSION_TEXTURE1DARRAY = 2, + D3D12_DSV_DIMENSION_TEXTURE2D = 3, + D3D12_DSV_DIMENSION_TEXTURE2DARRAY = 4, + D3D12_DSV_DIMENSION_TEXTURE2DMS = 5, + D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY = 6 + } D3D12_DSV_DIMENSION; + +typedef struct D3D12_DEPTH_STENCIL_VIEW_DESC + { + DXGI_FORMAT Format; + D3D12_DSV_DIMENSION ViewDimension; + D3D12_DSV_FLAGS Flags; + union + { + D3D12_TEX1D_DSV Texture1D; + D3D12_TEX1D_ARRAY_DSV Texture1DArray; + D3D12_TEX2D_DSV Texture2D; + D3D12_TEX2D_ARRAY_DSV Texture2DArray; + D3D12_TEX2DMS_DSV Texture2DMS; + D3D12_TEX2DMS_ARRAY_DSV Texture2DMSArray; + } ; + } D3D12_DEPTH_STENCIL_VIEW_DESC; + +typedef +enum D3D12_CLEAR_FLAGS + { + D3D12_CLEAR_FLAG_DEPTH = 0x1, + D3D12_CLEAR_FLAG_STENCIL = 0x2 + } D3D12_CLEAR_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_CLEAR_FLAGS ) +typedef +enum D3D12_FENCE_FLAGS + { + D3D12_FENCE_FLAG_NONE = 0, + D3D12_FENCE_FLAG_SHARED = 0x1, + D3D12_FENCE_FLAG_SHARED_CROSS_ADAPTER = 0x2, + D3D12_FENCE_FLAG_NON_MONITORED = 0x4 + } D3D12_FENCE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_FENCE_FLAGS ) +typedef +enum D3D12_DESCRIPTOR_HEAP_TYPE + { + D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV = 0, + D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER = ( D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV + 1 ) , + D3D12_DESCRIPTOR_HEAP_TYPE_RTV = ( D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER + 1 ) , + D3D12_DESCRIPTOR_HEAP_TYPE_DSV = ( D3D12_DESCRIPTOR_HEAP_TYPE_RTV + 1 ) , + D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES = ( D3D12_DESCRIPTOR_HEAP_TYPE_DSV + 1 ) + } D3D12_DESCRIPTOR_HEAP_TYPE; + +typedef +enum D3D12_DESCRIPTOR_HEAP_FLAGS + { + D3D12_DESCRIPTOR_HEAP_FLAG_NONE = 0, + D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE = 0x1 + } D3D12_DESCRIPTOR_HEAP_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_DESCRIPTOR_HEAP_FLAGS ) +typedef struct D3D12_DESCRIPTOR_HEAP_DESC + { + D3D12_DESCRIPTOR_HEAP_TYPE Type; + UINT NumDescriptors; + D3D12_DESCRIPTOR_HEAP_FLAGS Flags; + UINT NodeMask; + } D3D12_DESCRIPTOR_HEAP_DESC; + +typedef +enum D3D12_DESCRIPTOR_RANGE_TYPE + { + D3D12_DESCRIPTOR_RANGE_TYPE_SRV = 0, + D3D12_DESCRIPTOR_RANGE_TYPE_UAV = ( D3D12_DESCRIPTOR_RANGE_TYPE_SRV + 1 ) , + D3D12_DESCRIPTOR_RANGE_TYPE_CBV = ( D3D12_DESCRIPTOR_RANGE_TYPE_UAV + 1 ) , + D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER = ( D3D12_DESCRIPTOR_RANGE_TYPE_CBV + 1 ) + } D3D12_DESCRIPTOR_RANGE_TYPE; + +typedef struct D3D12_DESCRIPTOR_RANGE + { + D3D12_DESCRIPTOR_RANGE_TYPE RangeType; + UINT NumDescriptors; + UINT BaseShaderRegister; + UINT RegisterSpace; + UINT OffsetInDescriptorsFromTableStart; + } D3D12_DESCRIPTOR_RANGE; + +typedef struct D3D12_ROOT_DESCRIPTOR_TABLE + { + UINT NumDescriptorRanges; + _Field_size_full_(NumDescriptorRanges) const D3D12_DESCRIPTOR_RANGE *pDescriptorRanges; + } D3D12_ROOT_DESCRIPTOR_TABLE; + +typedef struct D3D12_ROOT_CONSTANTS + { + UINT ShaderRegister; + UINT RegisterSpace; + UINT Num32BitValues; + } D3D12_ROOT_CONSTANTS; + +typedef struct D3D12_ROOT_DESCRIPTOR + { + UINT ShaderRegister; + UINT RegisterSpace; + } D3D12_ROOT_DESCRIPTOR; + +typedef +enum D3D12_SHADER_VISIBILITY + { + D3D12_SHADER_VISIBILITY_ALL = 0, + D3D12_SHADER_VISIBILITY_VERTEX = 1, + D3D12_SHADER_VISIBILITY_HULL = 2, + D3D12_SHADER_VISIBILITY_DOMAIN = 3, + D3D12_SHADER_VISIBILITY_GEOMETRY = 4, + D3D12_SHADER_VISIBILITY_PIXEL = 5, + D3D12_SHADER_VISIBILITY_AMPLIFICATION = 6, + D3D12_SHADER_VISIBILITY_MESH = 7 + } D3D12_SHADER_VISIBILITY; + +typedef +enum D3D12_ROOT_PARAMETER_TYPE + { + D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE = 0, + D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS = ( D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE + 1 ) , + D3D12_ROOT_PARAMETER_TYPE_CBV = ( D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS + 1 ) , + D3D12_ROOT_PARAMETER_TYPE_SRV = ( D3D12_ROOT_PARAMETER_TYPE_CBV + 1 ) , + D3D12_ROOT_PARAMETER_TYPE_UAV = ( D3D12_ROOT_PARAMETER_TYPE_SRV + 1 ) + } D3D12_ROOT_PARAMETER_TYPE; + +typedef struct D3D12_ROOT_PARAMETER + { + D3D12_ROOT_PARAMETER_TYPE ParameterType; + union + { + D3D12_ROOT_DESCRIPTOR_TABLE DescriptorTable; + D3D12_ROOT_CONSTANTS Constants; + D3D12_ROOT_DESCRIPTOR Descriptor; + } ; + D3D12_SHADER_VISIBILITY ShaderVisibility; + } D3D12_ROOT_PARAMETER; + +typedef +enum D3D12_ROOT_SIGNATURE_FLAGS + { + D3D12_ROOT_SIGNATURE_FLAG_NONE = 0, + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT = 0x1, + D3D12_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS = 0x2, + D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS = 0x4, + D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS = 0x8, + D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS = 0x10, + D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS = 0x20, + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT = 0x40, + D3D12_ROOT_SIGNATURE_FLAG_LOCAL_ROOT_SIGNATURE = 0x80, + D3D12_ROOT_SIGNATURE_FLAG_DENY_AMPLIFICATION_SHADER_ROOT_ACCESS = 0x100, + D3D12_ROOT_SIGNATURE_FLAG_DENY_MESH_SHADER_ROOT_ACCESS = 0x200, + D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED = 0x400, + D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED = 0x800 + } D3D12_ROOT_SIGNATURE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_ROOT_SIGNATURE_FLAGS ) +typedef +enum D3D12_STATIC_BORDER_COLOR + { + D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK = 0, + D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK = ( D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK + 1 ) , + D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE = ( D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK + 1 ) , + D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK_UINT = ( D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE + 1 ) , + D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE_UINT = ( D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK_UINT + 1 ) + } D3D12_STATIC_BORDER_COLOR; + +typedef struct D3D12_STATIC_SAMPLER_DESC + { + D3D12_FILTER Filter; + D3D12_TEXTURE_ADDRESS_MODE AddressU; + D3D12_TEXTURE_ADDRESS_MODE AddressV; + D3D12_TEXTURE_ADDRESS_MODE AddressW; + FLOAT MipLODBias; + UINT MaxAnisotropy; + D3D12_COMPARISON_FUNC ComparisonFunc; + D3D12_STATIC_BORDER_COLOR BorderColor; + FLOAT MinLOD; + FLOAT MaxLOD; + UINT ShaderRegister; + UINT RegisterSpace; + D3D12_SHADER_VISIBILITY ShaderVisibility; + } D3D12_STATIC_SAMPLER_DESC; + +typedef struct D3D12_STATIC_SAMPLER_DESC1 + { + D3D12_FILTER Filter; + D3D12_TEXTURE_ADDRESS_MODE AddressU; + D3D12_TEXTURE_ADDRESS_MODE AddressV; + D3D12_TEXTURE_ADDRESS_MODE AddressW; + FLOAT MipLODBias; + UINT MaxAnisotropy; + D3D12_COMPARISON_FUNC ComparisonFunc; + D3D12_STATIC_BORDER_COLOR BorderColor; + FLOAT MinLOD; + FLOAT MaxLOD; + UINT ShaderRegister; + UINT RegisterSpace; + D3D12_SHADER_VISIBILITY ShaderVisibility; + D3D12_SAMPLER_FLAGS Flags; + } D3D12_STATIC_SAMPLER_DESC1; + +typedef struct D3D12_ROOT_SIGNATURE_DESC + { + UINT NumParameters; + _Field_size_full_(NumParameters) const D3D12_ROOT_PARAMETER *pParameters; + UINT NumStaticSamplers; + _Field_size_full_(NumStaticSamplers) const D3D12_STATIC_SAMPLER_DESC *pStaticSamplers; + D3D12_ROOT_SIGNATURE_FLAGS Flags; + } D3D12_ROOT_SIGNATURE_DESC; + +typedef +enum D3D12_DESCRIPTOR_RANGE_FLAGS + { + D3D12_DESCRIPTOR_RANGE_FLAG_NONE = 0, + D3D12_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_VOLATILE = 0x1, + D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE = 0x2, + D3D12_DESCRIPTOR_RANGE_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE = 0x4, + D3D12_DESCRIPTOR_RANGE_FLAG_DATA_STATIC = 0x8, + D3D12_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS = 0x10000 + } D3D12_DESCRIPTOR_RANGE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_DESCRIPTOR_RANGE_FLAGS ) +typedef struct D3D12_DESCRIPTOR_RANGE1 + { + D3D12_DESCRIPTOR_RANGE_TYPE RangeType; + UINT NumDescriptors; + UINT BaseShaderRegister; + UINT RegisterSpace; + D3D12_DESCRIPTOR_RANGE_FLAGS Flags; + UINT OffsetInDescriptorsFromTableStart; + } D3D12_DESCRIPTOR_RANGE1; + +typedef struct D3D12_ROOT_DESCRIPTOR_TABLE1 + { + UINT NumDescriptorRanges; + _Field_size_full_(NumDescriptorRanges) const D3D12_DESCRIPTOR_RANGE1 *pDescriptorRanges; + } D3D12_ROOT_DESCRIPTOR_TABLE1; + +typedef +enum D3D12_ROOT_DESCRIPTOR_FLAGS + { + D3D12_ROOT_DESCRIPTOR_FLAG_NONE = 0, + D3D12_ROOT_DESCRIPTOR_FLAG_DATA_VOLATILE = 0x2, + D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE = 0x4, + D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC = 0x8 + } D3D12_ROOT_DESCRIPTOR_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_ROOT_DESCRIPTOR_FLAGS ) +typedef struct D3D12_ROOT_DESCRIPTOR1 + { + UINT ShaderRegister; + UINT RegisterSpace; + D3D12_ROOT_DESCRIPTOR_FLAGS Flags; + } D3D12_ROOT_DESCRIPTOR1; + +typedef struct D3D12_ROOT_PARAMETER1 + { + D3D12_ROOT_PARAMETER_TYPE ParameterType; + union + { + D3D12_ROOT_DESCRIPTOR_TABLE1 DescriptorTable; + D3D12_ROOT_CONSTANTS Constants; + D3D12_ROOT_DESCRIPTOR1 Descriptor; + } ; + D3D12_SHADER_VISIBILITY ShaderVisibility; + } D3D12_ROOT_PARAMETER1; + +typedef struct D3D12_ROOT_SIGNATURE_DESC1 + { + UINT NumParameters; + _Field_size_full_(NumParameters) const D3D12_ROOT_PARAMETER1 *pParameters; + UINT NumStaticSamplers; + _Field_size_full_(NumStaticSamplers) const D3D12_STATIC_SAMPLER_DESC *pStaticSamplers; + D3D12_ROOT_SIGNATURE_FLAGS Flags; + } D3D12_ROOT_SIGNATURE_DESC1; + +typedef struct D3D12_ROOT_SIGNATURE_DESC2 + { + UINT NumParameters; + _Field_size_full_(NumParameters) const D3D12_ROOT_PARAMETER1 *pParameters; + UINT NumStaticSamplers; + _Field_size_full_(NumStaticSamplers) const D3D12_STATIC_SAMPLER_DESC1 *pStaticSamplers; + D3D12_ROOT_SIGNATURE_FLAGS Flags; + } D3D12_ROOT_SIGNATURE_DESC2; + +typedef struct D3D12_VERSIONED_ROOT_SIGNATURE_DESC + { + D3D_ROOT_SIGNATURE_VERSION Version; + union + { + D3D12_ROOT_SIGNATURE_DESC Desc_1_0; + D3D12_ROOT_SIGNATURE_DESC1 Desc_1_1; + D3D12_ROOT_SIGNATURE_DESC2 Desc_1_2; + } ; + } D3D12_VERSIONED_ROOT_SIGNATURE_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0001_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0001_v0_0_s_ifspec; + +#ifndef __ID3D12RootSignatureDeserializer_INTERFACE_DEFINED__ +#define __ID3D12RootSignatureDeserializer_INTERFACE_DEFINED__ + +/* interface ID3D12RootSignatureDeserializer */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12RootSignatureDeserializer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("34AB647B-3CC8-46AC-841B-C0965645C046") + ID3D12RootSignatureDeserializer : public IUnknown + { + public: + virtual const D3D12_ROOT_SIGNATURE_DESC *STDMETHODCALLTYPE GetRootSignatureDesc( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12RootSignatureDeserializerVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12RootSignatureDeserializer * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12RootSignatureDeserializer * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12RootSignatureDeserializer * This); + + DECLSPEC_XFGVIRT(ID3D12RootSignatureDeserializer, GetRootSignatureDesc) + const D3D12_ROOT_SIGNATURE_DESC *( STDMETHODCALLTYPE *GetRootSignatureDesc )( + ID3D12RootSignatureDeserializer * This); + + END_INTERFACE + } ID3D12RootSignatureDeserializerVtbl; + + interface ID3D12RootSignatureDeserializer + { + CONST_VTBL struct ID3D12RootSignatureDeserializerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12RootSignatureDeserializer_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12RootSignatureDeserializer_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12RootSignatureDeserializer_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12RootSignatureDeserializer_GetRootSignatureDesc(This) \ + ( (This)->lpVtbl -> GetRootSignatureDesc(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12RootSignatureDeserializer_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12VersionedRootSignatureDeserializer_INTERFACE_DEFINED__ +#define __ID3D12VersionedRootSignatureDeserializer_INTERFACE_DEFINED__ + +/* interface ID3D12VersionedRootSignatureDeserializer */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12VersionedRootSignatureDeserializer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7F91CE67-090C-4BB7-B78E-ED8FF2E31DA0") + ID3D12VersionedRootSignatureDeserializer : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetRootSignatureDescAtVersion( + D3D_ROOT_SIGNATURE_VERSION convertToVersion, + _Out_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC **ppDesc) = 0; + + virtual const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *STDMETHODCALLTYPE GetUnconvertedRootSignatureDesc( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12VersionedRootSignatureDeserializerVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12VersionedRootSignatureDeserializer * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12VersionedRootSignatureDeserializer * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12VersionedRootSignatureDeserializer * This); + + DECLSPEC_XFGVIRT(ID3D12VersionedRootSignatureDeserializer, GetRootSignatureDescAtVersion) + HRESULT ( STDMETHODCALLTYPE *GetRootSignatureDescAtVersion )( + ID3D12VersionedRootSignatureDeserializer * This, + D3D_ROOT_SIGNATURE_VERSION convertToVersion, + _Out_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC **ppDesc); + + DECLSPEC_XFGVIRT(ID3D12VersionedRootSignatureDeserializer, GetUnconvertedRootSignatureDesc) + const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *( STDMETHODCALLTYPE *GetUnconvertedRootSignatureDesc )( + ID3D12VersionedRootSignatureDeserializer * This); + + END_INTERFACE + } ID3D12VersionedRootSignatureDeserializerVtbl; + + interface ID3D12VersionedRootSignatureDeserializer + { + CONST_VTBL struct ID3D12VersionedRootSignatureDeserializerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12VersionedRootSignatureDeserializer_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12VersionedRootSignatureDeserializer_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12VersionedRootSignatureDeserializer_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12VersionedRootSignatureDeserializer_GetRootSignatureDescAtVersion(This,convertToVersion,ppDesc) \ + ( (This)->lpVtbl -> GetRootSignatureDescAtVersion(This,convertToVersion,ppDesc) ) + +#define ID3D12VersionedRootSignatureDeserializer_GetUnconvertedRootSignatureDesc(This) \ + ( (This)->lpVtbl -> GetUnconvertedRootSignatureDesc(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12VersionedRootSignatureDeserializer_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0003 */ +/* [local] */ + +typedef HRESULT (WINAPI* PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)( + _In_ const D3D12_ROOT_SIGNATURE_DESC* pRootSignature, + _In_ D3D_ROOT_SIGNATURE_VERSION Version, + _Out_ ID3DBlob** ppBlob, + _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorBlob); + +HRESULT WINAPI D3D12SerializeRootSignature( + _In_ const D3D12_ROOT_SIGNATURE_DESC* pRootSignature, + _In_ D3D_ROOT_SIGNATURE_VERSION Version, + _Out_ ID3DBlob** ppBlob, + _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorBlob); + +typedef HRESULT (WINAPI* PFN_D3D12_CREATE_ROOT_SIGNATURE_DESERIALIZER)( + _In_reads_bytes_(SrcDataSizeInBytes) LPCVOID pSrcData, + _In_ SIZE_T SrcDataSizeInBytes, + _In_ REFIID pRootSignatureDeserializerInterface, + _Out_ void** ppRootSignatureDeserializer); + +HRESULT WINAPI D3D12CreateRootSignatureDeserializer( + _In_reads_bytes_(SrcDataSizeInBytes) LPCVOID pSrcData, + _In_ SIZE_T SrcDataSizeInBytes, + _In_ REFIID pRootSignatureDeserializerInterface, + _Out_ void** ppRootSignatureDeserializer); + +typedef HRESULT (WINAPI* PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE)( + _In_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC* pRootSignature, + _Out_ ID3DBlob** ppBlob, + _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorBlob); + +HRESULT WINAPI D3D12SerializeVersionedRootSignature( + _In_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC* pRootSignature, + _Out_ ID3DBlob** ppBlob, + _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorBlob); + +typedef HRESULT (WINAPI* PFN_D3D12_CREATE_VERSIONED_ROOT_SIGNATURE_DESERIALIZER)( + _In_reads_bytes_(SrcDataSizeInBytes) LPCVOID pSrcData, + _In_ SIZE_T SrcDataSizeInBytes, + _In_ REFIID pRootSignatureDeserializerInterface, + _Out_ void** ppRootSignatureDeserializer); + +HRESULT WINAPI D3D12CreateVersionedRootSignatureDeserializer( + _In_reads_bytes_(SrcDataSizeInBytes) LPCVOID pSrcData, + _In_ SIZE_T SrcDataSizeInBytes, + _In_ REFIID pRootSignatureDeserializerInterface, + _Out_ void** ppRootSignatureDeserializer); + +typedef struct D3D12_CPU_DESCRIPTOR_HANDLE + { + SIZE_T ptr; + } D3D12_CPU_DESCRIPTOR_HANDLE; + +typedef struct D3D12_GPU_DESCRIPTOR_HANDLE + { + UINT64 ptr; + } D3D12_GPU_DESCRIPTOR_HANDLE; + +// If rects are supplied in D3D12_DISCARD_REGION, below, the resource +// must have 2D subresources with all specified subresources the same dimension. +typedef struct D3D12_DISCARD_REGION + { + UINT NumRects; + _In_reads_(NumRects) const D3D12_RECT *pRects; + UINT FirstSubresource; + UINT NumSubresources; + } D3D12_DISCARD_REGION; + +typedef +enum D3D12_QUERY_HEAP_TYPE + { + D3D12_QUERY_HEAP_TYPE_OCCLUSION = 0, + D3D12_QUERY_HEAP_TYPE_TIMESTAMP = 1, + D3D12_QUERY_HEAP_TYPE_PIPELINE_STATISTICS = 2, + D3D12_QUERY_HEAP_TYPE_SO_STATISTICS = 3, + D3D12_QUERY_HEAP_TYPE_VIDEO_DECODE_STATISTICS = 4, + D3D12_QUERY_HEAP_TYPE_COPY_QUEUE_TIMESTAMP = 5, + D3D12_QUERY_HEAP_TYPE_PIPELINE_STATISTICS1 = 7 + } D3D12_QUERY_HEAP_TYPE; + +typedef struct D3D12_QUERY_HEAP_DESC + { + D3D12_QUERY_HEAP_TYPE Type; + UINT Count; + UINT NodeMask; + } D3D12_QUERY_HEAP_DESC; + +typedef +enum D3D12_QUERY_TYPE + { + D3D12_QUERY_TYPE_OCCLUSION = 0, + D3D12_QUERY_TYPE_BINARY_OCCLUSION = 1, + D3D12_QUERY_TYPE_TIMESTAMP = 2, + D3D12_QUERY_TYPE_PIPELINE_STATISTICS = 3, + D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0 = 4, + D3D12_QUERY_TYPE_SO_STATISTICS_STREAM1 = 5, + D3D12_QUERY_TYPE_SO_STATISTICS_STREAM2 = 6, + D3D12_QUERY_TYPE_SO_STATISTICS_STREAM3 = 7, + D3D12_QUERY_TYPE_VIDEO_DECODE_STATISTICS = 8, + D3D12_QUERY_TYPE_PIPELINE_STATISTICS1 = 10 + } D3D12_QUERY_TYPE; + +typedef +enum D3D12_PREDICATION_OP + { + D3D12_PREDICATION_OP_EQUAL_ZERO = 0, + D3D12_PREDICATION_OP_NOT_EQUAL_ZERO = 1 + } D3D12_PREDICATION_OP; + +typedef struct D3D12_QUERY_DATA_PIPELINE_STATISTICS + { + UINT64 IAVertices; + UINT64 IAPrimitives; + UINT64 VSInvocations; + UINT64 GSInvocations; + UINT64 GSPrimitives; + UINT64 CInvocations; + UINT64 CPrimitives; + UINT64 PSInvocations; + UINT64 HSInvocations; + UINT64 DSInvocations; + UINT64 CSInvocations; + } D3D12_QUERY_DATA_PIPELINE_STATISTICS; + +typedef struct D3D12_QUERY_DATA_PIPELINE_STATISTICS1 + { + UINT64 IAVertices; + UINT64 IAPrimitives; + UINT64 VSInvocations; + UINT64 GSInvocations; + UINT64 GSPrimitives; + UINT64 CInvocations; + UINT64 CPrimitives; + UINT64 PSInvocations; + UINT64 HSInvocations; + UINT64 DSInvocations; + UINT64 CSInvocations; + UINT64 ASInvocations; + UINT64 MSInvocations; + UINT64 MSPrimitives; + } D3D12_QUERY_DATA_PIPELINE_STATISTICS1; + +typedef struct D3D12_QUERY_DATA_SO_STATISTICS + { + UINT64 NumPrimitivesWritten; + UINT64 PrimitivesStorageNeeded; + } D3D12_QUERY_DATA_SO_STATISTICS; + +typedef struct D3D12_STREAM_OUTPUT_BUFFER_VIEW + { + D3D12_GPU_VIRTUAL_ADDRESS BufferLocation; + UINT64 SizeInBytes; + D3D12_GPU_VIRTUAL_ADDRESS BufferFilledSizeLocation; + } D3D12_STREAM_OUTPUT_BUFFER_VIEW; + +typedef struct D3D12_DRAW_ARGUMENTS + { + UINT VertexCountPerInstance; + UINT InstanceCount; + UINT StartVertexLocation; + UINT StartInstanceLocation; + } D3D12_DRAW_ARGUMENTS; + +typedef struct D3D12_DRAW_INDEXED_ARGUMENTS + { + UINT IndexCountPerInstance; + UINT InstanceCount; + UINT StartIndexLocation; + INT BaseVertexLocation; + UINT StartInstanceLocation; + } D3D12_DRAW_INDEXED_ARGUMENTS; + +typedef struct D3D12_DISPATCH_ARGUMENTS + { + UINT ThreadGroupCountX; + UINT ThreadGroupCountY; + UINT ThreadGroupCountZ; + } D3D12_DISPATCH_ARGUMENTS; + +typedef struct D3D12_VERTEX_BUFFER_VIEW + { + D3D12_GPU_VIRTUAL_ADDRESS BufferLocation; + UINT SizeInBytes; + UINT StrideInBytes; + } D3D12_VERTEX_BUFFER_VIEW; + +typedef struct D3D12_INDEX_BUFFER_VIEW + { + D3D12_GPU_VIRTUAL_ADDRESS BufferLocation; + UINT SizeInBytes; + DXGI_FORMAT Format; + } D3D12_INDEX_BUFFER_VIEW; + +typedef +enum D3D12_INDIRECT_ARGUMENT_TYPE + { + D3D12_INDIRECT_ARGUMENT_TYPE_DRAW = 0, + D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED = ( D3D12_INDIRECT_ARGUMENT_TYPE_DRAW + 1 ) , + D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH = ( D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED + 1 ) , + D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW = ( D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH + 1 ) , + D3D12_INDIRECT_ARGUMENT_TYPE_INDEX_BUFFER_VIEW = ( D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW + 1 ) , + D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT = ( D3D12_INDIRECT_ARGUMENT_TYPE_INDEX_BUFFER_VIEW + 1 ) , + D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT_BUFFER_VIEW = ( D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT + 1 ) , + D3D12_INDIRECT_ARGUMENT_TYPE_SHADER_RESOURCE_VIEW = ( D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT_BUFFER_VIEW + 1 ) , + D3D12_INDIRECT_ARGUMENT_TYPE_UNORDERED_ACCESS_VIEW = ( D3D12_INDIRECT_ARGUMENT_TYPE_SHADER_RESOURCE_VIEW + 1 ) , + D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH_RAYS = ( D3D12_INDIRECT_ARGUMENT_TYPE_UNORDERED_ACCESS_VIEW + 1 ) , + D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH_MESH = ( D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH_RAYS + 1 ) , + D3D12_INDIRECT_ARGUMENT_TYPE_INCREMENTING_CONSTANT = ( D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH_MESH + 1 ) + } D3D12_INDIRECT_ARGUMENT_TYPE; + +typedef struct D3D12_INDIRECT_ARGUMENT_DESC + { + D3D12_INDIRECT_ARGUMENT_TYPE Type; + union + { + struct + { + UINT Slot; + } VertexBuffer; + struct + { + UINT RootParameterIndex; + UINT DestOffsetIn32BitValues; + UINT Num32BitValuesToSet; + } Constant; + struct + { + UINT RootParameterIndex; + } ConstantBufferView; + struct + { + UINT RootParameterIndex; + } ShaderResourceView; + struct + { + UINT RootParameterIndex; + } UnorderedAccessView; + struct + { + UINT RootParameterIndex; + UINT DestOffsetIn32BitValues; + } IncrementingConstant; + } ; + } D3D12_INDIRECT_ARGUMENT_DESC; + +typedef struct D3D12_COMMAND_SIGNATURE_DESC + { + UINT ByteStride; + UINT NumArgumentDescs; + _Field_size_full_(NumArgumentDescs) const D3D12_INDIRECT_ARGUMENT_DESC *pArgumentDescs; + UINT NodeMask; + } D3D12_COMMAND_SIGNATURE_DESC; + + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0003_v0_0_s_ifspec; + +#ifndef __ID3D12Pageable_INTERFACE_DEFINED__ +#define __ID3D12Pageable_INTERFACE_DEFINED__ + +/* interface ID3D12Pageable */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Pageable; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("63ee58fb-1268-4835-86da-f008ce62f0d6") + ID3D12Pageable : public ID3D12DeviceChild + { + public: + }; + + +#else /* C style interface */ + + typedef struct ID3D12PageableVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Pageable * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Pageable * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Pageable * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Pageable * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Pageable * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Pageable * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Pageable * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12Pageable * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + END_INTERFACE + } ID3D12PageableVtbl; + + interface ID3D12Pageable + { + CONST_VTBL struct ID3D12PageableVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Pageable_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Pageable_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Pageable_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Pageable_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Pageable_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Pageable_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Pageable_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Pageable_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Pageable_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Heap_INTERFACE_DEFINED__ +#define __ID3D12Heap_INTERFACE_DEFINED__ + +/* interface ID3D12Heap */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Heap; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6b3b2502-6e51-45b3-90ee-9884265e8df3") + ID3D12Heap : public ID3D12Pageable + { + public: +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_HEAP_DESC STDMETHODCALLTYPE GetDesc( void) = 0; +#else + virtual D3D12_HEAP_DESC *STDMETHODCALLTYPE GetDesc( + D3D12_HEAP_DESC * RetVal) = 0; +#endif + + }; + + +#else /* C style interface */ + + typedef struct ID3D12HeapVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Heap * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Heap * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Heap * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Heap * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Heap * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Heap * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Heap * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12Heap * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12Heap, GetDesc) +#if !defined(_WIN32) + D3D12_HEAP_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12Heap * This); + +#else + D3D12_HEAP_DESC *( STDMETHODCALLTYPE *GetDesc )( + ID3D12Heap * This, + D3D12_HEAP_DESC * RetVal); + +#endif + + END_INTERFACE + } ID3D12HeapVtbl; + + interface ID3D12Heap + { + CONST_VTBL struct ID3D12HeapVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Heap_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Heap_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Heap_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Heap_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Heap_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Heap_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Heap_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Heap_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#if !defined(_WIN32) + +#define ID3D12Heap_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) +#else +#define ID3D12Heap_GetDesc(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc(This,RetVal) ) +#endif + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Heap_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Resource_INTERFACE_DEFINED__ +#define __ID3D12Resource_INTERFACE_DEFINED__ + +/* interface ID3D12Resource */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Resource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("696442be-a72e-4059-bc79-5b5c98040fad") + ID3D12Resource : public ID3D12Pageable + { + public: + virtual HRESULT STDMETHODCALLTYPE Map( + UINT Subresource, + _In_opt_ const D3D12_RANGE *pReadRange, + _Outptr_opt_result_bytebuffer_(_Inexpressible_("Dependent on resource")) void **ppData) = 0; + + virtual void STDMETHODCALLTYPE Unmap( + UINT Subresource, + _In_opt_ const D3D12_RANGE *pWrittenRange) = 0; + +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_RESOURCE_DESC STDMETHODCALLTYPE GetDesc( void) = 0; +#else + virtual D3D12_RESOURCE_DESC *STDMETHODCALLTYPE GetDesc( + D3D12_RESOURCE_DESC * RetVal) = 0; +#endif + + virtual D3D12_GPU_VIRTUAL_ADDRESS STDMETHODCALLTYPE GetGPUVirtualAddress( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE WriteToSubresource( + UINT DstSubresource, + _In_opt_ const D3D12_BOX *pDstBox, + _In_ const void *pSrcData, + UINT SrcRowPitch, + UINT SrcDepthPitch) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReadFromSubresource( + _Out_ void *pDstData, + UINT DstRowPitch, + UINT DstDepthPitch, + UINT SrcSubresource, + _In_opt_ const D3D12_BOX *pSrcBox) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetHeapProperties( + _Out_opt_ D3D12_HEAP_PROPERTIES *pHeapProperties, + _Out_opt_ D3D12_HEAP_FLAGS *pHeapFlags) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12ResourceVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Resource * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Resource * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Resource * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Resource * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Resource * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Resource * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Resource * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12Resource * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12Resource, Map) + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D12Resource * This, + UINT Subresource, + _In_opt_ const D3D12_RANGE *pReadRange, + _Outptr_opt_result_bytebuffer_(_Inexpressible_("Dependent on resource")) void **ppData); + + DECLSPEC_XFGVIRT(ID3D12Resource, Unmap) + void ( STDMETHODCALLTYPE *Unmap )( + ID3D12Resource * This, + UINT Subresource, + _In_opt_ const D3D12_RANGE *pWrittenRange); + + DECLSPEC_XFGVIRT(ID3D12Resource, GetDesc) +#if !defined(_WIN32) + D3D12_RESOURCE_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12Resource * This); + +#else + D3D12_RESOURCE_DESC *( STDMETHODCALLTYPE *GetDesc )( + ID3D12Resource * This, + D3D12_RESOURCE_DESC * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Resource, GetGPUVirtualAddress) + D3D12_GPU_VIRTUAL_ADDRESS ( STDMETHODCALLTYPE *GetGPUVirtualAddress )( + ID3D12Resource * This); + + DECLSPEC_XFGVIRT(ID3D12Resource, WriteToSubresource) + HRESULT ( STDMETHODCALLTYPE *WriteToSubresource )( + ID3D12Resource * This, + UINT DstSubresource, + _In_opt_ const D3D12_BOX *pDstBox, + _In_ const void *pSrcData, + UINT SrcRowPitch, + UINT SrcDepthPitch); + + DECLSPEC_XFGVIRT(ID3D12Resource, ReadFromSubresource) + HRESULT ( STDMETHODCALLTYPE *ReadFromSubresource )( + ID3D12Resource * This, + _Out_ void *pDstData, + UINT DstRowPitch, + UINT DstDepthPitch, + UINT SrcSubresource, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12Resource, GetHeapProperties) + HRESULT ( STDMETHODCALLTYPE *GetHeapProperties )( + ID3D12Resource * This, + _Out_opt_ D3D12_HEAP_PROPERTIES *pHeapProperties, + _Out_opt_ D3D12_HEAP_FLAGS *pHeapFlags); + + END_INTERFACE + } ID3D12ResourceVtbl; + + interface ID3D12Resource + { + CONST_VTBL struct ID3D12ResourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Resource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Resource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Resource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Resource_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Resource_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Resource_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Resource_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Resource_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12Resource_Map(This,Subresource,pReadRange,ppData) \ + ( (This)->lpVtbl -> Map(This,Subresource,pReadRange,ppData) ) + +#define ID3D12Resource_Unmap(This,Subresource,pWrittenRange) \ + ( (This)->lpVtbl -> Unmap(This,Subresource,pWrittenRange) ) +#if !defined(_WIN32) + +#define ID3D12Resource_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) +#else +#define ID3D12Resource_GetDesc(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc(This,RetVal) ) +#endif + +#define ID3D12Resource_GetGPUVirtualAddress(This) \ + ( (This)->lpVtbl -> GetGPUVirtualAddress(This) ) + +#define ID3D12Resource_WriteToSubresource(This,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->lpVtbl -> WriteToSubresource(This,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) + +#define ID3D12Resource_ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) \ + ( (This)->lpVtbl -> ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) ) + +#define ID3D12Resource_GetHeapProperties(This,pHeapProperties,pHeapFlags) \ + ( (This)->lpVtbl -> GetHeapProperties(This,pHeapProperties,pHeapFlags) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Resource_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12CommandAllocator_INTERFACE_DEFINED__ +#define __ID3D12CommandAllocator_INTERFACE_DEFINED__ + +/* interface ID3D12CommandAllocator */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12CommandAllocator; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6102dee4-af59-4b09-b999-b44d73f09b24") + ID3D12CommandAllocator : public ID3D12Pageable + { + public: + virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12CommandAllocatorVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12CommandAllocator * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12CommandAllocator * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12CommandAllocator * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12CommandAllocator * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12CommandAllocator * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12CommandAllocator * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12CommandAllocator * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12CommandAllocator * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandAllocator, Reset) + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12CommandAllocator * This); + + END_INTERFACE + } ID3D12CommandAllocatorVtbl; + + interface ID3D12CommandAllocator + { + CONST_VTBL struct ID3D12CommandAllocatorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12CommandAllocator_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12CommandAllocator_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12CommandAllocator_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12CommandAllocator_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12CommandAllocator_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12CommandAllocator_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12CommandAllocator_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12CommandAllocator_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12CommandAllocator_Reset(This) \ + ( (This)->lpVtbl -> Reset(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12CommandAllocator_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Fence_INTERFACE_DEFINED__ +#define __ID3D12Fence_INTERFACE_DEFINED__ + +/* interface ID3D12Fence */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Fence; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0a753dcf-c4d8-4b91-adf6-be5a60d95a76") + ID3D12Fence : public ID3D12Pageable + { + public: + virtual UINT64 STDMETHODCALLTYPE GetCompletedValue( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetEventOnCompletion( + UINT64 Value, + HANDLE hEvent) = 0; + + virtual HRESULT STDMETHODCALLTYPE Signal( + UINT64 Value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12FenceVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Fence * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Fence * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Fence * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Fence * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Fence * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Fence * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Fence * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12Fence * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12Fence, GetCompletedValue) + UINT64 ( STDMETHODCALLTYPE *GetCompletedValue )( + ID3D12Fence * This); + + DECLSPEC_XFGVIRT(ID3D12Fence, SetEventOnCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnCompletion )( + ID3D12Fence * This, + UINT64 Value, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Fence, Signal) + HRESULT ( STDMETHODCALLTYPE *Signal )( + ID3D12Fence * This, + UINT64 Value); + + END_INTERFACE + } ID3D12FenceVtbl; + + interface ID3D12Fence + { + CONST_VTBL struct ID3D12FenceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Fence_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Fence_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Fence_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Fence_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Fence_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Fence_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Fence_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Fence_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12Fence_GetCompletedValue(This) \ + ( (This)->lpVtbl -> GetCompletedValue(This) ) + +#define ID3D12Fence_SetEventOnCompletion(This,Value,hEvent) \ + ( (This)->lpVtbl -> SetEventOnCompletion(This,Value,hEvent) ) + +#define ID3D12Fence_Signal(This,Value) \ + ( (This)->lpVtbl -> Signal(This,Value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Fence_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Fence1_INTERFACE_DEFINED__ +#define __ID3D12Fence1_INTERFACE_DEFINED__ + +/* interface ID3D12Fence1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Fence1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("433685fe-e22b-4ca0-a8db-b5b4f4dd0e4a") + ID3D12Fence1 : public ID3D12Fence + { + public: + virtual D3D12_FENCE_FLAGS STDMETHODCALLTYPE GetCreationFlags( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Fence1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Fence1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Fence1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Fence1 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Fence1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Fence1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Fence1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Fence1 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12Fence1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12Fence, GetCompletedValue) + UINT64 ( STDMETHODCALLTYPE *GetCompletedValue )( + ID3D12Fence1 * This); + + DECLSPEC_XFGVIRT(ID3D12Fence, SetEventOnCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnCompletion )( + ID3D12Fence1 * This, + UINT64 Value, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Fence, Signal) + HRESULT ( STDMETHODCALLTYPE *Signal )( + ID3D12Fence1 * This, + UINT64 Value); + + DECLSPEC_XFGVIRT(ID3D12Fence1, GetCreationFlags) + D3D12_FENCE_FLAGS ( STDMETHODCALLTYPE *GetCreationFlags )( + ID3D12Fence1 * This); + + END_INTERFACE + } ID3D12Fence1Vtbl; + + interface ID3D12Fence1 + { + CONST_VTBL struct ID3D12Fence1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Fence1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Fence1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Fence1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Fence1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Fence1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Fence1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Fence1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Fence1_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12Fence1_GetCompletedValue(This) \ + ( (This)->lpVtbl -> GetCompletedValue(This) ) + +#define ID3D12Fence1_SetEventOnCompletion(This,Value,hEvent) \ + ( (This)->lpVtbl -> SetEventOnCompletion(This,Value,hEvent) ) + +#define ID3D12Fence1_Signal(This,Value) \ + ( (This)->lpVtbl -> Signal(This,Value) ) + + +#define ID3D12Fence1_GetCreationFlags(This) \ + ( (This)->lpVtbl -> GetCreationFlags(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Fence1_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12PipelineState_INTERFACE_DEFINED__ +#define __ID3D12PipelineState_INTERFACE_DEFINED__ + +/* interface ID3D12PipelineState */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12PipelineState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("765a30f3-f624-4c6f-a828-ace948622445") + ID3D12PipelineState : public ID3D12Pageable + { + public: + virtual HRESULT STDMETHODCALLTYPE GetCachedBlob( + _COM_Outptr_ ID3DBlob **ppBlob) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12PipelineStateVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12PipelineState * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12PipelineState * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12PipelineState * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12PipelineState * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12PipelineState * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12PipelineState * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12PipelineState * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12PipelineState * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12PipelineState, GetCachedBlob) + HRESULT ( STDMETHODCALLTYPE *GetCachedBlob )( + ID3D12PipelineState * This, + _COM_Outptr_ ID3DBlob **ppBlob); + + END_INTERFACE + } ID3D12PipelineStateVtbl; + + interface ID3D12PipelineState + { + CONST_VTBL struct ID3D12PipelineStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12PipelineState_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12PipelineState_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12PipelineState_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12PipelineState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12PipelineState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12PipelineState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12PipelineState_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12PipelineState_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12PipelineState_GetCachedBlob(This,ppBlob) \ + ( (This)->lpVtbl -> GetCachedBlob(This,ppBlob) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12PipelineState_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12DescriptorHeap_INTERFACE_DEFINED__ +#define __ID3D12DescriptorHeap_INTERFACE_DEFINED__ + +/* interface ID3D12DescriptorHeap */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DescriptorHeap; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8efb471d-616c-4f49-90f7-127bb763fa51") + ID3D12DescriptorHeap : public ID3D12Pageable + { + public: +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_DESCRIPTOR_HEAP_DESC STDMETHODCALLTYPE GetDesc( void) = 0; +#else + virtual D3D12_DESCRIPTOR_HEAP_DESC *STDMETHODCALLTYPE GetDesc( + D3D12_DESCRIPTOR_HEAP_DESC * RetVal) = 0; +#endif + +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_CPU_DESCRIPTOR_HANDLE STDMETHODCALLTYPE GetCPUDescriptorHandleForHeapStart( void) = 0; +#else + virtual D3D12_CPU_DESCRIPTOR_HANDLE *STDMETHODCALLTYPE GetCPUDescriptorHandleForHeapStart( + D3D12_CPU_DESCRIPTOR_HANDLE * RetVal) = 0; +#endif + +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_GPU_DESCRIPTOR_HANDLE STDMETHODCALLTYPE GetGPUDescriptorHandleForHeapStart( void) = 0; +#else + virtual D3D12_GPU_DESCRIPTOR_HANDLE *STDMETHODCALLTYPE GetGPUDescriptorHandleForHeapStart( + D3D12_GPU_DESCRIPTOR_HANDLE * RetVal) = 0; +#endif + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DescriptorHeapVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DescriptorHeap * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DescriptorHeap * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DescriptorHeap * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12DescriptorHeap * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12DescriptorHeap * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12DescriptorHeap * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12DescriptorHeap * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12DescriptorHeap * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12DescriptorHeap, GetDesc) +#if !defined(_WIN32) + D3D12_DESCRIPTOR_HEAP_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12DescriptorHeap * This); + +#else + D3D12_DESCRIPTOR_HEAP_DESC *( STDMETHODCALLTYPE *GetDesc )( + ID3D12DescriptorHeap * This, + D3D12_DESCRIPTOR_HEAP_DESC * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12DescriptorHeap, GetCPUDescriptorHandleForHeapStart) +#if !defined(_WIN32) + D3D12_CPU_DESCRIPTOR_HANDLE ( STDMETHODCALLTYPE *GetCPUDescriptorHandleForHeapStart )( + ID3D12DescriptorHeap * This); + +#else + D3D12_CPU_DESCRIPTOR_HANDLE *( STDMETHODCALLTYPE *GetCPUDescriptorHandleForHeapStart )( + ID3D12DescriptorHeap * This, + D3D12_CPU_DESCRIPTOR_HANDLE * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12DescriptorHeap, GetGPUDescriptorHandleForHeapStart) +#if !defined(_WIN32) + D3D12_GPU_DESCRIPTOR_HANDLE ( STDMETHODCALLTYPE *GetGPUDescriptorHandleForHeapStart )( + ID3D12DescriptorHeap * This); + +#else + D3D12_GPU_DESCRIPTOR_HANDLE *( STDMETHODCALLTYPE *GetGPUDescriptorHandleForHeapStart )( + ID3D12DescriptorHeap * This, + D3D12_GPU_DESCRIPTOR_HANDLE * RetVal); + +#endif + + END_INTERFACE + } ID3D12DescriptorHeapVtbl; + + interface ID3D12DescriptorHeap + { + CONST_VTBL struct ID3D12DescriptorHeapVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DescriptorHeap_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DescriptorHeap_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DescriptorHeap_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DescriptorHeap_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12DescriptorHeap_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12DescriptorHeap_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12DescriptorHeap_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12DescriptorHeap_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#if !defined(_WIN32) + +#define ID3D12DescriptorHeap_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) +#else +#define ID3D12DescriptorHeap_GetDesc(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc(This,RetVal) ) +#endif +#if !defined(_WIN32) + +#define ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(This) \ + ( (This)->lpVtbl -> GetCPUDescriptorHandleForHeapStart(This) ) +#else +#define ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(This,RetVal) \ + ( (This)->lpVtbl -> GetCPUDescriptorHandleForHeapStart(This,RetVal) ) +#endif +#if !defined(_WIN32) + +#define ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(This) \ + ( (This)->lpVtbl -> GetGPUDescriptorHandleForHeapStart(This) ) +#else +#define ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(This,RetVal) \ + ( (This)->lpVtbl -> GetGPUDescriptorHandleForHeapStart(This,RetVal) ) +#endif + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DescriptorHeap_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12QueryHeap_INTERFACE_DEFINED__ +#define __ID3D12QueryHeap_INTERFACE_DEFINED__ + +/* interface ID3D12QueryHeap */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12QueryHeap; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0d9658ae-ed45-469e-a61d-970ec583cab4") + ID3D12QueryHeap : public ID3D12Pageable + { + public: + }; + + +#else /* C style interface */ + + typedef struct ID3D12QueryHeapVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12QueryHeap * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12QueryHeap * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12QueryHeap * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12QueryHeap * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12QueryHeap * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12QueryHeap * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12QueryHeap * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12QueryHeap * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + END_INTERFACE + } ID3D12QueryHeapVtbl; + + interface ID3D12QueryHeap + { + CONST_VTBL struct ID3D12QueryHeapVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12QueryHeap_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12QueryHeap_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12QueryHeap_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12QueryHeap_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12QueryHeap_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12QueryHeap_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12QueryHeap_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12QueryHeap_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12QueryHeap_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12CommandSignature_INTERFACE_DEFINED__ +#define __ID3D12CommandSignature_INTERFACE_DEFINED__ + +/* interface ID3D12CommandSignature */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12CommandSignature; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("c36a797c-ec80-4f0a-8985-a7b2475082d1") + ID3D12CommandSignature : public ID3D12Pageable + { + public: + }; + + +#else /* C style interface */ + + typedef struct ID3D12CommandSignatureVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12CommandSignature * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12CommandSignature * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12CommandSignature * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12CommandSignature * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12CommandSignature * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12CommandSignature * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12CommandSignature * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12CommandSignature * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + END_INTERFACE + } ID3D12CommandSignatureVtbl; + + interface ID3D12CommandSignature + { + CONST_VTBL struct ID3D12CommandSignatureVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12CommandSignature_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12CommandSignature_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12CommandSignature_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12CommandSignature_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12CommandSignature_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12CommandSignature_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12CommandSignature_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12CommandSignature_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12CommandSignature_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12CommandList_INTERFACE_DEFINED__ +#define __ID3D12CommandList_INTERFACE_DEFINED__ + +/* interface ID3D12CommandList */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12CommandList; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7116d91c-e7e4-47ce-b8c6-ec8168f437e5") + ID3D12CommandList : public ID3D12DeviceChild + { + public: + virtual D3D12_COMMAND_LIST_TYPE STDMETHODCALLTYPE GetType( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12CommandListVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12CommandList * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12CommandList * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12CommandList * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12CommandList * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12CommandList * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12CommandList * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12CommandList * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12CommandList * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandList, GetType) + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12CommandList * This); + + END_INTERFACE + } ID3D12CommandListVtbl; + + interface ID3D12CommandList + { + CONST_VTBL struct ID3D12CommandListVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12CommandList_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12CommandList_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12CommandList_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12CommandList_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12CommandList_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12CommandList_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12CommandList_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12CommandList_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12CommandList_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12CommandList_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5b160d0f-ac1b-4185-8ba8-b3ae42a5a455") + ID3D12GraphicsCommandList : public ID3D12CommandList + { + public: + virtual HRESULT STDMETHODCALLTYPE Close( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Reset( + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState) = 0; + + virtual void STDMETHODCALLTYPE ClearState( + _In_opt_ ID3D12PipelineState *pPipelineState) = 0; + + virtual void STDMETHODCALLTYPE DrawInstanced( + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation) = 0; + + virtual void STDMETHODCALLTYPE DrawIndexedInstanced( + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation) = 0; + + virtual void STDMETHODCALLTYPE Dispatch( + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ) = 0; + + virtual void STDMETHODCALLTYPE CopyBufferRegion( + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes) = 0; + + virtual void STDMETHODCALLTYPE CopyTextureRegion( + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox) = 0; + + virtual void STDMETHODCALLTYPE CopyResource( + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource) = 0; + + virtual void STDMETHODCALLTYPE CopyTiles( + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags) = 0; + + virtual void STDMETHODCALLTYPE ResolveSubresource( + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format) = 0; + + virtual void STDMETHODCALLTYPE IASetPrimitiveTopology( + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology) = 0; + + virtual void STDMETHODCALLTYPE RSSetViewports( + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports) = 0; + + virtual void STDMETHODCALLTYPE RSSetScissorRects( + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects) = 0; + + virtual void STDMETHODCALLTYPE OMSetBlendFactor( + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]) = 0; + + virtual void STDMETHODCALLTYPE OMSetStencilRef( + _In_ UINT StencilRef) = 0; + + virtual void STDMETHODCALLTYPE SetPipelineState( + _In_ ID3D12PipelineState *pPipelineState) = 0; + + virtual void STDMETHODCALLTYPE ResourceBarrier( + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers) = 0; + + virtual void STDMETHODCALLTYPE ExecuteBundle( + _In_ ID3D12GraphicsCommandList *pCommandList) = 0; + + virtual void STDMETHODCALLTYPE SetDescriptorHeaps( + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps) = 0; + + virtual void STDMETHODCALLTYPE SetComputeRootSignature( + _In_opt_ ID3D12RootSignature *pRootSignature) = 0; + + virtual void STDMETHODCALLTYPE SetGraphicsRootSignature( + _In_opt_ ID3D12RootSignature *pRootSignature) = 0; + + virtual void STDMETHODCALLTYPE SetComputeRootDescriptorTable( + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor) = 0; + + virtual void STDMETHODCALLTYPE SetGraphicsRootDescriptorTable( + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor) = 0; + + virtual void STDMETHODCALLTYPE SetComputeRoot32BitConstant( + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues) = 0; + + virtual void STDMETHODCALLTYPE SetGraphicsRoot32BitConstant( + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues) = 0; + + virtual void STDMETHODCALLTYPE SetComputeRoot32BitConstants( + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues) = 0; + + virtual void STDMETHODCALLTYPE SetGraphicsRoot32BitConstants( + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues) = 0; + + virtual void STDMETHODCALLTYPE SetComputeRootConstantBufferView( + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation) = 0; + + virtual void STDMETHODCALLTYPE SetGraphicsRootConstantBufferView( + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation) = 0; + + virtual void STDMETHODCALLTYPE SetComputeRootShaderResourceView( + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation) = 0; + + virtual void STDMETHODCALLTYPE SetGraphicsRootShaderResourceView( + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation) = 0; + + virtual void STDMETHODCALLTYPE SetComputeRootUnorderedAccessView( + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation) = 0; + + virtual void STDMETHODCALLTYPE SetGraphicsRootUnorderedAccessView( + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation) = 0; + + virtual void STDMETHODCALLTYPE IASetIndexBuffer( + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView) = 0; + + virtual void STDMETHODCALLTYPE IASetVertexBuffers( + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews) = 0; + + virtual void STDMETHODCALLTYPE SOSetTargets( + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews) = 0; + + virtual void STDMETHODCALLTYPE OMSetRenderTargets( + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor) = 0; + + virtual void STDMETHODCALLTYPE ClearDepthStencilView( + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects) = 0; + + virtual void STDMETHODCALLTYPE ClearRenderTargetView( + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects) = 0; + + virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewUint( + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects) = 0; + + virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewFloat( + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects) = 0; + + virtual void STDMETHODCALLTYPE DiscardResource( + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion) = 0; + + virtual void STDMETHODCALLTYPE BeginQuery( + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index) = 0; + + virtual void STDMETHODCALLTYPE EndQuery( + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index) = 0; + + virtual void STDMETHODCALLTYPE ResolveQueryData( + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset) = 0; + + virtual void STDMETHODCALLTYPE SetPredication( + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation) = 0; + + virtual void STDMETHODCALLTYPE SetMarker( + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size) = 0; + + virtual void STDMETHODCALLTYPE BeginEvent( + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size) = 0; + + virtual void STDMETHODCALLTYPE EndEvent( void) = 0; + + virtual void STDMETHODCALLTYPE ExecuteIndirect( + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandListVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandList, GetType) + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Close) + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Reset) + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearState) + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawInstanced) + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawIndexedInstanced) + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Dispatch) + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyBufferRegion) + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTextureRegion) + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyResource) + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTiles) + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveSubresource) + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetPrimitiveTopology) + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetViewports) + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetScissorRects) + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetBlendFactor) + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetStencilRef) + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList * This, + _In_ UINT StencilRef); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPipelineState) + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList * This, + _In_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResourceBarrier) + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteBundle) + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetDescriptorHeaps) + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootSignature) + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootSignature) + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetIndexBuffer) + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetVertexBuffers) + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SOSetTargets) + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetRenderTargets) + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearDepthStencilView) + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearRenderTargetView) + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewUint) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewFloat) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DiscardResource) + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginQuery) + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndQuery) + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveQueryData) + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPredication) + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetMarker) + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginEvent) + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndEvent) + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteIndirect) + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + END_INTERFACE + } ID3D12GraphicsCommandListVtbl; + + interface ID3D12GraphicsCommandList + { + CONST_VTBL struct ID3D12GraphicsCommandListVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList1_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList1_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("553103fb-1fe7-4557-bb38-946d7d0e7ca7") + ID3D12GraphicsCommandList1 : public ID3D12GraphicsCommandList + { + public: + virtual void STDMETHODCALLTYPE AtomicCopyBufferUINT( + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges) = 0; + + virtual void STDMETHODCALLTYPE AtomicCopyBufferUINT64( + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges) = 0; + + virtual void STDMETHODCALLTYPE OMSetDepthBounds( + _In_ FLOAT Min, + _In_ FLOAT Max) = 0; + + virtual void STDMETHODCALLTYPE SetSamplePositions( + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions) = 0; + + virtual void STDMETHODCALLTYPE ResolveSubresourceRegion( + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode) = 0; + + virtual void STDMETHODCALLTYPE SetViewInstanceMask( + _In_ UINT Mask) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList1 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList1 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandList, GetType) + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList1 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Close) + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList1 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Reset) + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearState) + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList1 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawInstanced) + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawIndexedInstanced) + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Dispatch) + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyBufferRegion) + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTextureRegion) + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList1 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyResource) + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTiles) + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveSubresource) + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetPrimitiveTopology) + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList1 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetViewports) + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList1 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetScissorRects) + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList1 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetBlendFactor) + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList1 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetStencilRef) + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT StencilRef); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPipelineState) + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResourceBarrier) + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteBundle) + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetDescriptorHeaps) + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootSignature) + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList1 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootSignature) + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList1 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetIndexBuffer) + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList1 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetVertexBuffers) + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SOSetTargets) + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetRenderTargets) + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearDepthStencilView) + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList1 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearRenderTargetView) + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList1 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewUint) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList1 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewFloat) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList1 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DiscardResource) + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginQuery) + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndQuery) + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveQueryData) + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPredication) + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList1 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetMarker) + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList1 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginEvent) + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList1 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndEvent) + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList1 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteIndirect) + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT64) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, OMSetDepthBounds) + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList1 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetSamplePositions) + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, ResolveSubresourceRegion) + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetViewInstanceMask) + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT Mask); + + END_INTERFACE + } ID3D12GraphicsCommandList1Vtbl; + + interface ID3D12GraphicsCommandList1 + { + CONST_VTBL struct ID3D12GraphicsCommandList1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList1_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList1_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList1_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList1_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList1_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList1_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList1_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList1_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList1_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList1_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList1_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList1_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList1_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList1_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList1_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList1_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList1_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList1_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList1_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList1_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList1_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList1_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList1_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList1_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList1_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList1_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList1_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList1_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList1_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList1_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList1_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList1_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList1_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList1_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList1_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList1_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList1_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList1_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList1_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList1_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList1_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList1_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList1_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList1_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList1_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList1_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList1_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList1_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList1_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList1_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList1_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList1_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0018 */ +/* [local] */ + +typedef struct D3D12_WRITEBUFFERIMMEDIATE_PARAMETER + { + D3D12_GPU_VIRTUAL_ADDRESS Dest; + UINT32 Value; + } D3D12_WRITEBUFFERIMMEDIATE_PARAMETER; + +typedef +enum D3D12_WRITEBUFFERIMMEDIATE_MODE + { + D3D12_WRITEBUFFERIMMEDIATE_MODE_DEFAULT = 0, + D3D12_WRITEBUFFERIMMEDIATE_MODE_MARKER_IN = 0x1, + D3D12_WRITEBUFFERIMMEDIATE_MODE_MARKER_OUT = 0x2 + } D3D12_WRITEBUFFERIMMEDIATE_MODE; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0018_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0018_v0_0_s_ifspec; + +#ifndef __ID3D12GraphicsCommandList2_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList2_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("38C3E585-FF17-412C-9150-4FC6F9D72A28") + ID3D12GraphicsCommandList2 : public ID3D12GraphicsCommandList1 + { + public: + virtual void STDMETHODCALLTYPE WriteBufferImmediate( + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList2Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList2 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList2 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList2 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList2 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList2 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList2 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList2 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandList, GetType) + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList2 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Close) + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList2 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Reset) + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearState) + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList2 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawInstanced) + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawIndexedInstanced) + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Dispatch) + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyBufferRegion) + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTextureRegion) + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList2 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyResource) + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTiles) + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveSubresource) + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetPrimitiveTopology) + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList2 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetViewports) + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList2 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetScissorRects) + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList2 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetBlendFactor) + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList2 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetStencilRef) + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT StencilRef); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPipelineState) + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResourceBarrier) + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteBundle) + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetDescriptorHeaps) + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootSignature) + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList2 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootSignature) + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList2 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetIndexBuffer) + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList2 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetVertexBuffers) + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SOSetTargets) + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetRenderTargets) + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearDepthStencilView) + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList2 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearRenderTargetView) + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList2 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewUint) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList2 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewFloat) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList2 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DiscardResource) + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginQuery) + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndQuery) + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveQueryData) + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPredication) + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList2 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetMarker) + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList2 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginEvent) + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList2 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndEvent) + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList2 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteIndirect) + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT64) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, OMSetDepthBounds) + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList2 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetSamplePositions) + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, ResolveSubresourceRegion) + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetViewInstanceMask) + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT Mask); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList2, WriteBufferImmediate) + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12GraphicsCommandList2 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + END_INTERFACE + } ID3D12GraphicsCommandList2Vtbl; + + interface ID3D12GraphicsCommandList2 + { + CONST_VTBL struct ID3D12GraphicsCommandList2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList2_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList2_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList2_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList2_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList2_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList2_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList2_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList2_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList2_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList2_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList2_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList2_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList2_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList2_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList2_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList2_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList2_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList2_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList2_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList2_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList2_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList2_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList2_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList2_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList2_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList2_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList2_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList2_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList2_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList2_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList2_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList2_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList2_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList2_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList2_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList2_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList2_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList2_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList2_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList2_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList2_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList2_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList2_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList2_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList2_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList2_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList2_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList2_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList2_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList2_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList2_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList2_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList2_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList2_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList2_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList2_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + + +#define ID3D12GraphicsCommandList2_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList2_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12CommandQueue_INTERFACE_DEFINED__ +#define __ID3D12CommandQueue_INTERFACE_DEFINED__ + +/* interface ID3D12CommandQueue */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12CommandQueue; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0ec870a6-5d7e-4c22-8cfc-5baae07616ed") + ID3D12CommandQueue : public ID3D12Pageable + { + public: + virtual void STDMETHODCALLTYPE UpdateTileMappings( + _In_ ID3D12Resource *pResource, + UINT NumResourceRegions, + _In_reads_opt_(NumResourceRegions) const D3D12_TILED_RESOURCE_COORDINATE *pResourceRegionStartCoordinates, + _In_reads_opt_(NumResourceRegions) const D3D12_TILE_REGION_SIZE *pResourceRegionSizes, + _In_opt_ ID3D12Heap *pHeap, + UINT NumRanges, + _In_reads_opt_(NumRanges) const D3D12_TILE_RANGE_FLAGS *pRangeFlags, + _In_reads_opt_(NumRanges) const UINT *pHeapRangeStartOffsets, + _In_reads_opt_(NumRanges) const UINT *pRangeTileCounts, + D3D12_TILE_MAPPING_FLAGS Flags) = 0; + + virtual void STDMETHODCALLTYPE CopyTileMappings( + _In_ ID3D12Resource *pDstResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pDstRegionStartCoordinate, + _In_ ID3D12Resource *pSrcResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pSrcRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pRegionSize, + D3D12_TILE_MAPPING_FLAGS Flags) = 0; + + virtual void STDMETHODCALLTYPE ExecuteCommandLists( + _In_ UINT NumCommandLists, + _In_reads_(NumCommandLists) ID3D12CommandList *const *ppCommandLists) = 0; + + virtual void STDMETHODCALLTYPE SetMarker( + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size) = 0; + + virtual void STDMETHODCALLTYPE BeginEvent( + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size) = 0; + + virtual void STDMETHODCALLTYPE EndEvent( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Signal( + ID3D12Fence *pFence, + UINT64 Value) = 0; + + virtual HRESULT STDMETHODCALLTYPE Wait( + ID3D12Fence *pFence, + UINT64 Value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTimestampFrequency( + _Out_ UINT64 *pFrequency) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetClockCalibration( + _Out_ UINT64 *pGpuTimestamp, + _Out_ UINT64 *pCpuTimestamp) = 0; + +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_COMMAND_QUEUE_DESC STDMETHODCALLTYPE GetDesc( void) = 0; +#else + virtual D3D12_COMMAND_QUEUE_DESC *STDMETHODCALLTYPE GetDesc( + D3D12_COMMAND_QUEUE_DESC * RetVal) = 0; +#endif + + }; + + +#else /* C style interface */ + + typedef struct ID3D12CommandQueueVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12CommandQueue * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12CommandQueue * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12CommandQueue * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12CommandQueue * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12CommandQueue * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12CommandQueue * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12CommandQueue * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12CommandQueue * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandQueue, UpdateTileMappings) + void ( STDMETHODCALLTYPE *UpdateTileMappings )( + ID3D12CommandQueue * This, + _In_ ID3D12Resource *pResource, + UINT NumResourceRegions, + _In_reads_opt_(NumResourceRegions) const D3D12_TILED_RESOURCE_COORDINATE *pResourceRegionStartCoordinates, + _In_reads_opt_(NumResourceRegions) const D3D12_TILE_REGION_SIZE *pResourceRegionSizes, + _In_opt_ ID3D12Heap *pHeap, + UINT NumRanges, + _In_reads_opt_(NumRanges) const D3D12_TILE_RANGE_FLAGS *pRangeFlags, + _In_reads_opt_(NumRanges) const UINT *pHeapRangeStartOffsets, + _In_reads_opt_(NumRanges) const UINT *pRangeTileCounts, + D3D12_TILE_MAPPING_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12CommandQueue, CopyTileMappings) + void ( STDMETHODCALLTYPE *CopyTileMappings )( + ID3D12CommandQueue * This, + _In_ ID3D12Resource *pDstResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pDstRegionStartCoordinate, + _In_ ID3D12Resource *pSrcResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pSrcRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pRegionSize, + D3D12_TILE_MAPPING_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12CommandQueue, ExecuteCommandLists) + void ( STDMETHODCALLTYPE *ExecuteCommandLists )( + ID3D12CommandQueue * This, + _In_ UINT NumCommandLists, + _In_reads_(NumCommandLists) ID3D12CommandList *const *ppCommandLists); + + DECLSPEC_XFGVIRT(ID3D12CommandQueue, SetMarker) + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12CommandQueue * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12CommandQueue, BeginEvent) + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12CommandQueue * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12CommandQueue, EndEvent) + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12CommandQueue * This); + + DECLSPEC_XFGVIRT(ID3D12CommandQueue, Signal) + HRESULT ( STDMETHODCALLTYPE *Signal )( + ID3D12CommandQueue * This, + ID3D12Fence *pFence, + UINT64 Value); + + DECLSPEC_XFGVIRT(ID3D12CommandQueue, Wait) + HRESULT ( STDMETHODCALLTYPE *Wait )( + ID3D12CommandQueue * This, + ID3D12Fence *pFence, + UINT64 Value); + + DECLSPEC_XFGVIRT(ID3D12CommandQueue, GetTimestampFrequency) + HRESULT ( STDMETHODCALLTYPE *GetTimestampFrequency )( + ID3D12CommandQueue * This, + _Out_ UINT64 *pFrequency); + + DECLSPEC_XFGVIRT(ID3D12CommandQueue, GetClockCalibration) + HRESULT ( STDMETHODCALLTYPE *GetClockCalibration )( + ID3D12CommandQueue * This, + _Out_ UINT64 *pGpuTimestamp, + _Out_ UINT64 *pCpuTimestamp); + + DECLSPEC_XFGVIRT(ID3D12CommandQueue, GetDesc) +#if !defined(_WIN32) + D3D12_COMMAND_QUEUE_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12CommandQueue * This); + +#else + D3D12_COMMAND_QUEUE_DESC *( STDMETHODCALLTYPE *GetDesc )( + ID3D12CommandQueue * This, + D3D12_COMMAND_QUEUE_DESC * RetVal); + +#endif + + END_INTERFACE + } ID3D12CommandQueueVtbl; + + interface ID3D12CommandQueue + { + CONST_VTBL struct ID3D12CommandQueueVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12CommandQueue_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12CommandQueue_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12CommandQueue_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12CommandQueue_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12CommandQueue_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12CommandQueue_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12CommandQueue_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12CommandQueue_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12CommandQueue_UpdateTileMappings(This,pResource,NumResourceRegions,pResourceRegionStartCoordinates,pResourceRegionSizes,pHeap,NumRanges,pRangeFlags,pHeapRangeStartOffsets,pRangeTileCounts,Flags) \ + ( (This)->lpVtbl -> UpdateTileMappings(This,pResource,NumResourceRegions,pResourceRegionStartCoordinates,pResourceRegionSizes,pHeap,NumRanges,pRangeFlags,pHeapRangeStartOffsets,pRangeTileCounts,Flags) ) + +#define ID3D12CommandQueue_CopyTileMappings(This,pDstResource,pDstRegionStartCoordinate,pSrcResource,pSrcRegionStartCoordinate,pRegionSize,Flags) \ + ( (This)->lpVtbl -> CopyTileMappings(This,pDstResource,pDstRegionStartCoordinate,pSrcResource,pSrcRegionStartCoordinate,pRegionSize,Flags) ) + +#define ID3D12CommandQueue_ExecuteCommandLists(This,NumCommandLists,ppCommandLists) \ + ( (This)->lpVtbl -> ExecuteCommandLists(This,NumCommandLists,ppCommandLists) ) + +#define ID3D12CommandQueue_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12CommandQueue_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12CommandQueue_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12CommandQueue_Signal(This,pFence,Value) \ + ( (This)->lpVtbl -> Signal(This,pFence,Value) ) + +#define ID3D12CommandQueue_Wait(This,pFence,Value) \ + ( (This)->lpVtbl -> Wait(This,pFence,Value) ) + +#define ID3D12CommandQueue_GetTimestampFrequency(This,pFrequency) \ + ( (This)->lpVtbl -> GetTimestampFrequency(This,pFrequency) ) + +#define ID3D12CommandQueue_GetClockCalibration(This,pGpuTimestamp,pCpuTimestamp) \ + ( (This)->lpVtbl -> GetClockCalibration(This,pGpuTimestamp,pCpuTimestamp) ) +#if !defined(_WIN32) + +#define ID3D12CommandQueue_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) +#else +#define ID3D12CommandQueue_GetDesc(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc(This,RetVal) ) +#endif + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12CommandQueue_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0020 */ +/* [local] */ + +#ifdef __midl +#ifndef LUID_DEFINED +#define LUID_DEFINED 1 +typedef struct __LUID + { + DWORD LowPart; + LONG HighPart; + } LUID; + +typedef struct __LUID *PLUID; + +#endif +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0020_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0020_v0_0_s_ifspec; + +#ifndef __ID3D12Device_INTERFACE_DEFINED__ +#define __ID3D12Device_INTERFACE_DEFINED__ + +/* interface ID3D12Device */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("189819f1-1db6-4b57-be54-1821339b85f7") + ID3D12Device : public ID3D12Object + { + public: + virtual UINT STDMETHODCALLTYPE GetNodeCount( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateCommandQueue( + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateCommandAllocator( + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateGraphicsPipelineState( + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateComputePipelineState( + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateCommandList( + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckFeatureSupport( + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateDescriptorHeap( + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap) = 0; + + virtual UINT STDMETHODCALLTYPE GetDescriptorHandleIncrementSize( + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateRootSignature( + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature) = 0; + + virtual void STDMETHODCALLTYPE CreateConstantBufferView( + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor) = 0; + + virtual void STDMETHODCALLTYPE CreateShaderResourceView( + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor) = 0; + + virtual void STDMETHODCALLTYPE CreateUnorderedAccessView( + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor) = 0; + + virtual void STDMETHODCALLTYPE CreateRenderTargetView( + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor) = 0; + + virtual void STDMETHODCALLTYPE CreateDepthStencilView( + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor) = 0; + + virtual void STDMETHODCALLTYPE CreateSampler( + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor) = 0; + + virtual void STDMETHODCALLTYPE CopyDescriptors( + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType) = 0; + + virtual void STDMETHODCALLTYPE CopyDescriptorsSimple( + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType) = 0; + +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_RESOURCE_ALLOCATION_INFO STDMETHODCALLTYPE GetResourceAllocationInfo( + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs) = 0; +#else + virtual D3D12_RESOURCE_ALLOCATION_INFO *STDMETHODCALLTYPE GetResourceAllocationInfo( + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs) = 0; +#endif + +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_HEAP_PROPERTIES STDMETHODCALLTYPE GetCustomHeapProperties( + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType) = 0; +#else + virtual D3D12_HEAP_PROPERTIES *STDMETHODCALLTYPE GetCustomHeapProperties( + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType) = 0; +#endif + + virtual HRESULT STDMETHODCALLTYPE CreateCommittedResource( + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateHeap( + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreatePlacedResource( + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateReservedResource( + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateSharedHandle( + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenSharedHandle( + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenSharedHandleByName( + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE MakeResident( + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects) = 0; + + virtual HRESULT STDMETHODCALLTYPE Evict( + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateFence( + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDeviceRemovedReason( void) = 0; + + virtual void STDMETHODCALLTYPE GetCopyableFootprints( + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateQueryHeap( + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetStablePowerState( + BOOL Enable) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateCommandSignature( + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature) = 0; + + virtual void STDMETHODCALLTYPE GetResourceTiling( + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips) = 0; + +#if defined(_MSC_VER) || !defined(_WIN32) + virtual LUID STDMETHODCALLTYPE GetAdapterLuid( void) = 0; +#else + virtual LUID *STDMETHODCALLTYPE GetAdapterLuid( + LUID * RetVal) = 0; +#endif + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DeviceVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device * This, + LUID * RetVal); + +#endif + + END_INTERFACE + } ID3D12DeviceVtbl; + + interface ID3D12Device + { + CONST_VTBL struct ID3D12DeviceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12PipelineLibrary_INTERFACE_DEFINED__ +#define __ID3D12PipelineLibrary_INTERFACE_DEFINED__ + +/* interface ID3D12PipelineLibrary */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12PipelineLibrary; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("c64226a8-9201-46af-b4cc-53fb9ff7414f") + ID3D12PipelineLibrary : public ID3D12DeviceChild + { + public: + virtual HRESULT STDMETHODCALLTYPE StorePipeline( + _In_opt_ LPCWSTR pName, + _In_ ID3D12PipelineState *pPipeline) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadGraphicsPipeline( + _In_ LPCWSTR pName, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadComputePipeline( + _In_ LPCWSTR pName, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState) = 0; + + virtual SIZE_T STDMETHODCALLTYPE GetSerializedSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Serialize( + _Out_writes_(DataSizeInBytes) void *pData, + SIZE_T DataSizeInBytes) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12PipelineLibraryVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12PipelineLibrary * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12PipelineLibrary * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12PipelineLibrary * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12PipelineLibrary * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12PipelineLibrary * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12PipelineLibrary * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12PipelineLibrary * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12PipelineLibrary * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12PipelineLibrary, StorePipeline) + HRESULT ( STDMETHODCALLTYPE *StorePipeline )( + ID3D12PipelineLibrary * This, + _In_opt_ LPCWSTR pName, + _In_ ID3D12PipelineState *pPipeline); + + DECLSPEC_XFGVIRT(ID3D12PipelineLibrary, LoadGraphicsPipeline) + HRESULT ( STDMETHODCALLTYPE *LoadGraphicsPipeline )( + ID3D12PipelineLibrary * This, + _In_ LPCWSTR pName, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12PipelineLibrary, LoadComputePipeline) + HRESULT ( STDMETHODCALLTYPE *LoadComputePipeline )( + ID3D12PipelineLibrary * This, + _In_ LPCWSTR pName, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12PipelineLibrary, GetSerializedSize) + SIZE_T ( STDMETHODCALLTYPE *GetSerializedSize )( + ID3D12PipelineLibrary * This); + + DECLSPEC_XFGVIRT(ID3D12PipelineLibrary, Serialize) + HRESULT ( STDMETHODCALLTYPE *Serialize )( + ID3D12PipelineLibrary * This, + _Out_writes_(DataSizeInBytes) void *pData, + SIZE_T DataSizeInBytes); + + END_INTERFACE + } ID3D12PipelineLibraryVtbl; + + interface ID3D12PipelineLibrary + { + CONST_VTBL struct ID3D12PipelineLibraryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12PipelineLibrary_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12PipelineLibrary_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12PipelineLibrary_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12PipelineLibrary_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12PipelineLibrary_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12PipelineLibrary_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12PipelineLibrary_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12PipelineLibrary_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12PipelineLibrary_StorePipeline(This,pName,pPipeline) \ + ( (This)->lpVtbl -> StorePipeline(This,pName,pPipeline) ) + +#define ID3D12PipelineLibrary_LoadGraphicsPipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> LoadGraphicsPipeline(This,pName,pDesc,riid,ppPipelineState) ) + +#define ID3D12PipelineLibrary_LoadComputePipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> LoadComputePipeline(This,pName,pDesc,riid,ppPipelineState) ) + +#define ID3D12PipelineLibrary_GetSerializedSize(This) \ + ( (This)->lpVtbl -> GetSerializedSize(This) ) + +#define ID3D12PipelineLibrary_Serialize(This,pData,DataSizeInBytes) \ + ( (This)->lpVtbl -> Serialize(This,pData,DataSizeInBytes) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12PipelineLibrary_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12PipelineLibrary1_INTERFACE_DEFINED__ +#define __ID3D12PipelineLibrary1_INTERFACE_DEFINED__ + +/* interface ID3D12PipelineLibrary1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12PipelineLibrary1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("80eabf42-2568-4e5e-bd82-c37f86961dc3") + ID3D12PipelineLibrary1 : public ID3D12PipelineLibrary + { + public: + virtual HRESULT STDMETHODCALLTYPE LoadPipeline( + _In_ LPCWSTR pName, + _In_ const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12PipelineLibrary1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12PipelineLibrary1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12PipelineLibrary1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12PipelineLibrary1 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12PipelineLibrary1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12PipelineLibrary1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12PipelineLibrary1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12PipelineLibrary1 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12PipelineLibrary1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12PipelineLibrary, StorePipeline) + HRESULT ( STDMETHODCALLTYPE *StorePipeline )( + ID3D12PipelineLibrary1 * This, + _In_opt_ LPCWSTR pName, + _In_ ID3D12PipelineState *pPipeline); + + DECLSPEC_XFGVIRT(ID3D12PipelineLibrary, LoadGraphicsPipeline) + HRESULT ( STDMETHODCALLTYPE *LoadGraphicsPipeline )( + ID3D12PipelineLibrary1 * This, + _In_ LPCWSTR pName, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12PipelineLibrary, LoadComputePipeline) + HRESULT ( STDMETHODCALLTYPE *LoadComputePipeline )( + ID3D12PipelineLibrary1 * This, + _In_ LPCWSTR pName, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12PipelineLibrary, GetSerializedSize) + SIZE_T ( STDMETHODCALLTYPE *GetSerializedSize )( + ID3D12PipelineLibrary1 * This); + + DECLSPEC_XFGVIRT(ID3D12PipelineLibrary, Serialize) + HRESULT ( STDMETHODCALLTYPE *Serialize )( + ID3D12PipelineLibrary1 * This, + _Out_writes_(DataSizeInBytes) void *pData, + SIZE_T DataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12PipelineLibrary1, LoadPipeline) + HRESULT ( STDMETHODCALLTYPE *LoadPipeline )( + ID3D12PipelineLibrary1 * This, + _In_ LPCWSTR pName, + _In_ const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + END_INTERFACE + } ID3D12PipelineLibrary1Vtbl; + + interface ID3D12PipelineLibrary1 + { + CONST_VTBL struct ID3D12PipelineLibrary1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12PipelineLibrary1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12PipelineLibrary1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12PipelineLibrary1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12PipelineLibrary1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12PipelineLibrary1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12PipelineLibrary1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12PipelineLibrary1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12PipelineLibrary1_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12PipelineLibrary1_StorePipeline(This,pName,pPipeline) \ + ( (This)->lpVtbl -> StorePipeline(This,pName,pPipeline) ) + +#define ID3D12PipelineLibrary1_LoadGraphicsPipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> LoadGraphicsPipeline(This,pName,pDesc,riid,ppPipelineState) ) + +#define ID3D12PipelineLibrary1_LoadComputePipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> LoadComputePipeline(This,pName,pDesc,riid,ppPipelineState) ) + +#define ID3D12PipelineLibrary1_GetSerializedSize(This) \ + ( (This)->lpVtbl -> GetSerializedSize(This) ) + +#define ID3D12PipelineLibrary1_Serialize(This,pData,DataSizeInBytes) \ + ( (This)->lpVtbl -> Serialize(This,pData,DataSizeInBytes) ) + + +#define ID3D12PipelineLibrary1_LoadPipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> LoadPipeline(This,pName,pDesc,riid,ppPipelineState) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12PipelineLibrary1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0023 */ +/* [local] */ + +typedef +enum D3D12_MULTIPLE_FENCE_WAIT_FLAGS + { + D3D12_MULTIPLE_FENCE_WAIT_FLAG_NONE = 0, + D3D12_MULTIPLE_FENCE_WAIT_FLAG_ANY = 0x1, + D3D12_MULTIPLE_FENCE_WAIT_FLAG_ALL = 0 + } D3D12_MULTIPLE_FENCE_WAIT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_MULTIPLE_FENCE_WAIT_FLAGS ) +typedef +enum D3D12_RESIDENCY_PRIORITY + { + D3D12_RESIDENCY_PRIORITY_MINIMUM = 0x28000000, + D3D12_RESIDENCY_PRIORITY_LOW = 0x50000000, + D3D12_RESIDENCY_PRIORITY_NORMAL = 0x78000000, + D3D12_RESIDENCY_PRIORITY_HIGH = 0xa0010000, + D3D12_RESIDENCY_PRIORITY_MAXIMUM = 0xc8000000 + } D3D12_RESIDENCY_PRIORITY; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0023_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0023_v0_0_s_ifspec; + +#ifndef __ID3D12Device1_INTERFACE_DEFINED__ +#define __ID3D12Device1_INTERFACE_DEFINED__ + +/* interface ID3D12Device1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("77acce80-638e-4e65-8895-c1f23386863e") + ID3D12Device1 : public ID3D12Device + { + public: + virtual HRESULT STDMETHODCALLTYPE CreatePipelineLibrary( + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetEventOnMultipleFenceCompletion( + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetResidencyPriority( + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device1 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device1 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device1 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device1 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device1 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device1 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device1 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device1 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device1 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device1 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device1 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device1 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device1 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device1 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device1 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device1 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device1 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device1 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device1 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device1 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device1 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device1 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device1 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device1 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device1 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device1 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device1 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device1 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device1 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device1 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device1 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device1 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device1 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device1 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device1 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device1 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device1 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device1 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device1 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device1 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device1 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device1 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device1 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device1 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device1 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + END_INTERFACE + } ID3D12Device1Vtbl; + + interface ID3D12Device1 + { + CONST_VTBL struct ID3D12Device1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device1_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device1_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device1_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device1_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device1_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device1_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device1_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device1_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device1_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device1_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device1_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device1_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device1_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device1_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device1_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device1_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device1_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device1_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device1_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device1_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device1_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device1_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device1_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device1_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device1_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device1_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device1_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device1_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device1_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device1_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device1_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device1_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device1_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device1_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device1_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device1_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device1_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device1_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device1_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device1_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device1_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device1_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device1_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device1_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Device2_INTERFACE_DEFINED__ +#define __ID3D12Device2_INTERFACE_DEFINED__ + +/* interface ID3D12Device2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("30baa41e-b15b-475c-a0bb-1af5c5b64328") + ID3D12Device2 : public ID3D12Device1 + { + public: + virtual HRESULT STDMETHODCALLTYPE CreatePipelineState( + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device2Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device2 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device2 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device2 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device2 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device2 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device2 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device2 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device2 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device2 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device2 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device2 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device2 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device2 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device2 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device2 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device2 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device2 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device2 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device2 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device2 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device2 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device2 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device2 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device2 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device2 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device2 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device2 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device2 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device2 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device2 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device2 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device2 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device2 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device2 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device2 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device2 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device2 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device2 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device2 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device2 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device2 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device2 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device2 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device2 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device2 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device2 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device2 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device2 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device2 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + DECLSPEC_XFGVIRT(ID3D12Device2, CreatePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device2 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + END_INTERFACE + } ID3D12Device2Vtbl; + + interface ID3D12Device2 + { + CONST_VTBL struct ID3D12Device2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device2_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device2_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device2_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device2_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device2_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device2_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device2_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device2_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device2_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device2_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device2_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device2_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device2_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device2_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device2_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device2_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device2_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device2_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device2_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device2_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device2_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device2_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device2_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device2_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device2_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device2_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device2_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device2_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device2_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device2_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device2_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device2_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device2_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device2_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device2_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device2_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device2_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device2_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device2_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device2_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device2_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device2_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device2_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device2_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device2_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device2_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device2_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device2_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device2_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0025 */ +/* [local] */ + +typedef +enum D3D12_RESIDENCY_FLAGS + { + D3D12_RESIDENCY_FLAG_NONE = 0, + D3D12_RESIDENCY_FLAG_DENY_OVERBUDGET = 0x1 + } D3D12_RESIDENCY_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RESIDENCY_FLAGS ) + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0025_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0025_v0_0_s_ifspec; + +#ifndef __ID3D12Device3_INTERFACE_DEFINED__ +#define __ID3D12Device3_INTERFACE_DEFINED__ + +/* interface ID3D12Device3 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device3; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("81dadc15-2bad-4392-93c5-101345c4aa98") + ID3D12Device3 : public ID3D12Device2 + { + public: + virtual HRESULT STDMETHODCALLTYPE OpenExistingHeapFromAddress( + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenExistingHeapFromFileMapping( + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnqueueMakeResident( + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device3Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device3 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device3 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device3 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device3 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device3 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device3 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device3 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device3 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device3 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device3 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device3 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device3 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device3 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device3 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device3 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device3 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device3 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device3 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device3 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device3 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device3 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device3 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device3 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device3 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device3 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device3 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device3 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device3 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device3 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device3 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device3 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device3 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device3 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device3 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device3 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device3 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device3 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device3 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device3 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device3 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device3 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device3 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device3 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device3 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device3 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device3 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device3 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device3 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device3 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device3 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + DECLSPEC_XFGVIRT(ID3D12Device2, CreatePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device3 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromAddress) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device3 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromFileMapping) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device3 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, EnqueueMakeResident) + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device3 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + END_INTERFACE + } ID3D12Device3Vtbl; + + interface ID3D12Device3 + { + CONST_VTBL struct ID3D12Device3Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device3_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device3_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device3_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device3_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device3_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device3_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device3_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device3_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device3_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device3_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device3_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device3_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device3_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device3_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device3_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device3_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device3_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device3_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device3_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device3_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device3_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device3_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device3_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device3_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device3_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device3_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device3_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device3_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device3_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device3_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device3_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device3_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device3_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device3_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device3_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device3_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device3_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device3_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device3_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device3_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device3_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device3_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device3_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device3_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device3_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device3_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device3_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device3_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device3_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device3_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device3_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device3_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device3_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device3_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device3_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0026 */ +/* [local] */ + +typedef +enum D3D12_COMMAND_LIST_FLAGS + { + D3D12_COMMAND_LIST_FLAG_NONE = 0 + } D3D12_COMMAND_LIST_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMMAND_LIST_FLAGS ) +typedef +enum D3D12_COMMAND_POOL_FLAGS + { + D3D12_COMMAND_POOL_FLAG_NONE = 0 + } D3D12_COMMAND_POOL_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMMAND_POOL_FLAGS ) +typedef +enum D3D12_COMMAND_RECORDER_FLAGS + { + D3D12_COMMAND_RECORDER_FLAG_NONE = 0 + } D3D12_COMMAND_RECORDER_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMMAND_RECORDER_FLAGS ) +typedef +enum D3D12_PROTECTED_SESSION_STATUS + { + D3D12_PROTECTED_SESSION_STATUS_OK = 0, + D3D12_PROTECTED_SESSION_STATUS_INVALID = 1 + } D3D12_PROTECTED_SESSION_STATUS; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0026_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0026_v0_0_s_ifspec; + +#ifndef __ID3D12ProtectedSession_INTERFACE_DEFINED__ +#define __ID3D12ProtectedSession_INTERFACE_DEFINED__ + +/* interface ID3D12ProtectedSession */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12ProtectedSession; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A1533D18-0AC1-4084-85B9-89A96116806B") + ID3D12ProtectedSession : public ID3D12DeviceChild + { + public: + virtual HRESULT STDMETHODCALLTYPE GetStatusFence( + REFIID riid, + _COM_Outptr_opt_ void **ppFence) = 0; + + virtual D3D12_PROTECTED_SESSION_STATUS STDMETHODCALLTYPE GetSessionStatus( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12ProtectedSessionVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12ProtectedSession * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12ProtectedSession * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12ProtectedSession * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12ProtectedSession * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12ProtectedSession * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12ProtectedSession * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12ProtectedSession * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12ProtectedSession * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12ProtectedSession, GetStatusFence) + HRESULT ( STDMETHODCALLTYPE *GetStatusFence )( + ID3D12ProtectedSession * This, + REFIID riid, + _COM_Outptr_opt_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12ProtectedSession, GetSessionStatus) + D3D12_PROTECTED_SESSION_STATUS ( STDMETHODCALLTYPE *GetSessionStatus )( + ID3D12ProtectedSession * This); + + END_INTERFACE + } ID3D12ProtectedSessionVtbl; + + interface ID3D12ProtectedSession + { + CONST_VTBL struct ID3D12ProtectedSessionVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12ProtectedSession_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12ProtectedSession_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12ProtectedSession_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12ProtectedSession_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12ProtectedSession_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12ProtectedSession_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12ProtectedSession_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12ProtectedSession_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12ProtectedSession_GetStatusFence(This,riid,ppFence) \ + ( (This)->lpVtbl -> GetStatusFence(This,riid,ppFence) ) + +#define ID3D12ProtectedSession_GetSessionStatus(This) \ + ( (This)->lpVtbl -> GetSessionStatus(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12ProtectedSession_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0027 */ +/* [local] */ + +typedef +enum D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS + { + D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE = 0, + D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED = 0x1 + } D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS ) +typedef struct D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_SUPPORT + { + UINT NodeIndex; + D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS Support; + } D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_SUPPORT; + +typedef +enum D3D12_PROTECTED_RESOURCE_SESSION_FLAGS + { + D3D12_PROTECTED_RESOURCE_SESSION_FLAG_NONE = 0 + } D3D12_PROTECTED_RESOURCE_SESSION_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_PROTECTED_RESOURCE_SESSION_FLAGS ) +typedef struct D3D12_PROTECTED_RESOURCE_SESSION_DESC + { + UINT NodeMask; + D3D12_PROTECTED_RESOURCE_SESSION_FLAGS Flags; + } D3D12_PROTECTED_RESOURCE_SESSION_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0027_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0027_v0_0_s_ifspec; + +#ifndef __ID3D12ProtectedResourceSession_INTERFACE_DEFINED__ +#define __ID3D12ProtectedResourceSession_INTERFACE_DEFINED__ + +/* interface ID3D12ProtectedResourceSession */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12ProtectedResourceSession; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6CD696F4-F289-40CC-8091-5A6C0A099C3D") + ID3D12ProtectedResourceSession : public ID3D12ProtectedSession + { + public: +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_PROTECTED_RESOURCE_SESSION_DESC STDMETHODCALLTYPE GetDesc( void) = 0; +#else + virtual D3D12_PROTECTED_RESOURCE_SESSION_DESC *STDMETHODCALLTYPE GetDesc( + D3D12_PROTECTED_RESOURCE_SESSION_DESC * RetVal) = 0; +#endif + + }; + + +#else /* C style interface */ + + typedef struct ID3D12ProtectedResourceSessionVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12ProtectedResourceSession * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12ProtectedResourceSession * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12ProtectedResourceSession * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12ProtectedResourceSession * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12ProtectedResourceSession * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12ProtectedResourceSession * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12ProtectedResourceSession * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12ProtectedResourceSession * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12ProtectedSession, GetStatusFence) + HRESULT ( STDMETHODCALLTYPE *GetStatusFence )( + ID3D12ProtectedResourceSession * This, + REFIID riid, + _COM_Outptr_opt_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12ProtectedSession, GetSessionStatus) + D3D12_PROTECTED_SESSION_STATUS ( STDMETHODCALLTYPE *GetSessionStatus )( + ID3D12ProtectedResourceSession * This); + + DECLSPEC_XFGVIRT(ID3D12ProtectedResourceSession, GetDesc) +#if !defined(_WIN32) + D3D12_PROTECTED_RESOURCE_SESSION_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12ProtectedResourceSession * This); + +#else + D3D12_PROTECTED_RESOURCE_SESSION_DESC *( STDMETHODCALLTYPE *GetDesc )( + ID3D12ProtectedResourceSession * This, + D3D12_PROTECTED_RESOURCE_SESSION_DESC * RetVal); + +#endif + + END_INTERFACE + } ID3D12ProtectedResourceSessionVtbl; + + interface ID3D12ProtectedResourceSession + { + CONST_VTBL struct ID3D12ProtectedResourceSessionVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12ProtectedResourceSession_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12ProtectedResourceSession_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12ProtectedResourceSession_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12ProtectedResourceSession_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12ProtectedResourceSession_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12ProtectedResourceSession_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12ProtectedResourceSession_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12ProtectedResourceSession_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12ProtectedResourceSession_GetStatusFence(This,riid,ppFence) \ + ( (This)->lpVtbl -> GetStatusFence(This,riid,ppFence) ) + +#define ID3D12ProtectedResourceSession_GetSessionStatus(This) \ + ( (This)->lpVtbl -> GetSessionStatus(This) ) + +#if !defined(_WIN32) + +#define ID3D12ProtectedResourceSession_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) +#else +#define ID3D12ProtectedResourceSession_GetDesc(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc(This,RetVal) ) +#endif + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12ProtectedResourceSession_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Device4_INTERFACE_DEFINED__ +#define __ID3D12Device4_INTERFACE_DEFINED__ + +/* interface ID3D12Device4 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device4; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("e865df17-a9ee-46f9-a463-3098315aa2e5") + ID3D12Device4 : public ID3D12Device3 + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateCommandList1( + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateProtectedResourceSession( + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateCommittedResource1( + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateHeap1( + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateReservedResource1( + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource) = 0; + +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_RESOURCE_ALLOCATION_INFO STDMETHODCALLTYPE GetResourceAllocationInfo1( + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1) = 0; +#else + virtual D3D12_RESOURCE_ALLOCATION_INFO *STDMETHODCALLTYPE GetResourceAllocationInfo1( + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1) = 0; +#endif + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device4Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device4 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device4 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device4 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device4 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device4 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device4 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device4 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device4 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device4 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device4 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device4 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device4 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device4 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device4 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device4 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device4 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device4 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device4 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device4 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device4 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device4 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device4 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device4 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device4 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device4 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device4 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device4 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device4 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device4 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device4 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device4 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device4 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device4 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device4 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device4 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device4 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device4 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device4 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device4 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device4 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device4 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device4 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device4 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device4 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device4 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device4 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device4 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device4 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device4 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device4 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + DECLSPEC_XFGVIRT(ID3D12Device2, CreatePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device4 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromAddress) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device4 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromFileMapping) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device4 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, EnqueueMakeResident) + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device4 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommandList1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList1 )( + ID3D12Device4 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession )( + ID3D12Device4 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommittedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource1 )( + ID3D12Device4 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateHeap1) + HRESULT ( STDMETHODCALLTYPE *CreateHeap1 )( + ID3D12Device4 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateReservedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource1 )( + ID3D12Device4 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, GetResourceAllocationInfo1) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device4 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device4 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + END_INTERFACE + } ID3D12Device4Vtbl; + + interface ID3D12Device4 + { + CONST_VTBL struct ID3D12Device4Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device4_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device4_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device4_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device4_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device4_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device4_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device4_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device4_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device4_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device4_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device4_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device4_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device4_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device4_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device4_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device4_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device4_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device4_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device4_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device4_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device4_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device4_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device4_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device4_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device4_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device4_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device4_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device4_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device4_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device4_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device4_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device4_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device4_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device4_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device4_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device4_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device4_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device4_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device4_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device4_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device4_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device4_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device4_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device4_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device4_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device4_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device4_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device4_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device4_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device4_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device4_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device4_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device4_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device4_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + + +#define ID3D12Device4_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) ) + +#define ID3D12Device4_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession(This,pDesc,riid,ppSession) ) + +#define ID3D12Device4_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device4_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) ) + +#define ID3D12Device4_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#if !defined(_WIN32) + +#define ID3D12Device4_GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device4_GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device4_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0029 */ +/* [local] */ + +typedef +enum D3D12_LIFETIME_STATE + { + D3D12_LIFETIME_STATE_IN_USE = 0, + D3D12_LIFETIME_STATE_NOT_IN_USE = ( D3D12_LIFETIME_STATE_IN_USE + 1 ) + } D3D12_LIFETIME_STATE; + + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0029_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0029_v0_0_s_ifspec; + +#ifndef __ID3D12LifetimeOwner_INTERFACE_DEFINED__ +#define __ID3D12LifetimeOwner_INTERFACE_DEFINED__ + +/* interface ID3D12LifetimeOwner */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12LifetimeOwner; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("e667af9f-cd56-4f46-83ce-032e595d70a8") + ID3D12LifetimeOwner : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE LifetimeStateUpdated( + D3D12_LIFETIME_STATE NewState) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12LifetimeOwnerVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12LifetimeOwner * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12LifetimeOwner * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12LifetimeOwner * This); + + DECLSPEC_XFGVIRT(ID3D12LifetimeOwner, LifetimeStateUpdated) + void ( STDMETHODCALLTYPE *LifetimeStateUpdated )( + ID3D12LifetimeOwner * This, + D3D12_LIFETIME_STATE NewState); + + END_INTERFACE + } ID3D12LifetimeOwnerVtbl; + + interface ID3D12LifetimeOwner + { + CONST_VTBL struct ID3D12LifetimeOwnerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12LifetimeOwner_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12LifetimeOwner_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12LifetimeOwner_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12LifetimeOwner_LifetimeStateUpdated(This,NewState) \ + ( (This)->lpVtbl -> LifetimeStateUpdated(This,NewState) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12LifetimeOwner_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12SwapChainAssistant_INTERFACE_DEFINED__ +#define __ID3D12SwapChainAssistant_INTERFACE_DEFINED__ + +/* interface ID3D12SwapChainAssistant */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12SwapChainAssistant; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("f1df64b6-57fd-49cd-8807-c0eb88b45c8f") + ID3D12SwapChainAssistant : public IUnknown + { + public: +#if defined(_MSC_VER) || !defined(_WIN32) + virtual LUID STDMETHODCALLTYPE GetLUID( void) = 0; +#else + virtual LUID *STDMETHODCALLTYPE GetLUID( + LUID * RetVal) = 0; +#endif + + virtual HRESULT STDMETHODCALLTYPE GetSwapChainObject( + REFIID riid, + _COM_Outptr_ void **ppv) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCurrentResourceAndCommandQueue( + REFIID riidResource, + _COM_Outptr_ void **ppvResource, + REFIID riidQueue, + _COM_Outptr_ void **ppvQueue) = 0; + + virtual HRESULT STDMETHODCALLTYPE InsertImplicitSync( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12SwapChainAssistantVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12SwapChainAssistant * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12SwapChainAssistant * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12SwapChainAssistant * This); + + DECLSPEC_XFGVIRT(ID3D12SwapChainAssistant, GetLUID) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetLUID )( + ID3D12SwapChainAssistant * This); + +#else + LUID *( STDMETHODCALLTYPE *GetLUID )( + ID3D12SwapChainAssistant * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12SwapChainAssistant, GetSwapChainObject) + HRESULT ( STDMETHODCALLTYPE *GetSwapChainObject )( + ID3D12SwapChainAssistant * This, + REFIID riid, + _COM_Outptr_ void **ppv); + + DECLSPEC_XFGVIRT(ID3D12SwapChainAssistant, GetCurrentResourceAndCommandQueue) + HRESULT ( STDMETHODCALLTYPE *GetCurrentResourceAndCommandQueue )( + ID3D12SwapChainAssistant * This, + REFIID riidResource, + _COM_Outptr_ void **ppvResource, + REFIID riidQueue, + _COM_Outptr_ void **ppvQueue); + + DECLSPEC_XFGVIRT(ID3D12SwapChainAssistant, InsertImplicitSync) + HRESULT ( STDMETHODCALLTYPE *InsertImplicitSync )( + ID3D12SwapChainAssistant * This); + + END_INTERFACE + } ID3D12SwapChainAssistantVtbl; + + interface ID3D12SwapChainAssistant + { + CONST_VTBL struct ID3D12SwapChainAssistantVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12SwapChainAssistant_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12SwapChainAssistant_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12SwapChainAssistant_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + +#if !defined(_WIN32) + +#define ID3D12SwapChainAssistant_GetLUID(This) \ + ( (This)->lpVtbl -> GetLUID(This) ) +#else +#define ID3D12SwapChainAssistant_GetLUID(This,RetVal) \ + ( (This)->lpVtbl -> GetLUID(This,RetVal) ) +#endif + +#define ID3D12SwapChainAssistant_GetSwapChainObject(This,riid,ppv) \ + ( (This)->lpVtbl -> GetSwapChainObject(This,riid,ppv) ) + +#define ID3D12SwapChainAssistant_GetCurrentResourceAndCommandQueue(This,riidResource,ppvResource,riidQueue,ppvQueue) \ + ( (This)->lpVtbl -> GetCurrentResourceAndCommandQueue(This,riidResource,ppvResource,riidQueue,ppvQueue) ) + +#define ID3D12SwapChainAssistant_InsertImplicitSync(This) \ + ( (This)->lpVtbl -> InsertImplicitSync(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12SwapChainAssistant_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12LifetimeTracker_INTERFACE_DEFINED__ +#define __ID3D12LifetimeTracker_INTERFACE_DEFINED__ + +/* interface ID3D12LifetimeTracker */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12LifetimeTracker; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3fd03d36-4eb1-424a-a582-494ecb8ba813") + ID3D12LifetimeTracker : public ID3D12DeviceChild + { + public: + virtual HRESULT STDMETHODCALLTYPE DestroyOwnedObject( + _In_ ID3D12DeviceChild *pObject) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12LifetimeTrackerVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12LifetimeTracker * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12LifetimeTracker * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12LifetimeTracker * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12LifetimeTracker * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12LifetimeTracker * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12LifetimeTracker * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12LifetimeTracker * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12LifetimeTracker * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12LifetimeTracker, DestroyOwnedObject) + HRESULT ( STDMETHODCALLTYPE *DestroyOwnedObject )( + ID3D12LifetimeTracker * This, + _In_ ID3D12DeviceChild *pObject); + + END_INTERFACE + } ID3D12LifetimeTrackerVtbl; + + interface ID3D12LifetimeTracker + { + CONST_VTBL struct ID3D12LifetimeTrackerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12LifetimeTracker_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12LifetimeTracker_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12LifetimeTracker_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12LifetimeTracker_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12LifetimeTracker_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12LifetimeTracker_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12LifetimeTracker_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12LifetimeTracker_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12LifetimeTracker_DestroyOwnedObject(This,pObject) \ + ( (This)->lpVtbl -> DestroyOwnedObject(This,pObject) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12LifetimeTracker_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0032 */ +/* [local] */ + +typedef +enum D3D12_META_COMMAND_PARAMETER_TYPE + { + D3D12_META_COMMAND_PARAMETER_TYPE_FLOAT = 0, + D3D12_META_COMMAND_PARAMETER_TYPE_UINT64 = 1, + D3D12_META_COMMAND_PARAMETER_TYPE_GPU_VIRTUAL_ADDRESS = 2, + D3D12_META_COMMAND_PARAMETER_TYPE_CPU_DESCRIPTOR_HANDLE_HEAP_TYPE_CBV_SRV_UAV = 3, + D3D12_META_COMMAND_PARAMETER_TYPE_GPU_DESCRIPTOR_HANDLE_HEAP_TYPE_CBV_SRV_UAV = 4 + } D3D12_META_COMMAND_PARAMETER_TYPE; + +typedef +enum D3D12_META_COMMAND_PARAMETER_FLAGS + { + D3D12_META_COMMAND_PARAMETER_FLAG_INPUT = 0x1, + D3D12_META_COMMAND_PARAMETER_FLAG_OUTPUT = 0x2 + } D3D12_META_COMMAND_PARAMETER_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_META_COMMAND_PARAMETER_FLAGS ) +typedef +enum D3D12_META_COMMAND_PARAMETER_STAGE + { + D3D12_META_COMMAND_PARAMETER_STAGE_CREATION = 0, + D3D12_META_COMMAND_PARAMETER_STAGE_INITIALIZATION = 1, + D3D12_META_COMMAND_PARAMETER_STAGE_EXECUTION = 2 + } D3D12_META_COMMAND_PARAMETER_STAGE; + +typedef struct D3D12_META_COMMAND_PARAMETER_DESC + { + LPCWSTR Name; + D3D12_META_COMMAND_PARAMETER_TYPE Type; + D3D12_META_COMMAND_PARAMETER_FLAGS Flags; + D3D12_RESOURCE_STATES RequiredResourceState; + UINT StructureOffset; + } D3D12_META_COMMAND_PARAMETER_DESC; + +typedef +enum D3D12_GRAPHICS_STATES + { + D3D12_GRAPHICS_STATE_NONE = 0, + D3D12_GRAPHICS_STATE_IA_VERTEX_BUFFERS = ( 1 << 0 ) , + D3D12_GRAPHICS_STATE_IA_INDEX_BUFFER = ( 1 << 1 ) , + D3D12_GRAPHICS_STATE_IA_PRIMITIVE_TOPOLOGY = ( 1 << 2 ) , + D3D12_GRAPHICS_STATE_DESCRIPTOR_HEAP = ( 1 << 3 ) , + D3D12_GRAPHICS_STATE_GRAPHICS_ROOT_SIGNATURE = ( 1 << 4 ) , + D3D12_GRAPHICS_STATE_COMPUTE_ROOT_SIGNATURE = ( 1 << 5 ) , + D3D12_GRAPHICS_STATE_RS_VIEWPORTS = ( 1 << 6 ) , + D3D12_GRAPHICS_STATE_RS_SCISSOR_RECTS = ( 1 << 7 ) , + D3D12_GRAPHICS_STATE_PREDICATION = ( 1 << 8 ) , + D3D12_GRAPHICS_STATE_OM_RENDER_TARGETS = ( 1 << 9 ) , + D3D12_GRAPHICS_STATE_OM_STENCIL_REF = ( 1 << 10 ) , + D3D12_GRAPHICS_STATE_OM_BLEND_FACTOR = ( 1 << 11 ) , + D3D12_GRAPHICS_STATE_PIPELINE_STATE = ( 1 << 12 ) , + D3D12_GRAPHICS_STATE_SO_TARGETS = ( 1 << 13 ) , + D3D12_GRAPHICS_STATE_OM_DEPTH_BOUNDS = ( 1 << 14 ) , + D3D12_GRAPHICS_STATE_SAMPLE_POSITIONS = ( 1 << 15 ) , + D3D12_GRAPHICS_STATE_VIEW_INSTANCE_MASK = ( 1 << 16 ) + } D3D12_GRAPHICS_STATES; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_GRAPHICS_STATES ) +typedef struct D3D12_META_COMMAND_DESC + { + GUID Id; + LPCWSTR Name; + D3D12_GRAPHICS_STATES InitializationDirtyState; + D3D12_GRAPHICS_STATES ExecutionDirtyState; + } D3D12_META_COMMAND_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0032_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0032_v0_0_s_ifspec; + +#ifndef __ID3D12StateObject_INTERFACE_DEFINED__ +#define __ID3D12StateObject_INTERFACE_DEFINED__ + +/* interface ID3D12StateObject */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12StateObject; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("47016943-fca8-4594-93ea-af258b55346d") + ID3D12StateObject : public ID3D12Pageable + { + public: + }; + + +#else /* C style interface */ + + typedef struct ID3D12StateObjectVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12StateObject * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12StateObject * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12StateObject * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12StateObject * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12StateObject * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12StateObject * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12StateObject * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12StateObject * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + END_INTERFACE + } ID3D12StateObjectVtbl; + + interface ID3D12StateObject + { + CONST_VTBL struct ID3D12StateObjectVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12StateObject_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12StateObject_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12StateObject_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12StateObject_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12StateObject_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12StateObject_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12StateObject_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12StateObject_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12StateObject_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12StateObjectProperties_INTERFACE_DEFINED__ +#define __ID3D12StateObjectProperties_INTERFACE_DEFINED__ + +/* interface ID3D12StateObjectProperties */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12StateObjectProperties; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("de5fa827-9bf9-4f26-89ff-d7f56fde3860") + ID3D12StateObjectProperties : public IUnknown + { + public: + virtual void *STDMETHODCALLTYPE GetShaderIdentifier( + _In_ LPCWSTR pExportName) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetShaderStackSize( + _In_ LPCWSTR pExportName) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetPipelineStackSize( void) = 0; + + virtual void STDMETHODCALLTYPE SetPipelineStackSize( + UINT64 PipelineStackSizeInBytes) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12StateObjectPropertiesVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12StateObjectProperties * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12StateObjectProperties * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12StateObjectProperties * This); + + DECLSPEC_XFGVIRT(ID3D12StateObjectProperties, GetShaderIdentifier) + void *( STDMETHODCALLTYPE *GetShaderIdentifier )( + ID3D12StateObjectProperties * This, + _In_ LPCWSTR pExportName); + + DECLSPEC_XFGVIRT(ID3D12StateObjectProperties, GetShaderStackSize) + UINT64 ( STDMETHODCALLTYPE *GetShaderStackSize )( + ID3D12StateObjectProperties * This, + _In_ LPCWSTR pExportName); + + DECLSPEC_XFGVIRT(ID3D12StateObjectProperties, GetPipelineStackSize) + UINT64 ( STDMETHODCALLTYPE *GetPipelineStackSize )( + ID3D12StateObjectProperties * This); + + DECLSPEC_XFGVIRT(ID3D12StateObjectProperties, SetPipelineStackSize) + void ( STDMETHODCALLTYPE *SetPipelineStackSize )( + ID3D12StateObjectProperties * This, + UINT64 PipelineStackSizeInBytes); + + END_INTERFACE + } ID3D12StateObjectPropertiesVtbl; + + interface ID3D12StateObjectProperties + { + CONST_VTBL struct ID3D12StateObjectPropertiesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12StateObjectProperties_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12StateObjectProperties_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12StateObjectProperties_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12StateObjectProperties_GetShaderIdentifier(This,pExportName) \ + ( (This)->lpVtbl -> GetShaderIdentifier(This,pExportName) ) + +#define ID3D12StateObjectProperties_GetShaderStackSize(This,pExportName) \ + ( (This)->lpVtbl -> GetShaderStackSize(This,pExportName) ) + +#define ID3D12StateObjectProperties_GetPipelineStackSize(This) \ + ( (This)->lpVtbl -> GetPipelineStackSize(This) ) + +#define ID3D12StateObjectProperties_SetPipelineStackSize(This,PipelineStackSizeInBytes) \ + ( (This)->lpVtbl -> SetPipelineStackSize(This,PipelineStackSizeInBytes) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12StateObjectProperties_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0034 */ +/* [local] */ + +typedef struct D3D12_PROGRAM_IDENTIFIER + { + UINT64 OpaqueData[ 4 ]; + } D3D12_PROGRAM_IDENTIFIER; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0034_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0034_v0_0_s_ifspec; + +#ifndef __ID3D12StateObjectProperties1_INTERFACE_DEFINED__ +#define __ID3D12StateObjectProperties1_INTERFACE_DEFINED__ + +/* interface ID3D12StateObjectProperties1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12StateObjectProperties1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("460caac7-1d24-446a-a184-ca67db494138") + ID3D12StateObjectProperties1 : public ID3D12StateObjectProperties + { + public: +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_PROGRAM_IDENTIFIER STDMETHODCALLTYPE GetProgramIdentifier( + LPCWSTR pProgramName) = 0; +#else + virtual D3D12_PROGRAM_IDENTIFIER *STDMETHODCALLTYPE GetProgramIdentifier( + D3D12_PROGRAM_IDENTIFIER * RetVal, + LPCWSTR pProgramName) = 0; +#endif + + }; + + +#else /* C style interface */ + + typedef struct ID3D12StateObjectProperties1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12StateObjectProperties1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12StateObjectProperties1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12StateObjectProperties1 * This); + + DECLSPEC_XFGVIRT(ID3D12StateObjectProperties, GetShaderIdentifier) + void *( STDMETHODCALLTYPE *GetShaderIdentifier )( + ID3D12StateObjectProperties1 * This, + _In_ LPCWSTR pExportName); + + DECLSPEC_XFGVIRT(ID3D12StateObjectProperties, GetShaderStackSize) + UINT64 ( STDMETHODCALLTYPE *GetShaderStackSize )( + ID3D12StateObjectProperties1 * This, + _In_ LPCWSTR pExportName); + + DECLSPEC_XFGVIRT(ID3D12StateObjectProperties, GetPipelineStackSize) + UINT64 ( STDMETHODCALLTYPE *GetPipelineStackSize )( + ID3D12StateObjectProperties1 * This); + + DECLSPEC_XFGVIRT(ID3D12StateObjectProperties, SetPipelineStackSize) + void ( STDMETHODCALLTYPE *SetPipelineStackSize )( + ID3D12StateObjectProperties1 * This, + UINT64 PipelineStackSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12StateObjectProperties1, GetProgramIdentifier) +#if !defined(_WIN32) + D3D12_PROGRAM_IDENTIFIER ( STDMETHODCALLTYPE *GetProgramIdentifier )( + ID3D12StateObjectProperties1 * This, + LPCWSTR pProgramName); + +#else + D3D12_PROGRAM_IDENTIFIER *( STDMETHODCALLTYPE *GetProgramIdentifier )( + ID3D12StateObjectProperties1 * This, + D3D12_PROGRAM_IDENTIFIER * RetVal, + LPCWSTR pProgramName); + +#endif + + END_INTERFACE + } ID3D12StateObjectProperties1Vtbl; + + interface ID3D12StateObjectProperties1 + { + CONST_VTBL struct ID3D12StateObjectProperties1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12StateObjectProperties1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12StateObjectProperties1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12StateObjectProperties1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12StateObjectProperties1_GetShaderIdentifier(This,pExportName) \ + ( (This)->lpVtbl -> GetShaderIdentifier(This,pExportName) ) + +#define ID3D12StateObjectProperties1_GetShaderStackSize(This,pExportName) \ + ( (This)->lpVtbl -> GetShaderStackSize(This,pExportName) ) + +#define ID3D12StateObjectProperties1_GetPipelineStackSize(This) \ + ( (This)->lpVtbl -> GetPipelineStackSize(This) ) + +#define ID3D12StateObjectProperties1_SetPipelineStackSize(This,PipelineStackSizeInBytes) \ + ( (This)->lpVtbl -> SetPipelineStackSize(This,PipelineStackSizeInBytes) ) + +#if !defined(_WIN32) + +#define ID3D12StateObjectProperties1_GetProgramIdentifier(This,pProgramName) \ + ( (This)->lpVtbl -> GetProgramIdentifier(This,pProgramName) ) +#else +#define ID3D12StateObjectProperties1_GetProgramIdentifier(This,RetVal,pProgramName) \ + ( (This)->lpVtbl -> GetProgramIdentifier(This,RetVal,pProgramName) ) +#endif + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12StateObjectProperties1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0035 */ +/* [local] */ + +typedef struct D3D12_NODE_ID + { + LPCWSTR Name; + UINT ArrayIndex; + } D3D12_NODE_ID; + +typedef struct D3D12_WORK_GRAPH_MEMORY_REQUIREMENTS + { + UINT64 MinSizeInBytes; + UINT64 MaxSizeInBytes; + UINT SizeGranularityInBytes; + } D3D12_WORK_GRAPH_MEMORY_REQUIREMENTS; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0035_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0035_v0_0_s_ifspec; + +#ifndef __ID3D12WorkGraphProperties_INTERFACE_DEFINED__ +#define __ID3D12WorkGraphProperties_INTERFACE_DEFINED__ + +/* interface ID3D12WorkGraphProperties */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12WorkGraphProperties; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("065acf71-f863-4b89-82f4-02e4d5886757") + ID3D12WorkGraphProperties : public IUnknown + { + public: + virtual UINT STDMETHODCALLTYPE GetNumWorkGraphs( void) = 0; + + virtual LPCWSTR STDMETHODCALLTYPE GetProgramName( + UINT WorkGraphIndex) = 0; + + virtual UINT STDMETHODCALLTYPE GetWorkGraphIndex( + LPCWSTR pProgramName) = 0; + + virtual UINT STDMETHODCALLTYPE GetNumNodes( + UINT WorkGraphIndex) = 0; + +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_NODE_ID STDMETHODCALLTYPE GetNodeID( + UINT WorkGraphIndex, + UINT NodeIndex) = 0; +#else + virtual D3D12_NODE_ID *STDMETHODCALLTYPE GetNodeID( + D3D12_NODE_ID * RetVal, + UINT WorkGraphIndex, + UINT NodeIndex) = 0; +#endif + + virtual UINT STDMETHODCALLTYPE GetNodeIndex( + UINT WorkGraphIndex, + D3D12_NODE_ID NodeID) = 0; + + virtual UINT STDMETHODCALLTYPE GetNodeLocalRootArgumentsTableIndex( + UINT WorkGraphIndex, + UINT NodeIndex) = 0; + + virtual UINT STDMETHODCALLTYPE GetNumEntrypoints( + UINT WorkGraphIndex) = 0; + +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_NODE_ID STDMETHODCALLTYPE GetEntrypointID( + UINT WorkGraphIndex, + UINT EntrypointIndex) = 0; +#else + virtual D3D12_NODE_ID *STDMETHODCALLTYPE GetEntrypointID( + D3D12_NODE_ID * RetVal, + UINT WorkGraphIndex, + UINT EntrypointIndex) = 0; +#endif + + virtual UINT STDMETHODCALLTYPE GetEntrypointIndex( + UINT WorkGraphIndex, + D3D12_NODE_ID NodeID) = 0; + + virtual UINT STDMETHODCALLTYPE GetEntrypointRecordSizeInBytes( + UINT WorkGraphIndex, + UINT EntrypointIndex) = 0; + + virtual void STDMETHODCALLTYPE GetWorkGraphMemoryRequirements( + UINT WorkGraphIndex, + _Out_ D3D12_WORK_GRAPH_MEMORY_REQUIREMENTS *pWorkGraphMemoryRequirements) = 0; + + virtual UINT STDMETHODCALLTYPE GetEntrypointRecordAlignmentInBytes( + UINT WorkGraphIndex, + UINT EntrypointIndex) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12WorkGraphPropertiesVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12WorkGraphProperties * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12WorkGraphProperties * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12WorkGraphProperties * This); + + DECLSPEC_XFGVIRT(ID3D12WorkGraphProperties, GetNumWorkGraphs) + UINT ( STDMETHODCALLTYPE *GetNumWorkGraphs )( + ID3D12WorkGraphProperties * This); + + DECLSPEC_XFGVIRT(ID3D12WorkGraphProperties, GetProgramName) + LPCWSTR ( STDMETHODCALLTYPE *GetProgramName )( + ID3D12WorkGraphProperties * This, + UINT WorkGraphIndex); + + DECLSPEC_XFGVIRT(ID3D12WorkGraphProperties, GetWorkGraphIndex) + UINT ( STDMETHODCALLTYPE *GetWorkGraphIndex )( + ID3D12WorkGraphProperties * This, + LPCWSTR pProgramName); + + DECLSPEC_XFGVIRT(ID3D12WorkGraphProperties, GetNumNodes) + UINT ( STDMETHODCALLTYPE *GetNumNodes )( + ID3D12WorkGraphProperties * This, + UINT WorkGraphIndex); + + DECLSPEC_XFGVIRT(ID3D12WorkGraphProperties, GetNodeID) +#if !defined(_WIN32) + D3D12_NODE_ID ( STDMETHODCALLTYPE *GetNodeID )( + ID3D12WorkGraphProperties * This, + UINT WorkGraphIndex, + UINT NodeIndex); + +#else + D3D12_NODE_ID *( STDMETHODCALLTYPE *GetNodeID )( + ID3D12WorkGraphProperties * This, + D3D12_NODE_ID * RetVal, + UINT WorkGraphIndex, + UINT NodeIndex); + +#endif + + DECLSPEC_XFGVIRT(ID3D12WorkGraphProperties, GetNodeIndex) + UINT ( STDMETHODCALLTYPE *GetNodeIndex )( + ID3D12WorkGraphProperties * This, + UINT WorkGraphIndex, + D3D12_NODE_ID NodeID); + + DECLSPEC_XFGVIRT(ID3D12WorkGraphProperties, GetNodeLocalRootArgumentsTableIndex) + UINT ( STDMETHODCALLTYPE *GetNodeLocalRootArgumentsTableIndex )( + ID3D12WorkGraphProperties * This, + UINT WorkGraphIndex, + UINT NodeIndex); + + DECLSPEC_XFGVIRT(ID3D12WorkGraphProperties, GetNumEntrypoints) + UINT ( STDMETHODCALLTYPE *GetNumEntrypoints )( + ID3D12WorkGraphProperties * This, + UINT WorkGraphIndex); + + DECLSPEC_XFGVIRT(ID3D12WorkGraphProperties, GetEntrypointID) +#if !defined(_WIN32) + D3D12_NODE_ID ( STDMETHODCALLTYPE *GetEntrypointID )( + ID3D12WorkGraphProperties * This, + UINT WorkGraphIndex, + UINT EntrypointIndex); + +#else + D3D12_NODE_ID *( STDMETHODCALLTYPE *GetEntrypointID )( + ID3D12WorkGraphProperties * This, + D3D12_NODE_ID * RetVal, + UINT WorkGraphIndex, + UINT EntrypointIndex); + +#endif + + DECLSPEC_XFGVIRT(ID3D12WorkGraphProperties, GetEntrypointIndex) + UINT ( STDMETHODCALLTYPE *GetEntrypointIndex )( + ID3D12WorkGraphProperties * This, + UINT WorkGraphIndex, + D3D12_NODE_ID NodeID); + + DECLSPEC_XFGVIRT(ID3D12WorkGraphProperties, GetEntrypointRecordSizeInBytes) + UINT ( STDMETHODCALLTYPE *GetEntrypointRecordSizeInBytes )( + ID3D12WorkGraphProperties * This, + UINT WorkGraphIndex, + UINT EntrypointIndex); + + DECLSPEC_XFGVIRT(ID3D12WorkGraphProperties, GetWorkGraphMemoryRequirements) + void ( STDMETHODCALLTYPE *GetWorkGraphMemoryRequirements )( + ID3D12WorkGraphProperties * This, + UINT WorkGraphIndex, + _Out_ D3D12_WORK_GRAPH_MEMORY_REQUIREMENTS *pWorkGraphMemoryRequirements); + + DECLSPEC_XFGVIRT(ID3D12WorkGraphProperties, GetEntrypointRecordAlignmentInBytes) + UINT ( STDMETHODCALLTYPE *GetEntrypointRecordAlignmentInBytes )( + ID3D12WorkGraphProperties * This, + UINT WorkGraphIndex, + UINT EntrypointIndex); + + END_INTERFACE + } ID3D12WorkGraphPropertiesVtbl; + + interface ID3D12WorkGraphProperties + { + CONST_VTBL struct ID3D12WorkGraphPropertiesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12WorkGraphProperties_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12WorkGraphProperties_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12WorkGraphProperties_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12WorkGraphProperties_GetNumWorkGraphs(This) \ + ( (This)->lpVtbl -> GetNumWorkGraphs(This) ) + +#define ID3D12WorkGraphProperties_GetProgramName(This,WorkGraphIndex) \ + ( (This)->lpVtbl -> GetProgramName(This,WorkGraphIndex) ) + +#define ID3D12WorkGraphProperties_GetWorkGraphIndex(This,pProgramName) \ + ( (This)->lpVtbl -> GetWorkGraphIndex(This,pProgramName) ) + +#define ID3D12WorkGraphProperties_GetNumNodes(This,WorkGraphIndex) \ + ( (This)->lpVtbl -> GetNumNodes(This,WorkGraphIndex) ) +#if !defined(_WIN32) + +#define ID3D12WorkGraphProperties_GetNodeID(This,WorkGraphIndex,NodeIndex) \ + ( (This)->lpVtbl -> GetNodeID(This,WorkGraphIndex,NodeIndex) ) +#else +#define ID3D12WorkGraphProperties_GetNodeID(This,RetVal,WorkGraphIndex,NodeIndex) \ + ( (This)->lpVtbl -> GetNodeID(This,RetVal,WorkGraphIndex,NodeIndex) ) +#endif + +#define ID3D12WorkGraphProperties_GetNodeIndex(This,WorkGraphIndex,NodeID) \ + ( (This)->lpVtbl -> GetNodeIndex(This,WorkGraphIndex,NodeID) ) + +#define ID3D12WorkGraphProperties_GetNodeLocalRootArgumentsTableIndex(This,WorkGraphIndex,NodeIndex) \ + ( (This)->lpVtbl -> GetNodeLocalRootArgumentsTableIndex(This,WorkGraphIndex,NodeIndex) ) + +#define ID3D12WorkGraphProperties_GetNumEntrypoints(This,WorkGraphIndex) \ + ( (This)->lpVtbl -> GetNumEntrypoints(This,WorkGraphIndex) ) +#if !defined(_WIN32) + +#define ID3D12WorkGraphProperties_GetEntrypointID(This,WorkGraphIndex,EntrypointIndex) \ + ( (This)->lpVtbl -> GetEntrypointID(This,WorkGraphIndex,EntrypointIndex) ) +#else +#define ID3D12WorkGraphProperties_GetEntrypointID(This,RetVal,WorkGraphIndex,EntrypointIndex) \ + ( (This)->lpVtbl -> GetEntrypointID(This,RetVal,WorkGraphIndex,EntrypointIndex) ) +#endif + +#define ID3D12WorkGraphProperties_GetEntrypointIndex(This,WorkGraphIndex,NodeID) \ + ( (This)->lpVtbl -> GetEntrypointIndex(This,WorkGraphIndex,NodeID) ) + +#define ID3D12WorkGraphProperties_GetEntrypointRecordSizeInBytes(This,WorkGraphIndex,EntrypointIndex) \ + ( (This)->lpVtbl -> GetEntrypointRecordSizeInBytes(This,WorkGraphIndex,EntrypointIndex) ) + +#define ID3D12WorkGraphProperties_GetWorkGraphMemoryRequirements(This,WorkGraphIndex,pWorkGraphMemoryRequirements) \ + ( (This)->lpVtbl -> GetWorkGraphMemoryRequirements(This,WorkGraphIndex,pWorkGraphMemoryRequirements) ) + +#define ID3D12WorkGraphProperties_GetEntrypointRecordAlignmentInBytes(This,WorkGraphIndex,EntrypointIndex) \ + ( (This)->lpVtbl -> GetEntrypointRecordAlignmentInBytes(This,WorkGraphIndex,EntrypointIndex) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12WorkGraphProperties_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0036 */ +/* [local] */ + +typedef +enum D3D12_STATE_SUBOBJECT_TYPE + { + D3D12_STATE_SUBOBJECT_TYPE_STATE_OBJECT_CONFIG = 0, + D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE = 1, + D3D12_STATE_SUBOBJECT_TYPE_LOCAL_ROOT_SIGNATURE = 2, + D3D12_STATE_SUBOBJECT_TYPE_NODE_MASK = 3, + D3D12_STATE_SUBOBJECT_TYPE_DXIL_LIBRARY = 5, + D3D12_STATE_SUBOBJECT_TYPE_EXISTING_COLLECTION = 6, + D3D12_STATE_SUBOBJECT_TYPE_SUBOBJECT_TO_EXPORTS_ASSOCIATION = 7, + D3D12_STATE_SUBOBJECT_TYPE_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION = 8, + D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_SHADER_CONFIG = 9, + D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_PIPELINE_CONFIG = 10, + D3D12_STATE_SUBOBJECT_TYPE_HIT_GROUP = 11, + D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_PIPELINE_CONFIG1 = 12, + D3D12_STATE_SUBOBJECT_TYPE_WORK_GRAPH = 13, + D3D12_STATE_SUBOBJECT_TYPE_STREAM_OUTPUT = 14, + D3D12_STATE_SUBOBJECT_TYPE_BLEND = 15, + D3D12_STATE_SUBOBJECT_TYPE_SAMPLE_MASK = 16, + D3D12_STATE_SUBOBJECT_TYPE_RASTERIZER = 17, + D3D12_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL = 18, + D3D12_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT = 19, + D3D12_STATE_SUBOBJECT_TYPE_IB_STRIP_CUT_VALUE = 20, + D3D12_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY = 21, + D3D12_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS = 22, + D3D12_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL_FORMAT = 23, + D3D12_STATE_SUBOBJECT_TYPE_SAMPLE_DESC = 24, + D3D12_STATE_SUBOBJECT_TYPE_FLAGS = 26, + D3D12_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1 = 27, + D3D12_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING = 28, + D3D12_STATE_SUBOBJECT_TYPE_GENERIC_PROGRAM = 29, + D3D12_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL2 = 30, + D3D12_STATE_SUBOBJECT_TYPE_MAX_VALID = ( D3D12_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL2 + 1 ) + } D3D12_STATE_SUBOBJECT_TYPE; + +typedef struct D3D12_STATE_SUBOBJECT + { + D3D12_STATE_SUBOBJECT_TYPE Type; + const void *pDesc; + } D3D12_STATE_SUBOBJECT; + +typedef +enum D3D12_STATE_OBJECT_FLAGS + { + D3D12_STATE_OBJECT_FLAG_NONE = 0, + D3D12_STATE_OBJECT_FLAG_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITIONS = 0x1, + D3D12_STATE_OBJECT_FLAG_ALLOW_EXTERNAL_DEPENDENCIES_ON_LOCAL_DEFINITIONS = 0x2, + D3D12_STATE_OBJECT_FLAG_ALLOW_STATE_OBJECT_ADDITIONS = 0x4 + } D3D12_STATE_OBJECT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_STATE_OBJECT_FLAGS ) +typedef struct D3D12_STATE_OBJECT_CONFIG + { + D3D12_STATE_OBJECT_FLAGS Flags; + } D3D12_STATE_OBJECT_CONFIG; + +typedef struct D3D12_GLOBAL_ROOT_SIGNATURE + { + ID3D12RootSignature *pGlobalRootSignature; + } D3D12_GLOBAL_ROOT_SIGNATURE; + +typedef struct D3D12_LOCAL_ROOT_SIGNATURE + { + ID3D12RootSignature *pLocalRootSignature; + } D3D12_LOCAL_ROOT_SIGNATURE; + +typedef struct D3D12_NODE_MASK + { + UINT NodeMask; + } D3D12_NODE_MASK; + +typedef struct D3D12_SAMPLE_MASK + { + UINT SampleMask; + } D3D12_SAMPLE_MASK; + +typedef struct D3D12_IB_STRIP_CUT_VALUE + { + D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IndexBufferStripCutValue; + } D3D12_IB_STRIP_CUT_VALUE; + +typedef struct D3D12_PRIMITIVE_TOPOLOGY_DESC + { + D3D12_PRIMITIVE_TOPOLOGY_TYPE PrimitiveTopology; + } D3D12_PRIMITIVE_TOPOLOGY_DESC; + +typedef struct D3D12_DEPTH_STENCIL_FORMAT + { + DXGI_FORMAT DepthStencilFormat; + } D3D12_DEPTH_STENCIL_FORMAT; + +typedef +enum D3D12_EXPORT_FLAGS + { + D3D12_EXPORT_FLAG_NONE = 0 + } D3D12_EXPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_EXPORT_FLAGS ) +typedef struct D3D12_EXPORT_DESC + { + LPCWSTR Name; + _In_opt_ LPCWSTR ExportToRename; + D3D12_EXPORT_FLAGS Flags; + } D3D12_EXPORT_DESC; + +typedef struct D3D12_DXIL_LIBRARY_DESC + { + D3D12_SHADER_BYTECODE DXILLibrary; + UINT NumExports; + _In_reads_(NumExports) const D3D12_EXPORT_DESC *pExports; + } D3D12_DXIL_LIBRARY_DESC; + +typedef struct D3D12_EXISTING_COLLECTION_DESC + { + ID3D12StateObject *pExistingCollection; + UINT NumExports; + _In_reads_(NumExports) const D3D12_EXPORT_DESC *pExports; + } D3D12_EXISTING_COLLECTION_DESC; + +typedef struct D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION + { + const D3D12_STATE_SUBOBJECT *pSubobjectToAssociate; + UINT NumExports; + _In_reads_(NumExports) LPCWSTR *pExports; + } D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION; + +typedef struct D3D12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION + { + LPCWSTR SubobjectToAssociate; + UINT NumExports; + _In_reads_(NumExports) LPCWSTR *pExports; + } D3D12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION; + +typedef +enum D3D12_HIT_GROUP_TYPE + { + D3D12_HIT_GROUP_TYPE_TRIANGLES = 0, + D3D12_HIT_GROUP_TYPE_PROCEDURAL_PRIMITIVE = 0x1 + } D3D12_HIT_GROUP_TYPE; + +typedef struct D3D12_HIT_GROUP_DESC + { + LPCWSTR HitGroupExport; + D3D12_HIT_GROUP_TYPE Type; + _In_opt_ LPCWSTR AnyHitShaderImport; + _In_opt_ LPCWSTR ClosestHitShaderImport; + _In_opt_ LPCWSTR IntersectionShaderImport; + } D3D12_HIT_GROUP_DESC; + +typedef struct D3D12_RAYTRACING_SHADER_CONFIG + { + UINT MaxPayloadSizeInBytes; + UINT MaxAttributeSizeInBytes; + } D3D12_RAYTRACING_SHADER_CONFIG; + +typedef struct D3D12_RAYTRACING_PIPELINE_CONFIG + { + UINT MaxTraceRecursionDepth; + } D3D12_RAYTRACING_PIPELINE_CONFIG; + +typedef +enum D3D12_RAYTRACING_PIPELINE_FLAGS + { + D3D12_RAYTRACING_PIPELINE_FLAG_NONE = 0, + D3D12_RAYTRACING_PIPELINE_FLAG_SKIP_TRIANGLES = 0x100, + D3D12_RAYTRACING_PIPELINE_FLAG_SKIP_PROCEDURAL_PRIMITIVES = 0x200 + } D3D12_RAYTRACING_PIPELINE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RAYTRACING_PIPELINE_FLAGS ) +typedef struct D3D12_RAYTRACING_PIPELINE_CONFIG1 + { + UINT MaxTraceRecursionDepth; + D3D12_RAYTRACING_PIPELINE_FLAGS Flags; + } D3D12_RAYTRACING_PIPELINE_CONFIG1; + +typedef struct D3D12_NODE_OUTPUT_OVERRIDES + { + UINT OutputIndex; + _In_opt_ const D3D12_NODE_ID *pNewName; + _In_opt_ const BOOL *pAllowSparseNodes; + _In_opt_ const UINT *pMaxRecords; + _In_opt_ const UINT *pMaxRecordsSharedWithOutputIndex; + } D3D12_NODE_OUTPUT_OVERRIDES; + +typedef struct D3D12_BROADCASTING_LAUNCH_OVERRIDES + { + _In_opt_ const UINT *pLocalRootArgumentsTableIndex; + _In_opt_ const BOOL *pProgramEntry; + _In_opt_ const D3D12_NODE_ID *pNewName; + _In_opt_ const D3D12_NODE_ID *pShareInputOf; + _In_reads_opt_(3) const UINT *pDispatchGrid; + _In_reads_opt_(3) const UINT *pMaxDispatchGrid; + UINT NumOutputOverrides; + _In_reads_opt_(NumOutputOverrides) const D3D12_NODE_OUTPUT_OVERRIDES *pOutputOverrides; + } D3D12_BROADCASTING_LAUNCH_OVERRIDES; + +typedef struct D3D12_COALESCING_LAUNCH_OVERRIDES + { + _In_opt_ const UINT *pLocalRootArgumentsTableIndex; + _In_opt_ const BOOL *pProgramEntry; + _In_opt_ const D3D12_NODE_ID *pNewName; + _In_opt_ const D3D12_NODE_ID *pShareInputOf; + UINT NumOutputOverrides; + _In_reads_opt_(NumOutputOverrides) const D3D12_NODE_OUTPUT_OVERRIDES *pOutputOverrides; + } D3D12_COALESCING_LAUNCH_OVERRIDES; + +typedef struct D3D12_THREAD_LAUNCH_OVERRIDES + { + _In_opt_ const UINT *pLocalRootArgumentsTableIndex; + _In_opt_ const BOOL *pProgramEntry; + _In_opt_ const D3D12_NODE_ID *pNewName; + _In_opt_ const D3D12_NODE_ID *pShareInputOf; + UINT NumOutputOverrides; + _In_reads_opt_(NumOutputOverrides) const D3D12_NODE_OUTPUT_OVERRIDES *pOutputOverrides; + } D3D12_THREAD_LAUNCH_OVERRIDES; + +typedef struct D3D12_COMMON_COMPUTE_NODE_OVERRIDES + { + _In_opt_ const UINT *pLocalRootArgumentsTableIndex; + _In_opt_ const BOOL *pProgramEntry; + _In_opt_ const D3D12_NODE_ID *pNewName; + _In_opt_ const D3D12_NODE_ID *pShareInputOf; + UINT NumOutputOverrides; + _In_reads_opt_(NumOutputOverrides) const D3D12_NODE_OUTPUT_OVERRIDES *pOutputOverrides; + } D3D12_COMMON_COMPUTE_NODE_OVERRIDES; + +typedef +enum D3D12_NODE_OVERRIDES_TYPE + { + D3D12_NODE_OVERRIDES_TYPE_NONE = 0, + D3D12_NODE_OVERRIDES_TYPE_BROADCASTING_LAUNCH = 1, + D3D12_NODE_OVERRIDES_TYPE_COALESCING_LAUNCH = 2, + D3D12_NODE_OVERRIDES_TYPE_THREAD_LAUNCH = 3, + D3D12_NODE_OVERRIDES_TYPE_COMMON_COMPUTE = 4 + } D3D12_NODE_OVERRIDES_TYPE; + +typedef struct D3D12_SHADER_NODE + { + LPCWSTR Shader; + D3D12_NODE_OVERRIDES_TYPE OverridesType; + union + { + const D3D12_BROADCASTING_LAUNCH_OVERRIDES *pBroadcastingLaunchOverrides; + const D3D12_COALESCING_LAUNCH_OVERRIDES *pCoalescingLaunchOverrides; + const D3D12_THREAD_LAUNCH_OVERRIDES *pThreadLaunchOverrides; + const D3D12_COMMON_COMPUTE_NODE_OVERRIDES *pCommonComputeNodeOverrides; + } ; + } D3D12_SHADER_NODE; + +typedef +enum D3D12_NODE_TYPE + { + D3D12_NODE_TYPE_SHADER = 0 + } D3D12_NODE_TYPE; + +typedef struct D3D12_NODE + { + D3D12_NODE_TYPE NodeType; + union + { + D3D12_SHADER_NODE Shader; + } ; + } D3D12_NODE; + +typedef +enum D3D12_WORK_GRAPH_FLAGS + { + D3D12_WORK_GRAPH_FLAG_NONE = 0, + D3D12_WORK_GRAPH_FLAG_INCLUDE_ALL_AVAILABLE_NODES = 0x1 + } D3D12_WORK_GRAPH_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_WORK_GRAPH_FLAGS ) +typedef struct D3D12_WORK_GRAPH_DESC + { + LPCWSTR ProgramName; + D3D12_WORK_GRAPH_FLAGS Flags; + UINT NumEntrypoints; + _In_reads_opt_(NumEntrypoints) const D3D12_NODE_ID *pEntrypoints; + UINT NumExplicitlyDefinedNodes; + _In_reads_opt_(NumExplicitlyDefinedNodes) const D3D12_NODE *pExplicitlyDefinedNodes; + } D3D12_WORK_GRAPH_DESC; + +typedef struct D3D12_GENERIC_PROGRAM_DESC + { + LPCWSTR ProgramName; + UINT NumExports; + _In_reads_(NumExports) LPCWSTR *pExports; + UINT NumSubobjects; + _In_reads_opt_(NumSubobjects) const D3D12_STATE_SUBOBJECT *const *ppSubobjects; + } D3D12_GENERIC_PROGRAM_DESC; + +typedef +enum D3D12_STATE_OBJECT_TYPE + { + D3D12_STATE_OBJECT_TYPE_COLLECTION = 0, + D3D12_STATE_OBJECT_TYPE_RAYTRACING_PIPELINE = 3, + D3D12_STATE_OBJECT_TYPE_EXECUTABLE = 4 + } D3D12_STATE_OBJECT_TYPE; + +typedef struct D3D12_STATE_OBJECT_DESC + { + D3D12_STATE_OBJECT_TYPE Type; + UINT NumSubobjects; + _In_reads_(NumSubobjects) const D3D12_STATE_SUBOBJECT *pSubobjects; + } D3D12_STATE_OBJECT_DESC; + +typedef +enum D3D12_RAYTRACING_GEOMETRY_FLAGS + { + D3D12_RAYTRACING_GEOMETRY_FLAG_NONE = 0, + D3D12_RAYTRACING_GEOMETRY_FLAG_OPAQUE = 0x1, + D3D12_RAYTRACING_GEOMETRY_FLAG_NO_DUPLICATE_ANYHIT_INVOCATION = 0x2 + } D3D12_RAYTRACING_GEOMETRY_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RAYTRACING_GEOMETRY_FLAGS ) +typedef +enum D3D12_RAYTRACING_GEOMETRY_TYPE + { + D3D12_RAYTRACING_GEOMETRY_TYPE_TRIANGLES = 0, + D3D12_RAYTRACING_GEOMETRY_TYPE_PROCEDURAL_PRIMITIVE_AABBS = ( D3D12_RAYTRACING_GEOMETRY_TYPE_TRIANGLES + 1 ) + } D3D12_RAYTRACING_GEOMETRY_TYPE; + +typedef +enum D3D12_RAYTRACING_INSTANCE_FLAGS + { + D3D12_RAYTRACING_INSTANCE_FLAG_NONE = 0, + D3D12_RAYTRACING_INSTANCE_FLAG_TRIANGLE_CULL_DISABLE = 0x1, + D3D12_RAYTRACING_INSTANCE_FLAG_TRIANGLE_FRONT_COUNTERCLOCKWISE = 0x2, + D3D12_RAYTRACING_INSTANCE_FLAG_FORCE_OPAQUE = 0x4, + D3D12_RAYTRACING_INSTANCE_FLAG_FORCE_NON_OPAQUE = 0x8 + } D3D12_RAYTRACING_INSTANCE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RAYTRACING_INSTANCE_FLAGS ) +typedef struct D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE + { + D3D12_GPU_VIRTUAL_ADDRESS StartAddress; + UINT64 StrideInBytes; + } D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE; + +typedef struct D3D12_GPU_VIRTUAL_ADDRESS_RANGE + { + D3D12_GPU_VIRTUAL_ADDRESS StartAddress; + UINT64 SizeInBytes; + } D3D12_GPU_VIRTUAL_ADDRESS_RANGE; + +typedef struct D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE + { + D3D12_GPU_VIRTUAL_ADDRESS StartAddress; + UINT64 SizeInBytes; + UINT64 StrideInBytes; + } D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE; + +typedef struct D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC + { + D3D12_GPU_VIRTUAL_ADDRESS Transform3x4; + DXGI_FORMAT IndexFormat; + DXGI_FORMAT VertexFormat; + UINT IndexCount; + UINT VertexCount; + D3D12_GPU_VIRTUAL_ADDRESS IndexBuffer; + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE VertexBuffer; + } D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC; + +typedef struct D3D12_RAYTRACING_AABB + { + FLOAT MinX; + FLOAT MinY; + FLOAT MinZ; + FLOAT MaxX; + FLOAT MaxY; + FLOAT MaxZ; + } D3D12_RAYTRACING_AABB; + +typedef struct D3D12_RAYTRACING_GEOMETRY_AABBS_DESC + { + UINT64 AABBCount; + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE AABBs; + } D3D12_RAYTRACING_GEOMETRY_AABBS_DESC; + +typedef +enum D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_NONE = 0, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_ALLOW_UPDATE = 0x1, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_ALLOW_COMPACTION = 0x2, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PREFER_FAST_TRACE = 0x4, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PREFER_FAST_BUILD = 0x8, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_MINIMIZE_MEMORY = 0x10, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PERFORM_UPDATE = 0x20 + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS ) +typedef +enum D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_CLONE = 0, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_COMPACT = 0x1, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_VISUALIZATION_DECODE_FOR_TOOLS = 0x2, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_SERIALIZE = 0x3, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_DESERIALIZE = 0x4 + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE; + +typedef +enum D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL = 0, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL = 0x1 + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE; + +typedef +enum D3D12_ELEMENTS_LAYOUT + { + D3D12_ELEMENTS_LAYOUT_ARRAY = 0, + D3D12_ELEMENTS_LAYOUT_ARRAY_OF_POINTERS = 0x1 + } D3D12_ELEMENTS_LAYOUT; + +typedef +enum D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TYPE + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_COMPACTED_SIZE = 0, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TOOLS_VISUALIZATION = 0x1, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_SERIALIZATION = 0x2, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_CURRENT_SIZE = 0x3 + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TYPE; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC + { + D3D12_GPU_VIRTUAL_ADDRESS DestBuffer; + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TYPE InfoType; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_COMPACTED_SIZE_DESC + { + UINT64 CompactedSizeInBytes; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_COMPACTED_SIZE_DESC; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TOOLS_VISUALIZATION_DESC + { + UINT64 DecodedSizeInBytes; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TOOLS_VISUALIZATION_DESC; + +typedef struct D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_TOOLS_VISUALIZATION_HEADER + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE Type; + UINT NumDescs; + } D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_TOOLS_VISUALIZATION_HEADER; + +// Regarding D3D12_BUILD_RAY_TRACING_ACCELERATION_STRUCTURE_TOOLS_VISUALIZATION_HEADER above, +// depending on Type field, NumDescs above is followed by either: +// D3D12_RAY_TRACING_INSTANCE_DESC InstanceDescs[NumDescs] +// or D3D12_RAY_TRACING_GEOMETRY_DESC GeometryDescs[NumDescs]. +// There is 4 bytes of padding between GeometryDesc structs in the array so alignment is natural when viewed by CPU. + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_SERIALIZATION_DESC + { + UINT64 SerializedSizeInBytes; + UINT64 NumBottomLevelAccelerationStructurePointers; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_SERIALIZATION_DESC; + +typedef struct D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER + { + GUID DriverOpaqueGUID; + BYTE DriverOpaqueVersioningData[ 16 ]; + } D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER; + +typedef +enum D3D12_SERIALIZED_DATA_TYPE + { + D3D12_SERIALIZED_DATA_RAYTRACING_ACCELERATION_STRUCTURE = 0 + } D3D12_SERIALIZED_DATA_TYPE; + +typedef +enum D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS + { + D3D12_DRIVER_MATCHING_IDENTIFIER_COMPATIBLE_WITH_DEVICE = 0, + D3D12_DRIVER_MATCHING_IDENTIFIER_UNSUPPORTED_TYPE = 0x1, + D3D12_DRIVER_MATCHING_IDENTIFIER_UNRECOGNIZED = 0x2, + D3D12_DRIVER_MATCHING_IDENTIFIER_INCOMPATIBLE_VERSION = 0x3, + D3D12_DRIVER_MATCHING_IDENTIFIER_INCOMPATIBLE_TYPE = 0x4 + } D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS; + +typedef struct D3D12_SERIALIZED_RAYTRACING_ACCELERATION_STRUCTURE_HEADER + { + D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER DriverMatchingIdentifier; + UINT64 SerializedSizeInBytesIncludingHeader; + UINT64 DeserializedSizeInBytes; + UINT64 NumBottomLevelAccelerationStructurePointersAfterHeader; + } D3D12_SERIALIZED_RAYTRACING_ACCELERATION_STRUCTURE_HEADER; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_CURRENT_SIZE_DESC + { + UINT64 CurrentSizeInBytes; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_CURRENT_SIZE_DESC; + +typedef struct D3D12_RAYTRACING_INSTANCE_DESC + { + FLOAT Transform[ 3 ][ 4 ]; + UINT InstanceID : 24; + UINT InstanceMask : 8; + UINT InstanceContributionToHitGroupIndex : 24; + UINT Flags : 8; + D3D12_GPU_VIRTUAL_ADDRESS AccelerationStructure; + } D3D12_RAYTRACING_INSTANCE_DESC; + +typedef struct D3D12_RAYTRACING_GEOMETRY_DESC + { + D3D12_RAYTRACING_GEOMETRY_TYPE Type; + D3D12_RAYTRACING_GEOMETRY_FLAGS Flags; + union + { + D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC Triangles; + D3D12_RAYTRACING_GEOMETRY_AABBS_DESC AABBs; + } ; + } D3D12_RAYTRACING_GEOMETRY_DESC; + +typedef struct D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE Type; + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS Flags; + UINT NumDescs; + D3D12_ELEMENTS_LAYOUT DescsLayout; + union + { + D3D12_GPU_VIRTUAL_ADDRESS InstanceDescs; + const D3D12_RAYTRACING_GEOMETRY_DESC *pGeometryDescs; + const D3D12_RAYTRACING_GEOMETRY_DESC *const *ppGeometryDescs; + } ; + } D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS; + +typedef struct D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC + { + D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData; + D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS Inputs; + _In_opt_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData; + D3D12_GPU_VIRTUAL_ADDRESS ScratchAccelerationStructureData; + } D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO + { + UINT64 ResultDataMaxSizeInBytes; + UINT64 ScratchDataSizeInBytes; + UINT64 UpdateScratchDataSizeInBytes; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO; + +typedef +enum D3D12_RAY_FLAGS + { + D3D12_RAY_FLAG_NONE = 0, + D3D12_RAY_FLAG_FORCE_OPAQUE = 0x1, + D3D12_RAY_FLAG_FORCE_NON_OPAQUE = 0x2, + D3D12_RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH = 0x4, + D3D12_RAY_FLAG_SKIP_CLOSEST_HIT_SHADER = 0x8, + D3D12_RAY_FLAG_CULL_BACK_FACING_TRIANGLES = 0x10, + D3D12_RAY_FLAG_CULL_FRONT_FACING_TRIANGLES = 0x20, + D3D12_RAY_FLAG_CULL_OPAQUE = 0x40, + D3D12_RAY_FLAG_CULL_NON_OPAQUE = 0x80, + D3D12_RAY_FLAG_SKIP_TRIANGLES = 0x100, + D3D12_RAY_FLAG_SKIP_PROCEDURAL_PRIMITIVES = 0x200 + } D3D12_RAY_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RAY_FLAGS ) +typedef +enum D3D12_HIT_KIND + { + D3D12_HIT_KIND_TRIANGLE_FRONT_FACE = 0xfe, + D3D12_HIT_KIND_TRIANGLE_BACK_FACE = 0xff + } D3D12_HIT_KIND; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0036_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0036_v0_0_s_ifspec; + +#ifndef __ID3D12Device5_INTERFACE_DEFINED__ +#define __ID3D12Device5_INTERFACE_DEFINED__ + +/* interface ID3D12Device5 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device5; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8b4f173b-2fea-4b80-8f58-4307191ab95d") + ID3D12Device5 : public ID3D12Device4 + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateLifetimeTracker( + _In_ ID3D12LifetimeOwner *pOwner, + REFIID riid, + _COM_Outptr_ void **ppvTracker) = 0; + + virtual void STDMETHODCALLTYPE RemoveDevice( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumerateMetaCommands( + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_META_COMMAND_DESC *pDescs) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumerateMetaCommandParameters( + _In_ REFGUID CommandId, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _Out_opt_ UINT *pTotalStructureSizeInBytes, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_META_COMMAND_PARAMETER_DESC *pParameterDescs) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateMetaCommand( + _In_ REFGUID CommandId, + _In_ UINT NodeMask, + _In_reads_bytes_opt_(CreationParametersDataSizeInBytes) const void *pCreationParametersData, + _In_ SIZE_T CreationParametersDataSizeInBytes, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateStateObject( + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject) = 0; + + virtual void STDMETHODCALLTYPE GetRaytracingAccelerationStructurePrebuildInfo( + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo) = 0; + + virtual D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS STDMETHODCALLTYPE CheckDriverMatchingIdentifier( + _In_ D3D12_SERIALIZED_DATA_TYPE SerializedDataType, + _In_ const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *pIdentifierToCheck) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device5Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device5 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device5 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device5 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device5 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device5 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device5 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device5 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device5 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device5 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device5 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device5 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device5 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device5 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device5 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device5 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device5 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device5 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device5 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device5 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device5 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device5 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device5 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device5 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device5 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device5 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device5 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device5 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device5 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device5 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device5 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device5 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device5 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device5 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device5 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device5 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device5 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device5 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device5 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device5 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device5 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device5 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device5 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device5 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device5 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device5 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device5 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device5 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device5 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device5 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device5 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + DECLSPEC_XFGVIRT(ID3D12Device2, CreatePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device5 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromAddress) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device5 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromFileMapping) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device5 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, EnqueueMakeResident) + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device5 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommandList1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList1 )( + ID3D12Device5 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession )( + ID3D12Device5 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommittedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource1 )( + ID3D12Device5 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateHeap1) + HRESULT ( STDMETHODCALLTYPE *CreateHeap1 )( + ID3D12Device5 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateReservedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource1 )( + ID3D12Device5 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, GetResourceAllocationInfo1) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device5 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device5 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateLifetimeTracker) + HRESULT ( STDMETHODCALLTYPE *CreateLifetimeTracker )( + ID3D12Device5 * This, + _In_ ID3D12LifetimeOwner *pOwner, + REFIID riid, + _COM_Outptr_ void **ppvTracker); + + DECLSPEC_XFGVIRT(ID3D12Device5, RemoveDevice) + void ( STDMETHODCALLTYPE *RemoveDevice )( + ID3D12Device5 * This); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommands) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommands )( + ID3D12Device5 * This, + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_META_COMMAND_DESC *pDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommandParameters) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommandParameters )( + ID3D12Device5 * This, + _In_ REFGUID CommandId, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _Out_opt_ UINT *pTotalStructureSizeInBytes, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_META_COMMAND_PARAMETER_DESC *pParameterDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateMetaCommand) + HRESULT ( STDMETHODCALLTYPE *CreateMetaCommand )( + ID3D12Device5 * This, + _In_ REFGUID CommandId, + _In_ UINT NodeMask, + _In_reads_bytes_opt_(CreationParametersDataSizeInBytes) const void *pCreationParametersData, + _In_ SIZE_T CreationParametersDataSizeInBytes, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateStateObject) + HRESULT ( STDMETHODCALLTYPE *CreateStateObject )( + ID3D12Device5 * This, + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device5, GetRaytracingAccelerationStructurePrebuildInfo) + void ( STDMETHODCALLTYPE *GetRaytracingAccelerationStructurePrebuildInfo )( + ID3D12Device5 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo); + + DECLSPEC_XFGVIRT(ID3D12Device5, CheckDriverMatchingIdentifier) + D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS ( STDMETHODCALLTYPE *CheckDriverMatchingIdentifier )( + ID3D12Device5 * This, + _In_ D3D12_SERIALIZED_DATA_TYPE SerializedDataType, + _In_ const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *pIdentifierToCheck); + + END_INTERFACE + } ID3D12Device5Vtbl; + + interface ID3D12Device5 + { + CONST_VTBL struct ID3D12Device5Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device5_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device5_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device5_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device5_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device5_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device5_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device5_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device5_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device5_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device5_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device5_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device5_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device5_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device5_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device5_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device5_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device5_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device5_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device5_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device5_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device5_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device5_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device5_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device5_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device5_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device5_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device5_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device5_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device5_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device5_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device5_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device5_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device5_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device5_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device5_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device5_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device5_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device5_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device5_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device5_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device5_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device5_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device5_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device5_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device5_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device5_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device5_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device5_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device5_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device5_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device5_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device5_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device5_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device5_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + + +#define ID3D12Device5_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) ) + +#define ID3D12Device5_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession(This,pDesc,riid,ppSession) ) + +#define ID3D12Device5_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device5_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) ) + +#define ID3D12Device5_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#if !defined(_WIN32) + +#define ID3D12Device5_GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device5_GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + + +#define ID3D12Device5_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->lpVtbl -> CreateLifetimeTracker(This,pOwner,riid,ppvTracker) ) + +#define ID3D12Device5_RemoveDevice(This) \ + ( (This)->lpVtbl -> RemoveDevice(This) ) + +#define ID3D12Device5_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommands(This,pNumMetaCommands,pDescs) ) + +#define ID3D12Device5_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) + +#define ID3D12Device5_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->lpVtbl -> CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) + +#define ID3D12Device5_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->lpVtbl -> CreateStateObject(This,pDesc,riid,ppStateObject) ) + +#define ID3D12Device5_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->lpVtbl -> GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) ) + +#define ID3D12Device5_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->lpVtbl -> CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device5_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0037 */ +/* [local] */ + +typedef +enum D3D12_AUTO_BREADCRUMB_OP + { + D3D12_AUTO_BREADCRUMB_OP_SETMARKER = 0, + D3D12_AUTO_BREADCRUMB_OP_BEGINEVENT = 1, + D3D12_AUTO_BREADCRUMB_OP_ENDEVENT = 2, + D3D12_AUTO_BREADCRUMB_OP_DRAWINSTANCED = 3, + D3D12_AUTO_BREADCRUMB_OP_DRAWINDEXEDINSTANCED = 4, + D3D12_AUTO_BREADCRUMB_OP_EXECUTEINDIRECT = 5, + D3D12_AUTO_BREADCRUMB_OP_DISPATCH = 6, + D3D12_AUTO_BREADCRUMB_OP_COPYBUFFERREGION = 7, + D3D12_AUTO_BREADCRUMB_OP_COPYTEXTUREREGION = 8, + D3D12_AUTO_BREADCRUMB_OP_COPYRESOURCE = 9, + D3D12_AUTO_BREADCRUMB_OP_COPYTILES = 10, + D3D12_AUTO_BREADCRUMB_OP_RESOLVESUBRESOURCE = 11, + D3D12_AUTO_BREADCRUMB_OP_CLEARRENDERTARGETVIEW = 12, + D3D12_AUTO_BREADCRUMB_OP_CLEARUNORDEREDACCESSVIEW = 13, + D3D12_AUTO_BREADCRUMB_OP_CLEARDEPTHSTENCILVIEW = 14, + D3D12_AUTO_BREADCRUMB_OP_RESOURCEBARRIER = 15, + D3D12_AUTO_BREADCRUMB_OP_EXECUTEBUNDLE = 16, + D3D12_AUTO_BREADCRUMB_OP_PRESENT = 17, + D3D12_AUTO_BREADCRUMB_OP_RESOLVEQUERYDATA = 18, + D3D12_AUTO_BREADCRUMB_OP_BEGINSUBMISSION = 19, + D3D12_AUTO_BREADCRUMB_OP_ENDSUBMISSION = 20, + D3D12_AUTO_BREADCRUMB_OP_DECODEFRAME = 21, + D3D12_AUTO_BREADCRUMB_OP_PROCESSFRAMES = 22, + D3D12_AUTO_BREADCRUMB_OP_ATOMICCOPYBUFFERUINT = 23, + D3D12_AUTO_BREADCRUMB_OP_ATOMICCOPYBUFFERUINT64 = 24, + D3D12_AUTO_BREADCRUMB_OP_RESOLVESUBRESOURCEREGION = 25, + D3D12_AUTO_BREADCRUMB_OP_WRITEBUFFERIMMEDIATE = 26, + D3D12_AUTO_BREADCRUMB_OP_DECODEFRAME1 = 27, + D3D12_AUTO_BREADCRUMB_OP_SETPROTECTEDRESOURCESESSION = 28, + D3D12_AUTO_BREADCRUMB_OP_DECODEFRAME2 = 29, + D3D12_AUTO_BREADCRUMB_OP_PROCESSFRAMES1 = 30, + D3D12_AUTO_BREADCRUMB_OP_BUILDRAYTRACINGACCELERATIONSTRUCTURE = 31, + D3D12_AUTO_BREADCRUMB_OP_EMITRAYTRACINGACCELERATIONSTRUCTUREPOSTBUILDINFO = 32, + D3D12_AUTO_BREADCRUMB_OP_COPYRAYTRACINGACCELERATIONSTRUCTURE = 33, + D3D12_AUTO_BREADCRUMB_OP_DISPATCHRAYS = 34, + D3D12_AUTO_BREADCRUMB_OP_INITIALIZEMETACOMMAND = 35, + D3D12_AUTO_BREADCRUMB_OP_EXECUTEMETACOMMAND = 36, + D3D12_AUTO_BREADCRUMB_OP_ESTIMATEMOTION = 37, + D3D12_AUTO_BREADCRUMB_OP_RESOLVEMOTIONVECTORHEAP = 38, + D3D12_AUTO_BREADCRUMB_OP_SETPIPELINESTATE1 = 39, + D3D12_AUTO_BREADCRUMB_OP_INITIALIZEEXTENSIONCOMMAND = 40, + D3D12_AUTO_BREADCRUMB_OP_EXECUTEEXTENSIONCOMMAND = 41, + D3D12_AUTO_BREADCRUMB_OP_DISPATCHMESH = 42, + D3D12_AUTO_BREADCRUMB_OP_ENCODEFRAME = 43, + D3D12_AUTO_BREADCRUMB_OP_RESOLVEENCODEROUTPUTMETADATA = 44, + D3D12_AUTO_BREADCRUMB_OP_BARRIER = 45, + D3D12_AUTO_BREADCRUMB_OP_BEGIN_COMMAND_LIST = 46, + D3D12_AUTO_BREADCRUMB_OP_DISPATCHGRAPH = 47, + D3D12_AUTO_BREADCRUMB_OP_SETPROGRAM = 48 + } D3D12_AUTO_BREADCRUMB_OP; + +typedef struct D3D12_AUTO_BREADCRUMB_NODE + { + const char *pCommandListDebugNameA; + const wchar_t *pCommandListDebugNameW; + const char *pCommandQueueDebugNameA; + const wchar_t *pCommandQueueDebugNameW; + ID3D12GraphicsCommandList *pCommandList; + ID3D12CommandQueue *pCommandQueue; + UINT32 BreadcrumbCount; + const UINT32 *pLastBreadcrumbValue; + const D3D12_AUTO_BREADCRUMB_OP *pCommandHistory; + const struct D3D12_AUTO_BREADCRUMB_NODE *pNext; + } D3D12_AUTO_BREADCRUMB_NODE; + +typedef struct D3D12_DRED_BREADCRUMB_CONTEXT + { + UINT BreadcrumbIndex; + const wchar_t *pContextString; + } D3D12_DRED_BREADCRUMB_CONTEXT; + +typedef struct D3D12_AUTO_BREADCRUMB_NODE1 + { + const char *pCommandListDebugNameA; + const wchar_t *pCommandListDebugNameW; + const char *pCommandQueueDebugNameA; + const wchar_t *pCommandQueueDebugNameW; + ID3D12GraphicsCommandList *pCommandList; + ID3D12CommandQueue *pCommandQueue; + UINT BreadcrumbCount; + const UINT *pLastBreadcrumbValue; + const D3D12_AUTO_BREADCRUMB_OP *pCommandHistory; + const struct D3D12_AUTO_BREADCRUMB_NODE1 *pNext; + UINT BreadcrumbContextsCount; + D3D12_DRED_BREADCRUMB_CONTEXT *pBreadcrumbContexts; + } D3D12_AUTO_BREADCRUMB_NODE1; + +typedef +enum D3D12_DRED_VERSION + { + D3D12_DRED_VERSION_1_0 = 0x1, + D3D12_DRED_VERSION_1_1 = 0x2, + D3D12_DRED_VERSION_1_2 = 0x3, + D3D12_DRED_VERSION_1_3 = 0x4 + } D3D12_DRED_VERSION; + +typedef +enum D3D12_DRED_FLAGS + { + D3D12_DRED_FLAG_NONE = 0, + D3D12_DRED_FLAG_FORCE_ENABLE = 1, + D3D12_DRED_FLAG_DISABLE_AUTOBREADCRUMBS = 2 + } D3D12_DRED_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_DRED_FLAGS ) +typedef +enum D3D12_DRED_ENABLEMENT + { + D3D12_DRED_ENABLEMENT_SYSTEM_CONTROLLED = 0, + D3D12_DRED_ENABLEMENT_FORCED_OFF = 1, + D3D12_DRED_ENABLEMENT_FORCED_ON = 2 + } D3D12_DRED_ENABLEMENT; + +typedef struct D3D12_DEVICE_REMOVED_EXTENDED_DATA + { + _In_ D3D12_DRED_FLAGS Flags; + _Out_ D3D12_AUTO_BREADCRUMB_NODE *pHeadAutoBreadcrumbNode; + } D3D12_DEVICE_REMOVED_EXTENDED_DATA; + +typedef +enum D3D12_DRED_ALLOCATION_TYPE + { + D3D12_DRED_ALLOCATION_TYPE_COMMAND_QUEUE = 19, + D3D12_DRED_ALLOCATION_TYPE_COMMAND_ALLOCATOR = 20, + D3D12_DRED_ALLOCATION_TYPE_PIPELINE_STATE = 21, + D3D12_DRED_ALLOCATION_TYPE_COMMAND_LIST = 22, + D3D12_DRED_ALLOCATION_TYPE_FENCE = 23, + D3D12_DRED_ALLOCATION_TYPE_DESCRIPTOR_HEAP = 24, + D3D12_DRED_ALLOCATION_TYPE_HEAP = 25, + D3D12_DRED_ALLOCATION_TYPE_QUERY_HEAP = 27, + D3D12_DRED_ALLOCATION_TYPE_COMMAND_SIGNATURE = 28, + D3D12_DRED_ALLOCATION_TYPE_PIPELINE_LIBRARY = 29, + D3D12_DRED_ALLOCATION_TYPE_VIDEO_DECODER = 30, + D3D12_DRED_ALLOCATION_TYPE_VIDEO_PROCESSOR = 32, + D3D12_DRED_ALLOCATION_TYPE_RESOURCE = 34, + D3D12_DRED_ALLOCATION_TYPE_PASS = 35, + D3D12_DRED_ALLOCATION_TYPE_CRYPTOSESSION = 36, + D3D12_DRED_ALLOCATION_TYPE_CRYPTOSESSIONPOLICY = 37, + D3D12_DRED_ALLOCATION_TYPE_PROTECTEDRESOURCESESSION = 38, + D3D12_DRED_ALLOCATION_TYPE_VIDEO_DECODER_HEAP = 39, + D3D12_DRED_ALLOCATION_TYPE_COMMAND_POOL = 40, + D3D12_DRED_ALLOCATION_TYPE_COMMAND_RECORDER = 41, + D3D12_DRED_ALLOCATION_TYPE_STATE_OBJECT = 42, + D3D12_DRED_ALLOCATION_TYPE_METACOMMAND = 43, + D3D12_DRED_ALLOCATION_TYPE_SCHEDULINGGROUP = 44, + D3D12_DRED_ALLOCATION_TYPE_VIDEO_MOTION_ESTIMATOR = 45, + D3D12_DRED_ALLOCATION_TYPE_VIDEO_MOTION_VECTOR_HEAP = 46, + D3D12_DRED_ALLOCATION_TYPE_VIDEO_EXTENSION_COMMAND = 47, + D3D12_DRED_ALLOCATION_TYPE_VIDEO_ENCODER = 48, + D3D12_DRED_ALLOCATION_TYPE_VIDEO_ENCODER_HEAP = 49, + D3D12_DRED_ALLOCATION_TYPE_INVALID = 0xffffffff + } D3D12_DRED_ALLOCATION_TYPE; + +typedef struct D3D12_DRED_ALLOCATION_NODE + { + const char *ObjectNameA; + const wchar_t *ObjectNameW; + D3D12_DRED_ALLOCATION_TYPE AllocationType; + const struct D3D12_DRED_ALLOCATION_NODE *pNext; + } D3D12_DRED_ALLOCATION_NODE; + +typedef struct D3D12_DRED_ALLOCATION_NODE1 + { + const char *ObjectNameA; + const wchar_t *ObjectNameW; + D3D12_DRED_ALLOCATION_TYPE AllocationType; + const struct D3D12_DRED_ALLOCATION_NODE1 *pNext; + const IUnknown *pObject; + } D3D12_DRED_ALLOCATION_NODE1; + +typedef struct D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT + { + _Out_ const D3D12_AUTO_BREADCRUMB_NODE *pHeadAutoBreadcrumbNode; + } D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT; + +typedef struct D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT1 + { + _Out_ const D3D12_AUTO_BREADCRUMB_NODE1 *pHeadAutoBreadcrumbNode; + } D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT1; + +typedef struct D3D12_DRED_PAGE_FAULT_OUTPUT + { + D3D12_GPU_VIRTUAL_ADDRESS PageFaultVA; + _Out_ const D3D12_DRED_ALLOCATION_NODE *pHeadExistingAllocationNode; + _Out_ const D3D12_DRED_ALLOCATION_NODE *pHeadRecentFreedAllocationNode; + } D3D12_DRED_PAGE_FAULT_OUTPUT; + +typedef struct D3D12_DRED_PAGE_FAULT_OUTPUT1 + { + D3D12_GPU_VIRTUAL_ADDRESS PageFaultVA; + _Out_ const D3D12_DRED_ALLOCATION_NODE1 *pHeadExistingAllocationNode; + _Out_ const D3D12_DRED_ALLOCATION_NODE1 *pHeadRecentFreedAllocationNode; + } D3D12_DRED_PAGE_FAULT_OUTPUT1; + +typedef +enum D3D12_DRED_PAGE_FAULT_FLAGS + { + D3D12_DRED_PAGE_FAULT_FLAGS_NONE = 0 + } D3D12_DRED_PAGE_FAULT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_DRED_PAGE_FAULT_FLAGS ) +typedef +enum D3D12_DRED_DEVICE_STATE + { + D3D12_DRED_DEVICE_STATE_UNKNOWN = 0, + D3D12_DRED_DEVICE_STATE_HUNG = 3, + D3D12_DRED_DEVICE_STATE_FAULT = 6, + D3D12_DRED_DEVICE_STATE_PAGEFAULT = 7 + } D3D12_DRED_DEVICE_STATE; + +typedef struct D3D12_DRED_PAGE_FAULT_OUTPUT2 + { + D3D12_GPU_VIRTUAL_ADDRESS PageFaultVA; + _Out_ const D3D12_DRED_ALLOCATION_NODE1 *pHeadExistingAllocationNode; + _Out_ const D3D12_DRED_ALLOCATION_NODE1 *pHeadRecentFreedAllocationNode; + D3D12_DRED_PAGE_FAULT_FLAGS PageFaultFlags; + } D3D12_DRED_PAGE_FAULT_OUTPUT2; + +typedef struct D3D12_DEVICE_REMOVED_EXTENDED_DATA1 + { + HRESULT DeviceRemovedReason; + D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT AutoBreadcrumbsOutput; + D3D12_DRED_PAGE_FAULT_OUTPUT PageFaultOutput; + } D3D12_DEVICE_REMOVED_EXTENDED_DATA1; + +typedef struct D3D12_DEVICE_REMOVED_EXTENDED_DATA2 + { + HRESULT DeviceRemovedReason; + D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT1 AutoBreadcrumbsOutput; + D3D12_DRED_PAGE_FAULT_OUTPUT1 PageFaultOutput; + } D3D12_DEVICE_REMOVED_EXTENDED_DATA2; + +typedef struct D3D12_DEVICE_REMOVED_EXTENDED_DATA3 + { + HRESULT DeviceRemovedReason; + D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT1 AutoBreadcrumbsOutput; + D3D12_DRED_PAGE_FAULT_OUTPUT2 PageFaultOutput; + D3D12_DRED_DEVICE_STATE DeviceState; + } D3D12_DEVICE_REMOVED_EXTENDED_DATA3; + +typedef struct D3D12_VERSIONED_DEVICE_REMOVED_EXTENDED_DATA + { + D3D12_DRED_VERSION Version; + union + { + D3D12_DEVICE_REMOVED_EXTENDED_DATA Dred_1_0; + D3D12_DEVICE_REMOVED_EXTENDED_DATA1 Dred_1_1; + D3D12_DEVICE_REMOVED_EXTENDED_DATA2 Dred_1_2; + D3D12_DEVICE_REMOVED_EXTENDED_DATA3 Dred_1_3; + } ; + } D3D12_VERSIONED_DEVICE_REMOVED_EXTENDED_DATA; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0037_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0037_v0_0_s_ifspec; + +#ifndef __ID3D12DeviceRemovedExtendedDataSettings_INTERFACE_DEFINED__ +#define __ID3D12DeviceRemovedExtendedDataSettings_INTERFACE_DEFINED__ + +/* interface ID3D12DeviceRemovedExtendedDataSettings */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DeviceRemovedExtendedDataSettings; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("82BC481C-6B9B-4030-AEDB-7EE3D1DF1E63") + ID3D12DeviceRemovedExtendedDataSettings : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE SetAutoBreadcrumbsEnablement( + D3D12_DRED_ENABLEMENT Enablement) = 0; + + virtual void STDMETHODCALLTYPE SetPageFaultEnablement( + D3D12_DRED_ENABLEMENT Enablement) = 0; + + virtual void STDMETHODCALLTYPE SetWatsonDumpEnablement( + D3D12_DRED_ENABLEMENT Enablement) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DeviceRemovedExtendedDataSettingsVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DeviceRemovedExtendedDataSettings * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DeviceRemovedExtendedDataSettings * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DeviceRemovedExtendedDataSettings * This); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedDataSettings, SetAutoBreadcrumbsEnablement) + void ( STDMETHODCALLTYPE *SetAutoBreadcrumbsEnablement )( + ID3D12DeviceRemovedExtendedDataSettings * This, + D3D12_DRED_ENABLEMENT Enablement); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedDataSettings, SetPageFaultEnablement) + void ( STDMETHODCALLTYPE *SetPageFaultEnablement )( + ID3D12DeviceRemovedExtendedDataSettings * This, + D3D12_DRED_ENABLEMENT Enablement); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedDataSettings, SetWatsonDumpEnablement) + void ( STDMETHODCALLTYPE *SetWatsonDumpEnablement )( + ID3D12DeviceRemovedExtendedDataSettings * This, + D3D12_DRED_ENABLEMENT Enablement); + + END_INTERFACE + } ID3D12DeviceRemovedExtendedDataSettingsVtbl; + + interface ID3D12DeviceRemovedExtendedDataSettings + { + CONST_VTBL struct ID3D12DeviceRemovedExtendedDataSettingsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DeviceRemovedExtendedDataSettings_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DeviceRemovedExtendedDataSettings_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DeviceRemovedExtendedDataSettings_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DeviceRemovedExtendedDataSettings_SetAutoBreadcrumbsEnablement(This,Enablement) \ + ( (This)->lpVtbl -> SetAutoBreadcrumbsEnablement(This,Enablement) ) + +#define ID3D12DeviceRemovedExtendedDataSettings_SetPageFaultEnablement(This,Enablement) \ + ( (This)->lpVtbl -> SetPageFaultEnablement(This,Enablement) ) + +#define ID3D12DeviceRemovedExtendedDataSettings_SetWatsonDumpEnablement(This,Enablement) \ + ( (This)->lpVtbl -> SetWatsonDumpEnablement(This,Enablement) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DeviceRemovedExtendedDataSettings_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12DeviceRemovedExtendedDataSettings1_INTERFACE_DEFINED__ +#define __ID3D12DeviceRemovedExtendedDataSettings1_INTERFACE_DEFINED__ + +/* interface ID3D12DeviceRemovedExtendedDataSettings1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DeviceRemovedExtendedDataSettings1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("DBD5AE51-3317-4F0A-ADF9-1D7CEDCAAE0B") + ID3D12DeviceRemovedExtendedDataSettings1 : public ID3D12DeviceRemovedExtendedDataSettings + { + public: + virtual void STDMETHODCALLTYPE SetBreadcrumbContextEnablement( + D3D12_DRED_ENABLEMENT Enablement) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DeviceRemovedExtendedDataSettings1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DeviceRemovedExtendedDataSettings1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DeviceRemovedExtendedDataSettings1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DeviceRemovedExtendedDataSettings1 * This); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedDataSettings, SetAutoBreadcrumbsEnablement) + void ( STDMETHODCALLTYPE *SetAutoBreadcrumbsEnablement )( + ID3D12DeviceRemovedExtendedDataSettings1 * This, + D3D12_DRED_ENABLEMENT Enablement); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedDataSettings, SetPageFaultEnablement) + void ( STDMETHODCALLTYPE *SetPageFaultEnablement )( + ID3D12DeviceRemovedExtendedDataSettings1 * This, + D3D12_DRED_ENABLEMENT Enablement); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedDataSettings, SetWatsonDumpEnablement) + void ( STDMETHODCALLTYPE *SetWatsonDumpEnablement )( + ID3D12DeviceRemovedExtendedDataSettings1 * This, + D3D12_DRED_ENABLEMENT Enablement); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedDataSettings1, SetBreadcrumbContextEnablement) + void ( STDMETHODCALLTYPE *SetBreadcrumbContextEnablement )( + ID3D12DeviceRemovedExtendedDataSettings1 * This, + D3D12_DRED_ENABLEMENT Enablement); + + END_INTERFACE + } ID3D12DeviceRemovedExtendedDataSettings1Vtbl; + + interface ID3D12DeviceRemovedExtendedDataSettings1 + { + CONST_VTBL struct ID3D12DeviceRemovedExtendedDataSettings1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DeviceRemovedExtendedDataSettings1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DeviceRemovedExtendedDataSettings1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DeviceRemovedExtendedDataSettings1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DeviceRemovedExtendedDataSettings1_SetAutoBreadcrumbsEnablement(This,Enablement) \ + ( (This)->lpVtbl -> SetAutoBreadcrumbsEnablement(This,Enablement) ) + +#define ID3D12DeviceRemovedExtendedDataSettings1_SetPageFaultEnablement(This,Enablement) \ + ( (This)->lpVtbl -> SetPageFaultEnablement(This,Enablement) ) + +#define ID3D12DeviceRemovedExtendedDataSettings1_SetWatsonDumpEnablement(This,Enablement) \ + ( (This)->lpVtbl -> SetWatsonDumpEnablement(This,Enablement) ) + + +#define ID3D12DeviceRemovedExtendedDataSettings1_SetBreadcrumbContextEnablement(This,Enablement) \ + ( (This)->lpVtbl -> SetBreadcrumbContextEnablement(This,Enablement) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DeviceRemovedExtendedDataSettings1_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12DeviceRemovedExtendedDataSettings2_INTERFACE_DEFINED__ +#define __ID3D12DeviceRemovedExtendedDataSettings2_INTERFACE_DEFINED__ + +/* interface ID3D12DeviceRemovedExtendedDataSettings2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DeviceRemovedExtendedDataSettings2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("61552388-01ab-4008-a436-83db189566ea") + ID3D12DeviceRemovedExtendedDataSettings2 : public ID3D12DeviceRemovedExtendedDataSettings1 + { + public: + virtual void STDMETHODCALLTYPE UseMarkersOnlyAutoBreadcrumbs( + BOOL MarkersOnly) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DeviceRemovedExtendedDataSettings2Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DeviceRemovedExtendedDataSettings2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DeviceRemovedExtendedDataSettings2 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DeviceRemovedExtendedDataSettings2 * This); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedDataSettings, SetAutoBreadcrumbsEnablement) + void ( STDMETHODCALLTYPE *SetAutoBreadcrumbsEnablement )( + ID3D12DeviceRemovedExtendedDataSettings2 * This, + D3D12_DRED_ENABLEMENT Enablement); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedDataSettings, SetPageFaultEnablement) + void ( STDMETHODCALLTYPE *SetPageFaultEnablement )( + ID3D12DeviceRemovedExtendedDataSettings2 * This, + D3D12_DRED_ENABLEMENT Enablement); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedDataSettings, SetWatsonDumpEnablement) + void ( STDMETHODCALLTYPE *SetWatsonDumpEnablement )( + ID3D12DeviceRemovedExtendedDataSettings2 * This, + D3D12_DRED_ENABLEMENT Enablement); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedDataSettings1, SetBreadcrumbContextEnablement) + void ( STDMETHODCALLTYPE *SetBreadcrumbContextEnablement )( + ID3D12DeviceRemovedExtendedDataSettings2 * This, + D3D12_DRED_ENABLEMENT Enablement); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedDataSettings2, UseMarkersOnlyAutoBreadcrumbs) + void ( STDMETHODCALLTYPE *UseMarkersOnlyAutoBreadcrumbs )( + ID3D12DeviceRemovedExtendedDataSettings2 * This, + BOOL MarkersOnly); + + END_INTERFACE + } ID3D12DeviceRemovedExtendedDataSettings2Vtbl; + + interface ID3D12DeviceRemovedExtendedDataSettings2 + { + CONST_VTBL struct ID3D12DeviceRemovedExtendedDataSettings2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DeviceRemovedExtendedDataSettings2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DeviceRemovedExtendedDataSettings2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DeviceRemovedExtendedDataSettings2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DeviceRemovedExtendedDataSettings2_SetAutoBreadcrumbsEnablement(This,Enablement) \ + ( (This)->lpVtbl -> SetAutoBreadcrumbsEnablement(This,Enablement) ) + +#define ID3D12DeviceRemovedExtendedDataSettings2_SetPageFaultEnablement(This,Enablement) \ + ( (This)->lpVtbl -> SetPageFaultEnablement(This,Enablement) ) + +#define ID3D12DeviceRemovedExtendedDataSettings2_SetWatsonDumpEnablement(This,Enablement) \ + ( (This)->lpVtbl -> SetWatsonDumpEnablement(This,Enablement) ) + + +#define ID3D12DeviceRemovedExtendedDataSettings2_SetBreadcrumbContextEnablement(This,Enablement) \ + ( (This)->lpVtbl -> SetBreadcrumbContextEnablement(This,Enablement) ) + + +#define ID3D12DeviceRemovedExtendedDataSettings2_UseMarkersOnlyAutoBreadcrumbs(This,MarkersOnly) \ + ( (This)->lpVtbl -> UseMarkersOnlyAutoBreadcrumbs(This,MarkersOnly) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DeviceRemovedExtendedDataSettings2_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12DeviceRemovedExtendedData_INTERFACE_DEFINED__ +#define __ID3D12DeviceRemovedExtendedData_INTERFACE_DEFINED__ + +/* interface ID3D12DeviceRemovedExtendedData */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DeviceRemovedExtendedData; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("98931D33-5AE8-4791-AA3C-1A73A2934E71") + ID3D12DeviceRemovedExtendedData : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetAutoBreadcrumbsOutput( + _Out_ D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT *pOutput) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPageFaultAllocationOutput( + _Out_ D3D12_DRED_PAGE_FAULT_OUTPUT *pOutput) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DeviceRemovedExtendedDataVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DeviceRemovedExtendedData * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DeviceRemovedExtendedData * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DeviceRemovedExtendedData * This); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedData, GetAutoBreadcrumbsOutput) + HRESULT ( STDMETHODCALLTYPE *GetAutoBreadcrumbsOutput )( + ID3D12DeviceRemovedExtendedData * This, + _Out_ D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT *pOutput); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedData, GetPageFaultAllocationOutput) + HRESULT ( STDMETHODCALLTYPE *GetPageFaultAllocationOutput )( + ID3D12DeviceRemovedExtendedData * This, + _Out_ D3D12_DRED_PAGE_FAULT_OUTPUT *pOutput); + + END_INTERFACE + } ID3D12DeviceRemovedExtendedDataVtbl; + + interface ID3D12DeviceRemovedExtendedData + { + CONST_VTBL struct ID3D12DeviceRemovedExtendedDataVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DeviceRemovedExtendedData_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DeviceRemovedExtendedData_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DeviceRemovedExtendedData_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DeviceRemovedExtendedData_GetAutoBreadcrumbsOutput(This,pOutput) \ + ( (This)->lpVtbl -> GetAutoBreadcrumbsOutput(This,pOutput) ) + +#define ID3D12DeviceRemovedExtendedData_GetPageFaultAllocationOutput(This,pOutput) \ + ( (This)->lpVtbl -> GetPageFaultAllocationOutput(This,pOutput) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DeviceRemovedExtendedData_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12DeviceRemovedExtendedData1_INTERFACE_DEFINED__ +#define __ID3D12DeviceRemovedExtendedData1_INTERFACE_DEFINED__ + +/* interface ID3D12DeviceRemovedExtendedData1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DeviceRemovedExtendedData1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9727A022-CF1D-4DDA-9EBA-EFFA653FC506") + ID3D12DeviceRemovedExtendedData1 : public ID3D12DeviceRemovedExtendedData + { + public: + virtual HRESULT STDMETHODCALLTYPE GetAutoBreadcrumbsOutput1( + _Out_ D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT1 *pOutput) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPageFaultAllocationOutput1( + _Out_ D3D12_DRED_PAGE_FAULT_OUTPUT1 *pOutput) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DeviceRemovedExtendedData1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DeviceRemovedExtendedData1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DeviceRemovedExtendedData1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DeviceRemovedExtendedData1 * This); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedData, GetAutoBreadcrumbsOutput) + HRESULT ( STDMETHODCALLTYPE *GetAutoBreadcrumbsOutput )( + ID3D12DeviceRemovedExtendedData1 * This, + _Out_ D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT *pOutput); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedData, GetPageFaultAllocationOutput) + HRESULT ( STDMETHODCALLTYPE *GetPageFaultAllocationOutput )( + ID3D12DeviceRemovedExtendedData1 * This, + _Out_ D3D12_DRED_PAGE_FAULT_OUTPUT *pOutput); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedData1, GetAutoBreadcrumbsOutput1) + HRESULT ( STDMETHODCALLTYPE *GetAutoBreadcrumbsOutput1 )( + ID3D12DeviceRemovedExtendedData1 * This, + _Out_ D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT1 *pOutput); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedData1, GetPageFaultAllocationOutput1) + HRESULT ( STDMETHODCALLTYPE *GetPageFaultAllocationOutput1 )( + ID3D12DeviceRemovedExtendedData1 * This, + _Out_ D3D12_DRED_PAGE_FAULT_OUTPUT1 *pOutput); + + END_INTERFACE + } ID3D12DeviceRemovedExtendedData1Vtbl; + + interface ID3D12DeviceRemovedExtendedData1 + { + CONST_VTBL struct ID3D12DeviceRemovedExtendedData1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DeviceRemovedExtendedData1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DeviceRemovedExtendedData1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DeviceRemovedExtendedData1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DeviceRemovedExtendedData1_GetAutoBreadcrumbsOutput(This,pOutput) \ + ( (This)->lpVtbl -> GetAutoBreadcrumbsOutput(This,pOutput) ) + +#define ID3D12DeviceRemovedExtendedData1_GetPageFaultAllocationOutput(This,pOutput) \ + ( (This)->lpVtbl -> GetPageFaultAllocationOutput(This,pOutput) ) + + +#define ID3D12DeviceRemovedExtendedData1_GetAutoBreadcrumbsOutput1(This,pOutput) \ + ( (This)->lpVtbl -> GetAutoBreadcrumbsOutput1(This,pOutput) ) + +#define ID3D12DeviceRemovedExtendedData1_GetPageFaultAllocationOutput1(This,pOutput) \ + ( (This)->lpVtbl -> GetPageFaultAllocationOutput1(This,pOutput) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DeviceRemovedExtendedData1_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12DeviceRemovedExtendedData2_INTERFACE_DEFINED__ +#define __ID3D12DeviceRemovedExtendedData2_INTERFACE_DEFINED__ + +/* interface ID3D12DeviceRemovedExtendedData2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DeviceRemovedExtendedData2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("67FC5816-E4CA-4915-BF18-42541272DA54") + ID3D12DeviceRemovedExtendedData2 : public ID3D12DeviceRemovedExtendedData1 + { + public: + virtual HRESULT STDMETHODCALLTYPE GetPageFaultAllocationOutput2( + _Out_ D3D12_DRED_PAGE_FAULT_OUTPUT2 *pOutput) = 0; + + virtual D3D12_DRED_DEVICE_STATE STDMETHODCALLTYPE GetDeviceState( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DeviceRemovedExtendedData2Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DeviceRemovedExtendedData2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DeviceRemovedExtendedData2 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DeviceRemovedExtendedData2 * This); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedData, GetAutoBreadcrumbsOutput) + HRESULT ( STDMETHODCALLTYPE *GetAutoBreadcrumbsOutput )( + ID3D12DeviceRemovedExtendedData2 * This, + _Out_ D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT *pOutput); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedData, GetPageFaultAllocationOutput) + HRESULT ( STDMETHODCALLTYPE *GetPageFaultAllocationOutput )( + ID3D12DeviceRemovedExtendedData2 * This, + _Out_ D3D12_DRED_PAGE_FAULT_OUTPUT *pOutput); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedData1, GetAutoBreadcrumbsOutput1) + HRESULT ( STDMETHODCALLTYPE *GetAutoBreadcrumbsOutput1 )( + ID3D12DeviceRemovedExtendedData2 * This, + _Out_ D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT1 *pOutput); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedData1, GetPageFaultAllocationOutput1) + HRESULT ( STDMETHODCALLTYPE *GetPageFaultAllocationOutput1 )( + ID3D12DeviceRemovedExtendedData2 * This, + _Out_ D3D12_DRED_PAGE_FAULT_OUTPUT1 *pOutput); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedData2, GetPageFaultAllocationOutput2) + HRESULT ( STDMETHODCALLTYPE *GetPageFaultAllocationOutput2 )( + ID3D12DeviceRemovedExtendedData2 * This, + _Out_ D3D12_DRED_PAGE_FAULT_OUTPUT2 *pOutput); + + DECLSPEC_XFGVIRT(ID3D12DeviceRemovedExtendedData2, GetDeviceState) + D3D12_DRED_DEVICE_STATE ( STDMETHODCALLTYPE *GetDeviceState )( + ID3D12DeviceRemovedExtendedData2 * This); + + END_INTERFACE + } ID3D12DeviceRemovedExtendedData2Vtbl; + + interface ID3D12DeviceRemovedExtendedData2 + { + CONST_VTBL struct ID3D12DeviceRemovedExtendedData2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DeviceRemovedExtendedData2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DeviceRemovedExtendedData2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DeviceRemovedExtendedData2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DeviceRemovedExtendedData2_GetAutoBreadcrumbsOutput(This,pOutput) \ + ( (This)->lpVtbl -> GetAutoBreadcrumbsOutput(This,pOutput) ) + +#define ID3D12DeviceRemovedExtendedData2_GetPageFaultAllocationOutput(This,pOutput) \ + ( (This)->lpVtbl -> GetPageFaultAllocationOutput(This,pOutput) ) + + +#define ID3D12DeviceRemovedExtendedData2_GetAutoBreadcrumbsOutput1(This,pOutput) \ + ( (This)->lpVtbl -> GetAutoBreadcrumbsOutput1(This,pOutput) ) + +#define ID3D12DeviceRemovedExtendedData2_GetPageFaultAllocationOutput1(This,pOutput) \ + ( (This)->lpVtbl -> GetPageFaultAllocationOutput1(This,pOutput) ) + + +#define ID3D12DeviceRemovedExtendedData2_GetPageFaultAllocationOutput2(This,pOutput) \ + ( (This)->lpVtbl -> GetPageFaultAllocationOutput2(This,pOutput) ) + +#define ID3D12DeviceRemovedExtendedData2_GetDeviceState(This) \ + ( (This)->lpVtbl -> GetDeviceState(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DeviceRemovedExtendedData2_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0043 */ +/* [local] */ + +typedef +enum D3D12_BACKGROUND_PROCESSING_MODE + { + D3D12_BACKGROUND_PROCESSING_MODE_ALLOWED = 0, + D3D12_BACKGROUND_PROCESSING_MODE_ALLOW_INTRUSIVE_MEASUREMENTS = ( D3D12_BACKGROUND_PROCESSING_MODE_ALLOWED + 1 ) , + D3D12_BACKGROUND_PROCESSING_MODE_DISABLE_BACKGROUND_WORK = ( D3D12_BACKGROUND_PROCESSING_MODE_ALLOW_INTRUSIVE_MEASUREMENTS + 1 ) , + D3D12_BACKGROUND_PROCESSING_MODE_DISABLE_PROFILING_BY_SYSTEM = ( D3D12_BACKGROUND_PROCESSING_MODE_DISABLE_BACKGROUND_WORK + 1 ) + } D3D12_BACKGROUND_PROCESSING_MODE; + +typedef +enum D3D12_MEASUREMENTS_ACTION + { + D3D12_MEASUREMENTS_ACTION_KEEP_ALL = 0, + D3D12_MEASUREMENTS_ACTION_COMMIT_RESULTS = ( D3D12_MEASUREMENTS_ACTION_KEEP_ALL + 1 ) , + D3D12_MEASUREMENTS_ACTION_COMMIT_RESULTS_HIGH_PRIORITY = ( D3D12_MEASUREMENTS_ACTION_COMMIT_RESULTS + 1 ) , + D3D12_MEASUREMENTS_ACTION_DISCARD_PREVIOUS = ( D3D12_MEASUREMENTS_ACTION_COMMIT_RESULTS_HIGH_PRIORITY + 1 ) + } D3D12_MEASUREMENTS_ACTION; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0043_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0043_v0_0_s_ifspec; + +#ifndef __ID3D12Device6_INTERFACE_DEFINED__ +#define __ID3D12Device6_INTERFACE_DEFINED__ + +/* interface ID3D12Device6 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("c70b221b-40e4-4a17-89af-025a0727a6dc") + ID3D12Device6 : public ID3D12Device5 + { + public: + virtual HRESULT STDMETHODCALLTYPE SetBackgroundProcessingMode( + D3D12_BACKGROUND_PROCESSING_MODE Mode, + D3D12_MEASUREMENTS_ACTION MeasurementsAction, + _In_opt_ HANDLE hEventToSignalUponCompletion, + _Out_opt_ BOOL *pbFurtherMeasurementsDesired) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device6Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device6 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device6 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device6 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device6 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device6 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device6 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device6 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device6 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device6 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device6 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device6 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device6 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device6 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device6 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device6 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device6 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device6 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device6 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device6 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device6 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device6 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device6 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device6 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device6 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device6 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device6 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device6 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device6 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device6 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device6 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device6 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device6 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device6 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device6 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device6 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device6 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device6 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device6 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device6 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device6 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device6 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device6 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device6 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device6 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device6 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device6 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device6 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device6 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device6 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device6 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + DECLSPEC_XFGVIRT(ID3D12Device2, CreatePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device6 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromAddress) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device6 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromFileMapping) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device6 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, EnqueueMakeResident) + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device6 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommandList1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList1 )( + ID3D12Device6 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession )( + ID3D12Device6 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommittedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource1 )( + ID3D12Device6 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateHeap1) + HRESULT ( STDMETHODCALLTYPE *CreateHeap1 )( + ID3D12Device6 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateReservedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource1 )( + ID3D12Device6 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, GetResourceAllocationInfo1) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device6 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device6 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateLifetimeTracker) + HRESULT ( STDMETHODCALLTYPE *CreateLifetimeTracker )( + ID3D12Device6 * This, + _In_ ID3D12LifetimeOwner *pOwner, + REFIID riid, + _COM_Outptr_ void **ppvTracker); + + DECLSPEC_XFGVIRT(ID3D12Device5, RemoveDevice) + void ( STDMETHODCALLTYPE *RemoveDevice )( + ID3D12Device6 * This); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommands) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommands )( + ID3D12Device6 * This, + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_META_COMMAND_DESC *pDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommandParameters) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommandParameters )( + ID3D12Device6 * This, + _In_ REFGUID CommandId, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _Out_opt_ UINT *pTotalStructureSizeInBytes, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_META_COMMAND_PARAMETER_DESC *pParameterDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateMetaCommand) + HRESULT ( STDMETHODCALLTYPE *CreateMetaCommand )( + ID3D12Device6 * This, + _In_ REFGUID CommandId, + _In_ UINT NodeMask, + _In_reads_bytes_opt_(CreationParametersDataSizeInBytes) const void *pCreationParametersData, + _In_ SIZE_T CreationParametersDataSizeInBytes, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateStateObject) + HRESULT ( STDMETHODCALLTYPE *CreateStateObject )( + ID3D12Device6 * This, + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device5, GetRaytracingAccelerationStructurePrebuildInfo) + void ( STDMETHODCALLTYPE *GetRaytracingAccelerationStructurePrebuildInfo )( + ID3D12Device6 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo); + + DECLSPEC_XFGVIRT(ID3D12Device5, CheckDriverMatchingIdentifier) + D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS ( STDMETHODCALLTYPE *CheckDriverMatchingIdentifier )( + ID3D12Device6 * This, + _In_ D3D12_SERIALIZED_DATA_TYPE SerializedDataType, + _In_ const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *pIdentifierToCheck); + + DECLSPEC_XFGVIRT(ID3D12Device6, SetBackgroundProcessingMode) + HRESULT ( STDMETHODCALLTYPE *SetBackgroundProcessingMode )( + ID3D12Device6 * This, + D3D12_BACKGROUND_PROCESSING_MODE Mode, + D3D12_MEASUREMENTS_ACTION MeasurementsAction, + _In_opt_ HANDLE hEventToSignalUponCompletion, + _Out_opt_ BOOL *pbFurtherMeasurementsDesired); + + END_INTERFACE + } ID3D12Device6Vtbl; + + interface ID3D12Device6 + { + CONST_VTBL struct ID3D12Device6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device6_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device6_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device6_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device6_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device6_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device6_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device6_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device6_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device6_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device6_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device6_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device6_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device6_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device6_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device6_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device6_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device6_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device6_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device6_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device6_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device6_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device6_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device6_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device6_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device6_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device6_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device6_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device6_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device6_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device6_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device6_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device6_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device6_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device6_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device6_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device6_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device6_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device6_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device6_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device6_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device6_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device6_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device6_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device6_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device6_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device6_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device6_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device6_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device6_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device6_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device6_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + + +#define ID3D12Device6_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) ) + +#define ID3D12Device6_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession(This,pDesc,riid,ppSession) ) + +#define ID3D12Device6_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device6_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) ) + +#define ID3D12Device6_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#if !defined(_WIN32) + +#define ID3D12Device6_GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device6_GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + + +#define ID3D12Device6_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->lpVtbl -> CreateLifetimeTracker(This,pOwner,riid,ppvTracker) ) + +#define ID3D12Device6_RemoveDevice(This) \ + ( (This)->lpVtbl -> RemoveDevice(This) ) + +#define ID3D12Device6_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommands(This,pNumMetaCommands,pDescs) ) + +#define ID3D12Device6_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) + +#define ID3D12Device6_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->lpVtbl -> CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) + +#define ID3D12Device6_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->lpVtbl -> CreateStateObject(This,pDesc,riid,ppStateObject) ) + +#define ID3D12Device6_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->lpVtbl -> GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) ) + +#define ID3D12Device6_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->lpVtbl -> CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) ) + + +#define ID3D12Device6_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->lpVtbl -> SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device6_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0044 */ +/* [local] */ + +DEFINE_GUID(D3D12_PROTECTED_RESOURCES_SESSION_HARDWARE_PROTECTED, 0x62B0084E, 0xC70E, 0x4DAA, 0xA1, 0x09, 0x30, 0xFF, 0x8D, 0x5A, 0x04, 0x82); +typedef struct D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPE_COUNT + { + UINT NodeIndex; + UINT Count; + } D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPE_COUNT; + +typedef struct D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES + { + UINT NodeIndex; + UINT Count; + GUID *pTypes; + } D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES; + +typedef struct D3D12_PROTECTED_RESOURCE_SESSION_DESC1 + { + UINT NodeMask; + D3D12_PROTECTED_RESOURCE_SESSION_FLAGS Flags; + GUID ProtectionType; + } D3D12_PROTECTED_RESOURCE_SESSION_DESC1; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0044_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0044_v0_0_s_ifspec; + +#ifndef __ID3D12ProtectedResourceSession1_INTERFACE_DEFINED__ +#define __ID3D12ProtectedResourceSession1_INTERFACE_DEFINED__ + +/* interface ID3D12ProtectedResourceSession1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12ProtectedResourceSession1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D6F12DD6-76FB-406E-8961-4296EEFC0409") + ID3D12ProtectedResourceSession1 : public ID3D12ProtectedResourceSession + { + public: +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_PROTECTED_RESOURCE_SESSION_DESC1 STDMETHODCALLTYPE GetDesc1( void) = 0; +#else + virtual D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *STDMETHODCALLTYPE GetDesc1( + D3D12_PROTECTED_RESOURCE_SESSION_DESC1 * RetVal) = 0; +#endif + + }; + + +#else /* C style interface */ + + typedef struct ID3D12ProtectedResourceSession1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12ProtectedResourceSession1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12ProtectedResourceSession1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12ProtectedResourceSession1 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12ProtectedResourceSession1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12ProtectedResourceSession1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12ProtectedResourceSession1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12ProtectedResourceSession1 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12ProtectedResourceSession1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12ProtectedSession, GetStatusFence) + HRESULT ( STDMETHODCALLTYPE *GetStatusFence )( + ID3D12ProtectedResourceSession1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12ProtectedSession, GetSessionStatus) + D3D12_PROTECTED_SESSION_STATUS ( STDMETHODCALLTYPE *GetSessionStatus )( + ID3D12ProtectedResourceSession1 * This); + + DECLSPEC_XFGVIRT(ID3D12ProtectedResourceSession, GetDesc) +#if !defined(_WIN32) + D3D12_PROTECTED_RESOURCE_SESSION_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12ProtectedResourceSession1 * This); + +#else + D3D12_PROTECTED_RESOURCE_SESSION_DESC *( STDMETHODCALLTYPE *GetDesc )( + ID3D12ProtectedResourceSession1 * This, + D3D12_PROTECTED_RESOURCE_SESSION_DESC * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12ProtectedResourceSession1, GetDesc1) +#if !defined(_WIN32) + D3D12_PROTECTED_RESOURCE_SESSION_DESC1 ( STDMETHODCALLTYPE *GetDesc1 )( + ID3D12ProtectedResourceSession1 * This); + +#else + D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *( STDMETHODCALLTYPE *GetDesc1 )( + ID3D12ProtectedResourceSession1 * This, + D3D12_PROTECTED_RESOURCE_SESSION_DESC1 * RetVal); + +#endif + + END_INTERFACE + } ID3D12ProtectedResourceSession1Vtbl; + + interface ID3D12ProtectedResourceSession1 + { + CONST_VTBL struct ID3D12ProtectedResourceSession1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12ProtectedResourceSession1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12ProtectedResourceSession1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12ProtectedResourceSession1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12ProtectedResourceSession1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12ProtectedResourceSession1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12ProtectedResourceSession1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12ProtectedResourceSession1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12ProtectedResourceSession1_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12ProtectedResourceSession1_GetStatusFence(This,riid,ppFence) \ + ( (This)->lpVtbl -> GetStatusFence(This,riid,ppFence) ) + +#define ID3D12ProtectedResourceSession1_GetSessionStatus(This) \ + ( (This)->lpVtbl -> GetSessionStatus(This) ) + +#if !defined(_WIN32) + +#define ID3D12ProtectedResourceSession1_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) +#else +#define ID3D12ProtectedResourceSession1_GetDesc(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc(This,RetVal) ) +#endif + +#if !defined(_WIN32) + +#define ID3D12ProtectedResourceSession1_GetDesc1(This) \ + ( (This)->lpVtbl -> GetDesc1(This) ) +#else +#define ID3D12ProtectedResourceSession1_GetDesc1(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc1(This,RetVal) ) +#endif + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12ProtectedResourceSession1_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Device7_INTERFACE_DEFINED__ +#define __ID3D12Device7_INTERFACE_DEFINED__ + +/* interface ID3D12Device7 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device7; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5c014b53-68a1-4b9b-8bd1-dd6046b9358b") + ID3D12Device7 : public ID3D12Device6 + { + public: + virtual HRESULT STDMETHODCALLTYPE AddToStateObject( + const D3D12_STATE_OBJECT_DESC *pAddition, + ID3D12StateObject *pStateObjectToGrowFrom, + REFIID riid, + _COM_Outptr_ void **ppNewStateObject) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateProtectedResourceSession1( + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device7Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device7 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device7 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device7 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device7 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device7 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device7 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device7 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device7 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device7 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device7 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device7 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device7 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device7 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device7 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device7 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device7 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device7 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device7 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device7 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device7 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device7 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device7 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device7 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device7 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device7 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device7 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device7 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device7 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device7 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device7 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device7 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device7 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device7 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device7 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device7 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device7 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device7 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device7 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device7 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device7 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device7 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device7 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device7 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device7 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device7 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device7 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device7 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device7 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device7 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device7 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + DECLSPEC_XFGVIRT(ID3D12Device2, CreatePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device7 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromAddress) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device7 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromFileMapping) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device7 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, EnqueueMakeResident) + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device7 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommandList1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList1 )( + ID3D12Device7 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession )( + ID3D12Device7 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommittedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource1 )( + ID3D12Device7 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateHeap1) + HRESULT ( STDMETHODCALLTYPE *CreateHeap1 )( + ID3D12Device7 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateReservedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource1 )( + ID3D12Device7 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, GetResourceAllocationInfo1) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device7 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device7 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateLifetimeTracker) + HRESULT ( STDMETHODCALLTYPE *CreateLifetimeTracker )( + ID3D12Device7 * This, + _In_ ID3D12LifetimeOwner *pOwner, + REFIID riid, + _COM_Outptr_ void **ppvTracker); + + DECLSPEC_XFGVIRT(ID3D12Device5, RemoveDevice) + void ( STDMETHODCALLTYPE *RemoveDevice )( + ID3D12Device7 * This); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommands) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommands )( + ID3D12Device7 * This, + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_META_COMMAND_DESC *pDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommandParameters) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommandParameters )( + ID3D12Device7 * This, + _In_ REFGUID CommandId, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _Out_opt_ UINT *pTotalStructureSizeInBytes, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_META_COMMAND_PARAMETER_DESC *pParameterDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateMetaCommand) + HRESULT ( STDMETHODCALLTYPE *CreateMetaCommand )( + ID3D12Device7 * This, + _In_ REFGUID CommandId, + _In_ UINT NodeMask, + _In_reads_bytes_opt_(CreationParametersDataSizeInBytes) const void *pCreationParametersData, + _In_ SIZE_T CreationParametersDataSizeInBytes, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateStateObject) + HRESULT ( STDMETHODCALLTYPE *CreateStateObject )( + ID3D12Device7 * This, + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device5, GetRaytracingAccelerationStructurePrebuildInfo) + void ( STDMETHODCALLTYPE *GetRaytracingAccelerationStructurePrebuildInfo )( + ID3D12Device7 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo); + + DECLSPEC_XFGVIRT(ID3D12Device5, CheckDriverMatchingIdentifier) + D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS ( STDMETHODCALLTYPE *CheckDriverMatchingIdentifier )( + ID3D12Device7 * This, + _In_ D3D12_SERIALIZED_DATA_TYPE SerializedDataType, + _In_ const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *pIdentifierToCheck); + + DECLSPEC_XFGVIRT(ID3D12Device6, SetBackgroundProcessingMode) + HRESULT ( STDMETHODCALLTYPE *SetBackgroundProcessingMode )( + ID3D12Device7 * This, + D3D12_BACKGROUND_PROCESSING_MODE Mode, + D3D12_MEASUREMENTS_ACTION MeasurementsAction, + _In_opt_ HANDLE hEventToSignalUponCompletion, + _Out_opt_ BOOL *pbFurtherMeasurementsDesired); + + DECLSPEC_XFGVIRT(ID3D12Device7, AddToStateObject) + HRESULT ( STDMETHODCALLTYPE *AddToStateObject )( + ID3D12Device7 * This, + const D3D12_STATE_OBJECT_DESC *pAddition, + ID3D12StateObject *pStateObjectToGrowFrom, + REFIID riid, + _COM_Outptr_ void **ppNewStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device7, CreateProtectedResourceSession1) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession1 )( + ID3D12Device7 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + END_INTERFACE + } ID3D12Device7Vtbl; + + interface ID3D12Device7 + { + CONST_VTBL struct ID3D12Device7Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device7_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device7_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device7_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device7_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device7_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device7_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device7_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device7_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device7_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device7_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device7_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device7_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device7_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device7_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device7_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device7_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device7_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device7_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device7_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device7_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device7_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device7_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device7_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device7_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device7_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device7_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device7_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device7_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device7_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device7_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device7_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device7_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device7_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device7_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device7_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device7_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device7_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device7_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device7_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device7_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device7_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device7_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device7_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device7_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device7_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device7_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device7_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device7_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device7_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device7_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device7_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device7_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device7_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device7_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + + +#define ID3D12Device7_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) ) + +#define ID3D12Device7_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession(This,pDesc,riid,ppSession) ) + +#define ID3D12Device7_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device7_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) ) + +#define ID3D12Device7_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#if !defined(_WIN32) + +#define ID3D12Device7_GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device7_GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + + +#define ID3D12Device7_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->lpVtbl -> CreateLifetimeTracker(This,pOwner,riid,ppvTracker) ) + +#define ID3D12Device7_RemoveDevice(This) \ + ( (This)->lpVtbl -> RemoveDevice(This) ) + +#define ID3D12Device7_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommands(This,pNumMetaCommands,pDescs) ) + +#define ID3D12Device7_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) + +#define ID3D12Device7_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->lpVtbl -> CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) + +#define ID3D12Device7_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->lpVtbl -> CreateStateObject(This,pDesc,riid,ppStateObject) ) + +#define ID3D12Device7_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->lpVtbl -> GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) ) + +#define ID3D12Device7_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->lpVtbl -> CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) ) + + +#define ID3D12Device7_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->lpVtbl -> SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) + + +#define ID3D12Device7_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->lpVtbl -> AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) + +#define ID3D12Device7_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession1(This,pDesc,riid,ppSession) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device7_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Device8_INTERFACE_DEFINED__ +#define __ID3D12Device8_INTERFACE_DEFINED__ + +/* interface ID3D12Device8 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device8; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9218E6BB-F944-4F7E-A75C-B1B2C7B701F3") + ID3D12Device8 : public ID3D12Device7 + { + public: +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_RESOURCE_ALLOCATION_INFO STDMETHODCALLTYPE GetResourceAllocationInfo2( + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1) = 0; +#else + virtual D3D12_RESOURCE_ALLOCATION_INFO *STDMETHODCALLTYPE GetResourceAllocationInfo2( + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1) = 0; +#endif + + virtual HRESULT STDMETHODCALLTYPE CreateCommittedResource2( + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreatePlacedResource1( + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource) = 0; + + virtual void STDMETHODCALLTYPE CreateSamplerFeedbackUnorderedAccessView( + _In_opt_ ID3D12Resource *pTargetedResource, + _In_opt_ ID3D12Resource *pFeedbackResource, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor) = 0; + + virtual void STDMETHODCALLTYPE GetCopyableFootprints1( + _In_ const D3D12_RESOURCE_DESC1 *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device8Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device8 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device8 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device8 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device8 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device8 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device8 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device8 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device8 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device8 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device8 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device8 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device8 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device8 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device8 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device8 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device8 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device8 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device8 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device8 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device8 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device8 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device8 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device8 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device8 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device8 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device8 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device8 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device8 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device8 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device8 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device8 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device8 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device8 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device8 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device8 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device8 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device8 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device8 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device8 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device8 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device8 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device8 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device8 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device8 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device8 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device8 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device8 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device8 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device8 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device8 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + DECLSPEC_XFGVIRT(ID3D12Device2, CreatePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device8 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromAddress) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device8 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromFileMapping) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device8 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, EnqueueMakeResident) + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device8 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommandList1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList1 )( + ID3D12Device8 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession )( + ID3D12Device8 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommittedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource1 )( + ID3D12Device8 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateHeap1) + HRESULT ( STDMETHODCALLTYPE *CreateHeap1 )( + ID3D12Device8 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateReservedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource1 )( + ID3D12Device8 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, GetResourceAllocationInfo1) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device8 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device8 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateLifetimeTracker) + HRESULT ( STDMETHODCALLTYPE *CreateLifetimeTracker )( + ID3D12Device8 * This, + _In_ ID3D12LifetimeOwner *pOwner, + REFIID riid, + _COM_Outptr_ void **ppvTracker); + + DECLSPEC_XFGVIRT(ID3D12Device5, RemoveDevice) + void ( STDMETHODCALLTYPE *RemoveDevice )( + ID3D12Device8 * This); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommands) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommands )( + ID3D12Device8 * This, + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_META_COMMAND_DESC *pDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommandParameters) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommandParameters )( + ID3D12Device8 * This, + _In_ REFGUID CommandId, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _Out_opt_ UINT *pTotalStructureSizeInBytes, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_META_COMMAND_PARAMETER_DESC *pParameterDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateMetaCommand) + HRESULT ( STDMETHODCALLTYPE *CreateMetaCommand )( + ID3D12Device8 * This, + _In_ REFGUID CommandId, + _In_ UINT NodeMask, + _In_reads_bytes_opt_(CreationParametersDataSizeInBytes) const void *pCreationParametersData, + _In_ SIZE_T CreationParametersDataSizeInBytes, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateStateObject) + HRESULT ( STDMETHODCALLTYPE *CreateStateObject )( + ID3D12Device8 * This, + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device5, GetRaytracingAccelerationStructurePrebuildInfo) + void ( STDMETHODCALLTYPE *GetRaytracingAccelerationStructurePrebuildInfo )( + ID3D12Device8 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo); + + DECLSPEC_XFGVIRT(ID3D12Device5, CheckDriverMatchingIdentifier) + D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS ( STDMETHODCALLTYPE *CheckDriverMatchingIdentifier )( + ID3D12Device8 * This, + _In_ D3D12_SERIALIZED_DATA_TYPE SerializedDataType, + _In_ const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *pIdentifierToCheck); + + DECLSPEC_XFGVIRT(ID3D12Device6, SetBackgroundProcessingMode) + HRESULT ( STDMETHODCALLTYPE *SetBackgroundProcessingMode )( + ID3D12Device8 * This, + D3D12_BACKGROUND_PROCESSING_MODE Mode, + D3D12_MEASUREMENTS_ACTION MeasurementsAction, + _In_opt_ HANDLE hEventToSignalUponCompletion, + _Out_opt_ BOOL *pbFurtherMeasurementsDesired); + + DECLSPEC_XFGVIRT(ID3D12Device7, AddToStateObject) + HRESULT ( STDMETHODCALLTYPE *AddToStateObject )( + ID3D12Device8 * This, + const D3D12_STATE_OBJECT_DESC *pAddition, + ID3D12StateObject *pStateObjectToGrowFrom, + REFIID riid, + _COM_Outptr_ void **ppNewStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device7, CreateProtectedResourceSession1) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession1 )( + ID3D12Device8 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetResourceAllocationInfo2) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device8 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device8 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateCommittedResource2) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource2 )( + ID3D12Device8 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreatePlacedResource1) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource1 )( + ID3D12Device8 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateSamplerFeedbackUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateSamplerFeedbackUnorderedAccessView )( + ID3D12Device8 * This, + _In_opt_ ID3D12Resource *pTargetedResource, + _In_opt_ ID3D12Resource *pFeedbackResource, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetCopyableFootprints1) + void ( STDMETHODCALLTYPE *GetCopyableFootprints1 )( + ID3D12Device8 * This, + _In_ const D3D12_RESOURCE_DESC1 *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + END_INTERFACE + } ID3D12Device8Vtbl; + + interface ID3D12Device8 + { + CONST_VTBL struct ID3D12Device8Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device8_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device8_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device8_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device8_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device8_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device8_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device8_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device8_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device8_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device8_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device8_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device8_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device8_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device8_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device8_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device8_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device8_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device8_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device8_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device8_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device8_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device8_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device8_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device8_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device8_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device8_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device8_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device8_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device8_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device8_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device8_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device8_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device8_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device8_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device8_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device8_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device8_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device8_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device8_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device8_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device8_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device8_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device8_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device8_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device8_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device8_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device8_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device8_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device8_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device8_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device8_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device8_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device8_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device8_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + + +#define ID3D12Device8_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) ) + +#define ID3D12Device8_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession(This,pDesc,riid,ppSession) ) + +#define ID3D12Device8_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device8_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) ) + +#define ID3D12Device8_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#if !defined(_WIN32) + +#define ID3D12Device8_GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device8_GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + + +#define ID3D12Device8_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->lpVtbl -> CreateLifetimeTracker(This,pOwner,riid,ppvTracker) ) + +#define ID3D12Device8_RemoveDevice(This) \ + ( (This)->lpVtbl -> RemoveDevice(This) ) + +#define ID3D12Device8_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommands(This,pNumMetaCommands,pDescs) ) + +#define ID3D12Device8_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) + +#define ID3D12Device8_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->lpVtbl -> CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) + +#define ID3D12Device8_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->lpVtbl -> CreateStateObject(This,pDesc,riid,ppStateObject) ) + +#define ID3D12Device8_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->lpVtbl -> GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) ) + +#define ID3D12Device8_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->lpVtbl -> CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) ) + + +#define ID3D12Device8_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->lpVtbl -> SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) + + +#define ID3D12Device8_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->lpVtbl -> AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) + +#define ID3D12Device8_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession1(This,pDesc,riid,ppSession) ) + +#if !defined(_WIN32) + +#define ID3D12Device8_GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device8_GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + +#define ID3D12Device8_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device8_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device8_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) ) + +#define ID3D12Device8_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device8_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Resource1_INTERFACE_DEFINED__ +#define __ID3D12Resource1_INTERFACE_DEFINED__ + +/* interface ID3D12Resource1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Resource1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9D5E227A-4430-4161-88B3-3ECA6BB16E19") + ID3D12Resource1 : public ID3D12Resource + { + public: + virtual HRESULT STDMETHODCALLTYPE GetProtectedResourceSession( + REFIID riid, + _COM_Outptr_opt_ void **ppProtectedSession) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Resource1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Resource1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Resource1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Resource1 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Resource1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Resource1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Resource1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Resource1 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12Resource1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12Resource, Map) + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D12Resource1 * This, + UINT Subresource, + _In_opt_ const D3D12_RANGE *pReadRange, + _Outptr_opt_result_bytebuffer_(_Inexpressible_("Dependent on resource")) void **ppData); + + DECLSPEC_XFGVIRT(ID3D12Resource, Unmap) + void ( STDMETHODCALLTYPE *Unmap )( + ID3D12Resource1 * This, + UINT Subresource, + _In_opt_ const D3D12_RANGE *pWrittenRange); + + DECLSPEC_XFGVIRT(ID3D12Resource, GetDesc) +#if !defined(_WIN32) + D3D12_RESOURCE_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12Resource1 * This); + +#else + D3D12_RESOURCE_DESC *( STDMETHODCALLTYPE *GetDesc )( + ID3D12Resource1 * This, + D3D12_RESOURCE_DESC * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Resource, GetGPUVirtualAddress) + D3D12_GPU_VIRTUAL_ADDRESS ( STDMETHODCALLTYPE *GetGPUVirtualAddress )( + ID3D12Resource1 * This); + + DECLSPEC_XFGVIRT(ID3D12Resource, WriteToSubresource) + HRESULT ( STDMETHODCALLTYPE *WriteToSubresource )( + ID3D12Resource1 * This, + UINT DstSubresource, + _In_opt_ const D3D12_BOX *pDstBox, + _In_ const void *pSrcData, + UINT SrcRowPitch, + UINT SrcDepthPitch); + + DECLSPEC_XFGVIRT(ID3D12Resource, ReadFromSubresource) + HRESULT ( STDMETHODCALLTYPE *ReadFromSubresource )( + ID3D12Resource1 * This, + _Out_ void *pDstData, + UINT DstRowPitch, + UINT DstDepthPitch, + UINT SrcSubresource, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12Resource, GetHeapProperties) + HRESULT ( STDMETHODCALLTYPE *GetHeapProperties )( + ID3D12Resource1 * This, + _Out_opt_ D3D12_HEAP_PROPERTIES *pHeapProperties, + _Out_opt_ D3D12_HEAP_FLAGS *pHeapFlags); + + DECLSPEC_XFGVIRT(ID3D12Resource1, GetProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *GetProtectedResourceSession )( + ID3D12Resource1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppProtectedSession); + + END_INTERFACE + } ID3D12Resource1Vtbl; + + interface ID3D12Resource1 + { + CONST_VTBL struct ID3D12Resource1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Resource1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Resource1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Resource1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Resource1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Resource1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Resource1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Resource1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Resource1_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12Resource1_Map(This,Subresource,pReadRange,ppData) \ + ( (This)->lpVtbl -> Map(This,Subresource,pReadRange,ppData) ) + +#define ID3D12Resource1_Unmap(This,Subresource,pWrittenRange) \ + ( (This)->lpVtbl -> Unmap(This,Subresource,pWrittenRange) ) +#if !defined(_WIN32) + +#define ID3D12Resource1_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) +#else +#define ID3D12Resource1_GetDesc(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc(This,RetVal) ) +#endif + +#define ID3D12Resource1_GetGPUVirtualAddress(This) \ + ( (This)->lpVtbl -> GetGPUVirtualAddress(This) ) + +#define ID3D12Resource1_WriteToSubresource(This,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->lpVtbl -> WriteToSubresource(This,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) + +#define ID3D12Resource1_ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) \ + ( (This)->lpVtbl -> ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) ) + +#define ID3D12Resource1_GetHeapProperties(This,pHeapProperties,pHeapFlags) \ + ( (This)->lpVtbl -> GetHeapProperties(This,pHeapProperties,pHeapFlags) ) + + +#define ID3D12Resource1_GetProtectedResourceSession(This,riid,ppProtectedSession) \ + ( (This)->lpVtbl -> GetProtectedResourceSession(This,riid,ppProtectedSession) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Resource1_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Resource2_INTERFACE_DEFINED__ +#define __ID3D12Resource2_INTERFACE_DEFINED__ + +/* interface ID3D12Resource2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Resource2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BE36EC3B-EA85-4AEB-A45A-E9D76404A495") + ID3D12Resource2 : public ID3D12Resource1 + { + public: +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_RESOURCE_DESC1 STDMETHODCALLTYPE GetDesc1( void) = 0; +#else + virtual D3D12_RESOURCE_DESC1 *STDMETHODCALLTYPE GetDesc1( + D3D12_RESOURCE_DESC1 * RetVal) = 0; +#endif + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Resource2Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Resource2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Resource2 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Resource2 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Resource2 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Resource2 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Resource2 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Resource2 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12Resource2 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12Resource, Map) + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D12Resource2 * This, + UINT Subresource, + _In_opt_ const D3D12_RANGE *pReadRange, + _Outptr_opt_result_bytebuffer_(_Inexpressible_("Dependent on resource")) void **ppData); + + DECLSPEC_XFGVIRT(ID3D12Resource, Unmap) + void ( STDMETHODCALLTYPE *Unmap )( + ID3D12Resource2 * This, + UINT Subresource, + _In_opt_ const D3D12_RANGE *pWrittenRange); + + DECLSPEC_XFGVIRT(ID3D12Resource, GetDesc) +#if !defined(_WIN32) + D3D12_RESOURCE_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12Resource2 * This); + +#else + D3D12_RESOURCE_DESC *( STDMETHODCALLTYPE *GetDesc )( + ID3D12Resource2 * This, + D3D12_RESOURCE_DESC * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Resource, GetGPUVirtualAddress) + D3D12_GPU_VIRTUAL_ADDRESS ( STDMETHODCALLTYPE *GetGPUVirtualAddress )( + ID3D12Resource2 * This); + + DECLSPEC_XFGVIRT(ID3D12Resource, WriteToSubresource) + HRESULT ( STDMETHODCALLTYPE *WriteToSubresource )( + ID3D12Resource2 * This, + UINT DstSubresource, + _In_opt_ const D3D12_BOX *pDstBox, + _In_ const void *pSrcData, + UINT SrcRowPitch, + UINT SrcDepthPitch); + + DECLSPEC_XFGVIRT(ID3D12Resource, ReadFromSubresource) + HRESULT ( STDMETHODCALLTYPE *ReadFromSubresource )( + ID3D12Resource2 * This, + _Out_ void *pDstData, + UINT DstRowPitch, + UINT DstDepthPitch, + UINT SrcSubresource, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12Resource, GetHeapProperties) + HRESULT ( STDMETHODCALLTYPE *GetHeapProperties )( + ID3D12Resource2 * This, + _Out_opt_ D3D12_HEAP_PROPERTIES *pHeapProperties, + _Out_opt_ D3D12_HEAP_FLAGS *pHeapFlags); + + DECLSPEC_XFGVIRT(ID3D12Resource1, GetProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *GetProtectedResourceSession )( + ID3D12Resource2 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppProtectedSession); + + DECLSPEC_XFGVIRT(ID3D12Resource2, GetDesc1) +#if !defined(_WIN32) + D3D12_RESOURCE_DESC1 ( STDMETHODCALLTYPE *GetDesc1 )( + ID3D12Resource2 * This); + +#else + D3D12_RESOURCE_DESC1 *( STDMETHODCALLTYPE *GetDesc1 )( + ID3D12Resource2 * This, + D3D12_RESOURCE_DESC1 * RetVal); + +#endif + + END_INTERFACE + } ID3D12Resource2Vtbl; + + interface ID3D12Resource2 + { + CONST_VTBL struct ID3D12Resource2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Resource2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Resource2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Resource2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Resource2_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Resource2_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Resource2_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Resource2_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Resource2_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12Resource2_Map(This,Subresource,pReadRange,ppData) \ + ( (This)->lpVtbl -> Map(This,Subresource,pReadRange,ppData) ) + +#define ID3D12Resource2_Unmap(This,Subresource,pWrittenRange) \ + ( (This)->lpVtbl -> Unmap(This,Subresource,pWrittenRange) ) +#if !defined(_WIN32) + +#define ID3D12Resource2_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) +#else +#define ID3D12Resource2_GetDesc(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc(This,RetVal) ) +#endif + +#define ID3D12Resource2_GetGPUVirtualAddress(This) \ + ( (This)->lpVtbl -> GetGPUVirtualAddress(This) ) + +#define ID3D12Resource2_WriteToSubresource(This,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->lpVtbl -> WriteToSubresource(This,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) + +#define ID3D12Resource2_ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) \ + ( (This)->lpVtbl -> ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) ) + +#define ID3D12Resource2_GetHeapProperties(This,pHeapProperties,pHeapFlags) \ + ( (This)->lpVtbl -> GetHeapProperties(This,pHeapProperties,pHeapFlags) ) + + +#define ID3D12Resource2_GetProtectedResourceSession(This,riid,ppProtectedSession) \ + ( (This)->lpVtbl -> GetProtectedResourceSession(This,riid,ppProtectedSession) ) + +#if !defined(_WIN32) + +#define ID3D12Resource2_GetDesc1(This) \ + ( (This)->lpVtbl -> GetDesc1(This) ) +#else +#define ID3D12Resource2_GetDesc1(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc1(This,RetVal) ) +#endif + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Resource2_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Heap1_INTERFACE_DEFINED__ +#define __ID3D12Heap1_INTERFACE_DEFINED__ + +/* interface ID3D12Heap1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Heap1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("572F7389-2168-49E3-9693-D6DF5871BF6D") + ID3D12Heap1 : public ID3D12Heap + { + public: + virtual HRESULT STDMETHODCALLTYPE GetProtectedResourceSession( + REFIID riid, + _COM_Outptr_opt_ void **ppProtectedSession) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Heap1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Heap1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Heap1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Heap1 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Heap1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Heap1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Heap1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Heap1 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12Heap1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12Heap, GetDesc) +#if !defined(_WIN32) + D3D12_HEAP_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12Heap1 * This); + +#else + D3D12_HEAP_DESC *( STDMETHODCALLTYPE *GetDesc )( + ID3D12Heap1 * This, + D3D12_HEAP_DESC * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Heap1, GetProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *GetProtectedResourceSession )( + ID3D12Heap1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppProtectedSession); + + END_INTERFACE + } ID3D12Heap1Vtbl; + + interface ID3D12Heap1 + { + CONST_VTBL struct ID3D12Heap1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Heap1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Heap1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Heap1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Heap1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Heap1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Heap1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Heap1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Heap1_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#if !defined(_WIN32) + +#define ID3D12Heap1_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) +#else +#define ID3D12Heap1_GetDesc(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc(This,RetVal) ) +#endif + + +#define ID3D12Heap1_GetProtectedResourceSession(This,riid,ppProtectedSession) \ + ( (This)->lpVtbl -> GetProtectedResourceSession(This,riid,ppProtectedSession) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Heap1_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList3_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList3_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList3 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList3; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6FDA83A7-B84C-4E38-9AC8-C7BD22016B3D") + ID3D12GraphicsCommandList3 : public ID3D12GraphicsCommandList2 + { + public: + virtual void STDMETHODCALLTYPE SetProtectedResourceSession( + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList3Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList3 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList3 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList3 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList3 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList3 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList3 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList3 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList3 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandList, GetType) + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList3 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Close) + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList3 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Reset) + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearState) + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList3 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawInstanced) + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawIndexedInstanced) + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Dispatch) + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyBufferRegion) + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTextureRegion) + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList3 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyResource) + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTiles) + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveSubresource) + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetPrimitiveTopology) + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList3 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetViewports) + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList3 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetScissorRects) + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList3 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetBlendFactor) + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList3 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetStencilRef) + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT StencilRef); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPipelineState) + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResourceBarrier) + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteBundle) + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetDescriptorHeaps) + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootSignature) + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList3 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootSignature) + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList3 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetIndexBuffer) + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList3 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetVertexBuffers) + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SOSetTargets) + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetRenderTargets) + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearDepthStencilView) + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList3 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearRenderTargetView) + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList3 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewUint) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList3 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewFloat) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList3 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DiscardResource) + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginQuery) + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndQuery) + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveQueryData) + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPredication) + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList3 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetMarker) + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList3 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginEvent) + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList3 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndEvent) + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList3 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteIndirect) + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT64) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, OMSetDepthBounds) + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList3 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetSamplePositions) + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, ResolveSubresourceRegion) + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetViewInstanceMask) + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT Mask); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList2, WriteBufferImmediate) + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12GraphicsCommandList3 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList3, SetProtectedResourceSession) + void ( STDMETHODCALLTYPE *SetProtectedResourceSession )( + ID3D12GraphicsCommandList3 * This, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession); + + END_INTERFACE + } ID3D12GraphicsCommandList3Vtbl; + + interface ID3D12GraphicsCommandList3 + { + CONST_VTBL struct ID3D12GraphicsCommandList3Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList3_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList3_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList3_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList3_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList3_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList3_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList3_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList3_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList3_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList3_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList3_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList3_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList3_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList3_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList3_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList3_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList3_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList3_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList3_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList3_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList3_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList3_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList3_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList3_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList3_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList3_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList3_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList3_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList3_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList3_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList3_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList3_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList3_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList3_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList3_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList3_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList3_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList3_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList3_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList3_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList3_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList3_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList3_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList3_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList3_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList3_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList3_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList3_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList3_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList3_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList3_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList3_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList3_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList3_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList3_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList3_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList3_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList3_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList3_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + + +#define ID3D12GraphicsCommandList3_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12GraphicsCommandList3_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->lpVtbl -> SetProtectedResourceSession(This,pProtectedResourceSession) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList3_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0051 */ +/* [local] */ + +typedef +enum D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE + { + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_DISCARD = 0, + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE = ( D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_DISCARD + 1 ) , + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR = ( D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE + 1 ) , + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_NO_ACCESS = ( D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR + 1 ) , + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE_LOCAL_RENDER = ( D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_NO_ACCESS + 1 ) , + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE_LOCAL_SRV = ( D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE_LOCAL_RENDER + 1 ) , + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE_LOCAL_UAV = ( D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE_LOCAL_SRV + 1 ) + } D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE; + +typedef struct D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS + { + D3D12_CLEAR_VALUE ClearValue; + } D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS; + +typedef struct D3D12_RENDER_PASS_BEGINNING_ACCESS_PRESERVE_LOCAL_PARAMETERS + { + UINT AdditionalWidth; + UINT AdditionalHeight; + } D3D12_RENDER_PASS_BEGINNING_ACCESS_PRESERVE_LOCAL_PARAMETERS; + +typedef struct D3D12_RENDER_PASS_BEGINNING_ACCESS + { + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE Type; + union + { + D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS Clear; + D3D12_RENDER_PASS_BEGINNING_ACCESS_PRESERVE_LOCAL_PARAMETERS PreserveLocal; + } ; + } D3D12_RENDER_PASS_BEGINNING_ACCESS; + +typedef +enum D3D12_RENDER_PASS_ENDING_ACCESS_TYPE + { + D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_DISCARD = 0, + D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE = ( D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_DISCARD + 1 ) , + D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_RESOLVE = ( D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE + 1 ) , + D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_NO_ACCESS = ( D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_RESOLVE + 1 ) , + D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE_LOCAL_RENDER = ( D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_NO_ACCESS + 1 ) , + D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE_LOCAL_SRV = ( D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE_LOCAL_RENDER + 1 ) , + D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE_LOCAL_UAV = ( D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE_LOCAL_SRV + 1 ) + } D3D12_RENDER_PASS_ENDING_ACCESS_TYPE; + +typedef struct D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_SUBRESOURCE_PARAMETERS + { + UINT SrcSubresource; + UINT DstSubresource; + UINT DstX; + UINT DstY; + D3D12_RECT SrcRect; + } D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_SUBRESOURCE_PARAMETERS; + +typedef struct D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS + { + ID3D12Resource *pSrcResource; + ID3D12Resource *pDstResource; + UINT SubresourceCount; + _Field_size_full_(SubresourceCount) const D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_SUBRESOURCE_PARAMETERS *pSubresourceParameters; + DXGI_FORMAT Format; + D3D12_RESOLVE_MODE ResolveMode; + BOOL PreserveResolveSource; + } D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS; + +typedef struct D3D12_RENDER_PASS_ENDING_ACCESS_PRESERVE_LOCAL_PARAMETERS + { + UINT AdditionalWidth; + UINT AdditionalHeight; + } D3D12_RENDER_PASS_ENDING_ACCESS_PRESERVE_LOCAL_PARAMETERS; + +typedef struct D3D12_RENDER_PASS_ENDING_ACCESS + { + D3D12_RENDER_PASS_ENDING_ACCESS_TYPE Type; + union + { + D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS Resolve; + D3D12_RENDER_PASS_ENDING_ACCESS_PRESERVE_LOCAL_PARAMETERS PreserveLocal; + } ; + } D3D12_RENDER_PASS_ENDING_ACCESS; + +typedef struct D3D12_RENDER_PASS_RENDER_TARGET_DESC + { + D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptor; + D3D12_RENDER_PASS_BEGINNING_ACCESS BeginningAccess; + D3D12_RENDER_PASS_ENDING_ACCESS EndingAccess; + } D3D12_RENDER_PASS_RENDER_TARGET_DESC; + +typedef struct D3D12_RENDER_PASS_DEPTH_STENCIL_DESC + { + D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptor; + D3D12_RENDER_PASS_BEGINNING_ACCESS DepthBeginningAccess; + D3D12_RENDER_PASS_BEGINNING_ACCESS StencilBeginningAccess; + D3D12_RENDER_PASS_ENDING_ACCESS DepthEndingAccess; + D3D12_RENDER_PASS_ENDING_ACCESS StencilEndingAccess; + } D3D12_RENDER_PASS_DEPTH_STENCIL_DESC; + +typedef +enum D3D12_RENDER_PASS_FLAGS + { + D3D12_RENDER_PASS_FLAG_NONE = 0, + D3D12_RENDER_PASS_FLAG_ALLOW_UAV_WRITES = 0x1, + D3D12_RENDER_PASS_FLAG_SUSPENDING_PASS = 0x2, + D3D12_RENDER_PASS_FLAG_RESUMING_PASS = 0x4, + D3D12_RENDER_PASS_FLAG_BIND_READ_ONLY_DEPTH = 0x8, + D3D12_RENDER_PASS_FLAG_BIND_READ_ONLY_STENCIL = 0x10 + } D3D12_RENDER_PASS_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RENDER_PASS_FLAGS ) + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0051_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0051_v0_0_s_ifspec; + +#ifndef __ID3D12MetaCommand_INTERFACE_DEFINED__ +#define __ID3D12MetaCommand_INTERFACE_DEFINED__ + +/* interface ID3D12MetaCommand */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12MetaCommand; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("DBB84C27-36CE-4FC9-B801-F048C46AC570") + ID3D12MetaCommand : public ID3D12Pageable + { + public: + virtual UINT64 STDMETHODCALLTYPE GetRequiredParameterResourceSize( + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _In_ UINT ParameterIndex) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12MetaCommandVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12MetaCommand * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12MetaCommand * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12MetaCommand * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12MetaCommand * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12MetaCommand * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12MetaCommand * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12MetaCommand * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12MetaCommand * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12MetaCommand, GetRequiredParameterResourceSize) + UINT64 ( STDMETHODCALLTYPE *GetRequiredParameterResourceSize )( + ID3D12MetaCommand * This, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _In_ UINT ParameterIndex); + + END_INTERFACE + } ID3D12MetaCommandVtbl; + + interface ID3D12MetaCommand + { + CONST_VTBL struct ID3D12MetaCommandVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12MetaCommand_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12MetaCommand_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12MetaCommand_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12MetaCommand_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12MetaCommand_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12MetaCommand_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12MetaCommand_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12MetaCommand_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12MetaCommand_GetRequiredParameterResourceSize(This,Stage,ParameterIndex) \ + ( (This)->lpVtbl -> GetRequiredParameterResourceSize(This,Stage,ParameterIndex) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12MetaCommand_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0052 */ +/* [local] */ + +typedef struct D3D12_DISPATCH_RAYS_DESC + { + D3D12_GPU_VIRTUAL_ADDRESS_RANGE RayGenerationShaderRecord; + D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE MissShaderTable; + D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE HitGroupTable; + D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE CallableShaderTable; + UINT Width; + UINT Height; + UINT Depth; + } D3D12_DISPATCH_RAYS_DESC; + +typedef +enum D3D12_SET_WORK_GRAPH_FLAGS + { + D3D12_SET_WORK_GRAPH_FLAG_NONE = 0, + D3D12_SET_WORK_GRAPH_FLAG_INITIALIZE = 0x1 + } D3D12_SET_WORK_GRAPH_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_SET_WORK_GRAPH_FLAGS ) +typedef struct D3D12_SET_WORK_GRAPH_DESC + { + D3D12_PROGRAM_IDENTIFIER ProgramIdentifier; + D3D12_SET_WORK_GRAPH_FLAGS Flags; + D3D12_GPU_VIRTUAL_ADDRESS_RANGE BackingMemory; + D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE NodeLocalRootArgumentsTable; + } D3D12_SET_WORK_GRAPH_DESC; + +typedef struct D3D12_SET_RAYTRACING_PIPELINE_DESC + { + D3D12_PROGRAM_IDENTIFIER ProgramIdentifier; + } D3D12_SET_RAYTRACING_PIPELINE_DESC; + +typedef struct D3D12_SET_GENERIC_PIPELINE_DESC + { + D3D12_PROGRAM_IDENTIFIER ProgramIdentifier; + } D3D12_SET_GENERIC_PIPELINE_DESC; + +typedef +enum D3D12_PROGRAM_TYPE + { + D3D12_PROGRAM_TYPE_GENERIC_PIPELINE = 1, + D3D12_PROGRAM_TYPE_RAYTRACING_PIPELINE = 4, + D3D12_PROGRAM_TYPE_WORK_GRAPH = 5 + } D3D12_PROGRAM_TYPE; + +typedef struct D3D12_SET_PROGRAM_DESC + { + D3D12_PROGRAM_TYPE Type; + union + { + D3D12_SET_GENERIC_PIPELINE_DESC GenericPipeline; + D3D12_SET_RAYTRACING_PIPELINE_DESC RaytracingPipeline; + D3D12_SET_WORK_GRAPH_DESC WorkGraph; + } ; + } D3D12_SET_PROGRAM_DESC; + +typedef +enum D3D12_DISPATCH_MODE + { + D3D12_DISPATCH_MODE_NODE_CPU_INPUT = 0, + D3D12_DISPATCH_MODE_NODE_GPU_INPUT = 1, + D3D12_DISPATCH_MODE_MULTI_NODE_CPU_INPUT = 2, + D3D12_DISPATCH_MODE_MULTI_NODE_GPU_INPUT = 3 + } D3D12_DISPATCH_MODE; + +typedef struct D3D12_NODE_CPU_INPUT + { + UINT EntrypointIndex; + UINT NumRecords; + const void *pRecords; + UINT64 RecordStrideInBytes; + } D3D12_NODE_CPU_INPUT; + +typedef struct D3D12_NODE_GPU_INPUT + { + UINT EntrypointIndex; + UINT NumRecords; + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE Records; + } D3D12_NODE_GPU_INPUT; + +typedef struct D3D12_MULTI_NODE_CPU_INPUT + { + UINT NumNodeInputs; + const D3D12_NODE_CPU_INPUT *pNodeInputs; + UINT64 NodeInputStrideInBytes; + } D3D12_MULTI_NODE_CPU_INPUT; + +typedef struct D3D12_MULTI_NODE_GPU_INPUT + { + UINT NumNodeInputs; + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE NodeInputs; + } D3D12_MULTI_NODE_GPU_INPUT; + +typedef struct D3D12_DISPATCH_GRAPH_DESC + { + D3D12_DISPATCH_MODE Mode; + union + { + D3D12_NODE_CPU_INPUT NodeCPUInput; + D3D12_GPU_VIRTUAL_ADDRESS NodeGPUInput; + D3D12_MULTI_NODE_CPU_INPUT MultiNodeCPUInput; + D3D12_GPU_VIRTUAL_ADDRESS MultiNodeGPUInput; + } ; + } D3D12_DISPATCH_GRAPH_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0052_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0052_v0_0_s_ifspec; + +#ifndef __ID3D12GraphicsCommandList4_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList4_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList4 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList4; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8754318e-d3a9-4541-98cf-645b50dc4874") + ID3D12GraphicsCommandList4 : public ID3D12GraphicsCommandList3 + { + public: + virtual void STDMETHODCALLTYPE BeginRenderPass( + _In_ UINT NumRenderTargets, + _In_reads_opt_(NumRenderTargets) const D3D12_RENDER_PASS_RENDER_TARGET_DESC *pRenderTargets, + _In_opt_ const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC *pDepthStencil, + D3D12_RENDER_PASS_FLAGS Flags) = 0; + + virtual void STDMETHODCALLTYPE EndRenderPass( void) = 0; + + virtual void STDMETHODCALLTYPE InitializeMetaCommand( + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(InitializationParametersDataSizeInBytes) const void *pInitializationParametersData, + _In_ SIZE_T InitializationParametersDataSizeInBytes) = 0; + + virtual void STDMETHODCALLTYPE ExecuteMetaCommand( + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(ExecutionParametersDataSizeInBytes) const void *pExecutionParametersData, + _In_ SIZE_T ExecutionParametersDataSizeInBytes) = 0; + + virtual void STDMETHODCALLTYPE BuildRaytracingAccelerationStructure( + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC *pDesc, + _In_ UINT NumPostbuildInfoDescs, + _In_reads_opt_(NumPostbuildInfoDescs) const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pPostbuildInfoDescs) = 0; + + virtual void STDMETHODCALLTYPE EmitRaytracingAccelerationStructurePostbuildInfo( + _In_ const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pDesc, + _In_ UINT NumSourceAccelerationStructures, + _In_reads_( NumSourceAccelerationStructures ) const D3D12_GPU_VIRTUAL_ADDRESS *pSourceAccelerationStructureData) = 0; + + virtual void STDMETHODCALLTYPE CopyRaytracingAccelerationStructure( + _In_ D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData, + _In_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode) = 0; + + virtual void STDMETHODCALLTYPE SetPipelineState1( + _In_ ID3D12StateObject *pStateObject) = 0; + + virtual void STDMETHODCALLTYPE DispatchRays( + _In_ const D3D12_DISPATCH_RAYS_DESC *pDesc) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList4Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList4 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList4 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList4 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList4 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList4 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList4 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList4 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList4 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandList, GetType) + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList4 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Close) + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList4 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Reset) + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearState) + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList4 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawInstanced) + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawIndexedInstanced) + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Dispatch) + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyBufferRegion) + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTextureRegion) + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList4 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyResource) + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTiles) + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveSubresource) + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetPrimitiveTopology) + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList4 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetViewports) + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList4 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetScissorRects) + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList4 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetBlendFactor) + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList4 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetStencilRef) + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT StencilRef); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPipelineState) + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResourceBarrier) + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteBundle) + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetDescriptorHeaps) + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootSignature) + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList4 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootSignature) + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList4 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetIndexBuffer) + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList4 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetVertexBuffers) + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SOSetTargets) + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetRenderTargets) + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearDepthStencilView) + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList4 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearRenderTargetView) + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList4 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewUint) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList4 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewFloat) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList4 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DiscardResource) + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginQuery) + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndQuery) + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveQueryData) + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPredication) + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList4 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetMarker) + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList4 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginEvent) + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList4 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndEvent) + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList4 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteIndirect) + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT64) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, OMSetDepthBounds) + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList4 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetSamplePositions) + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, ResolveSubresourceRegion) + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetViewInstanceMask) + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT Mask); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList2, WriteBufferImmediate) + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12GraphicsCommandList4 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList3, SetProtectedResourceSession) + void ( STDMETHODCALLTYPE *SetProtectedResourceSession )( + ID3D12GraphicsCommandList4 * This, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BeginRenderPass) + void ( STDMETHODCALLTYPE *BeginRenderPass )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT NumRenderTargets, + _In_reads_opt_(NumRenderTargets) const D3D12_RENDER_PASS_RENDER_TARGET_DESC *pRenderTargets, + _In_opt_ const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC *pDepthStencil, + D3D12_RENDER_PASS_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EndRenderPass) + void ( STDMETHODCALLTYPE *EndRenderPass )( + ID3D12GraphicsCommandList4 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, InitializeMetaCommand) + void ( STDMETHODCALLTYPE *InitializeMetaCommand )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(InitializationParametersDataSizeInBytes) const void *pInitializationParametersData, + _In_ SIZE_T InitializationParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, ExecuteMetaCommand) + void ( STDMETHODCALLTYPE *ExecuteMetaCommand )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(ExecutionParametersDataSizeInBytes) const void *pExecutionParametersData, + _In_ SIZE_T ExecutionParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BuildRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *BuildRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList4 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC *pDesc, + _In_ UINT NumPostbuildInfoDescs, + _In_reads_opt_(NumPostbuildInfoDescs) const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pPostbuildInfoDescs); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EmitRaytracingAccelerationStructurePostbuildInfo) + void ( STDMETHODCALLTYPE *EmitRaytracingAccelerationStructurePostbuildInfo )( + ID3D12GraphicsCommandList4 * This, + _In_ const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pDesc, + _In_ UINT NumSourceAccelerationStructures, + _In_reads_( NumSourceAccelerationStructures ) const D3D12_GPU_VIRTUAL_ADDRESS *pSourceAccelerationStructureData); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, CopyRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *CopyRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList4 * This, + _In_ D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData, + _In_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, SetPipelineState1) + void ( STDMETHODCALLTYPE *SetPipelineState1 )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12StateObject *pStateObject); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, DispatchRays) + void ( STDMETHODCALLTYPE *DispatchRays )( + ID3D12GraphicsCommandList4 * This, + _In_ const D3D12_DISPATCH_RAYS_DESC *pDesc); + + END_INTERFACE + } ID3D12GraphicsCommandList4Vtbl; + + interface ID3D12GraphicsCommandList4 + { + CONST_VTBL struct ID3D12GraphicsCommandList4Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList4_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList4_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList4_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList4_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList4_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList4_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList4_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList4_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList4_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList4_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList4_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList4_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList4_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList4_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList4_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList4_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList4_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList4_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList4_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList4_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList4_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList4_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList4_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList4_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList4_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList4_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList4_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList4_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList4_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList4_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList4_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList4_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList4_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList4_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList4_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList4_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList4_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList4_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList4_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList4_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList4_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList4_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList4_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList4_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList4_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList4_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList4_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList4_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList4_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList4_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList4_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList4_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList4_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList4_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList4_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList4_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList4_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList4_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList4_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + + +#define ID3D12GraphicsCommandList4_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12GraphicsCommandList4_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->lpVtbl -> SetProtectedResourceSession(This,pProtectedResourceSession) ) + + +#define ID3D12GraphicsCommandList4_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->lpVtbl -> BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) + +#define ID3D12GraphicsCommandList4_EndRenderPass(This) \ + ( (This)->lpVtbl -> EndRenderPass(This) ) + +#define ID3D12GraphicsCommandList4_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList4_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList4_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->lpVtbl -> BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) + +#define ID3D12GraphicsCommandList4_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->lpVtbl -> EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) + +#define ID3D12GraphicsCommandList4_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->lpVtbl -> CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) + +#define ID3D12GraphicsCommandList4_SetPipelineState1(This,pStateObject) \ + ( (This)->lpVtbl -> SetPipelineState1(This,pStateObject) ) + +#define ID3D12GraphicsCommandList4_DispatchRays(This,pDesc) \ + ( (This)->lpVtbl -> DispatchRays(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList4_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0053 */ +/* [local] */ + +typedef +enum D3D12_SHADER_CACHE_MODE + { + D3D12_SHADER_CACHE_MODE_MEMORY = 0, + D3D12_SHADER_CACHE_MODE_DISK = ( D3D12_SHADER_CACHE_MODE_MEMORY + 1 ) + } D3D12_SHADER_CACHE_MODE; + +typedef +enum D3D12_SHADER_CACHE_FLAGS + { + D3D12_SHADER_CACHE_FLAG_NONE = 0, + D3D12_SHADER_CACHE_FLAG_DRIVER_VERSIONED = 0x1, + D3D12_SHADER_CACHE_FLAG_USE_WORKING_DIR = 0x2 + } D3D12_SHADER_CACHE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_SHADER_CACHE_FLAGS ) +typedef struct D3D12_SHADER_CACHE_SESSION_DESC + { + GUID Identifier; + D3D12_SHADER_CACHE_MODE Mode; + D3D12_SHADER_CACHE_FLAGS Flags; + UINT MaximumInMemoryCacheSizeBytes; + UINT MaximumInMemoryCacheEntries; + UINT MaximumValueFileSizeBytes; + UINT64 Version; + } D3D12_SHADER_CACHE_SESSION_DESC; + +typedef +enum D3D12_BARRIER_LAYOUT + { + D3D12_BARRIER_LAYOUT_UNDEFINED = 0xffffffff, + D3D12_BARRIER_LAYOUT_COMMON = 0, + D3D12_BARRIER_LAYOUT_PRESENT = 0, + D3D12_BARRIER_LAYOUT_GENERIC_READ = ( D3D12_BARRIER_LAYOUT_PRESENT + 1 ) , + D3D12_BARRIER_LAYOUT_RENDER_TARGET = ( D3D12_BARRIER_LAYOUT_GENERIC_READ + 1 ) , + D3D12_BARRIER_LAYOUT_UNORDERED_ACCESS = ( D3D12_BARRIER_LAYOUT_RENDER_TARGET + 1 ) , + D3D12_BARRIER_LAYOUT_DEPTH_STENCIL_WRITE = ( D3D12_BARRIER_LAYOUT_UNORDERED_ACCESS + 1 ) , + D3D12_BARRIER_LAYOUT_DEPTH_STENCIL_READ = ( D3D12_BARRIER_LAYOUT_DEPTH_STENCIL_WRITE + 1 ) , + D3D12_BARRIER_LAYOUT_SHADER_RESOURCE = ( D3D12_BARRIER_LAYOUT_DEPTH_STENCIL_READ + 1 ) , + D3D12_BARRIER_LAYOUT_COPY_SOURCE = ( D3D12_BARRIER_LAYOUT_SHADER_RESOURCE + 1 ) , + D3D12_BARRIER_LAYOUT_COPY_DEST = ( D3D12_BARRIER_LAYOUT_COPY_SOURCE + 1 ) , + D3D12_BARRIER_LAYOUT_RESOLVE_SOURCE = ( D3D12_BARRIER_LAYOUT_COPY_DEST + 1 ) , + D3D12_BARRIER_LAYOUT_RESOLVE_DEST = ( D3D12_BARRIER_LAYOUT_RESOLVE_SOURCE + 1 ) , + D3D12_BARRIER_LAYOUT_SHADING_RATE_SOURCE = ( D3D12_BARRIER_LAYOUT_RESOLVE_DEST + 1 ) , + D3D12_BARRIER_LAYOUT_VIDEO_DECODE_READ = ( D3D12_BARRIER_LAYOUT_SHADING_RATE_SOURCE + 1 ) , + D3D12_BARRIER_LAYOUT_VIDEO_DECODE_WRITE = ( D3D12_BARRIER_LAYOUT_VIDEO_DECODE_READ + 1 ) , + D3D12_BARRIER_LAYOUT_VIDEO_PROCESS_READ = ( D3D12_BARRIER_LAYOUT_VIDEO_DECODE_WRITE + 1 ) , + D3D12_BARRIER_LAYOUT_VIDEO_PROCESS_WRITE = ( D3D12_BARRIER_LAYOUT_VIDEO_PROCESS_READ + 1 ) , + D3D12_BARRIER_LAYOUT_VIDEO_ENCODE_READ = ( D3D12_BARRIER_LAYOUT_VIDEO_PROCESS_WRITE + 1 ) , + D3D12_BARRIER_LAYOUT_VIDEO_ENCODE_WRITE = ( D3D12_BARRIER_LAYOUT_VIDEO_ENCODE_READ + 1 ) , + D3D12_BARRIER_LAYOUT_DIRECT_QUEUE_COMMON = ( D3D12_BARRIER_LAYOUT_VIDEO_ENCODE_WRITE + 1 ) , + D3D12_BARRIER_LAYOUT_DIRECT_QUEUE_GENERIC_READ = ( D3D12_BARRIER_LAYOUT_DIRECT_QUEUE_COMMON + 1 ) , + D3D12_BARRIER_LAYOUT_DIRECT_QUEUE_UNORDERED_ACCESS = ( D3D12_BARRIER_LAYOUT_DIRECT_QUEUE_GENERIC_READ + 1 ) , + D3D12_BARRIER_LAYOUT_DIRECT_QUEUE_SHADER_RESOURCE = ( D3D12_BARRIER_LAYOUT_DIRECT_QUEUE_UNORDERED_ACCESS + 1 ) , + D3D12_BARRIER_LAYOUT_DIRECT_QUEUE_COPY_SOURCE = ( D3D12_BARRIER_LAYOUT_DIRECT_QUEUE_SHADER_RESOURCE + 1 ) , + D3D12_BARRIER_LAYOUT_DIRECT_QUEUE_COPY_DEST = ( D3D12_BARRIER_LAYOUT_DIRECT_QUEUE_COPY_SOURCE + 1 ) , + D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_COMMON = ( D3D12_BARRIER_LAYOUT_DIRECT_QUEUE_COPY_DEST + 1 ) , + D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_GENERIC_READ = ( D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_COMMON + 1 ) , + D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_UNORDERED_ACCESS = ( D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_GENERIC_READ + 1 ) , + D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_SHADER_RESOURCE = ( D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_UNORDERED_ACCESS + 1 ) , + D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_COPY_SOURCE = ( D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_SHADER_RESOURCE + 1 ) , + D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_COPY_DEST = ( D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_COPY_SOURCE + 1 ) , + D3D12_BARRIER_LAYOUT_VIDEO_QUEUE_COMMON = ( D3D12_BARRIER_LAYOUT_COMPUTE_QUEUE_COPY_DEST + 1 ) + } D3D12_BARRIER_LAYOUT; + +typedef +enum D3D12_BARRIER_SYNC + { + D3D12_BARRIER_SYNC_NONE = 0, + D3D12_BARRIER_SYNC_ALL = 0x1, + D3D12_BARRIER_SYNC_DRAW = 0x2, + D3D12_BARRIER_SYNC_INDEX_INPUT = 0x4, + D3D12_BARRIER_SYNC_VERTEX_SHADING = 0x8, + D3D12_BARRIER_SYNC_PIXEL_SHADING = 0x10, + D3D12_BARRIER_SYNC_DEPTH_STENCIL = 0x20, + D3D12_BARRIER_SYNC_RENDER_TARGET = 0x40, + D3D12_BARRIER_SYNC_COMPUTE_SHADING = 0x80, + D3D12_BARRIER_SYNC_RAYTRACING = 0x100, + D3D12_BARRIER_SYNC_COPY = 0x200, + D3D12_BARRIER_SYNC_RESOLVE = 0x400, + D3D12_BARRIER_SYNC_EXECUTE_INDIRECT = 0x800, + D3D12_BARRIER_SYNC_PREDICATION = 0x800, + D3D12_BARRIER_SYNC_ALL_SHADING = 0x1000, + D3D12_BARRIER_SYNC_NON_PIXEL_SHADING = 0x2000, + D3D12_BARRIER_SYNC_EMIT_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO = 0x4000, + D3D12_BARRIER_SYNC_CLEAR_UNORDERED_ACCESS_VIEW = 0x8000, + D3D12_BARRIER_SYNC_VIDEO_DECODE = 0x100000, + D3D12_BARRIER_SYNC_VIDEO_PROCESS = 0x200000, + D3D12_BARRIER_SYNC_VIDEO_ENCODE = 0x400000, + D3D12_BARRIER_SYNC_BUILD_RAYTRACING_ACCELERATION_STRUCTURE = 0x800000, + D3D12_BARRIER_SYNC_COPY_RAYTRACING_ACCELERATION_STRUCTURE = 0x1000000, + D3D12_BARRIER_SYNC_SPLIT = 0x80000000 + } D3D12_BARRIER_SYNC; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_BARRIER_SYNC ) +typedef +enum D3D12_BARRIER_ACCESS + { + D3D12_BARRIER_ACCESS_COMMON = 0, + D3D12_BARRIER_ACCESS_VERTEX_BUFFER = 0x1, + D3D12_BARRIER_ACCESS_CONSTANT_BUFFER = 0x2, + D3D12_BARRIER_ACCESS_INDEX_BUFFER = 0x4, + D3D12_BARRIER_ACCESS_RENDER_TARGET = 0x8, + D3D12_BARRIER_ACCESS_UNORDERED_ACCESS = 0x10, + D3D12_BARRIER_ACCESS_DEPTH_STENCIL_WRITE = 0x20, + D3D12_BARRIER_ACCESS_DEPTH_STENCIL_READ = 0x40, + D3D12_BARRIER_ACCESS_SHADER_RESOURCE = 0x80, + D3D12_BARRIER_ACCESS_STREAM_OUTPUT = 0x100, + D3D12_BARRIER_ACCESS_INDIRECT_ARGUMENT = 0x200, + D3D12_BARRIER_ACCESS_PREDICATION = 0x200, + D3D12_BARRIER_ACCESS_COPY_DEST = 0x400, + D3D12_BARRIER_ACCESS_COPY_SOURCE = 0x800, + D3D12_BARRIER_ACCESS_RESOLVE_DEST = 0x1000, + D3D12_BARRIER_ACCESS_RESOLVE_SOURCE = 0x2000, + D3D12_BARRIER_ACCESS_RAYTRACING_ACCELERATION_STRUCTURE_READ = 0x4000, + D3D12_BARRIER_ACCESS_RAYTRACING_ACCELERATION_STRUCTURE_WRITE = 0x8000, + D3D12_BARRIER_ACCESS_SHADING_RATE_SOURCE = 0x10000, + D3D12_BARRIER_ACCESS_VIDEO_DECODE_READ = 0x20000, + D3D12_BARRIER_ACCESS_VIDEO_DECODE_WRITE = 0x40000, + D3D12_BARRIER_ACCESS_VIDEO_PROCESS_READ = 0x80000, + D3D12_BARRIER_ACCESS_VIDEO_PROCESS_WRITE = 0x100000, + D3D12_BARRIER_ACCESS_VIDEO_ENCODE_READ = 0x200000, + D3D12_BARRIER_ACCESS_VIDEO_ENCODE_WRITE = 0x400000, + D3D12_BARRIER_ACCESS_NO_ACCESS = 0x80000000 + } D3D12_BARRIER_ACCESS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_BARRIER_ACCESS ) +typedef +enum D3D12_BARRIER_TYPE + { + D3D12_BARRIER_TYPE_GLOBAL = 0, + D3D12_BARRIER_TYPE_TEXTURE = ( D3D12_BARRIER_TYPE_GLOBAL + 1 ) , + D3D12_BARRIER_TYPE_BUFFER = ( D3D12_BARRIER_TYPE_TEXTURE + 1 ) + } D3D12_BARRIER_TYPE; + +typedef +enum D3D12_TEXTURE_BARRIER_FLAGS + { + D3D12_TEXTURE_BARRIER_FLAG_NONE = 0, + D3D12_TEXTURE_BARRIER_FLAG_DISCARD = 0x1 + } D3D12_TEXTURE_BARRIER_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_TEXTURE_BARRIER_FLAGS ) +typedef struct D3D12_BARRIER_SUBRESOURCE_RANGE + { + UINT IndexOrFirstMipLevel; + UINT NumMipLevels; + UINT FirstArraySlice; + UINT NumArraySlices; + UINT FirstPlane; + UINT NumPlanes; + } D3D12_BARRIER_SUBRESOURCE_RANGE; + +typedef struct D3D12_GLOBAL_BARRIER + { + D3D12_BARRIER_SYNC SyncBefore; + D3D12_BARRIER_SYNC SyncAfter; + D3D12_BARRIER_ACCESS AccessBefore; + D3D12_BARRIER_ACCESS AccessAfter; + } D3D12_GLOBAL_BARRIER; + +typedef struct D3D12_TEXTURE_BARRIER + { + D3D12_BARRIER_SYNC SyncBefore; + D3D12_BARRIER_SYNC SyncAfter; + D3D12_BARRIER_ACCESS AccessBefore; + D3D12_BARRIER_ACCESS AccessAfter; + D3D12_BARRIER_LAYOUT LayoutBefore; + D3D12_BARRIER_LAYOUT LayoutAfter; + _In_ ID3D12Resource *pResource; + D3D12_BARRIER_SUBRESOURCE_RANGE Subresources; + D3D12_TEXTURE_BARRIER_FLAGS Flags; + } D3D12_TEXTURE_BARRIER; + +typedef struct D3D12_BUFFER_BARRIER + { + D3D12_BARRIER_SYNC SyncBefore; + D3D12_BARRIER_SYNC SyncAfter; + D3D12_BARRIER_ACCESS AccessBefore; + D3D12_BARRIER_ACCESS AccessAfter; + _In_ ID3D12Resource *pResource; + UINT64 Offset; + UINT64 Size; + } D3D12_BUFFER_BARRIER; + +typedef struct D3D12_BARRIER_GROUP + { + D3D12_BARRIER_TYPE Type; + UINT32 NumBarriers; + union + { + _In_reads_(NumBarriers) const D3D12_GLOBAL_BARRIER *pGlobalBarriers; + _In_reads_(NumBarriers) const D3D12_TEXTURE_BARRIER *pTextureBarriers; + _In_reads_(NumBarriers) const D3D12_BUFFER_BARRIER *pBufferBarriers; + } ; + } D3D12_BARRIER_GROUP; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0053_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0053_v0_0_s_ifspec; + +#ifndef __ID3D12ShaderCacheSession_INTERFACE_DEFINED__ +#define __ID3D12ShaderCacheSession_INTERFACE_DEFINED__ + +/* interface ID3D12ShaderCacheSession */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12ShaderCacheSession; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("28e2495d-0f64-4ae4-a6ec-129255dc49a8") + ID3D12ShaderCacheSession : public ID3D12DeviceChild + { + public: + virtual HRESULT STDMETHODCALLTYPE FindValue( + /* [annotation][in] */ + _In_reads_bytes_(KeySize) const void *pKey, + UINT KeySize, + /* [annotation][out] */ + _Out_writes_bytes_(*pValueSize) void *pValue, + _Inout_ UINT *pValueSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE StoreValue( + /* [annotation][in] */ + _In_reads_bytes_(KeySize) const void *pKey, + UINT KeySize, + /* [annotation][in] */ + _In_reads_bytes_(ValueSize) const void *pValue, + UINT ValueSize) = 0; + + virtual void STDMETHODCALLTYPE SetDeleteOnDestroy( void) = 0; + +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_SHADER_CACHE_SESSION_DESC STDMETHODCALLTYPE GetDesc( void) = 0; +#else + virtual D3D12_SHADER_CACHE_SESSION_DESC *STDMETHODCALLTYPE GetDesc( + D3D12_SHADER_CACHE_SESSION_DESC * RetVal) = 0; +#endif + + }; + + +#else /* C style interface */ + + typedef struct ID3D12ShaderCacheSessionVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12ShaderCacheSession * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12ShaderCacheSession * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12ShaderCacheSession * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12ShaderCacheSession * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12ShaderCacheSession * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12ShaderCacheSession * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12ShaderCacheSession * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12ShaderCacheSession * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12ShaderCacheSession, FindValue) + HRESULT ( STDMETHODCALLTYPE *FindValue )( + ID3D12ShaderCacheSession * This, + /* [annotation][in] */ + _In_reads_bytes_(KeySize) const void *pKey, + UINT KeySize, + /* [annotation][out] */ + _Out_writes_bytes_(*pValueSize) void *pValue, + _Inout_ UINT *pValueSize); + + DECLSPEC_XFGVIRT(ID3D12ShaderCacheSession, StoreValue) + HRESULT ( STDMETHODCALLTYPE *StoreValue )( + ID3D12ShaderCacheSession * This, + /* [annotation][in] */ + _In_reads_bytes_(KeySize) const void *pKey, + UINT KeySize, + /* [annotation][in] */ + _In_reads_bytes_(ValueSize) const void *pValue, + UINT ValueSize); + + DECLSPEC_XFGVIRT(ID3D12ShaderCacheSession, SetDeleteOnDestroy) + void ( STDMETHODCALLTYPE *SetDeleteOnDestroy )( + ID3D12ShaderCacheSession * This); + + DECLSPEC_XFGVIRT(ID3D12ShaderCacheSession, GetDesc) +#if !defined(_WIN32) + D3D12_SHADER_CACHE_SESSION_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12ShaderCacheSession * This); + +#else + D3D12_SHADER_CACHE_SESSION_DESC *( STDMETHODCALLTYPE *GetDesc )( + ID3D12ShaderCacheSession * This, + D3D12_SHADER_CACHE_SESSION_DESC * RetVal); + +#endif + + END_INTERFACE + } ID3D12ShaderCacheSessionVtbl; + + interface ID3D12ShaderCacheSession + { + CONST_VTBL struct ID3D12ShaderCacheSessionVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12ShaderCacheSession_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12ShaderCacheSession_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12ShaderCacheSession_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12ShaderCacheSession_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12ShaderCacheSession_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12ShaderCacheSession_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12ShaderCacheSession_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12ShaderCacheSession_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12ShaderCacheSession_FindValue(This,pKey,KeySize,pValue,pValueSize) \ + ( (This)->lpVtbl -> FindValue(This,pKey,KeySize,pValue,pValueSize) ) + +#define ID3D12ShaderCacheSession_StoreValue(This,pKey,KeySize,pValue,ValueSize) \ + ( (This)->lpVtbl -> StoreValue(This,pKey,KeySize,pValue,ValueSize) ) + +#define ID3D12ShaderCacheSession_SetDeleteOnDestroy(This) \ + ( (This)->lpVtbl -> SetDeleteOnDestroy(This) ) +#if !defined(_WIN32) + +#define ID3D12ShaderCacheSession_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) +#else +#define ID3D12ShaderCacheSession_GetDesc(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc(This,RetVal) ) +#endif + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12ShaderCacheSession_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0054 */ +/* [local] */ + +typedef +enum D3D12_SHADER_CACHE_KIND_FLAGS + { + D3D12_SHADER_CACHE_KIND_FLAG_IMPLICIT_D3D_CACHE_FOR_DRIVER = 0x1, + D3D12_SHADER_CACHE_KIND_FLAG_IMPLICIT_D3D_CONVERSIONS = 0x2, + D3D12_SHADER_CACHE_KIND_FLAG_IMPLICIT_DRIVER_MANAGED = 0x4, + D3D12_SHADER_CACHE_KIND_FLAG_APPLICATION_MANAGED = 0x8 + } D3D12_SHADER_CACHE_KIND_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_SHADER_CACHE_KIND_FLAGS ) +typedef +enum D3D12_SHADER_CACHE_CONTROL_FLAGS + { + D3D12_SHADER_CACHE_CONTROL_FLAG_DISABLE = 0x1, + D3D12_SHADER_CACHE_CONTROL_FLAG_ENABLE = 0x2, + D3D12_SHADER_CACHE_CONTROL_FLAG_CLEAR = 0x4 + } D3D12_SHADER_CACHE_CONTROL_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_SHADER_CACHE_CONTROL_FLAGS ) + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0054_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0054_v0_0_s_ifspec; + +#ifndef __ID3D12Device9_INTERFACE_DEFINED__ +#define __ID3D12Device9_INTERFACE_DEFINED__ + +/* interface ID3D12Device9 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device9; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4c80e962-f032-4f60-bc9e-ebc2cfa1d83c") + ID3D12Device9 : public ID3D12Device8 + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateShaderCacheSession( + _In_ const D3D12_SHADER_CACHE_SESSION_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvSession) = 0; + + virtual HRESULT STDMETHODCALLTYPE ShaderCacheControl( + D3D12_SHADER_CACHE_KIND_FLAGS Kinds, + D3D12_SHADER_CACHE_CONTROL_FLAGS Control) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateCommandQueue1( + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID CreatorID, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device9Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device9 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device9 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device9 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device9 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device9 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device9 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device9 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device9 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device9 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device9 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device9 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device9 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device9 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device9 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device9 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device9 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device9 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device9 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device9 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device9 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device9 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device9 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device9 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device9 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device9 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device9 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device9 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device9 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device9 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device9 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device9 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device9 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device9 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device9 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device9 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device9 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device9 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device9 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device9 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device9 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device9 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device9 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device9 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device9 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device9 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device9 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device9 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device9 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device9 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device9 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + DECLSPEC_XFGVIRT(ID3D12Device2, CreatePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device9 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromAddress) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device9 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromFileMapping) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device9 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, EnqueueMakeResident) + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device9 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommandList1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList1 )( + ID3D12Device9 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession )( + ID3D12Device9 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommittedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource1 )( + ID3D12Device9 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateHeap1) + HRESULT ( STDMETHODCALLTYPE *CreateHeap1 )( + ID3D12Device9 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateReservedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource1 )( + ID3D12Device9 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, GetResourceAllocationInfo1) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device9 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device9 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateLifetimeTracker) + HRESULT ( STDMETHODCALLTYPE *CreateLifetimeTracker )( + ID3D12Device9 * This, + _In_ ID3D12LifetimeOwner *pOwner, + REFIID riid, + _COM_Outptr_ void **ppvTracker); + + DECLSPEC_XFGVIRT(ID3D12Device5, RemoveDevice) + void ( STDMETHODCALLTYPE *RemoveDevice )( + ID3D12Device9 * This); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommands) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommands )( + ID3D12Device9 * This, + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_META_COMMAND_DESC *pDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommandParameters) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommandParameters )( + ID3D12Device9 * This, + _In_ REFGUID CommandId, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _Out_opt_ UINT *pTotalStructureSizeInBytes, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_META_COMMAND_PARAMETER_DESC *pParameterDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateMetaCommand) + HRESULT ( STDMETHODCALLTYPE *CreateMetaCommand )( + ID3D12Device9 * This, + _In_ REFGUID CommandId, + _In_ UINT NodeMask, + _In_reads_bytes_opt_(CreationParametersDataSizeInBytes) const void *pCreationParametersData, + _In_ SIZE_T CreationParametersDataSizeInBytes, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateStateObject) + HRESULT ( STDMETHODCALLTYPE *CreateStateObject )( + ID3D12Device9 * This, + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device5, GetRaytracingAccelerationStructurePrebuildInfo) + void ( STDMETHODCALLTYPE *GetRaytracingAccelerationStructurePrebuildInfo )( + ID3D12Device9 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo); + + DECLSPEC_XFGVIRT(ID3D12Device5, CheckDriverMatchingIdentifier) + D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS ( STDMETHODCALLTYPE *CheckDriverMatchingIdentifier )( + ID3D12Device9 * This, + _In_ D3D12_SERIALIZED_DATA_TYPE SerializedDataType, + _In_ const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *pIdentifierToCheck); + + DECLSPEC_XFGVIRT(ID3D12Device6, SetBackgroundProcessingMode) + HRESULT ( STDMETHODCALLTYPE *SetBackgroundProcessingMode )( + ID3D12Device9 * This, + D3D12_BACKGROUND_PROCESSING_MODE Mode, + D3D12_MEASUREMENTS_ACTION MeasurementsAction, + _In_opt_ HANDLE hEventToSignalUponCompletion, + _Out_opt_ BOOL *pbFurtherMeasurementsDesired); + + DECLSPEC_XFGVIRT(ID3D12Device7, AddToStateObject) + HRESULT ( STDMETHODCALLTYPE *AddToStateObject )( + ID3D12Device9 * This, + const D3D12_STATE_OBJECT_DESC *pAddition, + ID3D12StateObject *pStateObjectToGrowFrom, + REFIID riid, + _COM_Outptr_ void **ppNewStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device7, CreateProtectedResourceSession1) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession1 )( + ID3D12Device9 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetResourceAllocationInfo2) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device9 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device9 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateCommittedResource2) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource2 )( + ID3D12Device9 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreatePlacedResource1) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource1 )( + ID3D12Device9 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateSamplerFeedbackUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateSamplerFeedbackUnorderedAccessView )( + ID3D12Device9 * This, + _In_opt_ ID3D12Resource *pTargetedResource, + _In_opt_ ID3D12Resource *pFeedbackResource, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetCopyableFootprints1) + void ( STDMETHODCALLTYPE *GetCopyableFootprints1 )( + ID3D12Device9 * This, + _In_ const D3D12_RESOURCE_DESC1 *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device9, CreateShaderCacheSession) + HRESULT ( STDMETHODCALLTYPE *CreateShaderCacheSession )( + ID3D12Device9 * This, + _In_ const D3D12_SHADER_CACHE_SESSION_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvSession); + + DECLSPEC_XFGVIRT(ID3D12Device9, ShaderCacheControl) + HRESULT ( STDMETHODCALLTYPE *ShaderCacheControl )( + ID3D12Device9 * This, + D3D12_SHADER_CACHE_KIND_FLAGS Kinds, + D3D12_SHADER_CACHE_CONTROL_FLAGS Control); + + DECLSPEC_XFGVIRT(ID3D12Device9, CreateCommandQueue1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue1 )( + ID3D12Device9 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID CreatorID, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + END_INTERFACE + } ID3D12Device9Vtbl; + + interface ID3D12Device9 + { + CONST_VTBL struct ID3D12Device9Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device9_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device9_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device9_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device9_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device9_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device9_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device9_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device9_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device9_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device9_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device9_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device9_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device9_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device9_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device9_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device9_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device9_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device9_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device9_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device9_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device9_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device9_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device9_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device9_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device9_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device9_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device9_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device9_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device9_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device9_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device9_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device9_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device9_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device9_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device9_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device9_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device9_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device9_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device9_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device9_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device9_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device9_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device9_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device9_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device9_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device9_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device9_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device9_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device9_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device9_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device9_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device9_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device9_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device9_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + + +#define ID3D12Device9_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) ) + +#define ID3D12Device9_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession(This,pDesc,riid,ppSession) ) + +#define ID3D12Device9_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device9_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) ) + +#define ID3D12Device9_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#if !defined(_WIN32) + +#define ID3D12Device9_GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device9_GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + + +#define ID3D12Device9_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->lpVtbl -> CreateLifetimeTracker(This,pOwner,riid,ppvTracker) ) + +#define ID3D12Device9_RemoveDevice(This) \ + ( (This)->lpVtbl -> RemoveDevice(This) ) + +#define ID3D12Device9_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommands(This,pNumMetaCommands,pDescs) ) + +#define ID3D12Device9_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) + +#define ID3D12Device9_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->lpVtbl -> CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) + +#define ID3D12Device9_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->lpVtbl -> CreateStateObject(This,pDesc,riid,ppStateObject) ) + +#define ID3D12Device9_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->lpVtbl -> GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) ) + +#define ID3D12Device9_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->lpVtbl -> CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) ) + + +#define ID3D12Device9_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->lpVtbl -> SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) + + +#define ID3D12Device9_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->lpVtbl -> AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) + +#define ID3D12Device9_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession1(This,pDesc,riid,ppSession) ) + +#if !defined(_WIN32) + +#define ID3D12Device9_GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device9_GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + +#define ID3D12Device9_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device9_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device9_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) ) + +#define ID3D12Device9_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + + +#define ID3D12Device9_CreateShaderCacheSession(This,pDesc,riid,ppvSession) \ + ( (This)->lpVtbl -> CreateShaderCacheSession(This,pDesc,riid,ppvSession) ) + +#define ID3D12Device9_ShaderCacheControl(This,Kinds,Control) \ + ( (This)->lpVtbl -> ShaderCacheControl(This,Kinds,Control) ) + +#define ID3D12Device9_CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device9_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Device10_INTERFACE_DEFINED__ +#define __ID3D12Device10_INTERFACE_DEFINED__ + +/* interface ID3D12Device10 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device10; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("517f8718-aa66-49f9-b02b-a7ab89c06031") + ID3D12Device10 : public ID3D12Device9 + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateCommittedResource3( + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreatePlacedResource2( + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateReservedResource2( + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device10Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device10 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device10 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device10 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device10 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device10 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device10 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device10 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device10 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device10 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device10 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device10 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device10 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device10 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device10 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device10 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device10 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device10 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device10 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device10 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device10 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device10 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device10 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device10 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device10 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device10 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device10 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device10 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device10 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device10 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device10 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device10 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device10 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device10 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device10 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device10 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device10 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device10 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device10 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device10 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device10 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device10 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device10 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device10 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device10 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device10 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device10 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device10 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device10 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device10 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device10 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + DECLSPEC_XFGVIRT(ID3D12Device2, CreatePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device10 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromAddress) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device10 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromFileMapping) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device10 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, EnqueueMakeResident) + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device10 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommandList1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList1 )( + ID3D12Device10 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession )( + ID3D12Device10 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommittedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource1 )( + ID3D12Device10 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateHeap1) + HRESULT ( STDMETHODCALLTYPE *CreateHeap1 )( + ID3D12Device10 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateReservedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource1 )( + ID3D12Device10 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, GetResourceAllocationInfo1) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device10 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device10 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateLifetimeTracker) + HRESULT ( STDMETHODCALLTYPE *CreateLifetimeTracker )( + ID3D12Device10 * This, + _In_ ID3D12LifetimeOwner *pOwner, + REFIID riid, + _COM_Outptr_ void **ppvTracker); + + DECLSPEC_XFGVIRT(ID3D12Device5, RemoveDevice) + void ( STDMETHODCALLTYPE *RemoveDevice )( + ID3D12Device10 * This); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommands) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommands )( + ID3D12Device10 * This, + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_META_COMMAND_DESC *pDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommandParameters) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommandParameters )( + ID3D12Device10 * This, + _In_ REFGUID CommandId, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _Out_opt_ UINT *pTotalStructureSizeInBytes, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_META_COMMAND_PARAMETER_DESC *pParameterDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateMetaCommand) + HRESULT ( STDMETHODCALLTYPE *CreateMetaCommand )( + ID3D12Device10 * This, + _In_ REFGUID CommandId, + _In_ UINT NodeMask, + _In_reads_bytes_opt_(CreationParametersDataSizeInBytes) const void *pCreationParametersData, + _In_ SIZE_T CreationParametersDataSizeInBytes, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateStateObject) + HRESULT ( STDMETHODCALLTYPE *CreateStateObject )( + ID3D12Device10 * This, + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device5, GetRaytracingAccelerationStructurePrebuildInfo) + void ( STDMETHODCALLTYPE *GetRaytracingAccelerationStructurePrebuildInfo )( + ID3D12Device10 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo); + + DECLSPEC_XFGVIRT(ID3D12Device5, CheckDriverMatchingIdentifier) + D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS ( STDMETHODCALLTYPE *CheckDriverMatchingIdentifier )( + ID3D12Device10 * This, + _In_ D3D12_SERIALIZED_DATA_TYPE SerializedDataType, + _In_ const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *pIdentifierToCheck); + + DECLSPEC_XFGVIRT(ID3D12Device6, SetBackgroundProcessingMode) + HRESULT ( STDMETHODCALLTYPE *SetBackgroundProcessingMode )( + ID3D12Device10 * This, + D3D12_BACKGROUND_PROCESSING_MODE Mode, + D3D12_MEASUREMENTS_ACTION MeasurementsAction, + _In_opt_ HANDLE hEventToSignalUponCompletion, + _Out_opt_ BOOL *pbFurtherMeasurementsDesired); + + DECLSPEC_XFGVIRT(ID3D12Device7, AddToStateObject) + HRESULT ( STDMETHODCALLTYPE *AddToStateObject )( + ID3D12Device10 * This, + const D3D12_STATE_OBJECT_DESC *pAddition, + ID3D12StateObject *pStateObjectToGrowFrom, + REFIID riid, + _COM_Outptr_ void **ppNewStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device7, CreateProtectedResourceSession1) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession1 )( + ID3D12Device10 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetResourceAllocationInfo2) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device10 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device10 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateCommittedResource2) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource2 )( + ID3D12Device10 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreatePlacedResource1) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource1 )( + ID3D12Device10 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateSamplerFeedbackUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateSamplerFeedbackUnorderedAccessView )( + ID3D12Device10 * This, + _In_opt_ ID3D12Resource *pTargetedResource, + _In_opt_ ID3D12Resource *pFeedbackResource, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetCopyableFootprints1) + void ( STDMETHODCALLTYPE *GetCopyableFootprints1 )( + ID3D12Device10 * This, + _In_ const D3D12_RESOURCE_DESC1 *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device9, CreateShaderCacheSession) + HRESULT ( STDMETHODCALLTYPE *CreateShaderCacheSession )( + ID3D12Device10 * This, + _In_ const D3D12_SHADER_CACHE_SESSION_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvSession); + + DECLSPEC_XFGVIRT(ID3D12Device9, ShaderCacheControl) + HRESULT ( STDMETHODCALLTYPE *ShaderCacheControl )( + ID3D12Device10 * This, + D3D12_SHADER_CACHE_KIND_FLAGS Kinds, + D3D12_SHADER_CACHE_CONTROL_FLAGS Control); + + DECLSPEC_XFGVIRT(ID3D12Device9, CreateCommandQueue1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue1 )( + ID3D12Device10 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID CreatorID, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreateCommittedResource3) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource3 )( + ID3D12Device10 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreatePlacedResource2) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource2 )( + ID3D12Device10 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreateReservedResource2) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource2 )( + ID3D12Device10 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + END_INTERFACE + } ID3D12Device10Vtbl; + + interface ID3D12Device10 + { + CONST_VTBL struct ID3D12Device10Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device10_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device10_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device10_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device10_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device10_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device10_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device10_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device10_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device10_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device10_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device10_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device10_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device10_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device10_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device10_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device10_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device10_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device10_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device10_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device10_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device10_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device10_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device10_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device10_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device10_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device10_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device10_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device10_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device10_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device10_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device10_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device10_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device10_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device10_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device10_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device10_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device10_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device10_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device10_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device10_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device10_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device10_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device10_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device10_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device10_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device10_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device10_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device10_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device10_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device10_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device10_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device10_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device10_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device10_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + + +#define ID3D12Device10_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) ) + +#define ID3D12Device10_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession(This,pDesc,riid,ppSession) ) + +#define ID3D12Device10_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device10_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) ) + +#define ID3D12Device10_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#if !defined(_WIN32) + +#define ID3D12Device10_GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device10_GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + + +#define ID3D12Device10_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->lpVtbl -> CreateLifetimeTracker(This,pOwner,riid,ppvTracker) ) + +#define ID3D12Device10_RemoveDevice(This) \ + ( (This)->lpVtbl -> RemoveDevice(This) ) + +#define ID3D12Device10_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommands(This,pNumMetaCommands,pDescs) ) + +#define ID3D12Device10_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) + +#define ID3D12Device10_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->lpVtbl -> CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) + +#define ID3D12Device10_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->lpVtbl -> CreateStateObject(This,pDesc,riid,ppStateObject) ) + +#define ID3D12Device10_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->lpVtbl -> GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) ) + +#define ID3D12Device10_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->lpVtbl -> CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) ) + + +#define ID3D12Device10_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->lpVtbl -> SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) + + +#define ID3D12Device10_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->lpVtbl -> AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) + +#define ID3D12Device10_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession1(This,pDesc,riid,ppSession) ) + +#if !defined(_WIN32) + +#define ID3D12Device10_GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device10_GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + +#define ID3D12Device10_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device10_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device10_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) ) + +#define ID3D12Device10_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + + +#define ID3D12Device10_CreateShaderCacheSession(This,pDesc,riid,ppvSession) \ + ( (This)->lpVtbl -> CreateShaderCacheSession(This,pDesc,riid,ppvSession) ) + +#define ID3D12Device10_ShaderCacheControl(This,Kinds,Control) \ + ( (This)->lpVtbl -> ShaderCacheControl(This,Kinds,Control) ) + +#define ID3D12Device10_CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) ) + + +#define ID3D12Device10_CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) ) + +#define ID3D12Device10_CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) ) + +#define ID3D12Device10_CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device10_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Device11_INTERFACE_DEFINED__ +#define __ID3D12Device11_INTERFACE_DEFINED__ + +/* interface ID3D12Device11 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device11; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5405c344-d457-444e-b4dd-2366e45aee39") + ID3D12Device11 : public ID3D12Device10 + { + public: + virtual void STDMETHODCALLTYPE CreateSampler2( + _In_ const D3D12_SAMPLER_DESC2 *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device11Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device11 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device11 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device11 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device11 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device11 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device11 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device11 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device11 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device11 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device11 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device11 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device11 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device11 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device11 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device11 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device11 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device11 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device11 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device11 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device11 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device11 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device11 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device11 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device11 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device11 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device11 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device11 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device11 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device11 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device11 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device11 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device11 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device11 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device11 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device11 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device11 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device11 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device11 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device11 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device11 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device11 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device11 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device11 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device11 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device11 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device11 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device11 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device11 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device11 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device11 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + DECLSPEC_XFGVIRT(ID3D12Device2, CreatePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device11 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromAddress) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device11 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromFileMapping) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device11 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, EnqueueMakeResident) + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device11 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommandList1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList1 )( + ID3D12Device11 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession )( + ID3D12Device11 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommittedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource1 )( + ID3D12Device11 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateHeap1) + HRESULT ( STDMETHODCALLTYPE *CreateHeap1 )( + ID3D12Device11 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateReservedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource1 )( + ID3D12Device11 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, GetResourceAllocationInfo1) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device11 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device11 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateLifetimeTracker) + HRESULT ( STDMETHODCALLTYPE *CreateLifetimeTracker )( + ID3D12Device11 * This, + _In_ ID3D12LifetimeOwner *pOwner, + REFIID riid, + _COM_Outptr_ void **ppvTracker); + + DECLSPEC_XFGVIRT(ID3D12Device5, RemoveDevice) + void ( STDMETHODCALLTYPE *RemoveDevice )( + ID3D12Device11 * This); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommands) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommands )( + ID3D12Device11 * This, + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_META_COMMAND_DESC *pDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommandParameters) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommandParameters )( + ID3D12Device11 * This, + _In_ REFGUID CommandId, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _Out_opt_ UINT *pTotalStructureSizeInBytes, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_META_COMMAND_PARAMETER_DESC *pParameterDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateMetaCommand) + HRESULT ( STDMETHODCALLTYPE *CreateMetaCommand )( + ID3D12Device11 * This, + _In_ REFGUID CommandId, + _In_ UINT NodeMask, + _In_reads_bytes_opt_(CreationParametersDataSizeInBytes) const void *pCreationParametersData, + _In_ SIZE_T CreationParametersDataSizeInBytes, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateStateObject) + HRESULT ( STDMETHODCALLTYPE *CreateStateObject )( + ID3D12Device11 * This, + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device5, GetRaytracingAccelerationStructurePrebuildInfo) + void ( STDMETHODCALLTYPE *GetRaytracingAccelerationStructurePrebuildInfo )( + ID3D12Device11 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo); + + DECLSPEC_XFGVIRT(ID3D12Device5, CheckDriverMatchingIdentifier) + D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS ( STDMETHODCALLTYPE *CheckDriverMatchingIdentifier )( + ID3D12Device11 * This, + _In_ D3D12_SERIALIZED_DATA_TYPE SerializedDataType, + _In_ const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *pIdentifierToCheck); + + DECLSPEC_XFGVIRT(ID3D12Device6, SetBackgroundProcessingMode) + HRESULT ( STDMETHODCALLTYPE *SetBackgroundProcessingMode )( + ID3D12Device11 * This, + D3D12_BACKGROUND_PROCESSING_MODE Mode, + D3D12_MEASUREMENTS_ACTION MeasurementsAction, + _In_opt_ HANDLE hEventToSignalUponCompletion, + _Out_opt_ BOOL *pbFurtherMeasurementsDesired); + + DECLSPEC_XFGVIRT(ID3D12Device7, AddToStateObject) + HRESULT ( STDMETHODCALLTYPE *AddToStateObject )( + ID3D12Device11 * This, + const D3D12_STATE_OBJECT_DESC *pAddition, + ID3D12StateObject *pStateObjectToGrowFrom, + REFIID riid, + _COM_Outptr_ void **ppNewStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device7, CreateProtectedResourceSession1) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession1 )( + ID3D12Device11 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetResourceAllocationInfo2) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device11 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device11 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateCommittedResource2) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource2 )( + ID3D12Device11 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreatePlacedResource1) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource1 )( + ID3D12Device11 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateSamplerFeedbackUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateSamplerFeedbackUnorderedAccessView )( + ID3D12Device11 * This, + _In_opt_ ID3D12Resource *pTargetedResource, + _In_opt_ ID3D12Resource *pFeedbackResource, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetCopyableFootprints1) + void ( STDMETHODCALLTYPE *GetCopyableFootprints1 )( + ID3D12Device11 * This, + _In_ const D3D12_RESOURCE_DESC1 *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device9, CreateShaderCacheSession) + HRESULT ( STDMETHODCALLTYPE *CreateShaderCacheSession )( + ID3D12Device11 * This, + _In_ const D3D12_SHADER_CACHE_SESSION_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvSession); + + DECLSPEC_XFGVIRT(ID3D12Device9, ShaderCacheControl) + HRESULT ( STDMETHODCALLTYPE *ShaderCacheControl )( + ID3D12Device11 * This, + D3D12_SHADER_CACHE_KIND_FLAGS Kinds, + D3D12_SHADER_CACHE_CONTROL_FLAGS Control); + + DECLSPEC_XFGVIRT(ID3D12Device9, CreateCommandQueue1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue1 )( + ID3D12Device11 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID CreatorID, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreateCommittedResource3) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource3 )( + ID3D12Device11 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreatePlacedResource2) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource2 )( + ID3D12Device11 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreateReservedResource2) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource2 )( + ID3D12Device11 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device11, CreateSampler2) + void ( STDMETHODCALLTYPE *CreateSampler2 )( + ID3D12Device11 * This, + _In_ const D3D12_SAMPLER_DESC2 *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + END_INTERFACE + } ID3D12Device11Vtbl; + + interface ID3D12Device11 + { + CONST_VTBL struct ID3D12Device11Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device11_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device11_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device11_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device11_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device11_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device11_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device11_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device11_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device11_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device11_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device11_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device11_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device11_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device11_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device11_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device11_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device11_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device11_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device11_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device11_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device11_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device11_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device11_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device11_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device11_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device11_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device11_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device11_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device11_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device11_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device11_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device11_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device11_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device11_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device11_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device11_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device11_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device11_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device11_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device11_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device11_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device11_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device11_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device11_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device11_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device11_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device11_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device11_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device11_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device11_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device11_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device11_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device11_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device11_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + + +#define ID3D12Device11_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) ) + +#define ID3D12Device11_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession(This,pDesc,riid,ppSession) ) + +#define ID3D12Device11_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device11_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) ) + +#define ID3D12Device11_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#if !defined(_WIN32) + +#define ID3D12Device11_GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device11_GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + + +#define ID3D12Device11_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->lpVtbl -> CreateLifetimeTracker(This,pOwner,riid,ppvTracker) ) + +#define ID3D12Device11_RemoveDevice(This) \ + ( (This)->lpVtbl -> RemoveDevice(This) ) + +#define ID3D12Device11_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommands(This,pNumMetaCommands,pDescs) ) + +#define ID3D12Device11_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) + +#define ID3D12Device11_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->lpVtbl -> CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) + +#define ID3D12Device11_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->lpVtbl -> CreateStateObject(This,pDesc,riid,ppStateObject) ) + +#define ID3D12Device11_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->lpVtbl -> GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) ) + +#define ID3D12Device11_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->lpVtbl -> CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) ) + + +#define ID3D12Device11_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->lpVtbl -> SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) + + +#define ID3D12Device11_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->lpVtbl -> AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) + +#define ID3D12Device11_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession1(This,pDesc,riid,ppSession) ) + +#if !defined(_WIN32) + +#define ID3D12Device11_GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device11_GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + +#define ID3D12Device11_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device11_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device11_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) ) + +#define ID3D12Device11_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + + +#define ID3D12Device11_CreateShaderCacheSession(This,pDesc,riid,ppvSession) \ + ( (This)->lpVtbl -> CreateShaderCacheSession(This,pDesc,riid,ppvSession) ) + +#define ID3D12Device11_ShaderCacheControl(This,Kinds,Control) \ + ( (This)->lpVtbl -> ShaderCacheControl(This,Kinds,Control) ) + +#define ID3D12Device11_CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) ) + + +#define ID3D12Device11_CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) ) + +#define ID3D12Device11_CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) ) + +#define ID3D12Device11_CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) ) + + +#define ID3D12Device11_CreateSampler2(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler2(This,pDesc,DestDescriptor) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device11_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Device12_INTERFACE_DEFINED__ +#define __ID3D12Device12_INTERFACE_DEFINED__ + +/* interface ID3D12Device12 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device12; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5af5c532-4c91-4cd0-b541-15a405395fc5") + ID3D12Device12 : public ID3D12Device11 + { + public: +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_RESOURCE_ALLOCATION_INFO STDMETHODCALLTYPE GetResourceAllocationInfo3( + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _In_opt_count_(numResourceDescs) const UINT32 *pNumCastableFormats, + _In_opt_count_(numResourceDescs) const DXGI_FORMAT *const *ppCastableFormats, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1) = 0; +#else + virtual D3D12_RESOURCE_ALLOCATION_INFO *STDMETHODCALLTYPE GetResourceAllocationInfo3( + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _In_opt_count_(numResourceDescs) const UINT32 *pNumCastableFormats, + _In_opt_count_(numResourceDescs) const DXGI_FORMAT *const *ppCastableFormats, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1) = 0; +#endif + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device12Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device12 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device12 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device12 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device12 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device12 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device12 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device12 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device12 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device12 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device12 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device12 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device12 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device12 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device12 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device12 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device12 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device12 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device12 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device12 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device12 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device12 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device12 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device12 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device12 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device12 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device12 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device12 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device12 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device12 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device12 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device12 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device12 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device12 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device12 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device12 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device12 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device12 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device12 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device12 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device12 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device12 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device12 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device12 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device12 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device12 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device12 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device12 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device12 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device12 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device12 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + DECLSPEC_XFGVIRT(ID3D12Device2, CreatePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device12 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromAddress) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device12 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromFileMapping) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device12 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, EnqueueMakeResident) + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device12 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommandList1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList1 )( + ID3D12Device12 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession )( + ID3D12Device12 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommittedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource1 )( + ID3D12Device12 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateHeap1) + HRESULT ( STDMETHODCALLTYPE *CreateHeap1 )( + ID3D12Device12 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateReservedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource1 )( + ID3D12Device12 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, GetResourceAllocationInfo1) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device12 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device12 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateLifetimeTracker) + HRESULT ( STDMETHODCALLTYPE *CreateLifetimeTracker )( + ID3D12Device12 * This, + _In_ ID3D12LifetimeOwner *pOwner, + REFIID riid, + _COM_Outptr_ void **ppvTracker); + + DECLSPEC_XFGVIRT(ID3D12Device5, RemoveDevice) + void ( STDMETHODCALLTYPE *RemoveDevice )( + ID3D12Device12 * This); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommands) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommands )( + ID3D12Device12 * This, + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_META_COMMAND_DESC *pDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommandParameters) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommandParameters )( + ID3D12Device12 * This, + _In_ REFGUID CommandId, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _Out_opt_ UINT *pTotalStructureSizeInBytes, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_META_COMMAND_PARAMETER_DESC *pParameterDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateMetaCommand) + HRESULT ( STDMETHODCALLTYPE *CreateMetaCommand )( + ID3D12Device12 * This, + _In_ REFGUID CommandId, + _In_ UINT NodeMask, + _In_reads_bytes_opt_(CreationParametersDataSizeInBytes) const void *pCreationParametersData, + _In_ SIZE_T CreationParametersDataSizeInBytes, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateStateObject) + HRESULT ( STDMETHODCALLTYPE *CreateStateObject )( + ID3D12Device12 * This, + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device5, GetRaytracingAccelerationStructurePrebuildInfo) + void ( STDMETHODCALLTYPE *GetRaytracingAccelerationStructurePrebuildInfo )( + ID3D12Device12 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo); + + DECLSPEC_XFGVIRT(ID3D12Device5, CheckDriverMatchingIdentifier) + D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS ( STDMETHODCALLTYPE *CheckDriverMatchingIdentifier )( + ID3D12Device12 * This, + _In_ D3D12_SERIALIZED_DATA_TYPE SerializedDataType, + _In_ const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *pIdentifierToCheck); + + DECLSPEC_XFGVIRT(ID3D12Device6, SetBackgroundProcessingMode) + HRESULT ( STDMETHODCALLTYPE *SetBackgroundProcessingMode )( + ID3D12Device12 * This, + D3D12_BACKGROUND_PROCESSING_MODE Mode, + D3D12_MEASUREMENTS_ACTION MeasurementsAction, + _In_opt_ HANDLE hEventToSignalUponCompletion, + _Out_opt_ BOOL *pbFurtherMeasurementsDesired); + + DECLSPEC_XFGVIRT(ID3D12Device7, AddToStateObject) + HRESULT ( STDMETHODCALLTYPE *AddToStateObject )( + ID3D12Device12 * This, + const D3D12_STATE_OBJECT_DESC *pAddition, + ID3D12StateObject *pStateObjectToGrowFrom, + REFIID riid, + _COM_Outptr_ void **ppNewStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device7, CreateProtectedResourceSession1) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession1 )( + ID3D12Device12 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetResourceAllocationInfo2) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device12 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device12 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateCommittedResource2) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource2 )( + ID3D12Device12 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreatePlacedResource1) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource1 )( + ID3D12Device12 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateSamplerFeedbackUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateSamplerFeedbackUnorderedAccessView )( + ID3D12Device12 * This, + _In_opt_ ID3D12Resource *pTargetedResource, + _In_opt_ ID3D12Resource *pFeedbackResource, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetCopyableFootprints1) + void ( STDMETHODCALLTYPE *GetCopyableFootprints1 )( + ID3D12Device12 * This, + _In_ const D3D12_RESOURCE_DESC1 *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device9, CreateShaderCacheSession) + HRESULT ( STDMETHODCALLTYPE *CreateShaderCacheSession )( + ID3D12Device12 * This, + _In_ const D3D12_SHADER_CACHE_SESSION_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvSession); + + DECLSPEC_XFGVIRT(ID3D12Device9, ShaderCacheControl) + HRESULT ( STDMETHODCALLTYPE *ShaderCacheControl )( + ID3D12Device12 * This, + D3D12_SHADER_CACHE_KIND_FLAGS Kinds, + D3D12_SHADER_CACHE_CONTROL_FLAGS Control); + + DECLSPEC_XFGVIRT(ID3D12Device9, CreateCommandQueue1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue1 )( + ID3D12Device12 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID CreatorID, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreateCommittedResource3) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource3 )( + ID3D12Device12 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreatePlacedResource2) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource2 )( + ID3D12Device12 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreateReservedResource2) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource2 )( + ID3D12Device12 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device11, CreateSampler2) + void ( STDMETHODCALLTYPE *CreateSampler2 )( + ID3D12Device12 * This, + _In_ const D3D12_SAMPLER_DESC2 *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device12, GetResourceAllocationInfo3) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo3 )( + ID3D12Device12 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _In_opt_count_(numResourceDescs) const UINT32 *pNumCastableFormats, + _In_opt_count_(numResourceDescs) const DXGI_FORMAT *const *ppCastableFormats, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo3 )( + ID3D12Device12 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _In_opt_count_(numResourceDescs) const UINT32 *pNumCastableFormats, + _In_opt_count_(numResourceDescs) const DXGI_FORMAT *const *ppCastableFormats, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + END_INTERFACE + } ID3D12Device12Vtbl; + + interface ID3D12Device12 + { + CONST_VTBL struct ID3D12Device12Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device12_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device12_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device12_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device12_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device12_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device12_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device12_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device12_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device12_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device12_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device12_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device12_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device12_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device12_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device12_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device12_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device12_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device12_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device12_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device12_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device12_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device12_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device12_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device12_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device12_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device12_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device12_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device12_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device12_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device12_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device12_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device12_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device12_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device12_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device12_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device12_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device12_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device12_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device12_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device12_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device12_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device12_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device12_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device12_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device12_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device12_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device12_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device12_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device12_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device12_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device12_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device12_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device12_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device12_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + + +#define ID3D12Device12_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) ) + +#define ID3D12Device12_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession(This,pDesc,riid,ppSession) ) + +#define ID3D12Device12_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device12_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) ) + +#define ID3D12Device12_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#if !defined(_WIN32) + +#define ID3D12Device12_GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device12_GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + + +#define ID3D12Device12_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->lpVtbl -> CreateLifetimeTracker(This,pOwner,riid,ppvTracker) ) + +#define ID3D12Device12_RemoveDevice(This) \ + ( (This)->lpVtbl -> RemoveDevice(This) ) + +#define ID3D12Device12_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommands(This,pNumMetaCommands,pDescs) ) + +#define ID3D12Device12_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) + +#define ID3D12Device12_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->lpVtbl -> CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) + +#define ID3D12Device12_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->lpVtbl -> CreateStateObject(This,pDesc,riid,ppStateObject) ) + +#define ID3D12Device12_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->lpVtbl -> GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) ) + +#define ID3D12Device12_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->lpVtbl -> CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) ) + + +#define ID3D12Device12_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->lpVtbl -> SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) + + +#define ID3D12Device12_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->lpVtbl -> AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) + +#define ID3D12Device12_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession1(This,pDesc,riid,ppSession) ) + +#if !defined(_WIN32) + +#define ID3D12Device12_GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device12_GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + +#define ID3D12Device12_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device12_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device12_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) ) + +#define ID3D12Device12_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + + +#define ID3D12Device12_CreateShaderCacheSession(This,pDesc,riid,ppvSession) \ + ( (This)->lpVtbl -> CreateShaderCacheSession(This,pDesc,riid,ppvSession) ) + +#define ID3D12Device12_ShaderCacheControl(This,Kinds,Control) \ + ( (This)->lpVtbl -> ShaderCacheControl(This,Kinds,Control) ) + +#define ID3D12Device12_CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) ) + + +#define ID3D12Device12_CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) ) + +#define ID3D12Device12_CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) ) + +#define ID3D12Device12_CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) ) + + +#define ID3D12Device12_CreateSampler2(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler2(This,pDesc,DestDescriptor) ) + +#if !defined(_WIN32) + +#define ID3D12Device12_GetResourceAllocationInfo3(This,visibleMask,numResourceDescs,pResourceDescs,pNumCastableFormats,ppCastableFormats,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo3(This,visibleMask,numResourceDescs,pResourceDescs,pNumCastableFormats,ppCastableFormats,pResourceAllocationInfo1) ) +#else +#define ID3D12Device12_GetResourceAllocationInfo3(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pNumCastableFormats,ppCastableFormats,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo3(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pNumCastableFormats,ppCastableFormats,pResourceAllocationInfo1) ) +#endif + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device12_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Device13_INTERFACE_DEFINED__ +#define __ID3D12Device13_INTERFACE_DEFINED__ + +/* interface ID3D12Device13 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device13; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("14eecffc-4df8-40f7-a118-5c816f45695e") + ID3D12Device13 : public ID3D12Device12 + { + public: + virtual HRESULT STDMETHODCALLTYPE OpenExistingHeapFromAddress1( + _In_ const void *pAddress, + SIZE_T size, + REFIID riid, + _COM_Outptr_ void **ppvHeap) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device13Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device13 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device13 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device13 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device13 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device13 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device13 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device13 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device13 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device13 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device13 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device13 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device13 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device13 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device13 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device13 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device13 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device13 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device13 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device13 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device13 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device13 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device13 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device13 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device13 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device13 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device13 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device13 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device13 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device13 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device13 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device13 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device13 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device13 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device13 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device13 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device13 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device13 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device13 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device13 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device13 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device13 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device13 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device13 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device13 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device13 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device13 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device13 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device13 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device13 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device13 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + DECLSPEC_XFGVIRT(ID3D12Device2, CreatePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device13 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromAddress) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device13 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromFileMapping) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device13 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, EnqueueMakeResident) + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device13 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommandList1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList1 )( + ID3D12Device13 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession )( + ID3D12Device13 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommittedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource1 )( + ID3D12Device13 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateHeap1) + HRESULT ( STDMETHODCALLTYPE *CreateHeap1 )( + ID3D12Device13 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateReservedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource1 )( + ID3D12Device13 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, GetResourceAllocationInfo1) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device13 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device13 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateLifetimeTracker) + HRESULT ( STDMETHODCALLTYPE *CreateLifetimeTracker )( + ID3D12Device13 * This, + _In_ ID3D12LifetimeOwner *pOwner, + REFIID riid, + _COM_Outptr_ void **ppvTracker); + + DECLSPEC_XFGVIRT(ID3D12Device5, RemoveDevice) + void ( STDMETHODCALLTYPE *RemoveDevice )( + ID3D12Device13 * This); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommands) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommands )( + ID3D12Device13 * This, + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_META_COMMAND_DESC *pDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommandParameters) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommandParameters )( + ID3D12Device13 * This, + _In_ REFGUID CommandId, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _Out_opt_ UINT *pTotalStructureSizeInBytes, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_META_COMMAND_PARAMETER_DESC *pParameterDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateMetaCommand) + HRESULT ( STDMETHODCALLTYPE *CreateMetaCommand )( + ID3D12Device13 * This, + _In_ REFGUID CommandId, + _In_ UINT NodeMask, + _In_reads_bytes_opt_(CreationParametersDataSizeInBytes) const void *pCreationParametersData, + _In_ SIZE_T CreationParametersDataSizeInBytes, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateStateObject) + HRESULT ( STDMETHODCALLTYPE *CreateStateObject )( + ID3D12Device13 * This, + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device5, GetRaytracingAccelerationStructurePrebuildInfo) + void ( STDMETHODCALLTYPE *GetRaytracingAccelerationStructurePrebuildInfo )( + ID3D12Device13 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo); + + DECLSPEC_XFGVIRT(ID3D12Device5, CheckDriverMatchingIdentifier) + D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS ( STDMETHODCALLTYPE *CheckDriverMatchingIdentifier )( + ID3D12Device13 * This, + _In_ D3D12_SERIALIZED_DATA_TYPE SerializedDataType, + _In_ const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *pIdentifierToCheck); + + DECLSPEC_XFGVIRT(ID3D12Device6, SetBackgroundProcessingMode) + HRESULT ( STDMETHODCALLTYPE *SetBackgroundProcessingMode )( + ID3D12Device13 * This, + D3D12_BACKGROUND_PROCESSING_MODE Mode, + D3D12_MEASUREMENTS_ACTION MeasurementsAction, + _In_opt_ HANDLE hEventToSignalUponCompletion, + _Out_opt_ BOOL *pbFurtherMeasurementsDesired); + + DECLSPEC_XFGVIRT(ID3D12Device7, AddToStateObject) + HRESULT ( STDMETHODCALLTYPE *AddToStateObject )( + ID3D12Device13 * This, + const D3D12_STATE_OBJECT_DESC *pAddition, + ID3D12StateObject *pStateObjectToGrowFrom, + REFIID riid, + _COM_Outptr_ void **ppNewStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device7, CreateProtectedResourceSession1) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession1 )( + ID3D12Device13 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetResourceAllocationInfo2) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device13 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device13 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateCommittedResource2) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource2 )( + ID3D12Device13 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreatePlacedResource1) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource1 )( + ID3D12Device13 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateSamplerFeedbackUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateSamplerFeedbackUnorderedAccessView )( + ID3D12Device13 * This, + _In_opt_ ID3D12Resource *pTargetedResource, + _In_opt_ ID3D12Resource *pFeedbackResource, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetCopyableFootprints1) + void ( STDMETHODCALLTYPE *GetCopyableFootprints1 )( + ID3D12Device13 * This, + _In_ const D3D12_RESOURCE_DESC1 *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device9, CreateShaderCacheSession) + HRESULT ( STDMETHODCALLTYPE *CreateShaderCacheSession )( + ID3D12Device13 * This, + _In_ const D3D12_SHADER_CACHE_SESSION_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvSession); + + DECLSPEC_XFGVIRT(ID3D12Device9, ShaderCacheControl) + HRESULT ( STDMETHODCALLTYPE *ShaderCacheControl )( + ID3D12Device13 * This, + D3D12_SHADER_CACHE_KIND_FLAGS Kinds, + D3D12_SHADER_CACHE_CONTROL_FLAGS Control); + + DECLSPEC_XFGVIRT(ID3D12Device9, CreateCommandQueue1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue1 )( + ID3D12Device13 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID CreatorID, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreateCommittedResource3) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource3 )( + ID3D12Device13 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreatePlacedResource2) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource2 )( + ID3D12Device13 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreateReservedResource2) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource2 )( + ID3D12Device13 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device11, CreateSampler2) + void ( STDMETHODCALLTYPE *CreateSampler2 )( + ID3D12Device13 * This, + _In_ const D3D12_SAMPLER_DESC2 *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device12, GetResourceAllocationInfo3) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo3 )( + ID3D12Device13 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _In_opt_count_(numResourceDescs) const UINT32 *pNumCastableFormats, + _In_opt_count_(numResourceDescs) const DXGI_FORMAT *const *ppCastableFormats, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo3 )( + ID3D12Device13 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _In_opt_count_(numResourceDescs) const UINT32 *pNumCastableFormats, + _In_opt_count_(numResourceDescs) const DXGI_FORMAT *const *ppCastableFormats, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device13, OpenExistingHeapFromAddress1) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress1 )( + ID3D12Device13 * This, + _In_ const void *pAddress, + SIZE_T size, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + END_INTERFACE + } ID3D12Device13Vtbl; + + interface ID3D12Device13 + { + CONST_VTBL struct ID3D12Device13Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device13_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device13_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device13_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device13_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device13_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device13_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device13_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device13_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device13_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device13_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device13_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device13_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device13_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device13_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device13_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device13_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device13_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device13_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device13_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device13_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device13_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device13_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device13_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device13_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device13_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device13_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device13_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device13_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device13_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device13_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device13_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device13_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device13_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device13_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device13_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device13_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device13_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device13_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device13_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device13_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device13_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device13_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device13_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device13_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device13_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device13_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device13_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device13_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device13_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device13_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device13_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device13_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device13_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device13_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + + +#define ID3D12Device13_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) ) + +#define ID3D12Device13_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession(This,pDesc,riid,ppSession) ) + +#define ID3D12Device13_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device13_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) ) + +#define ID3D12Device13_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#if !defined(_WIN32) + +#define ID3D12Device13_GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device13_GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + + +#define ID3D12Device13_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->lpVtbl -> CreateLifetimeTracker(This,pOwner,riid,ppvTracker) ) + +#define ID3D12Device13_RemoveDevice(This) \ + ( (This)->lpVtbl -> RemoveDevice(This) ) + +#define ID3D12Device13_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommands(This,pNumMetaCommands,pDescs) ) + +#define ID3D12Device13_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) + +#define ID3D12Device13_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->lpVtbl -> CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) + +#define ID3D12Device13_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->lpVtbl -> CreateStateObject(This,pDesc,riid,ppStateObject) ) + +#define ID3D12Device13_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->lpVtbl -> GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) ) + +#define ID3D12Device13_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->lpVtbl -> CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) ) + + +#define ID3D12Device13_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->lpVtbl -> SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) + + +#define ID3D12Device13_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->lpVtbl -> AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) + +#define ID3D12Device13_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession1(This,pDesc,riid,ppSession) ) + +#if !defined(_WIN32) + +#define ID3D12Device13_GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device13_GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + +#define ID3D12Device13_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device13_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device13_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) ) + +#define ID3D12Device13_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + + +#define ID3D12Device13_CreateShaderCacheSession(This,pDesc,riid,ppvSession) \ + ( (This)->lpVtbl -> CreateShaderCacheSession(This,pDesc,riid,ppvSession) ) + +#define ID3D12Device13_ShaderCacheControl(This,Kinds,Control) \ + ( (This)->lpVtbl -> ShaderCacheControl(This,Kinds,Control) ) + +#define ID3D12Device13_CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) ) + + +#define ID3D12Device13_CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) ) + +#define ID3D12Device13_CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) ) + +#define ID3D12Device13_CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) ) + + +#define ID3D12Device13_CreateSampler2(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler2(This,pDesc,DestDescriptor) ) + +#if !defined(_WIN32) + +#define ID3D12Device13_GetResourceAllocationInfo3(This,visibleMask,numResourceDescs,pResourceDescs,pNumCastableFormats,ppCastableFormats,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo3(This,visibleMask,numResourceDescs,pResourceDescs,pNumCastableFormats,ppCastableFormats,pResourceAllocationInfo1) ) +#else +#define ID3D12Device13_GetResourceAllocationInfo3(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pNumCastableFormats,ppCastableFormats,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo3(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pNumCastableFormats,ppCastableFormats,pResourceAllocationInfo1) ) +#endif + + +#define ID3D12Device13_OpenExistingHeapFromAddress1(This,pAddress,size,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress1(This,pAddress,size,riid,ppvHeap) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device13_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Device14_INTERFACE_DEFINED__ +#define __ID3D12Device14_INTERFACE_DEFINED__ + +/* interface ID3D12Device14 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device14; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5f6e592d-d895-44c2-8e4a-88ad4926d323") + ID3D12Device14 : public ID3D12Device13 + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateRootSignatureFromSubobjectInLibrary( + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pLibraryBlob, + _In_ SIZE_T blobLengthInBytes, + _In_opt_ LPCWSTR subobjectName, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device14Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device14 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device14 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device14 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device14 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device14 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device14 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device14 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12Device, GetNodeCount) + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device14 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandQueue) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device14 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandAllocator) + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device14 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateGraphicsPipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device14 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateComputePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device14 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandList) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device14 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device, CheckFeatureSupport) + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device14 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDescriptorHeap) + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device14 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDescriptorHandleIncrementSize) + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device14 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRootSignature) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device14 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateConstantBufferView) + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device14 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateShaderResourceView) + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device14 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device14 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateRenderTargetView) + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device14 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateDepthStencilView) + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device14 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSampler) + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device14 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptors) + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device14 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, CopyDescriptorsSimple) + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device14 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceAllocationInfo) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device14 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device14 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, GetCustomHeapProperties) +#if !defined(_WIN32) + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device14 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#else + D3D12_HEAP_PROPERTIES *( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device14 * This, + D3D12_HEAP_PROPERTIES * RetVal, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommittedResource) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device14 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateHeap) + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device14 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, CreatePlacedResource) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device14 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateReservedResource) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device14 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateSharedHandle) + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device14 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandle) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device14 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + DECLSPEC_XFGVIRT(ID3D12Device, OpenSharedHandleByName) + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device14 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + DECLSPEC_XFGVIRT(ID3D12Device, MakeResident) + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device14 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, Evict) + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device14 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateFence) + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device14 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + DECLSPEC_XFGVIRT(ID3D12Device, GetDeviceRemovedReason) + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device14 * This); + + DECLSPEC_XFGVIRT(ID3D12Device, GetCopyableFootprints) + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device14 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateQueryHeap) + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device14 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device, SetStablePowerState) + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device14 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Device, CreateCommandSignature) + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device14 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + DECLSPEC_XFGVIRT(ID3D12Device, GetResourceTiling) + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device14 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + DECLSPEC_XFGVIRT(ID3D12Device, GetAdapterLuid) +#if !defined(_WIN32) + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device14 * This); + +#else + LUID *( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device14 * This, + LUID * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device1, CreatePipelineLibrary) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device14 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetEventOnMultipleFenceCompletion) + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device14 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + DECLSPEC_XFGVIRT(ID3D12Device1, SetResidencyPriority) + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device14 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + DECLSPEC_XFGVIRT(ID3D12Device2, CreatePipelineState) + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device14 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromAddress) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device14 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, OpenExistingHeapFromFileMapping) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device14 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device3, EnqueueMakeResident) + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device14 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommandList1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandList1 )( + ID3D12Device14 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateProtectedResourceSession) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession )( + ID3D12Device14 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateCommittedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource1 )( + ID3D12Device14 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateHeap1) + HRESULT ( STDMETHODCALLTYPE *CreateHeap1 )( + ID3D12Device14 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device4, CreateReservedResource1) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource1 )( + ID3D12Device14 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device4, GetResourceAllocationInfo1) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device14 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device14 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateLifetimeTracker) + HRESULT ( STDMETHODCALLTYPE *CreateLifetimeTracker )( + ID3D12Device14 * This, + _In_ ID3D12LifetimeOwner *pOwner, + REFIID riid, + _COM_Outptr_ void **ppvTracker); + + DECLSPEC_XFGVIRT(ID3D12Device5, RemoveDevice) + void ( STDMETHODCALLTYPE *RemoveDevice )( + ID3D12Device14 * This); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommands) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommands )( + ID3D12Device14 * This, + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_META_COMMAND_DESC *pDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, EnumerateMetaCommandParameters) + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommandParameters )( + ID3D12Device14 * This, + _In_ REFGUID CommandId, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _Out_opt_ UINT *pTotalStructureSizeInBytes, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_META_COMMAND_PARAMETER_DESC *pParameterDescs); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateMetaCommand) + HRESULT ( STDMETHODCALLTYPE *CreateMetaCommand )( + ID3D12Device14 * This, + _In_ REFGUID CommandId, + _In_ UINT NodeMask, + _In_reads_bytes_opt_(CreationParametersDataSizeInBytes) const void *pCreationParametersData, + _In_ SIZE_T CreationParametersDataSizeInBytes, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand); + + DECLSPEC_XFGVIRT(ID3D12Device5, CreateStateObject) + HRESULT ( STDMETHODCALLTYPE *CreateStateObject )( + ID3D12Device14 * This, + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device5, GetRaytracingAccelerationStructurePrebuildInfo) + void ( STDMETHODCALLTYPE *GetRaytracingAccelerationStructurePrebuildInfo )( + ID3D12Device14 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo); + + DECLSPEC_XFGVIRT(ID3D12Device5, CheckDriverMatchingIdentifier) + D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS ( STDMETHODCALLTYPE *CheckDriverMatchingIdentifier )( + ID3D12Device14 * This, + _In_ D3D12_SERIALIZED_DATA_TYPE SerializedDataType, + _In_ const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *pIdentifierToCheck); + + DECLSPEC_XFGVIRT(ID3D12Device6, SetBackgroundProcessingMode) + HRESULT ( STDMETHODCALLTYPE *SetBackgroundProcessingMode )( + ID3D12Device14 * This, + D3D12_BACKGROUND_PROCESSING_MODE Mode, + D3D12_MEASUREMENTS_ACTION MeasurementsAction, + _In_opt_ HANDLE hEventToSignalUponCompletion, + _Out_opt_ BOOL *pbFurtherMeasurementsDesired); + + DECLSPEC_XFGVIRT(ID3D12Device7, AddToStateObject) + HRESULT ( STDMETHODCALLTYPE *AddToStateObject )( + ID3D12Device14 * This, + const D3D12_STATE_OBJECT_DESC *pAddition, + ID3D12StateObject *pStateObjectToGrowFrom, + REFIID riid, + _COM_Outptr_ void **ppNewStateObject); + + DECLSPEC_XFGVIRT(ID3D12Device7, CreateProtectedResourceSession1) + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession1 )( + ID3D12Device14 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetResourceAllocationInfo2) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device14 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo2 )( + ID3D12Device14 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateCommittedResource2) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource2 )( + ID3D12Device14 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreatePlacedResource1) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource1 )( + ID3D12Device14 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device8, CreateSamplerFeedbackUnorderedAccessView) + void ( STDMETHODCALLTYPE *CreateSamplerFeedbackUnorderedAccessView )( + ID3D12Device14 * This, + _In_opt_ ID3D12Resource *pTargetedResource, + _In_opt_ ID3D12Resource *pFeedbackResource, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device8, GetCopyableFootprints1) + void ( STDMETHODCALLTYPE *GetCopyableFootprints1 )( + ID3D12Device14 * This, + _In_ const D3D12_RESOURCE_DESC1 *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + DECLSPEC_XFGVIRT(ID3D12Device9, CreateShaderCacheSession) + HRESULT ( STDMETHODCALLTYPE *CreateShaderCacheSession )( + ID3D12Device14 * This, + _In_ const D3D12_SHADER_CACHE_SESSION_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvSession); + + DECLSPEC_XFGVIRT(ID3D12Device9, ShaderCacheControl) + HRESULT ( STDMETHODCALLTYPE *ShaderCacheControl )( + ID3D12Device14 * This, + D3D12_SHADER_CACHE_KIND_FLAGS Kinds, + D3D12_SHADER_CACHE_CONTROL_FLAGS Control); + + DECLSPEC_XFGVIRT(ID3D12Device9, CreateCommandQueue1) + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue1 )( + ID3D12Device14 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID CreatorID, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreateCommittedResource3) + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource3 )( + ID3D12Device14 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreatePlacedResource2) + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource2 )( + ID3D12Device14 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device10, CreateReservedResource2) + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource2 )( + ID3D12Device14 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_BARRIER_LAYOUT InitialLayout, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + UINT32 NumCastableFormats, + _In_opt_count_(NumCastableFormats) const DXGI_FORMAT *pCastableFormats, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + DECLSPEC_XFGVIRT(ID3D12Device11, CreateSampler2) + void ( STDMETHODCALLTYPE *CreateSampler2 )( + ID3D12Device14 * This, + _In_ const D3D12_SAMPLER_DESC2 *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + DECLSPEC_XFGVIRT(ID3D12Device12, GetResourceAllocationInfo3) +#if !defined(_WIN32) + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo3 )( + ID3D12Device14 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _In_opt_count_(numResourceDescs) const UINT32 *pNumCastableFormats, + _In_opt_count_(numResourceDescs) const DXGI_FORMAT *const *ppCastableFormats, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#else + D3D12_RESOURCE_ALLOCATION_INFO *( STDMETHODCALLTYPE *GetResourceAllocationInfo3 )( + ID3D12Device14 * This, + D3D12_RESOURCE_ALLOCATION_INFO * RetVal, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _In_opt_count_(numResourceDescs) const UINT32 *pNumCastableFormats, + _In_opt_count_(numResourceDescs) const DXGI_FORMAT *const *ppCastableFormats, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + +#endif + + DECLSPEC_XFGVIRT(ID3D12Device13, OpenExistingHeapFromAddress1) + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress1 )( + ID3D12Device14 * This, + _In_ const void *pAddress, + SIZE_T size, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + DECLSPEC_XFGVIRT(ID3D12Device14, CreateRootSignatureFromSubobjectInLibrary) + HRESULT ( STDMETHODCALLTYPE *CreateRootSignatureFromSubobjectInLibrary )( + ID3D12Device14 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pLibraryBlob, + _In_ SIZE_T blobLengthInBytes, + _In_opt_ LPCWSTR subobjectName, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + END_INTERFACE + } ID3D12Device14Vtbl; + + interface ID3D12Device14 + { + CONST_VTBL struct ID3D12Device14Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device14_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device14_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device14_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device14_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device14_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device14_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device14_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device14_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device14_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device14_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device14_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device14_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device14_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device14_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device14_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device14_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device14_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device14_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device14_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device14_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device14_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device14_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device14_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device14_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device14_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#if !defined(_WIN32) + +#define ID3D12Device14_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) +#else +#define ID3D12Device14_GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,RetVal,visibleMask,numResourceDescs,pResourceDescs) ) +#endif +#if !defined(_WIN32) + +#define ID3D12Device14_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) +#else +#define ID3D12Device14_GetCustomHeapProperties(This,RetVal,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,RetVal,nodeMask,heapType) ) +#endif + +#define ID3D12Device14_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device14_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device14_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device14_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device14_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device14_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device14_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device14_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device14_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device14_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device14_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device14_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device14_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device14_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device14_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device14_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#if !defined(_WIN32) + +#define ID3D12Device14_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) +#else +#define ID3D12Device14_GetAdapterLuid(This,RetVal) \ + ( (This)->lpVtbl -> GetAdapterLuid(This,RetVal) ) +#endif + + +#define ID3D12Device14_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device14_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device14_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device14_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device14_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device14_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device14_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + + +#define ID3D12Device14_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) ) + +#define ID3D12Device14_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession(This,pDesc,riid,ppSession) ) + +#define ID3D12Device14_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device14_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) ) + +#define ID3D12Device14_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#if !defined(_WIN32) + +#define ID3D12Device14_GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device14_GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + + +#define ID3D12Device14_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->lpVtbl -> CreateLifetimeTracker(This,pOwner,riid,ppvTracker) ) + +#define ID3D12Device14_RemoveDevice(This) \ + ( (This)->lpVtbl -> RemoveDevice(This) ) + +#define ID3D12Device14_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommands(This,pNumMetaCommands,pDescs) ) + +#define ID3D12Device14_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) + +#define ID3D12Device14_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->lpVtbl -> CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) + +#define ID3D12Device14_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->lpVtbl -> CreateStateObject(This,pDesc,riid,ppStateObject) ) + +#define ID3D12Device14_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->lpVtbl -> GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) ) + +#define ID3D12Device14_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->lpVtbl -> CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) ) + + +#define ID3D12Device14_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->lpVtbl -> SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) + + +#define ID3D12Device14_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->lpVtbl -> AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) + +#define ID3D12Device14_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession1(This,pDesc,riid,ppSession) ) + +#if !defined(_WIN32) + +#define ID3D12Device14_GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#else +#define ID3D12Device14_GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo2(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) +#endif + +#define ID3D12Device14_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device14_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device14_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) ) + +#define ID3D12Device14_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + + +#define ID3D12Device14_CreateShaderCacheSession(This,pDesc,riid,ppvSession) \ + ( (This)->lpVtbl -> CreateShaderCacheSession(This,pDesc,riid,ppvSession) ) + +#define ID3D12Device14_ShaderCacheControl(This,Kinds,Control) \ + ( (This)->lpVtbl -> ShaderCacheControl(This,Kinds,Control) ) + +#define ID3D12Device14_CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) ) + + +#define ID3D12Device14_CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) ) + +#define ID3D12Device14_CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) ) + +#define ID3D12Device14_CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) ) + + +#define ID3D12Device14_CreateSampler2(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler2(This,pDesc,DestDescriptor) ) + +#if !defined(_WIN32) + +#define ID3D12Device14_GetResourceAllocationInfo3(This,visibleMask,numResourceDescs,pResourceDescs,pNumCastableFormats,ppCastableFormats,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo3(This,visibleMask,numResourceDescs,pResourceDescs,pNumCastableFormats,ppCastableFormats,pResourceAllocationInfo1) ) +#else +#define ID3D12Device14_GetResourceAllocationInfo3(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pNumCastableFormats,ppCastableFormats,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo3(This,RetVal,visibleMask,numResourceDescs,pResourceDescs,pNumCastableFormats,ppCastableFormats,pResourceAllocationInfo1) ) +#endif + + +#define ID3D12Device14_OpenExistingHeapFromAddress1(This,pAddress,size,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress1(This,pAddress,size,riid,ppvHeap) ) + + +#define ID3D12Device14_CreateRootSignatureFromSubobjectInLibrary(This,nodeMask,pLibraryBlob,blobLengthInBytes,subobjectName,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignatureFromSubobjectInLibrary(This,nodeMask,pLibraryBlob,blobLengthInBytes,subobjectName,riid,ppvRootSignature) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device14_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12VirtualizationGuestDevice_INTERFACE_DEFINED__ +#define __ID3D12VirtualizationGuestDevice_INTERFACE_DEFINED__ + +/* interface ID3D12VirtualizationGuestDevice */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12VirtualizationGuestDevice; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("bc66d368-7373-4943-8757-fc87dc79e476") + ID3D12VirtualizationGuestDevice : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE ShareWithHost( + _In_ ID3D12DeviceChild *pObject, + _Out_ HANDLE *pHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateFenceFd( + _In_ ID3D12Fence *pFence, + UINT64 FenceValue, + _Out_ int *pFenceFd) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12VirtualizationGuestDeviceVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12VirtualizationGuestDevice * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12VirtualizationGuestDevice * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12VirtualizationGuestDevice * This); + + DECLSPEC_XFGVIRT(ID3D12VirtualizationGuestDevice, ShareWithHost) + HRESULT ( STDMETHODCALLTYPE *ShareWithHost )( + ID3D12VirtualizationGuestDevice * This, + _In_ ID3D12DeviceChild *pObject, + _Out_ HANDLE *pHandle); + + DECLSPEC_XFGVIRT(ID3D12VirtualizationGuestDevice, CreateFenceFd) + HRESULT ( STDMETHODCALLTYPE *CreateFenceFd )( + ID3D12VirtualizationGuestDevice * This, + _In_ ID3D12Fence *pFence, + UINT64 FenceValue, + _Out_ int *pFenceFd); + + END_INTERFACE + } ID3D12VirtualizationGuestDeviceVtbl; + + interface ID3D12VirtualizationGuestDevice + { + CONST_VTBL struct ID3D12VirtualizationGuestDeviceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12VirtualizationGuestDevice_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12VirtualizationGuestDevice_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12VirtualizationGuestDevice_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12VirtualizationGuestDevice_ShareWithHost(This,pObject,pHandle) \ + ( (This)->lpVtbl -> ShareWithHost(This,pObject,pHandle) ) + +#define ID3D12VirtualizationGuestDevice_CreateFenceFd(This,pFence,FenceValue,pFenceFd) \ + ( (This)->lpVtbl -> CreateFenceFd(This,pFence,FenceValue,pFenceFd) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12VirtualizationGuestDevice_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Tools_INTERFACE_DEFINED__ +#define __ID3D12Tools_INTERFACE_DEFINED__ + +/* interface ID3D12Tools */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Tools; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7071e1f0-e84b-4b33-974f-12fa49de65c5") + ID3D12Tools : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE EnableShaderInstrumentation( + BOOL bEnable) = 0; + + virtual BOOL STDMETHODCALLTYPE ShaderInstrumentationEnabled( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12ToolsVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Tools * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Tools * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Tools * This); + + DECLSPEC_XFGVIRT(ID3D12Tools, EnableShaderInstrumentation) + void ( STDMETHODCALLTYPE *EnableShaderInstrumentation )( + ID3D12Tools * This, + BOOL bEnable); + + DECLSPEC_XFGVIRT(ID3D12Tools, ShaderInstrumentationEnabled) + BOOL ( STDMETHODCALLTYPE *ShaderInstrumentationEnabled )( + ID3D12Tools * This); + + END_INTERFACE + } ID3D12ToolsVtbl; + + interface ID3D12Tools + { + CONST_VTBL struct ID3D12ToolsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Tools_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Tools_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Tools_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Tools_EnableShaderInstrumentation(This,bEnable) \ + ( (This)->lpVtbl -> EnableShaderInstrumentation(This,bEnable) ) + +#define ID3D12Tools_ShaderInstrumentationEnabled(This) \ + ( (This)->lpVtbl -> ShaderInstrumentationEnabled(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Tools_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0062 */ +/* [local] */ + +typedef struct D3D12_SUBRESOURCE_DATA + { + const void *pData; + LONG_PTR RowPitch; + LONG_PTR SlicePitch; + } D3D12_SUBRESOURCE_DATA; + +typedef struct D3D12_MEMCPY_DEST + { + void *pData; + SIZE_T RowPitch; + SIZE_T SlicePitch; + } D3D12_MEMCPY_DEST; + +#if !defined( D3D12_IGNORE_SDK_LAYERS ) +#include "d3d12sdklayers.h" +#endif + +/////////////////////////////////////////////////////////////////////////// +// D3D12CreateDevice +// ------------------ +// +// pAdapter +// If NULL, D3D12CreateDevice will choose the primary adapter. +// If non-NULL, D3D12CreateDevice will use the provided adapter. +// MinimumFeatureLevel +// The minimum feature level required for successful device creation. +// riid +// The interface IID of the device to be returned. Expected: ID3D12Device. +// ppDevice +// Pointer to returned interface. May be NULL. +// +// Return Values +// Any of those documented for +// CreateDXGIFactory1 +// IDXGIFactory::EnumAdapters +// D3D12CreateDevice +// +/////////////////////////////////////////////////////////////////////////// +typedef HRESULT (WINAPI* PFN_D3D12_CREATE_DEVICE)( _In_opt_ IUnknown*, + D3D_FEATURE_LEVEL, + _In_ REFIID, _COM_Outptr_opt_ void** ); + +HRESULT WINAPI D3D12CreateDevice( + _In_opt_ IUnknown* pAdapter, + D3D_FEATURE_LEVEL MinimumFeatureLevel, + _In_ REFIID riid, // Expected: ID3D12Device + _COM_Outptr_opt_ void** ppDevice ); + + +typedef HRESULT (WINAPI* PFN_D3D12_GET_DEBUG_INTERFACE)( _In_ REFIID, _COM_Outptr_opt_ void** ); + +HRESULT WINAPI D3D12GetDebugInterface( _In_ REFIID riid, _COM_Outptr_opt_ void** ppvDebug ); + +// -------------------------------------------------------------------------------------------------------------------------------- +// D3D12EnableExperimentalFeatures +// +// Pass in a list of feature GUIDs to be enabled together. +// +// If a particular feature requires some configuration information on enablement, it will have +// a configuration struct that can be passed alongside the GUID. +// +// Some features might use an interface IID as the GUID. For these, once the feature is enabled via +// D3D12EnableExperimentalFeatures, D3D12GetDebugInterface can then be called with the IID to retrieve the interface +// for manipulating the feature. This allows for control that might not cleanly be expressed by just +// the configuration struct that D3D12EnableExperimentalFeatures provides. +// +// If this method is called and a change to existing feature enablement is made, +// all current D3D12 devices are set to DEVICE_REMOVED state, since under the covers there is really only one +// singleton device for a process. Removing the devices when configuration changes prevents +// mismatched expectations of how a device is supposed to work after it has been created from the app's point of view. +// +// The call returns E_NOINTERFACE if an unrecognized feature is passed in or Windows Developer mode is not on. +// The call returns E_INVALIDARG if the configuration of a feature is incorrect, the set of features passed +// in are known to be incompatible with each other, or other errors. +// Returns S_OK otherwise. +// +// -------------------------------------------------------------------------------------------------------------------------------- +HRESULT WINAPI D3D12EnableExperimentalFeatures( + UINT NumFeatures, + _In_count_(NumFeatures) const IID* pIIDs, + _In_opt_count_(NumFeatures) void* pConfigurationStructs, + _In_opt_count_(NumFeatures) UINT* pConfigurationStructSizes); + +// -------------------------------------------------------------------------------------------------------------------------------- +// Experimental Feature: D3D12ExperimentalShaderModels +// +// Use with D3D12EnableExperimentalFeatures to enable experimental shader model support, +// meaning shader models that haven't been finalized for use in retail. +// +// Enabling D3D12ExperimentalShaderModels needs no configuration struct, pass NULL in the pConfigurationStructs array. +// +// -------------------------------------------------------------------------------------------------------------------------------- +static const UUID D3D12ExperimentalShaderModels = { /* 76f5573e-f13a-40f5-b297-81ce9e18933f */ + 0x76f5573e, + 0xf13a, + 0x40f5, + { 0xb2, 0x97, 0x81, 0xce, 0x9e, 0x18, 0x93, 0x3f } +}; +// -------------------------------------------------------------------------------------------------------------------------------- +// Experimental Feature: D3D12TiledResourceTier4 +// +// Use with D3D12EnableExperimentalFeatures to enable tiled resource tier 4 support, +// meaning texture tile data-inheritance is allowed. +// +// Enabling D3D12TiledResourceTier4 needs no configuration struct, pass NULL in the pConfigurationStructs array. +// +// -------------------------------------------------------------------------------------------------------------------------------- +static const UUID D3D12TiledResourceTier4 = { /* c9c4725f-a81a-4f56-8c5b-c51039d694fb */ + 0xc9c4725f, + 0xa81a, + 0x4f56, + { 0x8c, 0x5b, 0xc5, 0x10, 0x39, 0xd6, 0x94, 0xfb } +}; +// -------------------------------------------------------------------------------------------------------------------------------- +// D3D12GetInterface +// +// Retrieve Global D3D12 Interface. +// + +DEFINE_GUID(CLSID_D3D12Debug, 0xf2352aeb, 0xdd84, 0x49fe, 0xb9, 0x7b, 0xa9, 0xdc, 0xfd, 0xcc, 0x1b, 0x4f); +DEFINE_GUID(CLSID_D3D12Tools, 0xe38216b1, 0x3c8c, 0x4833, 0xaa, 0x09, 0x0a, 0x06, 0xb6, 0x5d, 0x96, 0xc8); +DEFINE_GUID(CLSID_D3D12DeviceRemovedExtendedData, 0x4a75bbc4, 0x9ff4, 0x4ad8, 0x9f, 0x18, 0xab, 0xae, 0x84, 0xdc, 0x5f, 0xf2); +DEFINE_GUID(CLSID_D3D12SDKConfiguration, 0x7cda6aca, 0xa03e, 0x49c8, 0x94, 0x58, 0x03, 0x34, 0xd2, 0x0e, 0x07, 0xce); +DEFINE_GUID(CLSID_D3D12DeviceFactory, 0x114863bf, 0xc386, 0x4aee, 0xb3, 0x9d, 0x8f, 0x0b, 0xbb, 0x06, 0x29, 0x55); + +typedef HRESULT (WINAPI* PFN_D3D12_GET_INTERFACE)( _In_ REFCLSID, _In_ REFIID, _COM_Outptr_opt_ void** ); + +HRESULT WINAPI D3D12GetInterface( _In_ REFCLSID rclsid, _In_ REFIID riid, _COM_Outptr_opt_ void** ppvDebug ); + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0062_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0062_v0_0_s_ifspec; + +#ifndef __ID3D12SDKConfiguration_INTERFACE_DEFINED__ +#define __ID3D12SDKConfiguration_INTERFACE_DEFINED__ + +/* interface ID3D12SDKConfiguration */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12SDKConfiguration; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("e9eb5314-33aa-42b2-a718-d77f58b1f1c7") + ID3D12SDKConfiguration : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetSDKVersion( + UINT SDKVersion, + _In_z_ LPCSTR SDKPath) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12SDKConfigurationVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12SDKConfiguration * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12SDKConfiguration * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12SDKConfiguration * This); + + DECLSPEC_XFGVIRT(ID3D12SDKConfiguration, SetSDKVersion) + HRESULT ( STDMETHODCALLTYPE *SetSDKVersion )( + ID3D12SDKConfiguration * This, + UINT SDKVersion, + _In_z_ LPCSTR SDKPath); + + END_INTERFACE + } ID3D12SDKConfigurationVtbl; + + interface ID3D12SDKConfiguration + { + CONST_VTBL struct ID3D12SDKConfigurationVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12SDKConfiguration_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12SDKConfiguration_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12SDKConfiguration_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12SDKConfiguration_SetSDKVersion(This,SDKVersion,SDKPath) \ + ( (This)->lpVtbl -> SetSDKVersion(This,SDKVersion,SDKPath) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12SDKConfiguration_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12SDKConfiguration1_INTERFACE_DEFINED__ +#define __ID3D12SDKConfiguration1_INTERFACE_DEFINED__ + +/* interface ID3D12SDKConfiguration1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12SDKConfiguration1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8aaf9303-ad25-48b9-9a57-d9c37e009d9f") + ID3D12SDKConfiguration1 : public ID3D12SDKConfiguration + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateDeviceFactory( + UINT SDKVersion, + _In_ LPCSTR SDKPath, + REFIID riid, + _COM_Outptr_ void **ppvFactory) = 0; + + virtual void STDMETHODCALLTYPE FreeUnusedSDKs( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12SDKConfiguration1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12SDKConfiguration1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12SDKConfiguration1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12SDKConfiguration1 * This); + + DECLSPEC_XFGVIRT(ID3D12SDKConfiguration, SetSDKVersion) + HRESULT ( STDMETHODCALLTYPE *SetSDKVersion )( + ID3D12SDKConfiguration1 * This, + UINT SDKVersion, + _In_z_ LPCSTR SDKPath); + + DECLSPEC_XFGVIRT(ID3D12SDKConfiguration1, CreateDeviceFactory) + HRESULT ( STDMETHODCALLTYPE *CreateDeviceFactory )( + ID3D12SDKConfiguration1 * This, + UINT SDKVersion, + _In_ LPCSTR SDKPath, + REFIID riid, + _COM_Outptr_ void **ppvFactory); + + DECLSPEC_XFGVIRT(ID3D12SDKConfiguration1, FreeUnusedSDKs) + void ( STDMETHODCALLTYPE *FreeUnusedSDKs )( + ID3D12SDKConfiguration1 * This); + + END_INTERFACE + } ID3D12SDKConfiguration1Vtbl; + + interface ID3D12SDKConfiguration1 + { + CONST_VTBL struct ID3D12SDKConfiguration1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12SDKConfiguration1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12SDKConfiguration1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12SDKConfiguration1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12SDKConfiguration1_SetSDKVersion(This,SDKVersion,SDKPath) \ + ( (This)->lpVtbl -> SetSDKVersion(This,SDKVersion,SDKPath) ) + + +#define ID3D12SDKConfiguration1_CreateDeviceFactory(This,SDKVersion,SDKPath,riid,ppvFactory) \ + ( (This)->lpVtbl -> CreateDeviceFactory(This,SDKVersion,SDKPath,riid,ppvFactory) ) + +#define ID3D12SDKConfiguration1_FreeUnusedSDKs(This) \ + ( (This)->lpVtbl -> FreeUnusedSDKs(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12SDKConfiguration1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0064 */ +/* [local] */ + +typedef +enum D3D12_DEVICE_FACTORY_FLAGS + { + D3D12_DEVICE_FACTORY_FLAG_NONE = 0, + D3D12_DEVICE_FACTORY_FLAG_ALLOW_RETURNING_EXISTING_DEVICE = 0x1, + D3D12_DEVICE_FACTORY_FLAG_ALLOW_RETURNING_INCOMPATIBLE_EXISTING_DEVICE = 0x2, + D3D12_DEVICE_FACTORY_FLAG_DISALLOW_STORING_NEW_DEVICE_AS_SINGLETON = 0x4 + } D3D12_DEVICE_FACTORY_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_DEVICE_FACTORY_FLAGS ) + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0064_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0064_v0_0_s_ifspec; + +#ifndef __ID3D12DeviceFactory_INTERFACE_DEFINED__ +#define __ID3D12DeviceFactory_INTERFACE_DEFINED__ + +/* interface ID3D12DeviceFactory */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DeviceFactory; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("61f307d3-d34e-4e7c-8374-3ba4de23cccb") + ID3D12DeviceFactory : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE InitializeFromGlobalState( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE ApplyToGlobalState( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFlags( + D3D12_DEVICE_FACTORY_FLAGS flags) = 0; + + virtual D3D12_DEVICE_FACTORY_FLAGS STDMETHODCALLTYPE GetFlags( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetConfigurationInterface( + REFCLSID clsid, + REFIID iid, + _COM_Outptr_ void **ppv) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableExperimentalFeatures( + UINT NumFeatures, + _In_reads_(NumFeatures) const IID *pIIDs, + _In_reads_opt_(NumFeatures) void *pConfigurationStructs, + _In_reads_opt_(NumFeatures) UINT *pConfigurationStructSizes) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateDevice( + _In_opt_ IUnknown *adapter, + D3D_FEATURE_LEVEL FeatureLevel, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DeviceFactoryVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DeviceFactory * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DeviceFactory * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DeviceFactory * This); + + DECLSPEC_XFGVIRT(ID3D12DeviceFactory, InitializeFromGlobalState) + HRESULT ( STDMETHODCALLTYPE *InitializeFromGlobalState )( + ID3D12DeviceFactory * This); + + DECLSPEC_XFGVIRT(ID3D12DeviceFactory, ApplyToGlobalState) + HRESULT ( STDMETHODCALLTYPE *ApplyToGlobalState )( + ID3D12DeviceFactory * This); + + DECLSPEC_XFGVIRT(ID3D12DeviceFactory, SetFlags) + HRESULT ( STDMETHODCALLTYPE *SetFlags )( + ID3D12DeviceFactory * This, + D3D12_DEVICE_FACTORY_FLAGS flags); + + DECLSPEC_XFGVIRT(ID3D12DeviceFactory, GetFlags) + D3D12_DEVICE_FACTORY_FLAGS ( STDMETHODCALLTYPE *GetFlags )( + ID3D12DeviceFactory * This); + + DECLSPEC_XFGVIRT(ID3D12DeviceFactory, GetConfigurationInterface) + HRESULT ( STDMETHODCALLTYPE *GetConfigurationInterface )( + ID3D12DeviceFactory * This, + REFCLSID clsid, + REFIID iid, + _COM_Outptr_ void **ppv); + + DECLSPEC_XFGVIRT(ID3D12DeviceFactory, EnableExperimentalFeatures) + HRESULT ( STDMETHODCALLTYPE *EnableExperimentalFeatures )( + ID3D12DeviceFactory * This, + UINT NumFeatures, + _In_reads_(NumFeatures) const IID *pIIDs, + _In_reads_opt_(NumFeatures) void *pConfigurationStructs, + _In_reads_opt_(NumFeatures) UINT *pConfigurationStructSizes); + + DECLSPEC_XFGVIRT(ID3D12DeviceFactory, CreateDevice) + HRESULT ( STDMETHODCALLTYPE *CreateDevice )( + ID3D12DeviceFactory * This, + _In_opt_ IUnknown *adapter, + D3D_FEATURE_LEVEL FeatureLevel, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + END_INTERFACE + } ID3D12DeviceFactoryVtbl; + + interface ID3D12DeviceFactory + { + CONST_VTBL struct ID3D12DeviceFactoryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DeviceFactory_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DeviceFactory_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DeviceFactory_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DeviceFactory_InitializeFromGlobalState(This) \ + ( (This)->lpVtbl -> InitializeFromGlobalState(This) ) + +#define ID3D12DeviceFactory_ApplyToGlobalState(This) \ + ( (This)->lpVtbl -> ApplyToGlobalState(This) ) + +#define ID3D12DeviceFactory_SetFlags(This,flags) \ + ( (This)->lpVtbl -> SetFlags(This,flags) ) + +#define ID3D12DeviceFactory_GetFlags(This) \ + ( (This)->lpVtbl -> GetFlags(This) ) + +#define ID3D12DeviceFactory_GetConfigurationInterface(This,clsid,iid,ppv) \ + ( (This)->lpVtbl -> GetConfigurationInterface(This,clsid,iid,ppv) ) + +#define ID3D12DeviceFactory_EnableExperimentalFeatures(This,NumFeatures,pIIDs,pConfigurationStructs,pConfigurationStructSizes) \ + ( (This)->lpVtbl -> EnableExperimentalFeatures(This,NumFeatures,pIIDs,pConfigurationStructs,pConfigurationStructSizes) ) + +#define ID3D12DeviceFactory_CreateDevice(This,adapter,FeatureLevel,riid,ppvDevice) \ + ( (This)->lpVtbl -> CreateDevice(This,adapter,FeatureLevel,riid,ppvDevice) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DeviceFactory_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0065 */ +/* [local] */ + +typedef +enum D3D12_DEVICE_FLAGS + { + D3D12_DEVICE_FLAG_NONE = 0, + D3D12_DEVICE_FLAG_DEBUG_LAYER_ENABLED = 0x1, + D3D12_DEVICE_FLAG_GPU_BASED_VALIDATION_ENABLED = 0x2, + D3D12_DEVICE_FLAG_SYNCHRONIZED_COMMAND_QUEUE_VALIDATION_DISABLED = 0x4, + D3D12_DEVICE_FLAG_DRED_AUTO_BREADCRUMBS_ENABLED = 0x8, + D3D12_DEVICE_FLAG_DRED_PAGE_FAULT_REPORTING_ENABLED = 0x10, + D3D12_DEVICE_FLAG_DRED_WATSON_REPORTING_ENABLED = 0x20, + D3D12_DEVICE_FLAG_DRED_BREADCRUMB_CONTEXT_ENABLED = 0x40, + D3D12_DEVICE_FLAG_DRED_USE_MARKERS_ONLY_BREADCRUMBS = 0x80, + D3D12_DEVICE_FLAG_SHADER_INSTRUMENTATION_ENABLED = 0x100, + D3D12_DEVICE_FLAG_AUTO_DEBUG_NAME_ENABLED = 0x200, + D3D12_DEVICE_FLAG_FORCE_LEGACY_STATE_VALIDATION = 0x400 + } D3D12_DEVICE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_DEVICE_FLAGS ) +typedef struct D3D12_DEVICE_CONFIGURATION_DESC + { + D3D12_DEVICE_FLAGS Flags; + UINT GpuBasedValidationFlags; + UINT SDKVersion; + UINT NumEnabledExperimentalFeatures; + } D3D12_DEVICE_CONFIGURATION_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0065_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0065_v0_0_s_ifspec; + +#ifndef __ID3D12DeviceConfiguration_INTERFACE_DEFINED__ +#define __ID3D12DeviceConfiguration_INTERFACE_DEFINED__ + +/* interface ID3D12DeviceConfiguration */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DeviceConfiguration; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("78dbf87b-f766-422b-a61c-c8c446bdb9ad") + ID3D12DeviceConfiguration : public IUnknown + { + public: +#if defined(_MSC_VER) || !defined(_WIN32) + virtual D3D12_DEVICE_CONFIGURATION_DESC STDMETHODCALLTYPE GetDesc( void) = 0; +#else + virtual D3D12_DEVICE_CONFIGURATION_DESC *STDMETHODCALLTYPE GetDesc( + D3D12_DEVICE_CONFIGURATION_DESC * RetVal) = 0; +#endif + + virtual HRESULT STDMETHODCALLTYPE GetEnabledExperimentalFeatures( + _Out_writes_(NumGuids) GUID *pGuids, + UINT NumGuids) = 0; + + virtual HRESULT STDMETHODCALLTYPE SerializeVersionedRootSignature( + _In_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *pDesc, + _COM_Outptr_ ID3DBlob **ppResult, + _Always_(_Outptr_opt_result_maybenull_) ID3DBlob **ppError) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVersionedRootSignatureDeserializer( + _In_reads_bytes_(Size) const void *pBlob, + SIZE_T Size, + REFIID riid, + _COM_Outptr_ void **ppvDeserializer) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DeviceConfigurationVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DeviceConfiguration * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DeviceConfiguration * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DeviceConfiguration * This); + + DECLSPEC_XFGVIRT(ID3D12DeviceConfiguration, GetDesc) +#if !defined(_WIN32) + D3D12_DEVICE_CONFIGURATION_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12DeviceConfiguration * This); + +#else + D3D12_DEVICE_CONFIGURATION_DESC *( STDMETHODCALLTYPE *GetDesc )( + ID3D12DeviceConfiguration * This, + D3D12_DEVICE_CONFIGURATION_DESC * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12DeviceConfiguration, GetEnabledExperimentalFeatures) + HRESULT ( STDMETHODCALLTYPE *GetEnabledExperimentalFeatures )( + ID3D12DeviceConfiguration * This, + _Out_writes_(NumGuids) GUID *pGuids, + UINT NumGuids); + + DECLSPEC_XFGVIRT(ID3D12DeviceConfiguration, SerializeVersionedRootSignature) + HRESULT ( STDMETHODCALLTYPE *SerializeVersionedRootSignature )( + ID3D12DeviceConfiguration * This, + _In_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *pDesc, + _COM_Outptr_ ID3DBlob **ppResult, + _Always_(_Outptr_opt_result_maybenull_) ID3DBlob **ppError); + + DECLSPEC_XFGVIRT(ID3D12DeviceConfiguration, CreateVersionedRootSignatureDeserializer) + HRESULT ( STDMETHODCALLTYPE *CreateVersionedRootSignatureDeserializer )( + ID3D12DeviceConfiguration * This, + _In_reads_bytes_(Size) const void *pBlob, + SIZE_T Size, + REFIID riid, + _COM_Outptr_ void **ppvDeserializer); + + END_INTERFACE + } ID3D12DeviceConfigurationVtbl; + + interface ID3D12DeviceConfiguration + { + CONST_VTBL struct ID3D12DeviceConfigurationVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DeviceConfiguration_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DeviceConfiguration_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DeviceConfiguration_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + +#if !defined(_WIN32) + +#define ID3D12DeviceConfiguration_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) +#else +#define ID3D12DeviceConfiguration_GetDesc(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc(This,RetVal) ) +#endif + +#define ID3D12DeviceConfiguration_GetEnabledExperimentalFeatures(This,pGuids,NumGuids) \ + ( (This)->lpVtbl -> GetEnabledExperimentalFeatures(This,pGuids,NumGuids) ) + +#define ID3D12DeviceConfiguration_SerializeVersionedRootSignature(This,pDesc,ppResult,ppError) \ + ( (This)->lpVtbl -> SerializeVersionedRootSignature(This,pDesc,ppResult,ppError) ) + +#define ID3D12DeviceConfiguration_CreateVersionedRootSignatureDeserializer(This,pBlob,Size,riid,ppvDeserializer) \ + ( (This)->lpVtbl -> CreateVersionedRootSignatureDeserializer(This,pBlob,Size,riid,ppvDeserializer) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DeviceConfiguration_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12DeviceConfiguration1_INTERFACE_DEFINED__ +#define __ID3D12DeviceConfiguration1_INTERFACE_DEFINED__ + +/* interface ID3D12DeviceConfiguration1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DeviceConfiguration1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("ed342442-6343-4e16-bb82-a3a577874e56") + ID3D12DeviceConfiguration1 : public ID3D12DeviceConfiguration + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateVersionedRootSignatureDeserializerFromSubobjectInLibrary( + _In_reads_bytes_(Size) const void *pLibraryBlob, + SIZE_T Size, + LPCWSTR RootSignatureSubobjectName, + REFIID riid, + _COM_Outptr_ void **ppvDeserializer) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DeviceConfiguration1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DeviceConfiguration1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DeviceConfiguration1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DeviceConfiguration1 * This); + + DECLSPEC_XFGVIRT(ID3D12DeviceConfiguration, GetDesc) +#if !defined(_WIN32) + D3D12_DEVICE_CONFIGURATION_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12DeviceConfiguration1 * This); + +#else + D3D12_DEVICE_CONFIGURATION_DESC *( STDMETHODCALLTYPE *GetDesc )( + ID3D12DeviceConfiguration1 * This, + D3D12_DEVICE_CONFIGURATION_DESC * RetVal); + +#endif + + DECLSPEC_XFGVIRT(ID3D12DeviceConfiguration, GetEnabledExperimentalFeatures) + HRESULT ( STDMETHODCALLTYPE *GetEnabledExperimentalFeatures )( + ID3D12DeviceConfiguration1 * This, + _Out_writes_(NumGuids) GUID *pGuids, + UINT NumGuids); + + DECLSPEC_XFGVIRT(ID3D12DeviceConfiguration, SerializeVersionedRootSignature) + HRESULT ( STDMETHODCALLTYPE *SerializeVersionedRootSignature )( + ID3D12DeviceConfiguration1 * This, + _In_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *pDesc, + _COM_Outptr_ ID3DBlob **ppResult, + _Always_(_Outptr_opt_result_maybenull_) ID3DBlob **ppError); + + DECLSPEC_XFGVIRT(ID3D12DeviceConfiguration, CreateVersionedRootSignatureDeserializer) + HRESULT ( STDMETHODCALLTYPE *CreateVersionedRootSignatureDeserializer )( + ID3D12DeviceConfiguration1 * This, + _In_reads_bytes_(Size) const void *pBlob, + SIZE_T Size, + REFIID riid, + _COM_Outptr_ void **ppvDeserializer); + + DECLSPEC_XFGVIRT(ID3D12DeviceConfiguration1, CreateVersionedRootSignatureDeserializerFromSubobjectInLibrary) + HRESULT ( STDMETHODCALLTYPE *CreateVersionedRootSignatureDeserializerFromSubobjectInLibrary )( + ID3D12DeviceConfiguration1 * This, + _In_reads_bytes_(Size) const void *pLibraryBlob, + SIZE_T Size, + LPCWSTR RootSignatureSubobjectName, + REFIID riid, + _COM_Outptr_ void **ppvDeserializer); + + END_INTERFACE + } ID3D12DeviceConfiguration1Vtbl; + + interface ID3D12DeviceConfiguration1 + { + CONST_VTBL struct ID3D12DeviceConfiguration1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DeviceConfiguration1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DeviceConfiguration1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DeviceConfiguration1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + +#if !defined(_WIN32) + +#define ID3D12DeviceConfiguration1_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) +#else +#define ID3D12DeviceConfiguration1_GetDesc(This,RetVal) \ + ( (This)->lpVtbl -> GetDesc(This,RetVal) ) +#endif + +#define ID3D12DeviceConfiguration1_GetEnabledExperimentalFeatures(This,pGuids,NumGuids) \ + ( (This)->lpVtbl -> GetEnabledExperimentalFeatures(This,pGuids,NumGuids) ) + +#define ID3D12DeviceConfiguration1_SerializeVersionedRootSignature(This,pDesc,ppResult,ppError) \ + ( (This)->lpVtbl -> SerializeVersionedRootSignature(This,pDesc,ppResult,ppError) ) + +#define ID3D12DeviceConfiguration1_CreateVersionedRootSignatureDeserializer(This,pBlob,Size,riid,ppvDeserializer) \ + ( (This)->lpVtbl -> CreateVersionedRootSignatureDeserializer(This,pBlob,Size,riid,ppvDeserializer) ) + + +#define ID3D12DeviceConfiguration1_CreateVersionedRootSignatureDeserializerFromSubobjectInLibrary(This,pLibraryBlob,Size,RootSignatureSubobjectName,riid,ppvDeserializer) \ + ( (This)->lpVtbl -> CreateVersionedRootSignatureDeserializerFromSubobjectInLibrary(This,pLibraryBlob,Size,RootSignatureSubobjectName,riid,ppvDeserializer) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DeviceConfiguration1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0067 */ +/* [local] */ + +typedef +enum D3D12_AXIS_SHADING_RATE + { + D3D12_AXIS_SHADING_RATE_1X = 0, + D3D12_AXIS_SHADING_RATE_2X = 0x1, + D3D12_AXIS_SHADING_RATE_4X = 0x2 + } D3D12_AXIS_SHADING_RATE; + +#define D3D12_SHADING_RATE_X_AXIS_SHIFT 2 +#define D3D12_SHADING_RATE_VALID_MASK 3 +#define D3D12_MAKE_COARSE_SHADING_RATE(x,y) ((x) << D3D12_SHADING_RATE_X_AXIS_SHIFT | (y)) +#define D3D12_GET_COARSE_SHADING_RATE_X_AXIS(x) (((x) >> D3D12_SHADING_RATE_X_AXIS_SHIFT) & D3D12_SHADING_RATE_VALID_MASK) +#define D3D12_GET_COARSE_SHADING_RATE_Y_AXIS(y) ((y) & D3D12_SHADING_RATE_VALID_MASK) +typedef +enum D3D12_SHADING_RATE + { + D3D12_SHADING_RATE_1X1 = 0, + D3D12_SHADING_RATE_1X2 = 0x1, + D3D12_SHADING_RATE_2X1 = 0x4, + D3D12_SHADING_RATE_2X2 = 0x5, + D3D12_SHADING_RATE_2X4 = 0x6, + D3D12_SHADING_RATE_4X2 = 0x9, + D3D12_SHADING_RATE_4X4 = 0xa + } D3D12_SHADING_RATE; + +typedef +enum D3D12_SHADING_RATE_COMBINER + { + D3D12_SHADING_RATE_COMBINER_PASSTHROUGH = 0, + D3D12_SHADING_RATE_COMBINER_OVERRIDE = 1, + D3D12_SHADING_RATE_COMBINER_MIN = 2, + D3D12_SHADING_RATE_COMBINER_MAX = 3, + D3D12_SHADING_RATE_COMBINER_SUM = 4 + } D3D12_SHADING_RATE_COMBINER; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0067_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0067_v0_0_s_ifspec; + +#ifndef __ID3D12GraphicsCommandList5_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList5_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList5 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList5; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("55050859-4024-474c-87f5-6472eaee44ea") + ID3D12GraphicsCommandList5 : public ID3D12GraphicsCommandList4 + { + public: + virtual void STDMETHODCALLTYPE RSSetShadingRate( + _In_ D3D12_SHADING_RATE baseShadingRate, + _In_reads_opt_(D3D12_RS_SET_SHADING_RATE_COMBINER_COUNT) const D3D12_SHADING_RATE_COMBINER *combiners) = 0; + + virtual void STDMETHODCALLTYPE RSSetShadingRateImage( + _In_opt_ ID3D12Resource *shadingRateImage) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList5Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList5 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList5 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList5 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList5 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList5 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList5 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList5 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList5 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandList, GetType) + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList5 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Close) + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList5 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Reset) + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearState) + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList5 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawInstanced) + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawIndexedInstanced) + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Dispatch) + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyBufferRegion) + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTextureRegion) + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList5 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyResource) + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTiles) + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveSubresource) + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetPrimitiveTopology) + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList5 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetViewports) + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList5 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetScissorRects) + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList5 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetBlendFactor) + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList5 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetStencilRef) + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT StencilRef); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPipelineState) + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResourceBarrier) + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteBundle) + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetDescriptorHeaps) + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootSignature) + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList5 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootSignature) + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList5 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetIndexBuffer) + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList5 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetVertexBuffers) + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SOSetTargets) + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetRenderTargets) + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearDepthStencilView) + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList5 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearRenderTargetView) + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList5 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewUint) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList5 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewFloat) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList5 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DiscardResource) + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginQuery) + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndQuery) + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveQueryData) + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPredication) + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList5 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetMarker) + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList5 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginEvent) + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList5 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndEvent) + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList5 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteIndirect) + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT64) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, OMSetDepthBounds) + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList5 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetSamplePositions) + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, ResolveSubresourceRegion) + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetViewInstanceMask) + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT Mask); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList2, WriteBufferImmediate) + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12GraphicsCommandList5 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList3, SetProtectedResourceSession) + void ( STDMETHODCALLTYPE *SetProtectedResourceSession )( + ID3D12GraphicsCommandList5 * This, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BeginRenderPass) + void ( STDMETHODCALLTYPE *BeginRenderPass )( + ID3D12GraphicsCommandList5 * This, + _In_ UINT NumRenderTargets, + _In_reads_opt_(NumRenderTargets) const D3D12_RENDER_PASS_RENDER_TARGET_DESC *pRenderTargets, + _In_opt_ const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC *pDepthStencil, + D3D12_RENDER_PASS_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EndRenderPass) + void ( STDMETHODCALLTYPE *EndRenderPass )( + ID3D12GraphicsCommandList5 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, InitializeMetaCommand) + void ( STDMETHODCALLTYPE *InitializeMetaCommand )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(InitializationParametersDataSizeInBytes) const void *pInitializationParametersData, + _In_ SIZE_T InitializationParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, ExecuteMetaCommand) + void ( STDMETHODCALLTYPE *ExecuteMetaCommand )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(ExecutionParametersDataSizeInBytes) const void *pExecutionParametersData, + _In_ SIZE_T ExecutionParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BuildRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *BuildRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList5 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC *pDesc, + _In_ UINT NumPostbuildInfoDescs, + _In_reads_opt_(NumPostbuildInfoDescs) const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pPostbuildInfoDescs); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EmitRaytracingAccelerationStructurePostbuildInfo) + void ( STDMETHODCALLTYPE *EmitRaytracingAccelerationStructurePostbuildInfo )( + ID3D12GraphicsCommandList5 * This, + _In_ const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pDesc, + _In_ UINT NumSourceAccelerationStructures, + _In_reads_( NumSourceAccelerationStructures ) const D3D12_GPU_VIRTUAL_ADDRESS *pSourceAccelerationStructureData); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, CopyRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *CopyRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList5 * This, + _In_ D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData, + _In_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, SetPipelineState1) + void ( STDMETHODCALLTYPE *SetPipelineState1 )( + ID3D12GraphicsCommandList5 * This, + _In_ ID3D12StateObject *pStateObject); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, DispatchRays) + void ( STDMETHODCALLTYPE *DispatchRays )( + ID3D12GraphicsCommandList5 * This, + _In_ const D3D12_DISPATCH_RAYS_DESC *pDesc); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList5, RSSetShadingRate) + void ( STDMETHODCALLTYPE *RSSetShadingRate )( + ID3D12GraphicsCommandList5 * This, + _In_ D3D12_SHADING_RATE baseShadingRate, + _In_reads_opt_(D3D12_RS_SET_SHADING_RATE_COMBINER_COUNT) const D3D12_SHADING_RATE_COMBINER *combiners); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList5, RSSetShadingRateImage) + void ( STDMETHODCALLTYPE *RSSetShadingRateImage )( + ID3D12GraphicsCommandList5 * This, + _In_opt_ ID3D12Resource *shadingRateImage); + + END_INTERFACE + } ID3D12GraphicsCommandList5Vtbl; + + interface ID3D12GraphicsCommandList5 + { + CONST_VTBL struct ID3D12GraphicsCommandList5Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList5_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList5_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList5_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList5_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList5_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList5_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList5_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList5_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList5_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList5_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList5_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList5_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList5_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList5_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList5_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList5_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList5_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList5_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList5_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList5_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList5_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList5_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList5_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList5_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList5_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList5_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList5_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList5_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList5_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList5_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList5_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList5_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList5_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList5_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList5_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList5_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList5_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList5_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList5_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList5_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList5_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList5_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList5_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList5_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList5_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList5_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList5_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList5_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList5_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList5_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList5_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList5_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList5_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList5_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList5_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList5_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList5_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList5_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList5_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList5_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList5_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList5_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList5_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList5_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList5_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList5_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + + +#define ID3D12GraphicsCommandList5_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12GraphicsCommandList5_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->lpVtbl -> SetProtectedResourceSession(This,pProtectedResourceSession) ) + + +#define ID3D12GraphicsCommandList5_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->lpVtbl -> BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) + +#define ID3D12GraphicsCommandList5_EndRenderPass(This) \ + ( (This)->lpVtbl -> EndRenderPass(This) ) + +#define ID3D12GraphicsCommandList5_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList5_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList5_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->lpVtbl -> BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) + +#define ID3D12GraphicsCommandList5_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->lpVtbl -> EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) + +#define ID3D12GraphicsCommandList5_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->lpVtbl -> CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) + +#define ID3D12GraphicsCommandList5_SetPipelineState1(This,pStateObject) \ + ( (This)->lpVtbl -> SetPipelineState1(This,pStateObject) ) + +#define ID3D12GraphicsCommandList5_DispatchRays(This,pDesc) \ + ( (This)->lpVtbl -> DispatchRays(This,pDesc) ) + + +#define ID3D12GraphicsCommandList5_RSSetShadingRate(This,baseShadingRate,combiners) \ + ( (This)->lpVtbl -> RSSetShadingRate(This,baseShadingRate,combiners) ) + +#define ID3D12GraphicsCommandList5_RSSetShadingRateImage(This,shadingRateImage) \ + ( (This)->lpVtbl -> RSSetShadingRateImage(This,shadingRateImage) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList5_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0068 */ +/* [local] */ + +typedef struct D3D12_DISPATCH_MESH_ARGUMENTS + { + UINT ThreadGroupCountX; + UINT ThreadGroupCountY; + UINT ThreadGroupCountZ; + } D3D12_DISPATCH_MESH_ARGUMENTS; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0068_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0068_v0_0_s_ifspec; + +#ifndef __ID3D12GraphicsCommandList6_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList6_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList6 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("c3827890-e548-4cfa-96cf-5689a9370f80") + ID3D12GraphicsCommandList6 : public ID3D12GraphicsCommandList5 + { + public: + virtual void STDMETHODCALLTYPE DispatchMesh( + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList6Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList6 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList6 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList6 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList6 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList6 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList6 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList6 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList6 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandList, GetType) + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList6 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Close) + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList6 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Reset) + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearState) + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList6 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawInstanced) + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawIndexedInstanced) + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Dispatch) + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyBufferRegion) + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTextureRegion) + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList6 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyResource) + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTiles) + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveSubresource) + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetPrimitiveTopology) + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList6 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetViewports) + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList6 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetScissorRects) + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList6 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetBlendFactor) + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList6 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetStencilRef) + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT StencilRef); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPipelineState) + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResourceBarrier) + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteBundle) + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetDescriptorHeaps) + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootSignature) + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList6 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootSignature) + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList6 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetIndexBuffer) + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList6 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetVertexBuffers) + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SOSetTargets) + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetRenderTargets) + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearDepthStencilView) + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList6 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearRenderTargetView) + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList6 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewUint) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList6 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewFloat) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList6 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DiscardResource) + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginQuery) + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndQuery) + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveQueryData) + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPredication) + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList6 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetMarker) + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList6 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginEvent) + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList6 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndEvent) + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList6 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteIndirect) + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT64) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, OMSetDepthBounds) + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList6 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetSamplePositions) + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, ResolveSubresourceRegion) + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetViewInstanceMask) + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT Mask); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList2, WriteBufferImmediate) + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12GraphicsCommandList6 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList3, SetProtectedResourceSession) + void ( STDMETHODCALLTYPE *SetProtectedResourceSession )( + ID3D12GraphicsCommandList6 * This, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BeginRenderPass) + void ( STDMETHODCALLTYPE *BeginRenderPass )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT NumRenderTargets, + _In_reads_opt_(NumRenderTargets) const D3D12_RENDER_PASS_RENDER_TARGET_DESC *pRenderTargets, + _In_opt_ const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC *pDepthStencil, + D3D12_RENDER_PASS_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EndRenderPass) + void ( STDMETHODCALLTYPE *EndRenderPass )( + ID3D12GraphicsCommandList6 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, InitializeMetaCommand) + void ( STDMETHODCALLTYPE *InitializeMetaCommand )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(InitializationParametersDataSizeInBytes) const void *pInitializationParametersData, + _In_ SIZE_T InitializationParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, ExecuteMetaCommand) + void ( STDMETHODCALLTYPE *ExecuteMetaCommand )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(ExecutionParametersDataSizeInBytes) const void *pExecutionParametersData, + _In_ SIZE_T ExecutionParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BuildRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *BuildRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList6 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC *pDesc, + _In_ UINT NumPostbuildInfoDescs, + _In_reads_opt_(NumPostbuildInfoDescs) const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pPostbuildInfoDescs); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EmitRaytracingAccelerationStructurePostbuildInfo) + void ( STDMETHODCALLTYPE *EmitRaytracingAccelerationStructurePostbuildInfo )( + ID3D12GraphicsCommandList6 * This, + _In_ const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pDesc, + _In_ UINT NumSourceAccelerationStructures, + _In_reads_( NumSourceAccelerationStructures ) const D3D12_GPU_VIRTUAL_ADDRESS *pSourceAccelerationStructureData); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, CopyRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *CopyRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList6 * This, + _In_ D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData, + _In_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, SetPipelineState1) + void ( STDMETHODCALLTYPE *SetPipelineState1 )( + ID3D12GraphicsCommandList6 * This, + _In_ ID3D12StateObject *pStateObject); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, DispatchRays) + void ( STDMETHODCALLTYPE *DispatchRays )( + ID3D12GraphicsCommandList6 * This, + _In_ const D3D12_DISPATCH_RAYS_DESC *pDesc); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList5, RSSetShadingRate) + void ( STDMETHODCALLTYPE *RSSetShadingRate )( + ID3D12GraphicsCommandList6 * This, + _In_ D3D12_SHADING_RATE baseShadingRate, + _In_reads_opt_(D3D12_RS_SET_SHADING_RATE_COMBINER_COUNT) const D3D12_SHADING_RATE_COMBINER *combiners); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList5, RSSetShadingRateImage) + void ( STDMETHODCALLTYPE *RSSetShadingRateImage )( + ID3D12GraphicsCommandList6 * This, + _In_opt_ ID3D12Resource *shadingRateImage); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList6, DispatchMesh) + void ( STDMETHODCALLTYPE *DispatchMesh )( + ID3D12GraphicsCommandList6 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + END_INTERFACE + } ID3D12GraphicsCommandList6Vtbl; + + interface ID3D12GraphicsCommandList6 + { + CONST_VTBL struct ID3D12GraphicsCommandList6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList6_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList6_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList6_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList6_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList6_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList6_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList6_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList6_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList6_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList6_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList6_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList6_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList6_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList6_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList6_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList6_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList6_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList6_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList6_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList6_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList6_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList6_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList6_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList6_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList6_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList6_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList6_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList6_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList6_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList6_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList6_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList6_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList6_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList6_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList6_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList6_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList6_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList6_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList6_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList6_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList6_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList6_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList6_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList6_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList6_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList6_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList6_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList6_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList6_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList6_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList6_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList6_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList6_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList6_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList6_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList6_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList6_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList6_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList6_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList6_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList6_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList6_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList6_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + + +#define ID3D12GraphicsCommandList6_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12GraphicsCommandList6_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->lpVtbl -> SetProtectedResourceSession(This,pProtectedResourceSession) ) + + +#define ID3D12GraphicsCommandList6_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->lpVtbl -> BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) + +#define ID3D12GraphicsCommandList6_EndRenderPass(This) \ + ( (This)->lpVtbl -> EndRenderPass(This) ) + +#define ID3D12GraphicsCommandList6_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList6_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList6_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->lpVtbl -> BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) + +#define ID3D12GraphicsCommandList6_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->lpVtbl -> EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) + +#define ID3D12GraphicsCommandList6_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->lpVtbl -> CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) + +#define ID3D12GraphicsCommandList6_SetPipelineState1(This,pStateObject) \ + ( (This)->lpVtbl -> SetPipelineState1(This,pStateObject) ) + +#define ID3D12GraphicsCommandList6_DispatchRays(This,pDesc) \ + ( (This)->lpVtbl -> DispatchRays(This,pDesc) ) + + +#define ID3D12GraphicsCommandList6_RSSetShadingRate(This,baseShadingRate,combiners) \ + ( (This)->lpVtbl -> RSSetShadingRate(This,baseShadingRate,combiners) ) + +#define ID3D12GraphicsCommandList6_RSSetShadingRateImage(This,shadingRateImage) \ + ( (This)->lpVtbl -> RSSetShadingRateImage(This,shadingRateImage) ) + + +#define ID3D12GraphicsCommandList6_DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList6_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList7_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList7_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList7 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList7; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("dd171223-8b61-4769-90e3-160ccde4e2c1") + ID3D12GraphicsCommandList7 : public ID3D12GraphicsCommandList6 + { + public: + virtual void STDMETHODCALLTYPE Barrier( + UINT32 NumBarrierGroups, + _In_reads_(NumBarrierGroups) const D3D12_BARRIER_GROUP *pBarrierGroups) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList7Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList7 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList7 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList7 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList7 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList7 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList7 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList7 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList7 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandList, GetType) + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList7 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Close) + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList7 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Reset) + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearState) + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList7 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawInstanced) + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawIndexedInstanced) + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Dispatch) + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyBufferRegion) + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTextureRegion) + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList7 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyResource) + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTiles) + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveSubresource) + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetPrimitiveTopology) + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList7 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetViewports) + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList7 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetScissorRects) + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList7 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetBlendFactor) + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList7 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetStencilRef) + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT StencilRef); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPipelineState) + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResourceBarrier) + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteBundle) + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetDescriptorHeaps) + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootSignature) + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList7 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootSignature) + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList7 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetIndexBuffer) + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList7 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetVertexBuffers) + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SOSetTargets) + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetRenderTargets) + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearDepthStencilView) + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList7 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearRenderTargetView) + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList7 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewUint) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList7 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewFloat) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList7 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DiscardResource) + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginQuery) + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndQuery) + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveQueryData) + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPredication) + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList7 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetMarker) + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList7 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginEvent) + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList7 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndEvent) + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList7 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteIndirect) + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT64) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, OMSetDepthBounds) + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList7 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetSamplePositions) + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, ResolveSubresourceRegion) + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetViewInstanceMask) + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT Mask); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList2, WriteBufferImmediate) + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12GraphicsCommandList7 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList3, SetProtectedResourceSession) + void ( STDMETHODCALLTYPE *SetProtectedResourceSession )( + ID3D12GraphicsCommandList7 * This, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BeginRenderPass) + void ( STDMETHODCALLTYPE *BeginRenderPass )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT NumRenderTargets, + _In_reads_opt_(NumRenderTargets) const D3D12_RENDER_PASS_RENDER_TARGET_DESC *pRenderTargets, + _In_opt_ const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC *pDepthStencil, + D3D12_RENDER_PASS_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EndRenderPass) + void ( STDMETHODCALLTYPE *EndRenderPass )( + ID3D12GraphicsCommandList7 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, InitializeMetaCommand) + void ( STDMETHODCALLTYPE *InitializeMetaCommand )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(InitializationParametersDataSizeInBytes) const void *pInitializationParametersData, + _In_ SIZE_T InitializationParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, ExecuteMetaCommand) + void ( STDMETHODCALLTYPE *ExecuteMetaCommand )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(ExecutionParametersDataSizeInBytes) const void *pExecutionParametersData, + _In_ SIZE_T ExecutionParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BuildRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *BuildRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList7 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC *pDesc, + _In_ UINT NumPostbuildInfoDescs, + _In_reads_opt_(NumPostbuildInfoDescs) const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pPostbuildInfoDescs); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EmitRaytracingAccelerationStructurePostbuildInfo) + void ( STDMETHODCALLTYPE *EmitRaytracingAccelerationStructurePostbuildInfo )( + ID3D12GraphicsCommandList7 * This, + _In_ const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pDesc, + _In_ UINT NumSourceAccelerationStructures, + _In_reads_( NumSourceAccelerationStructures ) const D3D12_GPU_VIRTUAL_ADDRESS *pSourceAccelerationStructureData); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, CopyRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *CopyRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList7 * This, + _In_ D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData, + _In_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, SetPipelineState1) + void ( STDMETHODCALLTYPE *SetPipelineState1 )( + ID3D12GraphicsCommandList7 * This, + _In_ ID3D12StateObject *pStateObject); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, DispatchRays) + void ( STDMETHODCALLTYPE *DispatchRays )( + ID3D12GraphicsCommandList7 * This, + _In_ const D3D12_DISPATCH_RAYS_DESC *pDesc); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList5, RSSetShadingRate) + void ( STDMETHODCALLTYPE *RSSetShadingRate )( + ID3D12GraphicsCommandList7 * This, + _In_ D3D12_SHADING_RATE baseShadingRate, + _In_reads_opt_(D3D12_RS_SET_SHADING_RATE_COMBINER_COUNT) const D3D12_SHADING_RATE_COMBINER *combiners); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList5, RSSetShadingRateImage) + void ( STDMETHODCALLTYPE *RSSetShadingRateImage )( + ID3D12GraphicsCommandList7 * This, + _In_opt_ ID3D12Resource *shadingRateImage); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList6, DispatchMesh) + void ( STDMETHODCALLTYPE *DispatchMesh )( + ID3D12GraphicsCommandList7 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList7, Barrier) + void ( STDMETHODCALLTYPE *Barrier )( + ID3D12GraphicsCommandList7 * This, + UINT32 NumBarrierGroups, + _In_reads_(NumBarrierGroups) const D3D12_BARRIER_GROUP *pBarrierGroups); + + END_INTERFACE + } ID3D12GraphicsCommandList7Vtbl; + + interface ID3D12GraphicsCommandList7 + { + CONST_VTBL struct ID3D12GraphicsCommandList7Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList7_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList7_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList7_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList7_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList7_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList7_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList7_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList7_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList7_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList7_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList7_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList7_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList7_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList7_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList7_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList7_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList7_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList7_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList7_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList7_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList7_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList7_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList7_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList7_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList7_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList7_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList7_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList7_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList7_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList7_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList7_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList7_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList7_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList7_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList7_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList7_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList7_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList7_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList7_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList7_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList7_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList7_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList7_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList7_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList7_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList7_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList7_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList7_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList7_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList7_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList7_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList7_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList7_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList7_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList7_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList7_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList7_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList7_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList7_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList7_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList7_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList7_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList7_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList7_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList7_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList7_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + + +#define ID3D12GraphicsCommandList7_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12GraphicsCommandList7_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->lpVtbl -> SetProtectedResourceSession(This,pProtectedResourceSession) ) + + +#define ID3D12GraphicsCommandList7_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->lpVtbl -> BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) + +#define ID3D12GraphicsCommandList7_EndRenderPass(This) \ + ( (This)->lpVtbl -> EndRenderPass(This) ) + +#define ID3D12GraphicsCommandList7_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList7_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList7_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->lpVtbl -> BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) + +#define ID3D12GraphicsCommandList7_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->lpVtbl -> EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) + +#define ID3D12GraphicsCommandList7_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->lpVtbl -> CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) + +#define ID3D12GraphicsCommandList7_SetPipelineState1(This,pStateObject) \ + ( (This)->lpVtbl -> SetPipelineState1(This,pStateObject) ) + +#define ID3D12GraphicsCommandList7_DispatchRays(This,pDesc) \ + ( (This)->lpVtbl -> DispatchRays(This,pDesc) ) + + +#define ID3D12GraphicsCommandList7_RSSetShadingRate(This,baseShadingRate,combiners) \ + ( (This)->lpVtbl -> RSSetShadingRate(This,baseShadingRate,combiners) ) + +#define ID3D12GraphicsCommandList7_RSSetShadingRateImage(This,shadingRateImage) \ + ( (This)->lpVtbl -> RSSetShadingRateImage(This,shadingRateImage) ) + + +#define ID3D12GraphicsCommandList7_DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + + +#define ID3D12GraphicsCommandList7_Barrier(This,NumBarrierGroups,pBarrierGroups) \ + ( (This)->lpVtbl -> Barrier(This,NumBarrierGroups,pBarrierGroups) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList7_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList8_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList8_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList8 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList8; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("ee936ef9-599d-4d28-938e-23c4ad05ce51") + ID3D12GraphicsCommandList8 : public ID3D12GraphicsCommandList7 + { + public: + virtual void STDMETHODCALLTYPE OMSetFrontAndBackStencilRef( + _In_ UINT FrontStencilRef, + _In_ UINT BackStencilRef) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList8Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList8 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList8 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList8 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList8 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList8 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList8 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList8 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList8 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandList, GetType) + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList8 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Close) + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList8 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Reset) + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearState) + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList8 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawInstanced) + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawIndexedInstanced) + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Dispatch) + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyBufferRegion) + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTextureRegion) + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList8 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyResource) + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTiles) + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveSubresource) + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetPrimitiveTopology) + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList8 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetViewports) + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList8 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetScissorRects) + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList8 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetBlendFactor) + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList8 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetStencilRef) + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT StencilRef); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPipelineState) + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResourceBarrier) + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteBundle) + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetDescriptorHeaps) + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootSignature) + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList8 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootSignature) + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList8 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetIndexBuffer) + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList8 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetVertexBuffers) + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SOSetTargets) + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetRenderTargets) + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearDepthStencilView) + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList8 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearRenderTargetView) + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList8 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewUint) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList8 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewFloat) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList8 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DiscardResource) + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginQuery) + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndQuery) + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveQueryData) + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPredication) + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList8 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetMarker) + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList8 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginEvent) + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList8 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndEvent) + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList8 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteIndirect) + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT64) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, OMSetDepthBounds) + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList8 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetSamplePositions) + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, ResolveSubresourceRegion) + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetViewInstanceMask) + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT Mask); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList2, WriteBufferImmediate) + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12GraphicsCommandList8 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList3, SetProtectedResourceSession) + void ( STDMETHODCALLTYPE *SetProtectedResourceSession )( + ID3D12GraphicsCommandList8 * This, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BeginRenderPass) + void ( STDMETHODCALLTYPE *BeginRenderPass )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT NumRenderTargets, + _In_reads_opt_(NumRenderTargets) const D3D12_RENDER_PASS_RENDER_TARGET_DESC *pRenderTargets, + _In_opt_ const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC *pDepthStencil, + D3D12_RENDER_PASS_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EndRenderPass) + void ( STDMETHODCALLTYPE *EndRenderPass )( + ID3D12GraphicsCommandList8 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, InitializeMetaCommand) + void ( STDMETHODCALLTYPE *InitializeMetaCommand )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(InitializationParametersDataSizeInBytes) const void *pInitializationParametersData, + _In_ SIZE_T InitializationParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, ExecuteMetaCommand) + void ( STDMETHODCALLTYPE *ExecuteMetaCommand )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(ExecutionParametersDataSizeInBytes) const void *pExecutionParametersData, + _In_ SIZE_T ExecutionParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BuildRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *BuildRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList8 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC *pDesc, + _In_ UINT NumPostbuildInfoDescs, + _In_reads_opt_(NumPostbuildInfoDescs) const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pPostbuildInfoDescs); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EmitRaytracingAccelerationStructurePostbuildInfo) + void ( STDMETHODCALLTYPE *EmitRaytracingAccelerationStructurePostbuildInfo )( + ID3D12GraphicsCommandList8 * This, + _In_ const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pDesc, + _In_ UINT NumSourceAccelerationStructures, + _In_reads_( NumSourceAccelerationStructures ) const D3D12_GPU_VIRTUAL_ADDRESS *pSourceAccelerationStructureData); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, CopyRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *CopyRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList8 * This, + _In_ D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData, + _In_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, SetPipelineState1) + void ( STDMETHODCALLTYPE *SetPipelineState1 )( + ID3D12GraphicsCommandList8 * This, + _In_ ID3D12StateObject *pStateObject); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, DispatchRays) + void ( STDMETHODCALLTYPE *DispatchRays )( + ID3D12GraphicsCommandList8 * This, + _In_ const D3D12_DISPATCH_RAYS_DESC *pDesc); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList5, RSSetShadingRate) + void ( STDMETHODCALLTYPE *RSSetShadingRate )( + ID3D12GraphicsCommandList8 * This, + _In_ D3D12_SHADING_RATE baseShadingRate, + _In_reads_opt_(D3D12_RS_SET_SHADING_RATE_COMBINER_COUNT) const D3D12_SHADING_RATE_COMBINER *combiners); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList5, RSSetShadingRateImage) + void ( STDMETHODCALLTYPE *RSSetShadingRateImage )( + ID3D12GraphicsCommandList8 * This, + _In_opt_ ID3D12Resource *shadingRateImage); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList6, DispatchMesh) + void ( STDMETHODCALLTYPE *DispatchMesh )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList7, Barrier) + void ( STDMETHODCALLTYPE *Barrier )( + ID3D12GraphicsCommandList8 * This, + UINT32 NumBarrierGroups, + _In_reads_(NumBarrierGroups) const D3D12_BARRIER_GROUP *pBarrierGroups); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList8, OMSetFrontAndBackStencilRef) + void ( STDMETHODCALLTYPE *OMSetFrontAndBackStencilRef )( + ID3D12GraphicsCommandList8 * This, + _In_ UINT FrontStencilRef, + _In_ UINT BackStencilRef); + + END_INTERFACE + } ID3D12GraphicsCommandList8Vtbl; + + interface ID3D12GraphicsCommandList8 + { + CONST_VTBL struct ID3D12GraphicsCommandList8Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList8_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList8_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList8_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList8_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList8_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList8_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList8_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList8_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList8_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList8_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList8_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList8_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList8_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList8_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList8_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList8_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList8_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList8_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList8_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList8_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList8_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList8_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList8_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList8_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList8_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList8_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList8_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList8_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList8_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList8_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList8_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList8_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList8_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList8_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList8_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList8_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList8_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList8_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList8_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList8_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList8_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList8_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList8_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList8_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList8_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList8_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList8_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList8_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList8_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList8_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList8_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList8_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList8_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList8_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList8_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList8_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList8_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList8_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList8_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList8_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList8_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList8_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList8_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList8_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList8_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList8_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + + +#define ID3D12GraphicsCommandList8_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12GraphicsCommandList8_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->lpVtbl -> SetProtectedResourceSession(This,pProtectedResourceSession) ) + + +#define ID3D12GraphicsCommandList8_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->lpVtbl -> BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) + +#define ID3D12GraphicsCommandList8_EndRenderPass(This) \ + ( (This)->lpVtbl -> EndRenderPass(This) ) + +#define ID3D12GraphicsCommandList8_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList8_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList8_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->lpVtbl -> BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) + +#define ID3D12GraphicsCommandList8_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->lpVtbl -> EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) + +#define ID3D12GraphicsCommandList8_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->lpVtbl -> CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) + +#define ID3D12GraphicsCommandList8_SetPipelineState1(This,pStateObject) \ + ( (This)->lpVtbl -> SetPipelineState1(This,pStateObject) ) + +#define ID3D12GraphicsCommandList8_DispatchRays(This,pDesc) \ + ( (This)->lpVtbl -> DispatchRays(This,pDesc) ) + + +#define ID3D12GraphicsCommandList8_RSSetShadingRate(This,baseShadingRate,combiners) \ + ( (This)->lpVtbl -> RSSetShadingRate(This,baseShadingRate,combiners) ) + +#define ID3D12GraphicsCommandList8_RSSetShadingRateImage(This,shadingRateImage) \ + ( (This)->lpVtbl -> RSSetShadingRateImage(This,shadingRateImage) ) + + +#define ID3D12GraphicsCommandList8_DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + + +#define ID3D12GraphicsCommandList8_Barrier(This,NumBarrierGroups,pBarrierGroups) \ + ( (This)->lpVtbl -> Barrier(This,NumBarrierGroups,pBarrierGroups) ) + + +#define ID3D12GraphicsCommandList8_OMSetFrontAndBackStencilRef(This,FrontStencilRef,BackStencilRef) \ + ( (This)->lpVtbl -> OMSetFrontAndBackStencilRef(This,FrontStencilRef,BackStencilRef) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList8_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList9_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList9_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList9 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList9; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("34ed2808-ffe6-4c2b-b11a-cabd2b0c59e1") + ID3D12GraphicsCommandList9 : public ID3D12GraphicsCommandList8 + { + public: + virtual void STDMETHODCALLTYPE RSSetDepthBias( + _In_ FLOAT DepthBias, + _In_ FLOAT DepthBiasClamp, + _In_ FLOAT SlopeScaledDepthBias) = 0; + + virtual void STDMETHODCALLTYPE IASetIndexBufferStripCutValue( + _In_ D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList9Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList9 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList9 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList9 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList9 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList9 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList9 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList9 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList9 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandList, GetType) + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList9 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Close) + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList9 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Reset) + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearState) + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList9 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawInstanced) + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawIndexedInstanced) + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Dispatch) + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyBufferRegion) + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTextureRegion) + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList9 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyResource) + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTiles) + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveSubresource) + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetPrimitiveTopology) + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList9 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetViewports) + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList9 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetScissorRects) + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList9 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetBlendFactor) + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList9 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetStencilRef) + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT StencilRef); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPipelineState) + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResourceBarrier) + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteBundle) + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetDescriptorHeaps) + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootSignature) + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList9 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootSignature) + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList9 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetIndexBuffer) + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList9 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetVertexBuffers) + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SOSetTargets) + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetRenderTargets) + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearDepthStencilView) + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList9 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearRenderTargetView) + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList9 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewUint) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList9 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewFloat) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList9 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DiscardResource) + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginQuery) + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndQuery) + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveQueryData) + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPredication) + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList9 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetMarker) + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList9 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginEvent) + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList9 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndEvent) + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList9 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteIndirect) + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT64) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, OMSetDepthBounds) + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList9 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetSamplePositions) + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, ResolveSubresourceRegion) + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetViewInstanceMask) + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT Mask); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList2, WriteBufferImmediate) + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12GraphicsCommandList9 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList3, SetProtectedResourceSession) + void ( STDMETHODCALLTYPE *SetProtectedResourceSession )( + ID3D12GraphicsCommandList9 * This, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BeginRenderPass) + void ( STDMETHODCALLTYPE *BeginRenderPass )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT NumRenderTargets, + _In_reads_opt_(NumRenderTargets) const D3D12_RENDER_PASS_RENDER_TARGET_DESC *pRenderTargets, + _In_opt_ const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC *pDepthStencil, + D3D12_RENDER_PASS_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EndRenderPass) + void ( STDMETHODCALLTYPE *EndRenderPass )( + ID3D12GraphicsCommandList9 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, InitializeMetaCommand) + void ( STDMETHODCALLTYPE *InitializeMetaCommand )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(InitializationParametersDataSizeInBytes) const void *pInitializationParametersData, + _In_ SIZE_T InitializationParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, ExecuteMetaCommand) + void ( STDMETHODCALLTYPE *ExecuteMetaCommand )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(ExecutionParametersDataSizeInBytes) const void *pExecutionParametersData, + _In_ SIZE_T ExecutionParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BuildRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *BuildRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList9 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC *pDesc, + _In_ UINT NumPostbuildInfoDescs, + _In_reads_opt_(NumPostbuildInfoDescs) const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pPostbuildInfoDescs); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EmitRaytracingAccelerationStructurePostbuildInfo) + void ( STDMETHODCALLTYPE *EmitRaytracingAccelerationStructurePostbuildInfo )( + ID3D12GraphicsCommandList9 * This, + _In_ const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pDesc, + _In_ UINT NumSourceAccelerationStructures, + _In_reads_( NumSourceAccelerationStructures ) const D3D12_GPU_VIRTUAL_ADDRESS *pSourceAccelerationStructureData); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, CopyRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *CopyRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList9 * This, + _In_ D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData, + _In_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, SetPipelineState1) + void ( STDMETHODCALLTYPE *SetPipelineState1 )( + ID3D12GraphicsCommandList9 * This, + _In_ ID3D12StateObject *pStateObject); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, DispatchRays) + void ( STDMETHODCALLTYPE *DispatchRays )( + ID3D12GraphicsCommandList9 * This, + _In_ const D3D12_DISPATCH_RAYS_DESC *pDesc); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList5, RSSetShadingRate) + void ( STDMETHODCALLTYPE *RSSetShadingRate )( + ID3D12GraphicsCommandList9 * This, + _In_ D3D12_SHADING_RATE baseShadingRate, + _In_reads_opt_(D3D12_RS_SET_SHADING_RATE_COMBINER_COUNT) const D3D12_SHADING_RATE_COMBINER *combiners); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList5, RSSetShadingRateImage) + void ( STDMETHODCALLTYPE *RSSetShadingRateImage )( + ID3D12GraphicsCommandList9 * This, + _In_opt_ ID3D12Resource *shadingRateImage); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList6, DispatchMesh) + void ( STDMETHODCALLTYPE *DispatchMesh )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList7, Barrier) + void ( STDMETHODCALLTYPE *Barrier )( + ID3D12GraphicsCommandList9 * This, + UINT32 NumBarrierGroups, + _In_reads_(NumBarrierGroups) const D3D12_BARRIER_GROUP *pBarrierGroups); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList8, OMSetFrontAndBackStencilRef) + void ( STDMETHODCALLTYPE *OMSetFrontAndBackStencilRef )( + ID3D12GraphicsCommandList9 * This, + _In_ UINT FrontStencilRef, + _In_ UINT BackStencilRef); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList9, RSSetDepthBias) + void ( STDMETHODCALLTYPE *RSSetDepthBias )( + ID3D12GraphicsCommandList9 * This, + _In_ FLOAT DepthBias, + _In_ FLOAT DepthBiasClamp, + _In_ FLOAT SlopeScaledDepthBias); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList9, IASetIndexBufferStripCutValue) + void ( STDMETHODCALLTYPE *IASetIndexBufferStripCutValue )( + ID3D12GraphicsCommandList9 * This, + _In_ D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue); + + END_INTERFACE + } ID3D12GraphicsCommandList9Vtbl; + + interface ID3D12GraphicsCommandList9 + { + CONST_VTBL struct ID3D12GraphicsCommandList9Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList9_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList9_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList9_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList9_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList9_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList9_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList9_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList9_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList9_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList9_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList9_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList9_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList9_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList9_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList9_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList9_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList9_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList9_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList9_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList9_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList9_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList9_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList9_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList9_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList9_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList9_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList9_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList9_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList9_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList9_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList9_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList9_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList9_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList9_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList9_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList9_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList9_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList9_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList9_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList9_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList9_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList9_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList9_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList9_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList9_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList9_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList9_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList9_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList9_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList9_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList9_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList9_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList9_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList9_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList9_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList9_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList9_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList9_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList9_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList9_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList9_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList9_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList9_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList9_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList9_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList9_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + + +#define ID3D12GraphicsCommandList9_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12GraphicsCommandList9_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->lpVtbl -> SetProtectedResourceSession(This,pProtectedResourceSession) ) + + +#define ID3D12GraphicsCommandList9_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->lpVtbl -> BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) + +#define ID3D12GraphicsCommandList9_EndRenderPass(This) \ + ( (This)->lpVtbl -> EndRenderPass(This) ) + +#define ID3D12GraphicsCommandList9_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList9_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList9_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->lpVtbl -> BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) + +#define ID3D12GraphicsCommandList9_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->lpVtbl -> EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) + +#define ID3D12GraphicsCommandList9_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->lpVtbl -> CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) + +#define ID3D12GraphicsCommandList9_SetPipelineState1(This,pStateObject) \ + ( (This)->lpVtbl -> SetPipelineState1(This,pStateObject) ) + +#define ID3D12GraphicsCommandList9_DispatchRays(This,pDesc) \ + ( (This)->lpVtbl -> DispatchRays(This,pDesc) ) + + +#define ID3D12GraphicsCommandList9_RSSetShadingRate(This,baseShadingRate,combiners) \ + ( (This)->lpVtbl -> RSSetShadingRate(This,baseShadingRate,combiners) ) + +#define ID3D12GraphicsCommandList9_RSSetShadingRateImage(This,shadingRateImage) \ + ( (This)->lpVtbl -> RSSetShadingRateImage(This,shadingRateImage) ) + + +#define ID3D12GraphicsCommandList9_DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + + +#define ID3D12GraphicsCommandList9_Barrier(This,NumBarrierGroups,pBarrierGroups) \ + ( (This)->lpVtbl -> Barrier(This,NumBarrierGroups,pBarrierGroups) ) + + +#define ID3D12GraphicsCommandList9_OMSetFrontAndBackStencilRef(This,FrontStencilRef,BackStencilRef) \ + ( (This)->lpVtbl -> OMSetFrontAndBackStencilRef(This,FrontStencilRef,BackStencilRef) ) + + +#define ID3D12GraphicsCommandList9_RSSetDepthBias(This,DepthBias,DepthBiasClamp,SlopeScaledDepthBias) \ + ( (This)->lpVtbl -> RSSetDepthBias(This,DepthBias,DepthBiasClamp,SlopeScaledDepthBias) ) + +#define ID3D12GraphicsCommandList9_IASetIndexBufferStripCutValue(This,IBStripCutValue) \ + ( (This)->lpVtbl -> IASetIndexBufferStripCutValue(This,IBStripCutValue) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList9_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList10_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList10_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList10 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList10; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7013c015-d161-4b63-a08c-238552dd8acc") + ID3D12GraphicsCommandList10 : public ID3D12GraphicsCommandList9 + { + public: + virtual void STDMETHODCALLTYPE SetProgram( + _In_ const D3D12_SET_PROGRAM_DESC *pDesc) = 0; + + virtual void STDMETHODCALLTYPE DispatchGraph( + _In_ const D3D12_DISPATCH_GRAPH_DESC *pDesc) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList10Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList10 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList10 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList10 * This); + + DECLSPEC_XFGVIRT(ID3D12Object, GetPrivateData) + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList10 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateData) + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList10 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetPrivateDataInterface) + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList10 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + DECLSPEC_XFGVIRT(ID3D12Object, SetName) + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList10 * This, + _In_z_ LPCWSTR Name); + + DECLSPEC_XFGVIRT(ID3D12DeviceChild, GetDevice) + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList10 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + DECLSPEC_XFGVIRT(ID3D12CommandList, GetType) + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList10 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Close) + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList10 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Reset) + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearState) + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList10 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawInstanced) + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DrawIndexedInstanced) + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, Dispatch) + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyBufferRegion) + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTextureRegion) + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList10 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyResource) + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, CopyTiles) + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveSubresource) + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetPrimitiveTopology) + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList10 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetViewports) + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList10 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, RSSetScissorRects) + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList10 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetBlendFactor) + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList10 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetStencilRef) + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT StencilRef); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPipelineState) + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12PipelineState *pPipelineState); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResourceBarrier) + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteBundle) + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetDescriptorHeaps) + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootSignature) + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList10 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootSignature) + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList10 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootDescriptorTable) + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstant) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRoot32BitConstants) + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootConstantBufferView) + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootShaderResourceView) + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetComputeRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetGraphicsRootUnorderedAccessView) + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetIndexBuffer) + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList10 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, IASetVertexBuffers) + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SOSetTargets) + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, OMSetRenderTargets) + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearDepthStencilView) + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList10 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearRenderTargetView) + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList10 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewUint) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList10 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ClearUnorderedAccessViewFloat) + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList10 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, DiscardResource) + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginQuery) + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndQuery) + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ResolveQueryData) + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetPredication) + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList10 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, SetMarker) + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList10 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, BeginEvent) + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList10 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, EndEvent) + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList10 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList, ExecuteIndirect) + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, AtomicCopyBufferUINT64) + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, OMSetDepthBounds) + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList10 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetSamplePositions) + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, ResolveSubresourceRegion) + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList1, SetViewInstanceMask) + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT Mask); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList2, WriteBufferImmediate) + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12GraphicsCommandList10 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList3, SetProtectedResourceSession) + void ( STDMETHODCALLTYPE *SetProtectedResourceSession )( + ID3D12GraphicsCommandList10 * This, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BeginRenderPass) + void ( STDMETHODCALLTYPE *BeginRenderPass )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT NumRenderTargets, + _In_reads_opt_(NumRenderTargets) const D3D12_RENDER_PASS_RENDER_TARGET_DESC *pRenderTargets, + _In_opt_ const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC *pDepthStencil, + D3D12_RENDER_PASS_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EndRenderPass) + void ( STDMETHODCALLTYPE *EndRenderPass )( + ID3D12GraphicsCommandList10 * This); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, InitializeMetaCommand) + void ( STDMETHODCALLTYPE *InitializeMetaCommand )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(InitializationParametersDataSizeInBytes) const void *pInitializationParametersData, + _In_ SIZE_T InitializationParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, ExecuteMetaCommand) + void ( STDMETHODCALLTYPE *ExecuteMetaCommand )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(ExecutionParametersDataSizeInBytes) const void *pExecutionParametersData, + _In_ SIZE_T ExecutionParametersDataSizeInBytes); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, BuildRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *BuildRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList10 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC *pDesc, + _In_ UINT NumPostbuildInfoDescs, + _In_reads_opt_(NumPostbuildInfoDescs) const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pPostbuildInfoDescs); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, EmitRaytracingAccelerationStructurePostbuildInfo) + void ( STDMETHODCALLTYPE *EmitRaytracingAccelerationStructurePostbuildInfo )( + ID3D12GraphicsCommandList10 * This, + _In_ const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pDesc, + _In_ UINT NumSourceAccelerationStructures, + _In_reads_( NumSourceAccelerationStructures ) const D3D12_GPU_VIRTUAL_ADDRESS *pSourceAccelerationStructureData); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, CopyRaytracingAccelerationStructure) + void ( STDMETHODCALLTYPE *CopyRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList10 * This, + _In_ D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData, + _In_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, SetPipelineState1) + void ( STDMETHODCALLTYPE *SetPipelineState1 )( + ID3D12GraphicsCommandList10 * This, + _In_ ID3D12StateObject *pStateObject); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList4, DispatchRays) + void ( STDMETHODCALLTYPE *DispatchRays )( + ID3D12GraphicsCommandList10 * This, + _In_ const D3D12_DISPATCH_RAYS_DESC *pDesc); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList5, RSSetShadingRate) + void ( STDMETHODCALLTYPE *RSSetShadingRate )( + ID3D12GraphicsCommandList10 * This, + _In_ D3D12_SHADING_RATE baseShadingRate, + _In_reads_opt_(D3D12_RS_SET_SHADING_RATE_COMBINER_COUNT) const D3D12_SHADING_RATE_COMBINER *combiners); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList5, RSSetShadingRateImage) + void ( STDMETHODCALLTYPE *RSSetShadingRateImage )( + ID3D12GraphicsCommandList10 * This, + _In_opt_ ID3D12Resource *shadingRateImage); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList6, DispatchMesh) + void ( STDMETHODCALLTYPE *DispatchMesh )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList7, Barrier) + void ( STDMETHODCALLTYPE *Barrier )( + ID3D12GraphicsCommandList10 * This, + UINT32 NumBarrierGroups, + _In_reads_(NumBarrierGroups) const D3D12_BARRIER_GROUP *pBarrierGroups); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList8, OMSetFrontAndBackStencilRef) + void ( STDMETHODCALLTYPE *OMSetFrontAndBackStencilRef )( + ID3D12GraphicsCommandList10 * This, + _In_ UINT FrontStencilRef, + _In_ UINT BackStencilRef); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList9, RSSetDepthBias) + void ( STDMETHODCALLTYPE *RSSetDepthBias )( + ID3D12GraphicsCommandList10 * This, + _In_ FLOAT DepthBias, + _In_ FLOAT DepthBiasClamp, + _In_ FLOAT SlopeScaledDepthBias); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList9, IASetIndexBufferStripCutValue) + void ( STDMETHODCALLTYPE *IASetIndexBufferStripCutValue )( + ID3D12GraphicsCommandList10 * This, + _In_ D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList10, SetProgram) + void ( STDMETHODCALLTYPE *SetProgram )( + ID3D12GraphicsCommandList10 * This, + _In_ const D3D12_SET_PROGRAM_DESC *pDesc); + + DECLSPEC_XFGVIRT(ID3D12GraphicsCommandList10, DispatchGraph) + void ( STDMETHODCALLTYPE *DispatchGraph )( + ID3D12GraphicsCommandList10 * This, + _In_ const D3D12_DISPATCH_GRAPH_DESC *pDesc); + + END_INTERFACE + } ID3D12GraphicsCommandList10Vtbl; + + interface ID3D12GraphicsCommandList10 + { + CONST_VTBL struct ID3D12GraphicsCommandList10Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList10_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList10_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList10_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList10_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList10_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList10_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList10_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList10_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList10_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList10_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList10_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList10_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList10_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList10_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList10_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList10_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList10_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList10_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList10_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList10_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList10_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList10_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList10_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList10_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList10_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList10_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList10_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList10_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList10_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList10_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList10_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList10_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList10_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList10_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList10_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList10_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList10_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList10_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList10_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList10_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList10_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList10_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList10_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList10_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList10_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList10_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList10_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList10_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList10_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList10_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList10_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList10_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList10_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList10_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList10_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList10_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList10_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList10_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList10_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList10_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList10_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList10_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList10_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList10_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList10_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList10_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + + +#define ID3D12GraphicsCommandList10_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12GraphicsCommandList10_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->lpVtbl -> SetProtectedResourceSession(This,pProtectedResourceSession) ) + + +#define ID3D12GraphicsCommandList10_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->lpVtbl -> BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) + +#define ID3D12GraphicsCommandList10_EndRenderPass(This) \ + ( (This)->lpVtbl -> EndRenderPass(This) ) + +#define ID3D12GraphicsCommandList10_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList10_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList10_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->lpVtbl -> BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) + +#define ID3D12GraphicsCommandList10_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->lpVtbl -> EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) + +#define ID3D12GraphicsCommandList10_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->lpVtbl -> CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) + +#define ID3D12GraphicsCommandList10_SetPipelineState1(This,pStateObject) \ + ( (This)->lpVtbl -> SetPipelineState1(This,pStateObject) ) + +#define ID3D12GraphicsCommandList10_DispatchRays(This,pDesc) \ + ( (This)->lpVtbl -> DispatchRays(This,pDesc) ) + + +#define ID3D12GraphicsCommandList10_RSSetShadingRate(This,baseShadingRate,combiners) \ + ( (This)->lpVtbl -> RSSetShadingRate(This,baseShadingRate,combiners) ) + +#define ID3D12GraphicsCommandList10_RSSetShadingRateImage(This,shadingRateImage) \ + ( (This)->lpVtbl -> RSSetShadingRateImage(This,shadingRateImage) ) + + +#define ID3D12GraphicsCommandList10_DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + + +#define ID3D12GraphicsCommandList10_Barrier(This,NumBarrierGroups,pBarrierGroups) \ + ( (This)->lpVtbl -> Barrier(This,NumBarrierGroups,pBarrierGroups) ) + + +#define ID3D12GraphicsCommandList10_OMSetFrontAndBackStencilRef(This,FrontStencilRef,BackStencilRef) \ + ( (This)->lpVtbl -> OMSetFrontAndBackStencilRef(This,FrontStencilRef,BackStencilRef) ) + + +#define ID3D12GraphicsCommandList10_RSSetDepthBias(This,DepthBias,DepthBiasClamp,SlopeScaledDepthBias) \ + ( (This)->lpVtbl -> RSSetDepthBias(This,DepthBias,DepthBiasClamp,SlopeScaledDepthBias) ) + +#define ID3D12GraphicsCommandList10_IASetIndexBufferStripCutValue(This,IBStripCutValue) \ + ( (This)->lpVtbl -> IASetIndexBufferStripCutValue(This,IBStripCutValue) ) + + +#define ID3D12GraphicsCommandList10_SetProgram(This,pDesc) \ + ( (This)->lpVtbl -> SetProgram(This,pDesc) ) + +#define ID3D12GraphicsCommandList10_DispatchGraph(This,pDesc) \ + ( (This)->lpVtbl -> DispatchGraph(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList10_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12GBVDiagnostics_INTERFACE_DEFINED__ +#define __ID3D12GBVDiagnostics_INTERFACE_DEFINED__ + +/* interface ID3D12GBVDiagnostics */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GBVDiagnostics; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("597985ab-9b75-4dbb-be23-0761195bebee") + ID3D12GBVDiagnostics : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetGBVEntireSubresourceStatesData( + _In_ ID3D12Resource *pResource, + _Out_writes_bytes_(DataSize) int *pData, + UINT DataSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGBVSubresourceState( + _In_ ID3D12Resource *pResource, + UINT Subresource, + _Out_ int *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGBVResourceUniformState( + _In_ ID3D12Resource *pResource, + _Out_ int *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGBVResourceInfo( + _In_ ID3D12Resource *pResource, + _In_opt_ D3D12_RESOURCE_DESC *pResourceDesc, + _In_opt_ UINT32 *pResourceHash, + _In_opt_ UINT32 *pSubresourceStatesByteOffset) = 0; + + virtual void STDMETHODCALLTYPE GBVReserved0( void) = 0; + + virtual void STDMETHODCALLTYPE GBVReserved1( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GBVDiagnosticsVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GBVDiagnostics * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GBVDiagnostics * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GBVDiagnostics * This); + + DECLSPEC_XFGVIRT(ID3D12GBVDiagnostics, GetGBVEntireSubresourceStatesData) + HRESULT ( STDMETHODCALLTYPE *GetGBVEntireSubresourceStatesData )( + ID3D12GBVDiagnostics * This, + _In_ ID3D12Resource *pResource, + _Out_writes_bytes_(DataSize) int *pData, + UINT DataSize); + + DECLSPEC_XFGVIRT(ID3D12GBVDiagnostics, GetGBVSubresourceState) + HRESULT ( STDMETHODCALLTYPE *GetGBVSubresourceState )( + ID3D12GBVDiagnostics * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + _Out_ int *pData); + + DECLSPEC_XFGVIRT(ID3D12GBVDiagnostics, GetGBVResourceUniformState) + HRESULT ( STDMETHODCALLTYPE *GetGBVResourceUniformState )( + ID3D12GBVDiagnostics * This, + _In_ ID3D12Resource *pResource, + _Out_ int *pData); + + DECLSPEC_XFGVIRT(ID3D12GBVDiagnostics, GetGBVResourceInfo) + HRESULT ( STDMETHODCALLTYPE *GetGBVResourceInfo )( + ID3D12GBVDiagnostics * This, + _In_ ID3D12Resource *pResource, + _In_opt_ D3D12_RESOURCE_DESC *pResourceDesc, + _In_opt_ UINT32 *pResourceHash, + _In_opt_ UINT32 *pSubresourceStatesByteOffset); + + DECLSPEC_XFGVIRT(ID3D12GBVDiagnostics, GBVReserved0) + void ( STDMETHODCALLTYPE *GBVReserved0 )( + ID3D12GBVDiagnostics * This); + + DECLSPEC_XFGVIRT(ID3D12GBVDiagnostics, GBVReserved1) + void ( STDMETHODCALLTYPE *GBVReserved1 )( + ID3D12GBVDiagnostics * This); + + END_INTERFACE + } ID3D12GBVDiagnosticsVtbl; + + interface ID3D12GBVDiagnostics + { + CONST_VTBL struct ID3D12GBVDiagnosticsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GBVDiagnostics_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GBVDiagnostics_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GBVDiagnostics_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GBVDiagnostics_GetGBVEntireSubresourceStatesData(This,pResource,pData,DataSize) \ + ( (This)->lpVtbl -> GetGBVEntireSubresourceStatesData(This,pResource,pData,DataSize) ) + +#define ID3D12GBVDiagnostics_GetGBVSubresourceState(This,pResource,Subresource,pData) \ + ( (This)->lpVtbl -> GetGBVSubresourceState(This,pResource,Subresource,pData) ) + +#define ID3D12GBVDiagnostics_GetGBVResourceUniformState(This,pResource,pData) \ + ( (This)->lpVtbl -> GetGBVResourceUniformState(This,pResource,pData) ) + +#define ID3D12GBVDiagnostics_GetGBVResourceInfo(This,pResource,pResourceDesc,pResourceHash,pSubresourceStatesByteOffset) \ + ( (This)->lpVtbl -> GetGBVResourceInfo(This,pResource,pResourceDesc,pResourceHash,pSubresourceStatesByteOffset) ) + +#define ID3D12GBVDiagnostics_GBVReserved0(This) \ + ( (This)->lpVtbl -> GBVReserved0(This) ) + +#define ID3D12GBVDiagnostics_GBVReserved1(This) \ + ( (This)->lpVtbl -> GBVReserved1(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GBVDiagnostics_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0074 */ +/* [local] */ + +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */ +#pragma endregion +DEFINE_GUID(IID_ID3D12Object,0xc4fec28f,0x7966,0x4e95,0x9f,0x94,0xf4,0x31,0xcb,0x56,0xc3,0xb8); +DEFINE_GUID(IID_ID3D12DeviceChild,0x905db94b,0xa00c,0x4140,0x9d,0xf5,0x2b,0x64,0xca,0x9e,0xa3,0x57); +DEFINE_GUID(IID_ID3D12RootSignature,0xc54a6b66,0x72df,0x4ee8,0x8b,0xe5,0xa9,0x46,0xa1,0x42,0x92,0x14); +DEFINE_GUID(IID_ID3D12RootSignatureDeserializer,0x34AB647B,0x3CC8,0x46AC,0x84,0x1B,0xC0,0x96,0x56,0x45,0xC0,0x46); +DEFINE_GUID(IID_ID3D12VersionedRootSignatureDeserializer,0x7F91CE67,0x090C,0x4BB7,0xB7,0x8E,0xED,0x8F,0xF2,0xE3,0x1D,0xA0); +DEFINE_GUID(IID_ID3D12Pageable,0x63ee58fb,0x1268,0x4835,0x86,0xda,0xf0,0x08,0xce,0x62,0xf0,0xd6); +DEFINE_GUID(IID_ID3D12Heap,0x6b3b2502,0x6e51,0x45b3,0x90,0xee,0x98,0x84,0x26,0x5e,0x8d,0xf3); +DEFINE_GUID(IID_ID3D12Resource,0x696442be,0xa72e,0x4059,0xbc,0x79,0x5b,0x5c,0x98,0x04,0x0f,0xad); +DEFINE_GUID(IID_ID3D12CommandAllocator,0x6102dee4,0xaf59,0x4b09,0xb9,0x99,0xb4,0x4d,0x73,0xf0,0x9b,0x24); +DEFINE_GUID(IID_ID3D12Fence,0x0a753dcf,0xc4d8,0x4b91,0xad,0xf6,0xbe,0x5a,0x60,0xd9,0x5a,0x76); +DEFINE_GUID(IID_ID3D12Fence1,0x433685fe,0xe22b,0x4ca0,0xa8,0xdb,0xb5,0xb4,0xf4,0xdd,0x0e,0x4a); +DEFINE_GUID(IID_ID3D12PipelineState,0x765a30f3,0xf624,0x4c6f,0xa8,0x28,0xac,0xe9,0x48,0x62,0x24,0x45); +DEFINE_GUID(IID_ID3D12DescriptorHeap,0x8efb471d,0x616c,0x4f49,0x90,0xf7,0x12,0x7b,0xb7,0x63,0xfa,0x51); +DEFINE_GUID(IID_ID3D12QueryHeap,0x0d9658ae,0xed45,0x469e,0xa6,0x1d,0x97,0x0e,0xc5,0x83,0xca,0xb4); +DEFINE_GUID(IID_ID3D12CommandSignature,0xc36a797c,0xec80,0x4f0a,0x89,0x85,0xa7,0xb2,0x47,0x50,0x82,0xd1); +DEFINE_GUID(IID_ID3D12CommandList,0x7116d91c,0xe7e4,0x47ce,0xb8,0xc6,0xec,0x81,0x68,0xf4,0x37,0xe5); +DEFINE_GUID(IID_ID3D12GraphicsCommandList,0x5b160d0f,0xac1b,0x4185,0x8b,0xa8,0xb3,0xae,0x42,0xa5,0xa4,0x55); +DEFINE_GUID(IID_ID3D12GraphicsCommandList1,0x553103fb,0x1fe7,0x4557,0xbb,0x38,0x94,0x6d,0x7d,0x0e,0x7c,0xa7); +DEFINE_GUID(IID_ID3D12GraphicsCommandList2,0x38C3E585,0xFF17,0x412C,0x91,0x50,0x4F,0xC6,0xF9,0xD7,0x2A,0x28); +DEFINE_GUID(IID_ID3D12CommandQueue,0x0ec870a6,0x5d7e,0x4c22,0x8c,0xfc,0x5b,0xaa,0xe0,0x76,0x16,0xed); +DEFINE_GUID(IID_ID3D12Device,0x189819f1,0x1db6,0x4b57,0xbe,0x54,0x18,0x21,0x33,0x9b,0x85,0xf7); +DEFINE_GUID(IID_ID3D12PipelineLibrary,0xc64226a8,0x9201,0x46af,0xb4,0xcc,0x53,0xfb,0x9f,0xf7,0x41,0x4f); +DEFINE_GUID(IID_ID3D12PipelineLibrary1,0x80eabf42,0x2568,0x4e5e,0xbd,0x82,0xc3,0x7f,0x86,0x96,0x1d,0xc3); +DEFINE_GUID(IID_ID3D12Device1,0x77acce80,0x638e,0x4e65,0x88,0x95,0xc1,0xf2,0x33,0x86,0x86,0x3e); +DEFINE_GUID(IID_ID3D12Device2,0x30baa41e,0xb15b,0x475c,0xa0,0xbb,0x1a,0xf5,0xc5,0xb6,0x43,0x28); +DEFINE_GUID(IID_ID3D12Device3,0x81dadc15,0x2bad,0x4392,0x93,0xc5,0x10,0x13,0x45,0xc4,0xaa,0x98); +DEFINE_GUID(IID_ID3D12ProtectedSession,0xA1533D18,0x0AC1,0x4084,0x85,0xB9,0x89,0xA9,0x61,0x16,0x80,0x6B); +DEFINE_GUID(IID_ID3D12ProtectedResourceSession,0x6CD696F4,0xF289,0x40CC,0x80,0x91,0x5A,0x6C,0x0A,0x09,0x9C,0x3D); +DEFINE_GUID(IID_ID3D12Device4,0xe865df17,0xa9ee,0x46f9,0xa4,0x63,0x30,0x98,0x31,0x5a,0xa2,0xe5); +DEFINE_GUID(IID_ID3D12LifetimeOwner,0xe667af9f,0xcd56,0x4f46,0x83,0xce,0x03,0x2e,0x59,0x5d,0x70,0xa8); +DEFINE_GUID(IID_ID3D12SwapChainAssistant,0xf1df64b6,0x57fd,0x49cd,0x88,0x07,0xc0,0xeb,0x88,0xb4,0x5c,0x8f); +DEFINE_GUID(IID_ID3D12LifetimeTracker,0x3fd03d36,0x4eb1,0x424a,0xa5,0x82,0x49,0x4e,0xcb,0x8b,0xa8,0x13); +DEFINE_GUID(IID_ID3D12StateObject,0x47016943,0xfca8,0x4594,0x93,0xea,0xaf,0x25,0x8b,0x55,0x34,0x6d); +DEFINE_GUID(IID_ID3D12StateObjectProperties,0xde5fa827,0x9bf9,0x4f26,0x89,0xff,0xd7,0xf5,0x6f,0xde,0x38,0x60); +DEFINE_GUID(IID_ID3D12StateObjectProperties1,0x460caac7,0x1d24,0x446a,0xa1,0x84,0xca,0x67,0xdb,0x49,0x41,0x38); +DEFINE_GUID(IID_ID3D12WorkGraphProperties,0x065acf71,0xf863,0x4b89,0x82,0xf4,0x02,0xe4,0xd5,0x88,0x67,0x57); +DEFINE_GUID(IID_ID3D12Device5,0x8b4f173b,0x2fea,0x4b80,0x8f,0x58,0x43,0x07,0x19,0x1a,0xb9,0x5d); +DEFINE_GUID(IID_ID3D12DeviceRemovedExtendedDataSettings,0x82BC481C,0x6B9B,0x4030,0xAE,0xDB,0x7E,0xE3,0xD1,0xDF,0x1E,0x63); +DEFINE_GUID(IID_ID3D12DeviceRemovedExtendedDataSettings1,0xDBD5AE51,0x3317,0x4F0A,0xAD,0xF9,0x1D,0x7C,0xED,0xCA,0xAE,0x0B); +DEFINE_GUID(IID_ID3D12DeviceRemovedExtendedDataSettings2,0x61552388,0x01ab,0x4008,0xa4,0x36,0x83,0xdb,0x18,0x95,0x66,0xea); +DEFINE_GUID(IID_ID3D12DeviceRemovedExtendedData,0x98931D33,0x5AE8,0x4791,0xAA,0x3C,0x1A,0x73,0xA2,0x93,0x4E,0x71); +DEFINE_GUID(IID_ID3D12DeviceRemovedExtendedData1,0x9727A022,0xCF1D,0x4DDA,0x9E,0xBA,0xEF,0xFA,0x65,0x3F,0xC5,0x06); +DEFINE_GUID(IID_ID3D12DeviceRemovedExtendedData2,0x67FC5816,0xE4CA,0x4915,0xBF,0x18,0x42,0x54,0x12,0x72,0xDA,0x54); +DEFINE_GUID(IID_ID3D12Device6,0xc70b221b,0x40e4,0x4a17,0x89,0xaf,0x02,0x5a,0x07,0x27,0xa6,0xdc); +DEFINE_GUID(IID_ID3D12ProtectedResourceSession1,0xD6F12DD6,0x76FB,0x406E,0x89,0x61,0x42,0x96,0xEE,0xFC,0x04,0x09); +DEFINE_GUID(IID_ID3D12Device7,0x5c014b53,0x68a1,0x4b9b,0x8b,0xd1,0xdd,0x60,0x46,0xb9,0x35,0x8b); +DEFINE_GUID(IID_ID3D12Device8,0x9218E6BB,0xF944,0x4F7E,0xA7,0x5C,0xB1,0xB2,0xC7,0xB7,0x01,0xF3); +DEFINE_GUID(IID_ID3D12Resource1,0x9D5E227A,0x4430,0x4161,0x88,0xB3,0x3E,0xCA,0x6B,0xB1,0x6E,0x19); +DEFINE_GUID(IID_ID3D12Resource2,0xBE36EC3B,0xEA85,0x4AEB,0xA4,0x5A,0xE9,0xD7,0x64,0x04,0xA4,0x95); +DEFINE_GUID(IID_ID3D12Heap1,0x572F7389,0x2168,0x49E3,0x96,0x93,0xD6,0xDF,0x58,0x71,0xBF,0x6D); +DEFINE_GUID(IID_ID3D12GraphicsCommandList3,0x6FDA83A7,0xB84C,0x4E38,0x9A,0xC8,0xC7,0xBD,0x22,0x01,0x6B,0x3D); +DEFINE_GUID(IID_ID3D12MetaCommand,0xDBB84C27,0x36CE,0x4FC9,0xB8,0x01,0xF0,0x48,0xC4,0x6A,0xC5,0x70); +DEFINE_GUID(IID_ID3D12GraphicsCommandList4,0x8754318e,0xd3a9,0x4541,0x98,0xcf,0x64,0x5b,0x50,0xdc,0x48,0x74); +DEFINE_GUID(IID_ID3D12ShaderCacheSession,0x28e2495d,0x0f64,0x4ae4,0xa6,0xec,0x12,0x92,0x55,0xdc,0x49,0xa8); +DEFINE_GUID(IID_ID3D12Device9,0x4c80e962,0xf032,0x4f60,0xbc,0x9e,0xeb,0xc2,0xcf,0xa1,0xd8,0x3c); +DEFINE_GUID(IID_ID3D12Device10,0x517f8718,0xaa66,0x49f9,0xb0,0x2b,0xa7,0xab,0x89,0xc0,0x60,0x31); +DEFINE_GUID(IID_ID3D12Device11,0x5405c344,0xd457,0x444e,0xb4,0xdd,0x23,0x66,0xe4,0x5a,0xee,0x39); +DEFINE_GUID(IID_ID3D12Device12,0x5af5c532,0x4c91,0x4cd0,0xb5,0x41,0x15,0xa4,0x05,0x39,0x5f,0xc5); +DEFINE_GUID(IID_ID3D12Device13,0x14eecffc,0x4df8,0x40f7,0xa1,0x18,0x5c,0x81,0x6f,0x45,0x69,0x5e); +DEFINE_GUID(IID_ID3D12Device14,0x5f6e592d,0xd895,0x44c2,0x8e,0x4a,0x88,0xad,0x49,0x26,0xd3,0x23); +DEFINE_GUID(IID_ID3D12VirtualizationGuestDevice,0xbc66d368,0x7373,0x4943,0x87,0x57,0xfc,0x87,0xdc,0x79,0xe4,0x76); +DEFINE_GUID(IID_ID3D12Tools,0x7071e1f0,0xe84b,0x4b33,0x97,0x4f,0x12,0xfa,0x49,0xde,0x65,0xc5); +DEFINE_GUID(IID_ID3D12SDKConfiguration,0xe9eb5314,0x33aa,0x42b2,0xa7,0x18,0xd7,0x7f,0x58,0xb1,0xf1,0xc7); +DEFINE_GUID(IID_ID3D12SDKConfiguration1,0x8aaf9303,0xad25,0x48b9,0x9a,0x57,0xd9,0xc3,0x7e,0x00,0x9d,0x9f); +DEFINE_GUID(IID_ID3D12DeviceFactory,0x61f307d3,0xd34e,0x4e7c,0x83,0x74,0x3b,0xa4,0xde,0x23,0xcc,0xcb); +DEFINE_GUID(IID_ID3D12DeviceConfiguration,0x78dbf87b,0xf766,0x422b,0xa6,0x1c,0xc8,0xc4,0x46,0xbd,0xb9,0xad); +DEFINE_GUID(IID_ID3D12DeviceConfiguration1,0xed342442,0x6343,0x4e16,0xbb,0x82,0xa3,0xa5,0x77,0x87,0x4e,0x56); +DEFINE_GUID(IID_ID3D12GraphicsCommandList5,0x55050859,0x4024,0x474c,0x87,0xf5,0x64,0x72,0xea,0xee,0x44,0xea); +DEFINE_GUID(IID_ID3D12GraphicsCommandList6,0xc3827890,0xe548,0x4cfa,0x96,0xcf,0x56,0x89,0xa9,0x37,0x0f,0x80); +DEFINE_GUID(IID_ID3D12GraphicsCommandList7,0xdd171223,0x8b61,0x4769,0x90,0xe3,0x16,0x0c,0xcd,0xe4,0xe2,0xc1); +DEFINE_GUID(IID_ID3D12GraphicsCommandList8,0xee936ef9,0x599d,0x4d28,0x93,0x8e,0x23,0xc4,0xad,0x05,0xce,0x51); +DEFINE_GUID(IID_ID3D12GraphicsCommandList9,0x34ed2808,0xffe6,0x4c2b,0xb1,0x1a,0xca,0xbd,0x2b,0x0c,0x59,0xe1); +DEFINE_GUID(IID_ID3D12GraphicsCommandList10,0x7013c015,0xd161,0x4b63,0xa0,0x8c,0x23,0x85,0x52,0xdd,0x8a,0xcc); +DEFINE_GUID(IID_ID3D12GBVDiagnostics,0x597985ab,0x9b75,0x4dbb,0xbe,0x23,0x07,0x61,0x19,0x5b,0xeb,0xee); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0074_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0074_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/src/video/directx/d3d12sdklayers.h b/src/video/directx/d3d12sdklayers.h new file mode 100644 index 0000000000000..3bab2e37eabba --- /dev/null +++ b/src/video/directx/d3d12sdklayers.h @@ -0,0 +1,4263 @@ +/*------------------------------------------------------------------------------------- + * + * Copyright (c) Microsoft Corporation + * Licensed under the MIT license + * + *-------------------------------------------------------------------------------------*/ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.01.0628 */ + + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 500 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCNDR_H_VERSION__ */ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3d12sdklayers_h__ +#define __d3d12sdklayers_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#ifndef DECLSPEC_XFGVIRT +#if defined(_CONTROL_FLOW_GUARD_XFG) +#define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func)) +#else +#define DECLSPEC_XFGVIRT(base, func) +#endif +#endif + +/* Forward Declarations */ + +#ifndef __ID3D12Debug_FWD_DEFINED__ +#define __ID3D12Debug_FWD_DEFINED__ +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 __ID3D12Debug2_FWD_DEFINED__ +#define __ID3D12Debug2_FWD_DEFINED__ +typedef interface ID3D12Debug2 ID3D12Debug2; + +#endif /* __ID3D12Debug2_FWD_DEFINED__ */ + + +#ifndef __ID3D12Debug3_FWD_DEFINED__ +#define __ID3D12Debug3_FWD_DEFINED__ +typedef interface ID3D12Debug3 ID3D12Debug3; + +#endif /* __ID3D12Debug3_FWD_DEFINED__ */ + + +#ifndef __ID3D12Debug4_FWD_DEFINED__ +#define __ID3D12Debug4_FWD_DEFINED__ +typedef interface ID3D12Debug4 ID3D12Debug4; + +#endif /* __ID3D12Debug4_FWD_DEFINED__ */ + + +#ifndef __ID3D12Debug5_FWD_DEFINED__ +#define __ID3D12Debug5_FWD_DEFINED__ +typedef interface ID3D12Debug5 ID3D12Debug5; + +#endif /* __ID3D12Debug5_FWD_DEFINED__ */ + + +#ifndef __ID3D12Debug6_FWD_DEFINED__ +#define __ID3D12Debug6_FWD_DEFINED__ +typedef interface ID3D12Debug6 ID3D12Debug6; + +#endif /* __ID3D12Debug6_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; + +#endif /* __ID3D12DebugDevice_FWD_DEFINED__ */ + + +#ifndef __ID3D12DebugDevice2_FWD_DEFINED__ +#define __ID3D12DebugDevice2_FWD_DEFINED__ +typedef interface ID3D12DebugDevice2 ID3D12DebugDevice2; + +#endif /* __ID3D12DebugDevice2_FWD_DEFINED__ */ + + +#ifndef __ID3D12DebugCommandQueue_FWD_DEFINED__ +#define __ID3D12DebugCommandQueue_FWD_DEFINED__ +typedef interface ID3D12DebugCommandQueue ID3D12DebugCommandQueue; + +#endif /* __ID3D12DebugCommandQueue_FWD_DEFINED__ */ + + +#ifndef __ID3D12DebugCommandQueue1_FWD_DEFINED__ +#define __ID3D12DebugCommandQueue1_FWD_DEFINED__ +typedef interface ID3D12DebugCommandQueue1 ID3D12DebugCommandQueue1; + +#endif /* __ID3D12DebugCommandQueue1_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; + +#endif /* __ID3D12DebugCommandList_FWD_DEFINED__ */ + + +#ifndef __ID3D12DebugCommandList2_FWD_DEFINED__ +#define __ID3D12DebugCommandList2_FWD_DEFINED__ +typedef interface ID3D12DebugCommandList2 ID3D12DebugCommandList2; + +#endif /* __ID3D12DebugCommandList2_FWD_DEFINED__ */ + + +#ifndef __ID3D12DebugCommandList3_FWD_DEFINED__ +#define __ID3D12DebugCommandList3_FWD_DEFINED__ +typedef interface ID3D12DebugCommandList3 ID3D12DebugCommandList3; + +#endif /* __ID3D12DebugCommandList3_FWD_DEFINED__ */ + + +#ifndef __ID3D12SharingContract_FWD_DEFINED__ +#define __ID3D12SharingContract_FWD_DEFINED__ +typedef interface ID3D12SharingContract ID3D12SharingContract; + +#endif /* __ID3D12SharingContract_FWD_DEFINED__ */ + + +#ifndef __ID3D12ManualWriteTrackingResource_FWD_DEFINED__ +#define __ID3D12ManualWriteTrackingResource_FWD_DEFINED__ +typedef interface ID3D12ManualWriteTrackingResource ID3D12ManualWriteTrackingResource; + +#endif /* __ID3D12ManualWriteTrackingResource_FWD_DEFINED__ */ + + +#ifndef __ID3D12InfoQueue_FWD_DEFINED__ +#define __ID3D12InfoQueue_FWD_DEFINED__ +typedef interface ID3D12InfoQueue ID3D12InfoQueue; + +#endif /* __ID3D12InfoQueue_FWD_DEFINED__ */ + + +#ifndef __ID3D12InfoQueue1_FWD_DEFINED__ +#define __ID3D12InfoQueue1_FWD_DEFINED__ +typedef interface ID3D12InfoQueue1 ID3D12InfoQueue1; + +#endif /* __ID3D12InfoQueue1_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "d3d12.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3d12sdklayers_0000_0000 */ +/* [local] */ + +#include +#pragma region App Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D12Debug_INTERFACE_DEFINED__ +#define __ID3D12Debug_INTERFACE_DEFINED__ + +/* interface ID3D12Debug */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Debug; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("344488b7-6846-474b-b989-f027448245e0") + ID3D12Debug : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE EnableDebugLayer( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DebugVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Debug * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Debug * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Debug * This); + + DECLSPEC_XFGVIRT(ID3D12Debug, EnableDebugLayer) + void ( STDMETHODCALLTYPE *EnableDebugLayer )( + ID3D12Debug * This); + + END_INTERFACE + } ID3D12DebugVtbl; + + interface ID3D12Debug + { + CONST_VTBL struct ID3D12DebugVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Debug_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Debug_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Debug_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Debug_EnableDebugLayer(This) \ + ( (This)->lpVtbl -> EnableDebugLayer(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Debug_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12sdklayers_0000_0001 */ +/* [local] */ + +typedef +enum D3D12_GPU_BASED_VALIDATION_FLAGS + { + D3D12_GPU_BASED_VALIDATION_FLAGS_NONE = 0, + D3D12_GPU_BASED_VALIDATION_FLAGS_DISABLE_STATE_TRACKING = 0x1 + } D3D12_GPU_BASED_VALIDATION_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_GPU_BASED_VALIDATION_FLAGS) + + +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; + +#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 + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Debug1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Debug1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Debug1 * This); + + DECLSPEC_XFGVIRT(ID3D12Debug1, EnableDebugLayer) + void ( STDMETHODCALLTYPE *EnableDebugLayer )( + ID3D12Debug1 * This); + + DECLSPEC_XFGVIRT(ID3D12Debug1, SetEnableGPUBasedValidation) + void ( STDMETHODCALLTYPE *SetEnableGPUBasedValidation )( + ID3D12Debug1 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Debug1, SetEnableSynchronizedCommandQueueValidation) + 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__ */ + + +#ifndef __ID3D12Debug2_INTERFACE_DEFINED__ +#define __ID3D12Debug2_INTERFACE_DEFINED__ + +/* interface ID3D12Debug2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Debug2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("93a665c4-a3b2-4e5d-b692-a26ae14e3374") + ID3D12Debug2 : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE SetGPUBasedValidationFlags( + D3D12_GPU_BASED_VALIDATION_FLAGS Flags) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Debug2Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Debug2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Debug2 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Debug2 * This); + + DECLSPEC_XFGVIRT(ID3D12Debug2, SetGPUBasedValidationFlags) + void ( STDMETHODCALLTYPE *SetGPUBasedValidationFlags )( + ID3D12Debug2 * This, + D3D12_GPU_BASED_VALIDATION_FLAGS Flags); + + END_INTERFACE + } ID3D12Debug2Vtbl; + + interface ID3D12Debug2 + { + CONST_VTBL struct ID3D12Debug2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Debug2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Debug2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Debug2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Debug2_SetGPUBasedValidationFlags(This,Flags) \ + ( (This)->lpVtbl -> SetGPUBasedValidationFlags(This,Flags) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Debug2_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Debug3_INTERFACE_DEFINED__ +#define __ID3D12Debug3_INTERFACE_DEFINED__ + +/* interface ID3D12Debug3 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Debug3; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5cf4e58f-f671-4ff1-a542-3686e3d153d1") + ID3D12Debug3 : public ID3D12Debug + { + public: + virtual void STDMETHODCALLTYPE SetEnableGPUBasedValidation( + BOOL Enable) = 0; + + virtual void STDMETHODCALLTYPE SetEnableSynchronizedCommandQueueValidation( + BOOL Enable) = 0; + + virtual void STDMETHODCALLTYPE SetGPUBasedValidationFlags( + D3D12_GPU_BASED_VALIDATION_FLAGS Flags) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Debug3Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Debug3 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Debug3 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Debug3 * This); + + DECLSPEC_XFGVIRT(ID3D12Debug, EnableDebugLayer) + void ( STDMETHODCALLTYPE *EnableDebugLayer )( + ID3D12Debug3 * This); + + DECLSPEC_XFGVIRT(ID3D12Debug3, SetEnableGPUBasedValidation) + void ( STDMETHODCALLTYPE *SetEnableGPUBasedValidation )( + ID3D12Debug3 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Debug3, SetEnableSynchronizedCommandQueueValidation) + void ( STDMETHODCALLTYPE *SetEnableSynchronizedCommandQueueValidation )( + ID3D12Debug3 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Debug3, SetGPUBasedValidationFlags) + void ( STDMETHODCALLTYPE *SetGPUBasedValidationFlags )( + ID3D12Debug3 * This, + D3D12_GPU_BASED_VALIDATION_FLAGS Flags); + + END_INTERFACE + } ID3D12Debug3Vtbl; + + interface ID3D12Debug3 + { + CONST_VTBL struct ID3D12Debug3Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Debug3_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Debug3_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Debug3_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Debug3_EnableDebugLayer(This) \ + ( (This)->lpVtbl -> EnableDebugLayer(This) ) + + +#define ID3D12Debug3_SetEnableGPUBasedValidation(This,Enable) \ + ( (This)->lpVtbl -> SetEnableGPUBasedValidation(This,Enable) ) + +#define ID3D12Debug3_SetEnableSynchronizedCommandQueueValidation(This,Enable) \ + ( (This)->lpVtbl -> SetEnableSynchronizedCommandQueueValidation(This,Enable) ) + +#define ID3D12Debug3_SetGPUBasedValidationFlags(This,Flags) \ + ( (This)->lpVtbl -> SetGPUBasedValidationFlags(This,Flags) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Debug3_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Debug4_INTERFACE_DEFINED__ +#define __ID3D12Debug4_INTERFACE_DEFINED__ + +/* interface ID3D12Debug4 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Debug4; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("014b816e-9ec5-4a2f-a845-ffbe441ce13a") + ID3D12Debug4 : public ID3D12Debug3 + { + public: + virtual void STDMETHODCALLTYPE DisableDebugLayer( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Debug4Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Debug4 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Debug4 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Debug4 * This); + + DECLSPEC_XFGVIRT(ID3D12Debug, EnableDebugLayer) + void ( STDMETHODCALLTYPE *EnableDebugLayer )( + ID3D12Debug4 * This); + + DECLSPEC_XFGVIRT(ID3D12Debug3, SetEnableGPUBasedValidation) + void ( STDMETHODCALLTYPE *SetEnableGPUBasedValidation )( + ID3D12Debug4 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Debug3, SetEnableSynchronizedCommandQueueValidation) + void ( STDMETHODCALLTYPE *SetEnableSynchronizedCommandQueueValidation )( + ID3D12Debug4 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Debug3, SetGPUBasedValidationFlags) + void ( STDMETHODCALLTYPE *SetGPUBasedValidationFlags )( + ID3D12Debug4 * This, + D3D12_GPU_BASED_VALIDATION_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12Debug4, DisableDebugLayer) + void ( STDMETHODCALLTYPE *DisableDebugLayer )( + ID3D12Debug4 * This); + + END_INTERFACE + } ID3D12Debug4Vtbl; + + interface ID3D12Debug4 + { + CONST_VTBL struct ID3D12Debug4Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Debug4_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Debug4_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Debug4_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Debug4_EnableDebugLayer(This) \ + ( (This)->lpVtbl -> EnableDebugLayer(This) ) + + +#define ID3D12Debug4_SetEnableGPUBasedValidation(This,Enable) \ + ( (This)->lpVtbl -> SetEnableGPUBasedValidation(This,Enable) ) + +#define ID3D12Debug4_SetEnableSynchronizedCommandQueueValidation(This,Enable) \ + ( (This)->lpVtbl -> SetEnableSynchronizedCommandQueueValidation(This,Enable) ) + +#define ID3D12Debug4_SetGPUBasedValidationFlags(This,Flags) \ + ( (This)->lpVtbl -> SetGPUBasedValidationFlags(This,Flags) ) + + +#define ID3D12Debug4_DisableDebugLayer(This) \ + ( (This)->lpVtbl -> DisableDebugLayer(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Debug4_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Debug5_INTERFACE_DEFINED__ +#define __ID3D12Debug5_INTERFACE_DEFINED__ + +/* interface ID3D12Debug5 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Debug5; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("548d6b12-09fa-40e0-9069-5dcd589a52c9") + ID3D12Debug5 : public ID3D12Debug4 + { + public: + virtual void STDMETHODCALLTYPE SetEnableAutoName( + BOOL Enable) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Debug5Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Debug5 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Debug5 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Debug5 * This); + + DECLSPEC_XFGVIRT(ID3D12Debug, EnableDebugLayer) + void ( STDMETHODCALLTYPE *EnableDebugLayer )( + ID3D12Debug5 * This); + + DECLSPEC_XFGVIRT(ID3D12Debug3, SetEnableGPUBasedValidation) + void ( STDMETHODCALLTYPE *SetEnableGPUBasedValidation )( + ID3D12Debug5 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Debug3, SetEnableSynchronizedCommandQueueValidation) + void ( STDMETHODCALLTYPE *SetEnableSynchronizedCommandQueueValidation )( + ID3D12Debug5 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Debug3, SetGPUBasedValidationFlags) + void ( STDMETHODCALLTYPE *SetGPUBasedValidationFlags )( + ID3D12Debug5 * This, + D3D12_GPU_BASED_VALIDATION_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12Debug4, DisableDebugLayer) + void ( STDMETHODCALLTYPE *DisableDebugLayer )( + ID3D12Debug5 * This); + + DECLSPEC_XFGVIRT(ID3D12Debug5, SetEnableAutoName) + void ( STDMETHODCALLTYPE *SetEnableAutoName )( + ID3D12Debug5 * This, + BOOL Enable); + + END_INTERFACE + } ID3D12Debug5Vtbl; + + interface ID3D12Debug5 + { + CONST_VTBL struct ID3D12Debug5Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Debug5_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Debug5_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Debug5_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Debug5_EnableDebugLayer(This) \ + ( (This)->lpVtbl -> EnableDebugLayer(This) ) + + +#define ID3D12Debug5_SetEnableGPUBasedValidation(This,Enable) \ + ( (This)->lpVtbl -> SetEnableGPUBasedValidation(This,Enable) ) + +#define ID3D12Debug5_SetEnableSynchronizedCommandQueueValidation(This,Enable) \ + ( (This)->lpVtbl -> SetEnableSynchronizedCommandQueueValidation(This,Enable) ) + +#define ID3D12Debug5_SetGPUBasedValidationFlags(This,Flags) \ + ( (This)->lpVtbl -> SetGPUBasedValidationFlags(This,Flags) ) + + +#define ID3D12Debug5_DisableDebugLayer(This) \ + ( (This)->lpVtbl -> DisableDebugLayer(This) ) + + +#define ID3D12Debug5_SetEnableAutoName(This,Enable) \ + ( (This)->lpVtbl -> SetEnableAutoName(This,Enable) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Debug5_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Debug6_INTERFACE_DEFINED__ +#define __ID3D12Debug6_INTERFACE_DEFINED__ + +/* interface ID3D12Debug6 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Debug6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("82a816d6-5d01-4157-97d0-4975463fd1ed") + ID3D12Debug6 : public ID3D12Debug5 + { + public: + virtual void STDMETHODCALLTYPE SetForceLegacyBarrierValidation( + BOOL Enable) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Debug6Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Debug6 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Debug6 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Debug6 * This); + + DECLSPEC_XFGVIRT(ID3D12Debug, EnableDebugLayer) + void ( STDMETHODCALLTYPE *EnableDebugLayer )( + ID3D12Debug6 * This); + + DECLSPEC_XFGVIRT(ID3D12Debug3, SetEnableGPUBasedValidation) + void ( STDMETHODCALLTYPE *SetEnableGPUBasedValidation )( + ID3D12Debug6 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Debug3, SetEnableSynchronizedCommandQueueValidation) + void ( STDMETHODCALLTYPE *SetEnableSynchronizedCommandQueueValidation )( + ID3D12Debug6 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Debug3, SetGPUBasedValidationFlags) + void ( STDMETHODCALLTYPE *SetGPUBasedValidationFlags )( + ID3D12Debug6 * This, + D3D12_GPU_BASED_VALIDATION_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12Debug4, DisableDebugLayer) + void ( STDMETHODCALLTYPE *DisableDebugLayer )( + ID3D12Debug6 * This); + + DECLSPEC_XFGVIRT(ID3D12Debug5, SetEnableAutoName) + void ( STDMETHODCALLTYPE *SetEnableAutoName )( + ID3D12Debug6 * This, + BOOL Enable); + + DECLSPEC_XFGVIRT(ID3D12Debug6, SetForceLegacyBarrierValidation) + void ( STDMETHODCALLTYPE *SetForceLegacyBarrierValidation )( + ID3D12Debug6 * This, + BOOL Enable); + + END_INTERFACE + } ID3D12Debug6Vtbl; + + interface ID3D12Debug6 + { + CONST_VTBL struct ID3D12Debug6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Debug6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Debug6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Debug6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Debug6_EnableDebugLayer(This) \ + ( (This)->lpVtbl -> EnableDebugLayer(This) ) + + +#define ID3D12Debug6_SetEnableGPUBasedValidation(This,Enable) \ + ( (This)->lpVtbl -> SetEnableGPUBasedValidation(This,Enable) ) + +#define ID3D12Debug6_SetEnableSynchronizedCommandQueueValidation(This,Enable) \ + ( (This)->lpVtbl -> SetEnableSynchronizedCommandQueueValidation(This,Enable) ) + +#define ID3D12Debug6_SetGPUBasedValidationFlags(This,Flags) \ + ( (This)->lpVtbl -> SetGPUBasedValidationFlags(This,Flags) ) + + +#define ID3D12Debug6_DisableDebugLayer(This) \ + ( (This)->lpVtbl -> DisableDebugLayer(This) ) + + +#define ID3D12Debug6_SetEnableAutoName(This,Enable) \ + ( (This)->lpVtbl -> SetEnableAutoName(This,Enable) ) + + +#define ID3D12Debug6_SetForceLegacyBarrierValidation(This,Enable) \ + ( (This)->lpVtbl -> SetForceLegacyBarrierValidation(This,Enable) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Debug6_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12sdklayers_0000_0007 */ +/* [local] */ + +DEFINE_GUID(WKPDID_D3DAutoDebugObjectNameW, 0xd4902e36, 0x757a, 0x4942, 0x95, 0x94, 0xb6, 0x76, 0x9a, 0xfa, 0x43, 0xcd); +typedef +enum D3D12_RLDO_FLAGS + { + D3D12_RLDO_NONE = 0, + D3D12_RLDO_SUMMARY = 0x1, + D3D12_RLDO_DETAIL = 0x2, + D3D12_RLDO_IGNORE_INTERNAL = 0x4 + } 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_GPU_SLOWDOWN_PERFORMANCE_FACTOR = ( D3D12_DEBUG_DEVICE_PARAMETER_GPU_BASED_VALIDATION_SETTINGS + 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_EMULATE_WINDOWS7 = 0x8 + } 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; + +typedef struct D3D12_DEBUG_DEVICE_GPU_SLOWDOWN_PERFORMANCE_FACTOR + { + FLOAT SlowdownFactor; + } D3D12_DEBUG_DEVICE_GPU_SLOWDOWN_PERFORMANCE_FACTOR; + + + +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 __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 + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DebugDevice1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DebugDevice1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DebugDevice1 * This); + + DECLSPEC_XFGVIRT(ID3D12DebugDevice1, SetDebugParameter) + HRESULT ( STDMETHODCALLTYPE *SetDebugParameter )( + ID3D12DebugDevice1 * This, + D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type, + _In_reads_bytes_(DataSize) const void *pData, + UINT DataSize); + + DECLSPEC_XFGVIRT(ID3D12DebugDevice1, GetDebugParameter) + HRESULT ( STDMETHODCALLTYPE *GetDebugParameter )( + ID3D12DebugDevice1 * This, + D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type, + _Out_writes_bytes_(DataSize) void *pData, + UINT DataSize); + + DECLSPEC_XFGVIRT(ID3D12DebugDevice1, ReportLiveDeviceObjects) + 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__ + +/* interface ID3D12DebugDevice */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DebugDevice; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3febd6dd-4973-4787-8194-e45f9e28923e") + ID3D12DebugDevice : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetFeatureMask( + D3D12_DEBUG_FEATURE Mask) = 0; + + virtual D3D12_DEBUG_FEATURE STDMETHODCALLTYPE GetFeatureMask( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReportLiveDeviceObjects( + D3D12_RLDO_FLAGS Flags) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DebugDeviceVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DebugDevice * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DebugDevice * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DebugDevice * This); + + DECLSPEC_XFGVIRT(ID3D12DebugDevice, SetFeatureMask) + HRESULT ( STDMETHODCALLTYPE *SetFeatureMask )( + ID3D12DebugDevice * This, + D3D12_DEBUG_FEATURE Mask); + + DECLSPEC_XFGVIRT(ID3D12DebugDevice, GetFeatureMask) + D3D12_DEBUG_FEATURE ( STDMETHODCALLTYPE *GetFeatureMask )( + ID3D12DebugDevice * This); + + DECLSPEC_XFGVIRT(ID3D12DebugDevice, ReportLiveDeviceObjects) + HRESULT ( STDMETHODCALLTYPE *ReportLiveDeviceObjects )( + ID3D12DebugDevice * This, + D3D12_RLDO_FLAGS Flags); + + END_INTERFACE + } ID3D12DebugDeviceVtbl; + + interface ID3D12DebugDevice + { + CONST_VTBL struct ID3D12DebugDeviceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DebugDevice_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DebugDevice_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DebugDevice_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DebugDevice_SetFeatureMask(This,Mask) \ + ( (This)->lpVtbl -> SetFeatureMask(This,Mask) ) + +#define ID3D12DebugDevice_GetFeatureMask(This) \ + ( (This)->lpVtbl -> GetFeatureMask(This) ) + +#define ID3D12DebugDevice_ReportLiveDeviceObjects(This,Flags) \ + ( (This)->lpVtbl -> ReportLiveDeviceObjects(This,Flags) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DebugDevice_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12DebugDevice2_INTERFACE_DEFINED__ +#define __ID3D12DebugDevice2_INTERFACE_DEFINED__ + +/* interface ID3D12DebugDevice2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DebugDevice2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("60eccbc1-378d-4df1-894c-f8ac5ce4d7dd") + ID3D12DebugDevice2 : public ID3D12DebugDevice + { + 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; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DebugDevice2Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DebugDevice2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DebugDevice2 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DebugDevice2 * This); + + DECLSPEC_XFGVIRT(ID3D12DebugDevice, SetFeatureMask) + HRESULT ( STDMETHODCALLTYPE *SetFeatureMask )( + ID3D12DebugDevice2 * This, + D3D12_DEBUG_FEATURE Mask); + + DECLSPEC_XFGVIRT(ID3D12DebugDevice, GetFeatureMask) + D3D12_DEBUG_FEATURE ( STDMETHODCALLTYPE *GetFeatureMask )( + ID3D12DebugDevice2 * This); + + DECLSPEC_XFGVIRT(ID3D12DebugDevice, ReportLiveDeviceObjects) + HRESULT ( STDMETHODCALLTYPE *ReportLiveDeviceObjects )( + ID3D12DebugDevice2 * This, + D3D12_RLDO_FLAGS Flags); + + DECLSPEC_XFGVIRT(ID3D12DebugDevice2, SetDebugParameter) + HRESULT ( STDMETHODCALLTYPE *SetDebugParameter )( + ID3D12DebugDevice2 * This, + D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type, + _In_reads_bytes_(DataSize) const void *pData, + UINT DataSize); + + DECLSPEC_XFGVIRT(ID3D12DebugDevice2, GetDebugParameter) + HRESULT ( STDMETHODCALLTYPE *GetDebugParameter )( + ID3D12DebugDevice2 * This, + D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type, + _Out_writes_bytes_(DataSize) void *pData, + UINT DataSize); + + END_INTERFACE + } ID3D12DebugDevice2Vtbl; + + interface ID3D12DebugDevice2 + { + CONST_VTBL struct ID3D12DebugDevice2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DebugDevice2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DebugDevice2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DebugDevice2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DebugDevice2_SetFeatureMask(This,Mask) \ + ( (This)->lpVtbl -> SetFeatureMask(This,Mask) ) + +#define ID3D12DebugDevice2_GetFeatureMask(This) \ + ( (This)->lpVtbl -> GetFeatureMask(This) ) + +#define ID3D12DebugDevice2_ReportLiveDeviceObjects(This,Flags) \ + ( (This)->lpVtbl -> ReportLiveDeviceObjects(This,Flags) ) + + +#define ID3D12DebugDevice2_SetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> SetDebugParameter(This,Type,pData,DataSize) ) + +#define ID3D12DebugDevice2_GetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> GetDebugParameter(This,Type,pData,DataSize) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DebugDevice2_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12sdklayers_0000_0010 */ +/* [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_0010_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0010_v0_0_s_ifspec; + +#ifndef __ID3D12DebugCommandQueue_INTERFACE_DEFINED__ +#define __ID3D12DebugCommandQueue_INTERFACE_DEFINED__ + +/* interface ID3D12DebugCommandQueue */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DebugCommandQueue; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("09e0bf36-54ac-484f-8847-4baeeab6053a") + ID3D12DebugCommandQueue : public IUnknown + { + public: + virtual BOOL STDMETHODCALLTYPE AssertResourceState( + _In_ ID3D12Resource *pResource, + UINT Subresource, + UINT State) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DebugCommandQueueVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DebugCommandQueue * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DebugCommandQueue * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DebugCommandQueue * This); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandQueue, AssertResourceState) + BOOL ( STDMETHODCALLTYPE *AssertResourceState )( + ID3D12DebugCommandQueue * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + UINT State); + + END_INTERFACE + } ID3D12DebugCommandQueueVtbl; + + interface ID3D12DebugCommandQueue + { + CONST_VTBL struct ID3D12DebugCommandQueueVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DebugCommandQueue_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DebugCommandQueue_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DebugCommandQueue_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DebugCommandQueue_AssertResourceState(This,pResource,Subresource,State) \ + ( (This)->lpVtbl -> AssertResourceState(This,pResource,Subresource,State) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DebugCommandQueue_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12DebugCommandQueue1_INTERFACE_DEFINED__ +#define __ID3D12DebugCommandQueue1_INTERFACE_DEFINED__ + +/* interface ID3D12DebugCommandQueue1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DebugCommandQueue1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("16be35a2-bfd6-49f2-bcae-eaae4aff862d") + ID3D12DebugCommandQueue1 : public ID3D12DebugCommandQueue + { + public: + virtual void STDMETHODCALLTYPE AssertResourceAccess( + _In_ ID3D12Resource *pResource, + UINT Subresource, + D3D12_BARRIER_ACCESS Access) = 0; + + virtual void STDMETHODCALLTYPE AssertTextureLayout( + _In_ ID3D12Resource *pResource, + UINT Subresource, + D3D12_BARRIER_LAYOUT Layout) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DebugCommandQueue1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DebugCommandQueue1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DebugCommandQueue1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DebugCommandQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandQueue, AssertResourceState) + BOOL ( STDMETHODCALLTYPE *AssertResourceState )( + ID3D12DebugCommandQueue1 * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + UINT State); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandQueue1, AssertResourceAccess) + void ( STDMETHODCALLTYPE *AssertResourceAccess )( + ID3D12DebugCommandQueue1 * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + D3D12_BARRIER_ACCESS Access); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandQueue1, AssertTextureLayout) + void ( STDMETHODCALLTYPE *AssertTextureLayout )( + ID3D12DebugCommandQueue1 * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + D3D12_BARRIER_LAYOUT Layout); + + END_INTERFACE + } ID3D12DebugCommandQueue1Vtbl; + + interface ID3D12DebugCommandQueue1 + { + CONST_VTBL struct ID3D12DebugCommandQueue1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DebugCommandQueue1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DebugCommandQueue1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DebugCommandQueue1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DebugCommandQueue1_AssertResourceState(This,pResource,Subresource,State) \ + ( (This)->lpVtbl -> AssertResourceState(This,pResource,Subresource,State) ) + + +#define ID3D12DebugCommandQueue1_AssertResourceAccess(This,pResource,Subresource,Access) \ + ( (This)->lpVtbl -> AssertResourceAccess(This,pResource,Subresource,Access) ) + +#define ID3D12DebugCommandQueue1_AssertTextureLayout(This,pResource,Subresource,Layout) \ + ( (This)->lpVtbl -> AssertTextureLayout(This,pResource,Subresource,Layout) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DebugCommandQueue1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12sdklayers_0000_0012 */ +/* [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_0012_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0012_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 + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DebugCommandList1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DebugCommandList1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DebugCommandList1 * This); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList1, AssertResourceState) + BOOL ( STDMETHODCALLTYPE *AssertResourceState )( + ID3D12DebugCommandList1 * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + UINT State); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList1, SetDebugParameter) + HRESULT ( STDMETHODCALLTYPE *SetDebugParameter )( + ID3D12DebugCommandList1 * This, + D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, + _In_reads_bytes_(DataSize) const void *pData, + UINT DataSize); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList1, GetDebugParameter) + 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__ + +/* interface ID3D12DebugCommandList */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DebugCommandList; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("09e0bf36-54ac-484f-8847-4baeeab6053f") + ID3D12DebugCommandList : public IUnknown + { + public: + virtual BOOL STDMETHODCALLTYPE AssertResourceState( + _In_ ID3D12Resource *pResource, + UINT Subresource, + UINT State) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFeatureMask( + D3D12_DEBUG_FEATURE Mask) = 0; + + virtual D3D12_DEBUG_FEATURE STDMETHODCALLTYPE GetFeatureMask( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DebugCommandListVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DebugCommandList * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DebugCommandList * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DebugCommandList * This); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList, AssertResourceState) + BOOL ( STDMETHODCALLTYPE *AssertResourceState )( + ID3D12DebugCommandList * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + UINT State); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList, SetFeatureMask) + HRESULT ( STDMETHODCALLTYPE *SetFeatureMask )( + ID3D12DebugCommandList * This, + D3D12_DEBUG_FEATURE Mask); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList, GetFeatureMask) + D3D12_DEBUG_FEATURE ( STDMETHODCALLTYPE *GetFeatureMask )( + ID3D12DebugCommandList * This); + + END_INTERFACE + } ID3D12DebugCommandListVtbl; + + interface ID3D12DebugCommandList + { + CONST_VTBL struct ID3D12DebugCommandListVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DebugCommandList_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DebugCommandList_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DebugCommandList_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DebugCommandList_AssertResourceState(This,pResource,Subresource,State) \ + ( (This)->lpVtbl -> AssertResourceState(This,pResource,Subresource,State) ) + +#define ID3D12DebugCommandList_SetFeatureMask(This,Mask) \ + ( (This)->lpVtbl -> SetFeatureMask(This,Mask) ) + +#define ID3D12DebugCommandList_GetFeatureMask(This) \ + ( (This)->lpVtbl -> GetFeatureMask(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DebugCommandList_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12DebugCommandList2_INTERFACE_DEFINED__ +#define __ID3D12DebugCommandList2_INTERFACE_DEFINED__ + +/* interface ID3D12DebugCommandList2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DebugCommandList2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("aeb575cf-4e06-48be-ba3b-c450fc96652e") + ID3D12DebugCommandList2 : public ID3D12DebugCommandList + { + public: + 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 ID3D12DebugCommandList2Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DebugCommandList2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DebugCommandList2 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DebugCommandList2 * This); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList, AssertResourceState) + BOOL ( STDMETHODCALLTYPE *AssertResourceState )( + ID3D12DebugCommandList2 * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + UINT State); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList, SetFeatureMask) + HRESULT ( STDMETHODCALLTYPE *SetFeatureMask )( + ID3D12DebugCommandList2 * This, + D3D12_DEBUG_FEATURE Mask); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList, GetFeatureMask) + D3D12_DEBUG_FEATURE ( STDMETHODCALLTYPE *GetFeatureMask )( + ID3D12DebugCommandList2 * This); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList2, SetDebugParameter) + HRESULT ( STDMETHODCALLTYPE *SetDebugParameter )( + ID3D12DebugCommandList2 * This, + D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, + _In_reads_bytes_(DataSize) const void *pData, + UINT DataSize); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList2, GetDebugParameter) + HRESULT ( STDMETHODCALLTYPE *GetDebugParameter )( + ID3D12DebugCommandList2 * This, + D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, + _Out_writes_bytes_(DataSize) void *pData, + UINT DataSize); + + END_INTERFACE + } ID3D12DebugCommandList2Vtbl; + + interface ID3D12DebugCommandList2 + { + CONST_VTBL struct ID3D12DebugCommandList2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DebugCommandList2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DebugCommandList2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DebugCommandList2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DebugCommandList2_AssertResourceState(This,pResource,Subresource,State) \ + ( (This)->lpVtbl -> AssertResourceState(This,pResource,Subresource,State) ) + +#define ID3D12DebugCommandList2_SetFeatureMask(This,Mask) \ + ( (This)->lpVtbl -> SetFeatureMask(This,Mask) ) + +#define ID3D12DebugCommandList2_GetFeatureMask(This) \ + ( (This)->lpVtbl -> GetFeatureMask(This) ) + + +#define ID3D12DebugCommandList2_SetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> SetDebugParameter(This,Type,pData,DataSize) ) + +#define ID3D12DebugCommandList2_GetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> GetDebugParameter(This,Type,pData,DataSize) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DebugCommandList2_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12DebugCommandList3_INTERFACE_DEFINED__ +#define __ID3D12DebugCommandList3_INTERFACE_DEFINED__ + +/* interface ID3D12DebugCommandList3 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DebugCommandList3; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("197d5e15-4d37-4d34-af78-724cd70fdb1f") + ID3D12DebugCommandList3 : public ID3D12DebugCommandList2 + { + public: + virtual void STDMETHODCALLTYPE AssertResourceAccess( + _In_ ID3D12Resource *pResource, + UINT Subresource, + D3D12_BARRIER_ACCESS Access) = 0; + + virtual void STDMETHODCALLTYPE AssertTextureLayout( + _In_ ID3D12Resource *pResource, + UINT Subresource, + D3D12_BARRIER_LAYOUT Layout) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DebugCommandList3Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DebugCommandList3 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DebugCommandList3 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DebugCommandList3 * This); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList, AssertResourceState) + BOOL ( STDMETHODCALLTYPE *AssertResourceState )( + ID3D12DebugCommandList3 * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + UINT State); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList, SetFeatureMask) + HRESULT ( STDMETHODCALLTYPE *SetFeatureMask )( + ID3D12DebugCommandList3 * This, + D3D12_DEBUG_FEATURE Mask); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList, GetFeatureMask) + D3D12_DEBUG_FEATURE ( STDMETHODCALLTYPE *GetFeatureMask )( + ID3D12DebugCommandList3 * This); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList2, SetDebugParameter) + HRESULT ( STDMETHODCALLTYPE *SetDebugParameter )( + ID3D12DebugCommandList3 * This, + D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, + _In_reads_bytes_(DataSize) const void *pData, + UINT DataSize); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList2, GetDebugParameter) + HRESULT ( STDMETHODCALLTYPE *GetDebugParameter )( + ID3D12DebugCommandList3 * This, + D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, + _Out_writes_bytes_(DataSize) void *pData, + UINT DataSize); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList3, AssertResourceAccess) + void ( STDMETHODCALLTYPE *AssertResourceAccess )( + ID3D12DebugCommandList3 * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + D3D12_BARRIER_ACCESS Access); + + DECLSPEC_XFGVIRT(ID3D12DebugCommandList3, AssertTextureLayout) + void ( STDMETHODCALLTYPE *AssertTextureLayout )( + ID3D12DebugCommandList3 * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + D3D12_BARRIER_LAYOUT Layout); + + END_INTERFACE + } ID3D12DebugCommandList3Vtbl; + + interface ID3D12DebugCommandList3 + { + CONST_VTBL struct ID3D12DebugCommandList3Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DebugCommandList3_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DebugCommandList3_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DebugCommandList3_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DebugCommandList3_AssertResourceState(This,pResource,Subresource,State) \ + ( (This)->lpVtbl -> AssertResourceState(This,pResource,Subresource,State) ) + +#define ID3D12DebugCommandList3_SetFeatureMask(This,Mask) \ + ( (This)->lpVtbl -> SetFeatureMask(This,Mask) ) + +#define ID3D12DebugCommandList3_GetFeatureMask(This) \ + ( (This)->lpVtbl -> GetFeatureMask(This) ) + + +#define ID3D12DebugCommandList3_SetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> SetDebugParameter(This,Type,pData,DataSize) ) + +#define ID3D12DebugCommandList3_GetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> GetDebugParameter(This,Type,pData,DataSize) ) + + +#define ID3D12DebugCommandList3_AssertResourceAccess(This,pResource,Subresource,Access) \ + ( (This)->lpVtbl -> AssertResourceAccess(This,pResource,Subresource,Access) ) + +#define ID3D12DebugCommandList3_AssertTextureLayout(This,pResource,Subresource,Layout) \ + ( (This)->lpVtbl -> AssertTextureLayout(This,pResource,Subresource,Layout) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DebugCommandList3_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12SharingContract_INTERFACE_DEFINED__ +#define __ID3D12SharingContract_INTERFACE_DEFINED__ + +/* interface ID3D12SharingContract */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12SharingContract; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0adf7d52-929c-4e61-addb-ffed30de66ef") + ID3D12SharingContract : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE Present( + _In_ ID3D12Resource *pResource, + UINT Subresource, + _In_ HWND window) = 0; + + virtual void STDMETHODCALLTYPE SharedFenceSignal( + _In_ ID3D12Fence *pFence, + UINT64 FenceValue) = 0; + + virtual void STDMETHODCALLTYPE BeginCapturableWork( + _In_ REFGUID guid) = 0; + + virtual void STDMETHODCALLTYPE EndCapturableWork( + _In_ REFGUID guid) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12SharingContractVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12SharingContract * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12SharingContract * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12SharingContract * This); + + DECLSPEC_XFGVIRT(ID3D12SharingContract, Present) + void ( STDMETHODCALLTYPE *Present )( + ID3D12SharingContract * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + _In_ HWND window); + + DECLSPEC_XFGVIRT(ID3D12SharingContract, SharedFenceSignal) + void ( STDMETHODCALLTYPE *SharedFenceSignal )( + ID3D12SharingContract * This, + _In_ ID3D12Fence *pFence, + UINT64 FenceValue); + + DECLSPEC_XFGVIRT(ID3D12SharingContract, BeginCapturableWork) + void ( STDMETHODCALLTYPE *BeginCapturableWork )( + ID3D12SharingContract * This, + _In_ REFGUID guid); + + DECLSPEC_XFGVIRT(ID3D12SharingContract, EndCapturableWork) + void ( STDMETHODCALLTYPE *EndCapturableWork )( + ID3D12SharingContract * This, + _In_ REFGUID guid); + + END_INTERFACE + } ID3D12SharingContractVtbl; + + interface ID3D12SharingContract + { + CONST_VTBL struct ID3D12SharingContractVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12SharingContract_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12SharingContract_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12SharingContract_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12SharingContract_Present(This,pResource,Subresource,window) \ + ( (This)->lpVtbl -> Present(This,pResource,Subresource,window) ) + +#define ID3D12SharingContract_SharedFenceSignal(This,pFence,FenceValue) \ + ( (This)->lpVtbl -> SharedFenceSignal(This,pFence,FenceValue) ) + +#define ID3D12SharingContract_BeginCapturableWork(This,guid) \ + ( (This)->lpVtbl -> BeginCapturableWork(This,guid) ) + +#define ID3D12SharingContract_EndCapturableWork(This,guid) \ + ( (This)->lpVtbl -> EndCapturableWork(This,guid) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12SharingContract_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12ManualWriteTrackingResource_INTERFACE_DEFINED__ +#define __ID3D12ManualWriteTrackingResource_INTERFACE_DEFINED__ + +/* interface ID3D12ManualWriteTrackingResource */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12ManualWriteTrackingResource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("86ca3b85-49ad-4b6e-aed5-eddb18540f41") + ID3D12ManualWriteTrackingResource : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE TrackWrite( + UINT Subresource, + _In_opt_ const D3D12_RANGE *pWrittenRange) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12ManualWriteTrackingResourceVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12ManualWriteTrackingResource * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12ManualWriteTrackingResource * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12ManualWriteTrackingResource * This); + + DECLSPEC_XFGVIRT(ID3D12ManualWriteTrackingResource, TrackWrite) + void ( STDMETHODCALLTYPE *TrackWrite )( + ID3D12ManualWriteTrackingResource * This, + UINT Subresource, + _In_opt_ const D3D12_RANGE *pWrittenRange); + + END_INTERFACE + } ID3D12ManualWriteTrackingResourceVtbl; + + interface ID3D12ManualWriteTrackingResource + { + CONST_VTBL struct ID3D12ManualWriteTrackingResourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12ManualWriteTrackingResource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12ManualWriteTrackingResource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12ManualWriteTrackingResource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12ManualWriteTrackingResource_TrackWrite(This,Subresource,pWrittenRange) \ + ( (This)->lpVtbl -> TrackWrite(This,Subresource,pWrittenRange) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12ManualWriteTrackingResource_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12sdklayers_0000_0018 */ +/* [local] */ + +typedef +enum D3D12_MESSAGE_CATEGORY + { + D3D12_MESSAGE_CATEGORY_APPLICATION_DEFINED = 0, + D3D12_MESSAGE_CATEGORY_MISCELLANEOUS = ( D3D12_MESSAGE_CATEGORY_APPLICATION_DEFINED + 1 ) , + D3D12_MESSAGE_CATEGORY_INITIALIZATION = ( D3D12_MESSAGE_CATEGORY_MISCELLANEOUS + 1 ) , + D3D12_MESSAGE_CATEGORY_CLEANUP = ( D3D12_MESSAGE_CATEGORY_INITIALIZATION + 1 ) , + D3D12_MESSAGE_CATEGORY_COMPILATION = ( D3D12_MESSAGE_CATEGORY_CLEANUP + 1 ) , + D3D12_MESSAGE_CATEGORY_STATE_CREATION = ( D3D12_MESSAGE_CATEGORY_COMPILATION + 1 ) , + D3D12_MESSAGE_CATEGORY_STATE_SETTING = ( D3D12_MESSAGE_CATEGORY_STATE_CREATION + 1 ) , + D3D12_MESSAGE_CATEGORY_STATE_GETTING = ( D3D12_MESSAGE_CATEGORY_STATE_SETTING + 1 ) , + D3D12_MESSAGE_CATEGORY_RESOURCE_MANIPULATION = ( D3D12_MESSAGE_CATEGORY_STATE_GETTING + 1 ) , + D3D12_MESSAGE_CATEGORY_EXECUTION = ( D3D12_MESSAGE_CATEGORY_RESOURCE_MANIPULATION + 1 ) , + D3D12_MESSAGE_CATEGORY_SHADER = ( D3D12_MESSAGE_CATEGORY_EXECUTION + 1 ) + } D3D12_MESSAGE_CATEGORY; + +typedef +enum D3D12_MESSAGE_SEVERITY + { + D3D12_MESSAGE_SEVERITY_CORRUPTION = 0, + D3D12_MESSAGE_SEVERITY_ERROR = ( D3D12_MESSAGE_SEVERITY_CORRUPTION + 1 ) , + D3D12_MESSAGE_SEVERITY_WARNING = ( D3D12_MESSAGE_SEVERITY_ERROR + 1 ) , + D3D12_MESSAGE_SEVERITY_INFO = ( D3D12_MESSAGE_SEVERITY_WARNING + 1 ) , + D3D12_MESSAGE_SEVERITY_MESSAGE = ( D3D12_MESSAGE_SEVERITY_INFO + 1 ) + } D3D12_MESSAGE_SEVERITY; + +typedef +enum D3D12_MESSAGE_ID + { + D3D12_MESSAGE_ID_UNKNOWN = 0, + D3D12_MESSAGE_ID_STRING_FROM_APPLICATION = 1, + D3D12_MESSAGE_ID_CORRUPTED_THIS = 2, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER1 = 3, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER2 = 4, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER3 = 5, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER4 = 6, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER5 = 7, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER6 = 8, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER7 = 9, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER8 = 10, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER9 = 11, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER10 = 12, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER11 = 13, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER12 = 14, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER13 = 15, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER14 = 16, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER15 = 17, + D3D12_MESSAGE_ID_CORRUPTED_MULTITHREADING = 18, + D3D12_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY = 19, + D3D12_MESSAGE_ID_GETPRIVATEDATA_MOREDATA = 20, + D3D12_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA = 21, + D3D12_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS = 24, + D3D12_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY = 25, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT = 26, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC = 27, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT = 28, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDVIDEOPLANESLICE = 29, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDPLANESLICE = 30, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS = 31, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE = 32, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT = 35, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT = 36, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC = 37, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT = 38, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDVIDEOPLANESLICE = 39, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDPLANESLICE = 40, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS = 41, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE = 42, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT = 45, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC = 46, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT = 47, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS = 48, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE = 49, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY = 52, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS = 53, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT = 54, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT = 55, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT = 56, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS = 57, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH = 58, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE = 59, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE = 60, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT = 61, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC = 62, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE = 63, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC = 64, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT = 65, + D3D12_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY = 66, + D3D12_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE = 67, + D3D12_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE = 68, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY = 69, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE = 70, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE = 71, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY = 72, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE = 73, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = 74, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES = 75, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED = 76, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED = 79, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT = 80, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT = 81, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT = 82, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT = 83, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION = 84, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT = 85, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE = 86, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC = 87, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH = 88, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS = 89, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX = 90, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE = 91, + D3D12_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY = 92, + D3D12_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE = 93, + D3D12_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE = 94, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE = 95, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE = 96, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP = 97, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS = 98, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK = 100, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC = 101, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP = 102, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP = 103, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP = 104, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC = 105, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP = 106, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP = 107, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP = 108, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC = 109, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND = 111, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND = 112, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP = 113, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA = 114, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA = 115, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA = 116, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK = 117, + D3D12_MESSAGE_ID_GET_PROGRAM_IDENTIFIER_ERROR = 118, + D3D12_MESSAGE_ID_GET_WORK_GRAPH_PROPERTIES_ERROR = 119, + D3D12_MESSAGE_ID_SET_PROGRAM_ERROR = 120, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID = 135, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_ROOT_SIGNATURE_NOT_SET = 200, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_ROOT_SIGNATURE_MISMATCH = 201, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_BUFFER_NOT_SET = 202, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL = 209, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_BUFFER_TOO_SMALL = 210, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_BUFFER_NOT_SET = 211, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_BUFFER_FORMAT_INVALID = 212, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_BUFFER_TOO_SMALL = 213, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INVALID_PRIMITIVETOPOLOGY = 219, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_STRIDE_UNALIGNED = 221, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_OFFSET_UNALIGNED = 222, + D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT = 232, + D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT = 233, + D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT = 234, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC = 239, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC = 240, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH = 245, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_EMPTY_LAYOUT = 253, + D3D12_MESSAGE_ID_LIVE_OBJECT_SUMMARY = 255, + D3D12_MESSAGE_ID_LIVE_DEVICE = 274, + D3D12_MESSAGE_ID_LIVE_SWAPCHAIN = 275, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFLAGS = 276, + D3D12_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDCLASSLINKAGE = 277, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDCLASSLINKAGE = 278, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAMTORASTERIZER = 280, + D3D12_MESSAGE_ID_CREATEPIXELSHADER_INVALIDCLASSLINKAGE = 283, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAM = 284, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDENTRIES = 285, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTRIDES = 286, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTRIDES = 287, + D3D12_MESSAGE_ID_CREATEHULLSHADER_OUTOFMEMORY = 289, + D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERBYTECODE = 290, + D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERTYPE = 291, + D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDCLASSLINKAGE = 292, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_OUTOFMEMORY = 294, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERBYTECODE = 295, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERTYPE = 296, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDCLASSLINKAGE = 297, + D3D12_MESSAGE_ID_RESOURCE_UNMAP_NOTMAPPED = 310, + D3D12_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_MISMATCHED_DATA_SIZE = 318, + D3D12_MESSAGE_ID_CREATECOMPUTESHADER_OUTOFMEMORY = 321, + D3D12_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDSHADERBYTECODE = 322, + D3D12_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDCLASSLINKAGE = 323, + D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 331, + D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 332, + D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 333, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 334, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEFLOATOPSNOTSUPPORTED = 335, + D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 336, + D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_DOUBLEFLOATOPSNOTSUPPORTED = 337, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDRESOURCE = 340, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDESC = 341, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFORMAT = 342, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDVIDEOPLANESLICE = 343, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDPLANESLICE = 344, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDIMENSIONS = 345, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_UNRECOGNIZEDFORMAT = 346, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFLAGS = 354, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFORCEDSAMPLECOUNT = 401, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDLOGICOPS = 403, + D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 410, + D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 412, + D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 414, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 416, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEEXTENSIONSNOTSUPPORTED = 418, + D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 420, + D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 422, + D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_UAVSNOTSUPPORTED = 425, + D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_UAVSNOTSUPPORTED = 426, + D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_UAVSNOTSUPPORTED = 427, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_UAVSNOTSUPPORTED = 428, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UAVSNOTSUPPORTED = 429, + D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_UAVSNOTSUPPORTED = 430, + D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_UAVSNOTSUPPORTED = 431, + D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDSOURCERECT = 447, + D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_EMPTYRECT = 448, + D3D12_MESSAGE_ID_UPDATETILEMAPPINGS_INVALID_PARAMETER = 493, + D3D12_MESSAGE_ID_COPYTILEMAPPINGS_INVALID_PARAMETER = 494, + D3D12_MESSAGE_ID_CREATEDEVICE_INVALIDARGS = 506, + D3D12_MESSAGE_ID_CREATEDEVICE_WARNING = 507, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_TYPE = 519, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_NULL_POINTER = 520, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_SUBRESOURCE = 521, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_RESERVED_BITS = 522, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISSING_BIND_FLAGS = 523, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_MISC_FLAGS = 524, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MATCHING_STATES = 525, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_COMBINATION = 526, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH = 527, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_RESOURCE = 528, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_SAMPLE_COUNT = 529, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_FLAGS = 530, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_COMBINED_FLAGS = 531, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_FLAGS_FOR_FORMAT = 532, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_SPLIT_BARRIER = 533, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_UNMATCHED_END = 534, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_UNMATCHED_BEGIN = 535, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_FLAG = 536, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_COMMAND_LIST_TYPE = 537, + D3D12_MESSAGE_ID_INVALID_SUBRESOURCE_STATE = 538, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_CONTENTION = 540, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_RESET = 541, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_RESET_BUNDLE = 542, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_CANNOT_RESET = 543, + D3D12_MESSAGE_ID_COMMAND_LIST_OPEN = 544, + D3D12_MESSAGE_ID_INVALID_BUNDLE_API = 546, + D3D12_MESSAGE_ID_COMMAND_LIST_CLOSED = 547, + D3D12_MESSAGE_ID_WRONG_COMMAND_ALLOCATOR_TYPE = 549, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_SYNC = 552, + D3D12_MESSAGE_ID_COMMAND_LIST_SYNC = 553, + D3D12_MESSAGE_ID_SET_DESCRIPTOR_HEAP_INVALID = 554, + D3D12_MESSAGE_ID_CREATE_COMMANDQUEUE = 557, + D3D12_MESSAGE_ID_CREATE_COMMANDALLOCATOR = 558, + D3D12_MESSAGE_ID_CREATE_PIPELINESTATE = 559, + D3D12_MESSAGE_ID_CREATE_COMMANDLIST12 = 560, + D3D12_MESSAGE_ID_CREATE_RESOURCE = 562, + D3D12_MESSAGE_ID_CREATE_DESCRIPTORHEAP = 563, + D3D12_MESSAGE_ID_CREATE_ROOTSIGNATURE = 564, + D3D12_MESSAGE_ID_CREATE_LIBRARY = 565, + D3D12_MESSAGE_ID_CREATE_HEAP = 566, + D3D12_MESSAGE_ID_CREATE_MONITOREDFENCE = 567, + D3D12_MESSAGE_ID_CREATE_QUERYHEAP = 568, + D3D12_MESSAGE_ID_CREATE_COMMANDSIGNATURE = 569, + D3D12_MESSAGE_ID_LIVE_COMMANDQUEUE = 570, + D3D12_MESSAGE_ID_LIVE_COMMANDALLOCATOR = 571, + D3D12_MESSAGE_ID_LIVE_PIPELINESTATE = 572, + D3D12_MESSAGE_ID_LIVE_COMMANDLIST12 = 573, + D3D12_MESSAGE_ID_LIVE_RESOURCE = 575, + D3D12_MESSAGE_ID_LIVE_DESCRIPTORHEAP = 576, + D3D12_MESSAGE_ID_LIVE_ROOTSIGNATURE = 577, + D3D12_MESSAGE_ID_LIVE_LIBRARY = 578, + D3D12_MESSAGE_ID_LIVE_HEAP = 579, + D3D12_MESSAGE_ID_LIVE_MONITOREDFENCE = 580, + D3D12_MESSAGE_ID_LIVE_QUERYHEAP = 581, + D3D12_MESSAGE_ID_LIVE_COMMANDSIGNATURE = 582, + D3D12_MESSAGE_ID_DESTROY_COMMANDQUEUE = 583, + D3D12_MESSAGE_ID_DESTROY_COMMANDALLOCATOR = 584, + D3D12_MESSAGE_ID_DESTROY_PIPELINESTATE = 585, + D3D12_MESSAGE_ID_DESTROY_COMMANDLIST12 = 586, + D3D12_MESSAGE_ID_DESTROY_RESOURCE = 588, + D3D12_MESSAGE_ID_DESTROY_DESCRIPTORHEAP = 589, + D3D12_MESSAGE_ID_DESTROY_ROOTSIGNATURE = 590, + D3D12_MESSAGE_ID_DESTROY_LIBRARY = 591, + D3D12_MESSAGE_ID_DESTROY_HEAP = 592, + D3D12_MESSAGE_ID_DESTROY_MONITOREDFENCE = 593, + D3D12_MESSAGE_ID_DESTROY_QUERYHEAP = 594, + D3D12_MESSAGE_ID_DESTROY_COMMANDSIGNATURE = 595, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDDIMENSIONS = 597, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDMISCFLAGS = 599, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDARG_RETURN = 602, + D3D12_MESSAGE_ID_CREATERESOURCE_OUTOFMEMORY_RETURN = 603, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDDESC = 604, + D3D12_MESSAGE_ID_POSSIBLY_INVALID_SUBRESOURCE_STATE = 607, + D3D12_MESSAGE_ID_INVALID_USE_OF_NON_RESIDENT_RESOURCE = 608, + D3D12_MESSAGE_ID_POSSIBLE_INVALID_USE_OF_NON_RESIDENT_RESOURCE = 609, + D3D12_MESSAGE_ID_BUNDLE_PIPELINE_STATE_MISMATCH = 610, + D3D12_MESSAGE_ID_PRIMITIVE_TOPOLOGY_MISMATCH_PIPELINE_STATE = 611, + D3D12_MESSAGE_ID_RENDER_TARGET_FORMAT_MISMATCH_PIPELINE_STATE = 613, + D3D12_MESSAGE_ID_RENDER_TARGET_SAMPLE_DESC_MISMATCH_PIPELINE_STATE = 614, + D3D12_MESSAGE_ID_DEPTH_STENCIL_FORMAT_MISMATCH_PIPELINE_STATE = 615, + D3D12_MESSAGE_ID_DEPTH_STENCIL_SAMPLE_DESC_MISMATCH_PIPELINE_STATE = 616, + D3D12_MESSAGE_ID_CREATESHADER_INVALIDBYTECODE = 622, + D3D12_MESSAGE_ID_CREATEHEAP_NULLDESC = 623, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDSIZE = 624, + D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDHEAPTYPE = 625, + D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDCPUPAGEPROPERTIES = 626, + D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDMEMORYPOOL = 627, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDPROPERTIES = 628, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDALIGNMENT = 629, + D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDMISCFLAGS = 630, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDMISCFLAGS = 631, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDARG_RETURN = 632, + D3D12_MESSAGE_ID_CREATEHEAP_OUTOFMEMORY_RETURN = 633, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_NULLHEAPPROPERTIES = 634, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDHEAPTYPE = 635, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDCPUPAGEPROPERTIES = 636, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDMEMORYPOOL = 637, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDHEAPPROPERTIES = 638, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDHEAPMISCFLAGS = 639, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDHEAPMISCFLAGS = 640, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDARG_RETURN = 641, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_OUTOFMEMORY_RETURN = 642, + D3D12_MESSAGE_ID_GETCUSTOMHEAPPROPERTIES_UNRECOGNIZEDHEAPTYPE = 643, + D3D12_MESSAGE_ID_GETCUSTOMHEAPPROPERTIES_INVALIDHEAPTYPE = 644, + D3D12_MESSAGE_ID_CREATE_DESCRIPTOR_HEAP_INVALID_DESC = 645, + D3D12_MESSAGE_ID_INVALID_DESCRIPTOR_HANDLE = 646, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALID_CONSERVATIVERASTERMODE = 647, + D3D12_MESSAGE_ID_CREATE_CONSTANT_BUFFER_VIEW_INVALID_RESOURCE = 649, + D3D12_MESSAGE_ID_CREATE_CONSTANT_BUFFER_VIEW_INVALID_DESC = 650, + D3D12_MESSAGE_ID_CREATE_UNORDEREDACCESS_VIEW_INVALID_COUNTER_USAGE = 652, + D3D12_MESSAGE_ID_COPY_DESCRIPTORS_INVALID_RANGES = 653, + D3D12_MESSAGE_ID_COPY_DESCRIPTORS_WRITE_ONLY_DESCRIPTOR = 654, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RTV_FORMAT_NOT_UNKNOWN = 655, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_RENDER_TARGET_COUNT = 656, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_VERTEX_SHADER_NOT_SET = 657, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INPUTLAYOUT_NOT_SET = 658, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_HS_DS_SIGNATURE_MISMATCH = 659, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_REGISTERINDEX = 660, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_COMPONENTTYPE = 661, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_REGISTERMASK = 662, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_SYSTEMVALUE = 663, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = 664, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_MINPRECISION = 665, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = 666, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_XOR_DS_MISMATCH = 667, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HULL_SHADER_INPUT_TOPOLOGY_MISMATCH = 668, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_DS_CONTROL_POINT_COUNT_MISMATCH = 669, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_DS_TESSELLATOR_DOMAIN_MISMATCH = 670, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = 671, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_USE_OF_FORCED_SAMPLE_COUNT = 672, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_PRIMITIVETOPOLOGY = 673, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_SYSTEMVALUE = 674, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = 675, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = 676, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_OUTPUT_TYPE_MISMATCH = 677, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_OM_RENDER_TARGET_DOES_NOT_SUPPORT_LOGIC_OPS = 678, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RENDERTARGETVIEW_NOT_SET = 679, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_DEPTHSTENCILVIEW_NOT_SET = 680, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_GS_INPUT_PRIMITIVE_MISMATCH = 681, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_POSITION_NOT_PRESENT = 682, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_MISSING_ROOT_SIGNATURE_FLAGS = 683, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_INDEX_BUFFER_PROPERTIES = 684, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_SAMPLE_DESC = 685, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_ROOT_SIGNATURE_MISMATCH = 686, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_DS_ROOT_SIGNATURE_MISMATCH = 687, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_VS_ROOT_SIGNATURE_MISMATCH = 688, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_GS_ROOT_SIGNATURE_MISMATCH = 689, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_ROOT_SIGNATURE_MISMATCH = 690, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_MISSING_ROOT_SIGNATURE = 691, + D3D12_MESSAGE_ID_EXECUTE_BUNDLE_OPEN_BUNDLE = 692, + D3D12_MESSAGE_ID_EXECUTE_BUNDLE_DESCRIPTOR_HEAP_MISMATCH = 693, + D3D12_MESSAGE_ID_EXECUTE_BUNDLE_TYPE = 694, + D3D12_MESSAGE_ID_DRAW_EMPTY_SCISSOR_RECTANGLE = 695, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_BLOB_NOT_FOUND = 696, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_DESERIALIZE_FAILED = 697, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_INVALID_CONFIGURATION = 698, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_NOT_SUPPORTED_ON_DEVICE = 699, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_NULLRESOURCEPROPERTIES = 700, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_NULLHEAP = 701, + D3D12_MESSAGE_ID_GETRESOURCEALLOCATIONINFO_INVALIDRDESCS = 702, + D3D12_MESSAGE_ID_MAKERESIDENT_NULLOBJECTARRAY = 703, + D3D12_MESSAGE_ID_EVICT_NULLOBJECTARRAY = 705, + D3D12_MESSAGE_ID_SET_DESCRIPTOR_TABLE_INVALID = 708, + D3D12_MESSAGE_ID_SET_ROOT_CONSTANT_INVALID = 709, + D3D12_MESSAGE_ID_SET_ROOT_CONSTANT_BUFFER_VIEW_INVALID = 710, + D3D12_MESSAGE_ID_SET_ROOT_SHADER_RESOURCE_VIEW_INVALID = 711, + D3D12_MESSAGE_ID_SET_ROOT_UNORDERED_ACCESS_VIEW_INVALID = 712, + D3D12_MESSAGE_ID_SET_VERTEX_BUFFERS_INVALID_DESC = 713, + D3D12_MESSAGE_ID_SET_INDEX_BUFFER_INVALID_DESC = 715, + D3D12_MESSAGE_ID_SET_STREAM_OUTPUT_BUFFERS_INVALID_DESC = 717, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDDIMENSIONALITY = 718, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDLAYOUT = 719, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDDIMENSIONALITY = 720, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDALIGNMENT = 721, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDMIPLEVELS = 722, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDSAMPLEDESC = 723, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDLAYOUT = 724, + D3D12_MESSAGE_ID_SET_INDEX_BUFFER_INVALID = 725, + D3D12_MESSAGE_ID_SET_VERTEX_BUFFERS_INVALID = 726, + D3D12_MESSAGE_ID_SET_STREAM_OUTPUT_BUFFERS_INVALID = 727, + D3D12_MESSAGE_ID_SET_RENDER_TARGETS_INVALID = 728, + D3D12_MESSAGE_ID_CREATEQUERY_HEAP_INVALID_PARAMETERS = 729, + D3D12_MESSAGE_ID_BEGIN_END_QUERY_INVALID_PARAMETERS = 731, + D3D12_MESSAGE_ID_CLOSE_COMMAND_LIST_OPEN_QUERY = 732, + D3D12_MESSAGE_ID_RESOLVE_QUERY_DATA_INVALID_PARAMETERS = 733, + D3D12_MESSAGE_ID_SET_PREDICATION_INVALID_PARAMETERS = 734, + D3D12_MESSAGE_ID_TIMESTAMPS_NOT_SUPPORTED = 735, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDFORMAT = 737, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDFORMAT = 738, + D3D12_MESSAGE_ID_GETCOPYABLEFOOTPRINTS_INVALIDSUBRESOURCERANGE = 739, + D3D12_MESSAGE_ID_GETCOPYABLEFOOTPRINTS_INVALIDBASEOFFSET = 740, + D3D12_MESSAGE_ID_GETCOPYABLELAYOUT_INVALIDSUBRESOURCERANGE = 739, + D3D12_MESSAGE_ID_GETCOPYABLELAYOUT_INVALIDBASEOFFSET = 740, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_HEAP = 741, + D3D12_MESSAGE_ID_CREATE_SAMPLER_INVALID = 742, + D3D12_MESSAGE_ID_CREATECOMMANDSIGNATURE_INVALID = 743, + D3D12_MESSAGE_ID_EXECUTE_INDIRECT_INVALID_PARAMETERS = 744, + D3D12_MESSAGE_ID_GETGPUVIRTUALADDRESS_INVALID_RESOURCE_DIMENSION = 745, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDCLEARVALUE = 815, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDCLEARVALUEFORMAT = 816, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDCLEARVALUEFORMAT = 817, + D3D12_MESSAGE_ID_CREATERESOURCE_CLEARVALUEDENORMFLUSH = 818, + D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE = 820, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_MISMATCHINGCLEARVALUE = 821, + D3D12_MESSAGE_ID_MAP_INVALIDHEAP = 822, + D3D12_MESSAGE_ID_UNMAP_INVALIDHEAP = 823, + D3D12_MESSAGE_ID_MAP_INVALIDRESOURCE = 824, + D3D12_MESSAGE_ID_UNMAP_INVALIDRESOURCE = 825, + D3D12_MESSAGE_ID_MAP_INVALIDSUBRESOURCE = 826, + D3D12_MESSAGE_ID_UNMAP_INVALIDSUBRESOURCE = 827, + D3D12_MESSAGE_ID_MAP_INVALIDRANGE = 828, + D3D12_MESSAGE_ID_UNMAP_INVALIDRANGE = 829, + D3D12_MESSAGE_ID_MAP_INVALIDDATAPOINTER = 832, + D3D12_MESSAGE_ID_MAP_INVALIDARG_RETURN = 833, + D3D12_MESSAGE_ID_MAP_OUTOFMEMORY_RETURN = 834, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_BUNDLENOTSUPPORTED = 835, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_COMMANDLISTMISMATCH = 836, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_OPENCOMMANDLIST = 837, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_FAILEDCOMMANDLIST = 838, + D3D12_MESSAGE_ID_COPYBUFFERREGION_NULLDST = 839, + D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALIDDSTRESOURCEDIMENSION = 840, + D3D12_MESSAGE_ID_COPYBUFFERREGION_DSTRANGEOUTOFBOUNDS = 841, + D3D12_MESSAGE_ID_COPYBUFFERREGION_NULLSRC = 842, + D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALIDSRCRESOURCEDIMENSION = 843, + D3D12_MESSAGE_ID_COPYBUFFERREGION_SRCRANGEOUTOFBOUNDS = 844, + D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALIDCOPYFLAGS = 845, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_NULLDST = 846, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDDSTTYPE = 847, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTRESOURCEDIMENSION = 848, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTRESOURCE = 849, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTSUBRESOURCE = 850, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTOFFSET = 851, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDDSTFORMAT = 852, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTFORMAT = 853, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTDIMENSIONS = 854, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTROWPITCH = 855, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTPLACEMENT = 856, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTDSPLACEDFOOTPRINTFORMAT = 857, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_DSTREGIONOUTOFBOUNDS = 858, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_NULLSRC = 859, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDSRCTYPE = 860, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCRESOURCEDIMENSION = 861, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCRESOURCE = 862, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCSUBRESOURCE = 863, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCOFFSET = 864, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDSRCFORMAT = 865, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCFORMAT = 866, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCDIMENSIONS = 867, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCROWPITCH = 868, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCPLACEMENT = 869, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCDSPLACEDFOOTPRINTFORMAT = 870, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_SRCREGIONOUTOFBOUNDS = 871, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTCOORDINATES = 872, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCBOX = 873, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_FORMATMISMATCH = 874, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_EMPTYBOX = 875, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDCOPYFLAGS = 876, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALID_SUBRESOURCE_INDEX = 877, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALID_FORMAT = 878, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_RESOURCE_MISMATCH = 879, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALID_SAMPLE_COUNT = 880, + D3D12_MESSAGE_ID_CREATECOMPUTEPIPELINESTATE_INVALID_SHADER = 881, + D3D12_MESSAGE_ID_CREATECOMPUTEPIPELINESTATE_CS_ROOT_SIGNATURE_MISMATCH = 882, + D3D12_MESSAGE_ID_CREATECOMPUTEPIPELINESTATE_MISSING_ROOT_SIGNATURE = 883, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_INVALIDCACHEDBLOB = 884, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBADAPTERMISMATCH = 885, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBDRIVERVERSIONMISMATCH = 886, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBDESCMISMATCH = 887, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBIGNORED = 888, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDHEAP = 889, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDRESOURCE = 890, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDBOX = 891, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDSUBRESOURCE = 892, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_EMPTYBOX = 893, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDHEAP = 894, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDRESOURCE = 895, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDBOX = 896, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDSUBRESOURCE = 897, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_EMPTYBOX = 898, + D3D12_MESSAGE_ID_TOO_MANY_NODES_SPECIFIED = 899, + D3D12_MESSAGE_ID_INVALID_NODE_INDEX = 900, + D3D12_MESSAGE_ID_GETHEAPPROPERTIES_INVALIDRESOURCE = 901, + D3D12_MESSAGE_ID_NODE_MASK_MISMATCH = 902, + D3D12_MESSAGE_ID_COMMAND_LIST_OUTOFMEMORY = 903, + D3D12_MESSAGE_ID_COMMAND_LIST_MULTIPLE_SWAPCHAIN_BUFFER_REFERENCES = 904, + D3D12_MESSAGE_ID_COMMAND_LIST_TOO_MANY_SWAPCHAIN_REFERENCES = 905, + D3D12_MESSAGE_ID_COMMAND_QUEUE_TOO_MANY_SWAPCHAIN_REFERENCES = 906, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_WRONGSWAPCHAINBUFFERREFERENCE = 907, + D3D12_MESSAGE_ID_COMMAND_LIST_SETRENDERTARGETS_INVALIDNUMRENDERTARGETS = 908, + D3D12_MESSAGE_ID_CREATE_QUEUE_INVALID_TYPE = 909, + D3D12_MESSAGE_ID_CREATE_QUEUE_INVALID_FLAGS = 910, + D3D12_MESSAGE_ID_CREATESHAREDRESOURCE_INVALIDFLAGS = 911, + D3D12_MESSAGE_ID_CREATESHAREDRESOURCE_INVALIDFORMAT = 912, + D3D12_MESSAGE_ID_CREATESHAREDHEAP_INVALIDFLAGS = 913, + D3D12_MESSAGE_ID_REFLECTSHAREDPROPERTIES_UNRECOGNIZEDPROPERTIES = 914, + D3D12_MESSAGE_ID_REFLECTSHAREDPROPERTIES_INVALIDSIZE = 915, + D3D12_MESSAGE_ID_REFLECTSHAREDPROPERTIES_INVALIDOBJECT = 916, + D3D12_MESSAGE_ID_KEYEDMUTEX_INVALIDOBJECT = 917, + D3D12_MESSAGE_ID_KEYEDMUTEX_INVALIDKEY = 918, + D3D12_MESSAGE_ID_KEYEDMUTEX_WRONGSTATE = 919, + D3D12_MESSAGE_ID_CREATE_QUEUE_INVALID_PRIORITY = 920, + D3D12_MESSAGE_ID_OBJECT_DELETED_WHILE_STILL_IN_USE = 921, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_INVALID_FLAGS = 922, + D3D12_MESSAGE_ID_HEAP_ADDRESS_RANGE_HAS_NO_RESOURCE = 923, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RENDER_TARGET_DELETED = 924, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_ALL_RENDER_TARGETS_HAVE_UNKNOWN_FORMAT = 925, + D3D12_MESSAGE_ID_HEAP_ADDRESS_RANGE_INTERSECTS_MULTIPLE_BUFFERS = 926, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_GPU_WRITTEN_READBACK_RESOURCE_MAPPED = 927, + D3D12_MESSAGE_ID_UNMAP_RANGE_NOT_EMPTY = 929, + D3D12_MESSAGE_ID_MAP_INVALID_NULLRANGE = 930, + D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE = 931, + D3D12_MESSAGE_ID_NO_GRAPHICS_API_SUPPORT = 932, + D3D12_MESSAGE_ID_NO_COMPUTE_API_SUPPORT = 933, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_RESOURCE_FLAGS_NOT_SUPPORTED = 934, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_ROOT_ARGUMENT_UNINITIALIZED = 935, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_HEAP_INDEX_OUT_OF_BOUNDS = 936, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_TABLE_REGISTER_INDEX_OUT_OF_BOUNDS = 937, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_UNINITIALIZED = 938, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_TYPE_MISMATCH = 939, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_SRV_RESOURCE_DIMENSION_MISMATCH = 940, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_UAV_RESOURCE_DIMENSION_MISMATCH = 941, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INCOMPATIBLE_RESOURCE_STATE = 942, + D3D12_MESSAGE_ID_COPYRESOURCE_NULLDST = 943, + D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDDSTRESOURCE = 944, + D3D12_MESSAGE_ID_COPYRESOURCE_NULLSRC = 945, + D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDSRCRESOURCE = 946, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_NULLDST = 947, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALIDDSTRESOURCE = 948, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_NULLSRC = 949, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALIDSRCRESOURCE = 950, + D3D12_MESSAGE_ID_PIPELINE_STATE_TYPE_MISMATCH = 951, + D3D12_MESSAGE_ID_COMMAND_LIST_DISPATCH_ROOT_SIGNATURE_NOT_SET = 952, + D3D12_MESSAGE_ID_COMMAND_LIST_DISPATCH_ROOT_SIGNATURE_MISMATCH = 953, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_ZERO_BARRIERS = 954, + D3D12_MESSAGE_ID_BEGIN_END_EVENT_MISMATCH = 955, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_POSSIBLE_BEFORE_AFTER_MISMATCH = 956, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_BEGIN_END = 957, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INVALID_RESOURCE = 958, + D3D12_MESSAGE_ID_USE_OF_ZERO_REFCOUNT_OBJECT = 959, + D3D12_MESSAGE_ID_OBJECT_EVICTED_WHILE_STILL_IN_USE = 960, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_ROOT_DESCRIPTOR_ACCESS_OUT_OF_BOUNDS = 961, + D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_INVALIDLIBRARYBLOB = 962, + D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_DRIVERVERSIONMISMATCH = 963, + D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_ADAPTERVERSIONMISMATCH = 964, + D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_UNSUPPORTED = 965, + D3D12_MESSAGE_ID_CREATE_PIPELINELIBRARY = 966, + D3D12_MESSAGE_ID_LIVE_PIPELINELIBRARY = 967, + D3D12_MESSAGE_ID_DESTROY_PIPELINELIBRARY = 968, + D3D12_MESSAGE_ID_STOREPIPELINE_NONAME = 969, + D3D12_MESSAGE_ID_STOREPIPELINE_DUPLICATENAME = 970, + D3D12_MESSAGE_ID_LOADPIPELINE_NAMENOTFOUND = 971, + D3D12_MESSAGE_ID_LOADPIPELINE_INVALIDDESC = 972, + D3D12_MESSAGE_ID_PIPELINELIBRARY_SERIALIZE_NOTENOUGHMEMORY = 973, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_OUTPUT_RT_OUTPUT_MISMATCH = 974, + D3D12_MESSAGE_ID_SETEVENTONMULTIPLEFENCECOMPLETION_INVALIDFLAGS = 975, + D3D12_MESSAGE_ID_CREATE_QUEUE_VIDEO_NOT_SUPPORTED = 976, + D3D12_MESSAGE_ID_CREATE_COMMAND_ALLOCATOR_VIDEO_NOT_SUPPORTED = 977, + D3D12_MESSAGE_ID_CREATEQUERY_HEAP_VIDEO_DECODE_STATISTICS_NOT_SUPPORTED = 978, + D3D12_MESSAGE_ID_CREATE_VIDEODECODECOMMANDLIST = 979, + D3D12_MESSAGE_ID_CREATE_VIDEODECODER = 980, + D3D12_MESSAGE_ID_CREATE_VIDEODECODESTREAM = 981, + D3D12_MESSAGE_ID_LIVE_VIDEODECODECOMMANDLIST = 982, + D3D12_MESSAGE_ID_LIVE_VIDEODECODER = 983, + D3D12_MESSAGE_ID_LIVE_VIDEODECODESTREAM = 984, + D3D12_MESSAGE_ID_DESTROY_VIDEODECODECOMMANDLIST = 985, + D3D12_MESSAGE_ID_DESTROY_VIDEODECODER = 986, + D3D12_MESSAGE_ID_DESTROY_VIDEODECODESTREAM = 987, + D3D12_MESSAGE_ID_DECODE_FRAME_INVALID_PARAMETERS = 988, + D3D12_MESSAGE_ID_DEPRECATED_API = 989, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_COMMAND_LIST_TYPE = 990, + D3D12_MESSAGE_ID_COMMAND_LIST_DESCRIPTOR_TABLE_NOT_SET = 991, + D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_CONSTANT_BUFFER_VIEW_NOT_SET = 992, + D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_SHADER_RESOURCE_VIEW_NOT_SET = 993, + D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_UNORDERED_ACCESS_VIEW_NOT_SET = 994, + D3D12_MESSAGE_ID_DISCARD_INVALID_SUBRESOURCE_RANGE = 995, + D3D12_MESSAGE_ID_DISCARD_ONE_SUBRESOURCE_FOR_MIPS_WITH_RECTS = 996, + D3D12_MESSAGE_ID_DISCARD_NO_RECTS_FOR_NON_TEXTURE2D = 997, + D3D12_MESSAGE_ID_COPY_ON_SAME_SUBRESOURCE = 998, + D3D12_MESSAGE_ID_SETRESIDENCYPRIORITY_INVALID_PAGEABLE = 999, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_UNSUPPORTED = 1000, + D3D12_MESSAGE_ID_STATIC_DESCRIPTOR_INVALID_DESCRIPTOR_CHANGE = 1001, + D3D12_MESSAGE_ID_DATA_STATIC_DESCRIPTOR_INVALID_DATA_CHANGE = 1002, + D3D12_MESSAGE_ID_DATA_STATIC_WHILE_SET_AT_EXECUTE_DESCRIPTOR_INVALID_DATA_CHANGE = 1003, + D3D12_MESSAGE_ID_EXECUTE_BUNDLE_STATIC_DESCRIPTOR_DATA_STATIC_NOT_SET = 1004, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_RESOURCE_ACCESS_OUT_OF_BOUNDS = 1005, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_SAMPLER_MODE_MISMATCH = 1006, + D3D12_MESSAGE_ID_CREATE_FENCE_INVALID_FLAGS = 1007, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_DUPLICATE_SUBRESOURCE_TRANSITIONS = 1008, + D3D12_MESSAGE_ID_SETRESIDENCYPRIORITY_INVALID_PRIORITY = 1009, + D3D12_MESSAGE_ID_CREATE_DESCRIPTOR_HEAP_LARGE_NUM_DESCRIPTORS = 1013, + D3D12_MESSAGE_ID_BEGIN_EVENT = 1014, + D3D12_MESSAGE_ID_END_EVENT = 1015, + D3D12_MESSAGE_ID_CREATEDEVICE_DEBUG_LAYER_STARTUP_OPTIONS = 1016, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_DEPTHBOUNDSTEST_UNSUPPORTED = 1017, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_DUPLICATE_SUBOBJECT = 1018, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_UNKNOWN_SUBOBJECT = 1019, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_ZERO_SIZE_STREAM = 1020, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_INVALID_STREAM = 1021, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CANNOT_DEDUCE_TYPE = 1022, + D3D12_MESSAGE_ID_COMMAND_LIST_STATIC_DESCRIPTOR_RESOURCE_DIMENSION_MISMATCH = 1023, + D3D12_MESSAGE_ID_CREATE_COMMAND_QUEUE_INSUFFICIENT_PRIVILEGE_FOR_GLOBAL_REALTIME = 1024, + D3D12_MESSAGE_ID_CREATE_COMMAND_QUEUE_INSUFFICIENT_HARDWARE_SUPPORT_FOR_GLOBAL_REALTIME = 1025, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_ARCHITECTURE = 1026, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_DST = 1027, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DST_RESOURCE_DIMENSION = 1028, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_DST_RANGE_OUT_OF_BOUNDS = 1029, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_SRC = 1030, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_SRC_RESOURCE_DIMENSION = 1031, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_SRC_RANGE_OUT_OF_BOUNDS = 1032, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_OFFSET_ALIGNMENT = 1033, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_DEPENDENT_RESOURCES = 1034, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_DEPENDENT_SUBRESOURCE_RANGES = 1035, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DEPENDENT_RESOURCE = 1036, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DEPENDENT_SUBRESOURCE_RANGE = 1037, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_DEPENDENT_SUBRESOURCE_OUT_OF_BOUNDS = 1038, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_DEPENDENT_RANGE_OUT_OF_BOUNDS = 1039, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_ZERO_DEPENDENCIES = 1040, + D3D12_MESSAGE_ID_DEVICE_CREATE_SHARED_HANDLE_INVALIDARG = 1041, + D3D12_MESSAGE_ID_DESCRIPTOR_HANDLE_WITH_INVALID_RESOURCE = 1042, + D3D12_MESSAGE_ID_SETDEPTHBOUNDS_INVALIDARGS = 1043, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_RESOURCE_STATE_IMPRECISE = 1044, + D3D12_MESSAGE_ID_COMMAND_LIST_PIPELINE_STATE_NOT_SET = 1045, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_MODEL_MISMATCH = 1046, + D3D12_MESSAGE_ID_OBJECT_ACCESSED_WHILE_STILL_IN_USE = 1047, + D3D12_MESSAGE_ID_PROGRAMMABLE_MSAA_UNSUPPORTED = 1048, + D3D12_MESSAGE_ID_SETSAMPLEPOSITIONS_INVALIDARGS = 1049, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCEREGION_INVALID_RECT = 1050, + D3D12_MESSAGE_ID_CREATE_VIDEODECODECOMMANDQUEUE = 1051, + D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSCOMMANDLIST = 1052, + D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSCOMMANDQUEUE = 1053, + D3D12_MESSAGE_ID_LIVE_VIDEODECODECOMMANDQUEUE = 1054, + D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSCOMMANDLIST = 1055, + D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSCOMMANDQUEUE = 1056, + D3D12_MESSAGE_ID_DESTROY_VIDEODECODECOMMANDQUEUE = 1057, + D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSCOMMANDLIST = 1058, + D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSCOMMANDQUEUE = 1059, + D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSOR = 1060, + D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSSTREAM = 1061, + D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSOR = 1062, + D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSSTREAM = 1063, + D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSOR = 1064, + D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSSTREAM = 1065, + D3D12_MESSAGE_ID_PROCESS_FRAME_INVALID_PARAMETERS = 1066, + D3D12_MESSAGE_ID_COPY_INVALIDLAYOUT = 1067, + D3D12_MESSAGE_ID_CREATE_CRYPTO_SESSION = 1068, + D3D12_MESSAGE_ID_CREATE_CRYPTO_SESSION_POLICY = 1069, + D3D12_MESSAGE_ID_CREATE_PROTECTED_RESOURCE_SESSION = 1070, + D3D12_MESSAGE_ID_LIVE_CRYPTO_SESSION = 1071, + D3D12_MESSAGE_ID_LIVE_CRYPTO_SESSION_POLICY = 1072, + D3D12_MESSAGE_ID_LIVE_PROTECTED_RESOURCE_SESSION = 1073, + D3D12_MESSAGE_ID_DESTROY_CRYPTO_SESSION = 1074, + D3D12_MESSAGE_ID_DESTROY_CRYPTO_SESSION_POLICY = 1075, + D3D12_MESSAGE_ID_DESTROY_PROTECTED_RESOURCE_SESSION = 1076, + D3D12_MESSAGE_ID_PROTECTED_RESOURCE_SESSION_UNSUPPORTED = 1077, + D3D12_MESSAGE_ID_FENCE_INVALIDOPERATION = 1078, + D3D12_MESSAGE_ID_CREATEQUERY_HEAP_COPY_QUEUE_TIMESTAMPS_NOT_SUPPORTED = 1079, + D3D12_MESSAGE_ID_SAMPLEPOSITIONS_MISMATCH_DEFERRED = 1080, + D3D12_MESSAGE_ID_SAMPLEPOSITIONS_MISMATCH_RECORDTIME_ASSUMEDFROMFIRSTUSE = 1081, + D3D12_MESSAGE_ID_SAMPLEPOSITIONS_MISMATCH_RECORDTIME_ASSUMEDFROMCLEAR = 1082, + D3D12_MESSAGE_ID_CREATE_VIDEODECODERHEAP = 1083, + D3D12_MESSAGE_ID_LIVE_VIDEODECODERHEAP = 1084, + D3D12_MESSAGE_ID_DESTROY_VIDEODECODERHEAP = 1085, + D3D12_MESSAGE_ID_OPENEXISTINGHEAP_INVALIDARG_RETURN = 1086, + D3D12_MESSAGE_ID_OPENEXISTINGHEAP_OUTOFMEMORY_RETURN = 1087, + D3D12_MESSAGE_ID_OPENEXISTINGHEAP_INVALIDADDRESS = 1088, + D3D12_MESSAGE_ID_OPENEXISTINGHEAP_INVALIDHANDLE = 1089, + D3D12_MESSAGE_ID_WRITEBUFFERIMMEDIATE_INVALID_DEST = 1090, + D3D12_MESSAGE_ID_WRITEBUFFERIMMEDIATE_INVALID_MODE = 1091, + D3D12_MESSAGE_ID_WRITEBUFFERIMMEDIATE_INVALID_ALIGNMENT = 1092, + D3D12_MESSAGE_ID_WRITEBUFFERIMMEDIATE_NOT_SUPPORTED = 1093, + D3D12_MESSAGE_ID_SETVIEWINSTANCEMASK_INVALIDARGS = 1094, + D3D12_MESSAGE_ID_VIEW_INSTANCING_UNSUPPORTED = 1095, + D3D12_MESSAGE_ID_VIEW_INSTANCING_INVALIDARGS = 1096, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_MISMATCH_DECODE_REFERENCE_ONLY_FLAG = 1097, + D3D12_MESSAGE_ID_COPYRESOURCE_MISMATCH_DECODE_REFERENCE_ONLY_FLAG = 1098, + D3D12_MESSAGE_ID_CREATE_VIDEO_DECODE_HEAP_CAPS_FAILURE = 1099, + D3D12_MESSAGE_ID_CREATE_VIDEO_DECODE_HEAP_CAPS_UNSUPPORTED = 1100, + D3D12_MESSAGE_ID_VIDEO_DECODE_SUPPORT_INVALID_INPUT = 1101, + D3D12_MESSAGE_ID_CREATE_VIDEO_DECODER_UNSUPPORTED = 1102, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_METADATA_ERROR = 1103, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_VIEW_INSTANCING_VERTEX_SIZE_EXCEEDED = 1104, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RUNTIME_INTERNAL_ERROR = 1105, + D3D12_MESSAGE_ID_NO_VIDEO_API_SUPPORT = 1106, + D3D12_MESSAGE_ID_VIDEO_PROCESS_SUPPORT_INVALID_INPUT = 1107, + D3D12_MESSAGE_ID_CREATE_VIDEO_PROCESSOR_CAPS_FAILURE = 1108, + D3D12_MESSAGE_ID_VIDEO_PROCESS_SUPPORT_UNSUPPORTED_FORMAT = 1109, + D3D12_MESSAGE_ID_VIDEO_DECODE_FRAME_INVALID_ARGUMENT = 1110, + D3D12_MESSAGE_ID_ENQUEUE_MAKE_RESIDENT_INVALID_FLAGS = 1111, + D3D12_MESSAGE_ID_OPENEXISTINGHEAP_UNSUPPORTED = 1112, + D3D12_MESSAGE_ID_VIDEO_PROCESS_FRAMES_INVALID_ARGUMENT = 1113, + D3D12_MESSAGE_ID_VIDEO_DECODE_SUPPORT_UNSUPPORTED = 1114, + D3D12_MESSAGE_ID_CREATE_COMMANDRECORDER = 1115, + D3D12_MESSAGE_ID_LIVE_COMMANDRECORDER = 1116, + D3D12_MESSAGE_ID_DESTROY_COMMANDRECORDER = 1117, + D3D12_MESSAGE_ID_CREATE_COMMAND_RECORDER_VIDEO_NOT_SUPPORTED = 1118, + D3D12_MESSAGE_ID_CREATE_COMMAND_RECORDER_INVALID_SUPPORT_FLAGS = 1119, + D3D12_MESSAGE_ID_CREATE_COMMAND_RECORDER_INVALID_FLAGS = 1120, + D3D12_MESSAGE_ID_CREATE_COMMAND_RECORDER_MORE_RECORDERS_THAN_LOGICAL_PROCESSORS = 1121, + D3D12_MESSAGE_ID_CREATE_COMMANDPOOL = 1122, + D3D12_MESSAGE_ID_LIVE_COMMANDPOOL = 1123, + D3D12_MESSAGE_ID_DESTROY_COMMANDPOOL = 1124, + D3D12_MESSAGE_ID_CREATE_COMMAND_POOL_INVALID_FLAGS = 1125, + D3D12_MESSAGE_ID_CREATE_COMMAND_LIST_VIDEO_NOT_SUPPORTED = 1126, + D3D12_MESSAGE_ID_COMMAND_RECORDER_SUPPORT_FLAGS_MISMATCH = 1127, + D3D12_MESSAGE_ID_COMMAND_RECORDER_CONTENTION = 1128, + D3D12_MESSAGE_ID_COMMAND_RECORDER_USAGE_WITH_CREATECOMMANDLIST_COMMAND_LIST = 1129, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_USAGE_WITH_CREATECOMMANDLIST1_COMMAND_LIST = 1130, + D3D12_MESSAGE_ID_CANNOT_EXECUTE_EMPTY_COMMAND_LIST = 1131, + D3D12_MESSAGE_ID_CANNOT_RESET_COMMAND_POOL_WITH_OPEN_COMMAND_LISTS = 1132, + D3D12_MESSAGE_ID_CANNOT_USE_COMMAND_RECORDER_WITHOUT_CURRENT_TARGET = 1133, + D3D12_MESSAGE_ID_CANNOT_CHANGE_COMMAND_RECORDER_TARGET_WHILE_RECORDING = 1134, + D3D12_MESSAGE_ID_COMMAND_POOL_SYNC = 1135, + D3D12_MESSAGE_ID_EVICT_UNDERFLOW = 1136, + D3D12_MESSAGE_ID_CREATE_META_COMMAND = 1137, + D3D12_MESSAGE_ID_LIVE_META_COMMAND = 1138, + D3D12_MESSAGE_ID_DESTROY_META_COMMAND = 1139, + D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALID_DST_RESOURCE = 1140, + D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALID_SRC_RESOURCE = 1141, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DST_RESOURCE = 1142, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_SRC_RESOURCE = 1143, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_NULL_BUFFER = 1144, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_NULL_RESOURCE_DESC = 1145, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_UNSUPPORTED = 1146, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_INVALID_BUFFER_DIMENSION = 1147, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_INVALID_BUFFER_FLAGS = 1148, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_INVALID_BUFFER_OFFSET = 1149, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_INVALID_RESOURCE_DIMENSION = 1150, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_INVALID_RESOURCE_FLAGS = 1151, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_OUTOFMEMORY_RETURN = 1152, + D3D12_MESSAGE_ID_CANNOT_CREATE_GRAPHICS_AND_VIDEO_COMMAND_RECORDER = 1153, + D3D12_MESSAGE_ID_UPDATETILEMAPPINGS_POSSIBLY_MISMATCHING_PROPERTIES = 1154, + D3D12_MESSAGE_ID_CREATE_COMMAND_LIST_INVALID_COMMAND_LIST_TYPE = 1155, + D3D12_MESSAGE_ID_CLEARUNORDEREDACCESSVIEW_INCOMPATIBLE_WITH_STRUCTURED_BUFFERS = 1156, + D3D12_MESSAGE_ID_COMPUTE_ONLY_DEVICE_OPERATION_UNSUPPORTED = 1157, + D3D12_MESSAGE_ID_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INVALID = 1158, + D3D12_MESSAGE_ID_EMIT_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_INVALID = 1159, + D3D12_MESSAGE_ID_COPY_RAYTRACING_ACCELERATION_STRUCTURE_INVALID = 1160, + D3D12_MESSAGE_ID_DISPATCH_RAYS_INVALID = 1161, + D3D12_MESSAGE_ID_GET_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO_INVALID = 1162, + D3D12_MESSAGE_ID_CREATE_LIFETIMETRACKER = 1163, + D3D12_MESSAGE_ID_LIVE_LIFETIMETRACKER = 1164, + D3D12_MESSAGE_ID_DESTROY_LIFETIMETRACKER = 1165, + D3D12_MESSAGE_ID_DESTROYOWNEDOBJECT_OBJECTNOTOWNED = 1166, + D3D12_MESSAGE_ID_CREATE_TRACKEDWORKLOAD = 1167, + D3D12_MESSAGE_ID_LIVE_TRACKEDWORKLOAD = 1168, + D3D12_MESSAGE_ID_DESTROY_TRACKEDWORKLOAD = 1169, + D3D12_MESSAGE_ID_RENDER_PASS_ERROR = 1170, + D3D12_MESSAGE_ID_META_COMMAND_ID_INVALID = 1171, + D3D12_MESSAGE_ID_META_COMMAND_UNSUPPORTED_PARAMS = 1172, + D3D12_MESSAGE_ID_META_COMMAND_FAILED_ENUMERATION = 1173, + D3D12_MESSAGE_ID_META_COMMAND_PARAMETER_SIZE_MISMATCH = 1174, + D3D12_MESSAGE_ID_UNINITIALIZED_META_COMMAND = 1175, + D3D12_MESSAGE_ID_META_COMMAND_INVALID_GPU_VIRTUAL_ADDRESS = 1176, + D3D12_MESSAGE_ID_CREATE_VIDEOENCODECOMMANDLIST = 1177, + D3D12_MESSAGE_ID_LIVE_VIDEOENCODECOMMANDLIST = 1178, + D3D12_MESSAGE_ID_DESTROY_VIDEOENCODECOMMANDLIST = 1179, + D3D12_MESSAGE_ID_CREATE_VIDEOENCODECOMMANDQUEUE = 1180, + D3D12_MESSAGE_ID_LIVE_VIDEOENCODECOMMANDQUEUE = 1181, + D3D12_MESSAGE_ID_DESTROY_VIDEOENCODECOMMANDQUEUE = 1182, + D3D12_MESSAGE_ID_CREATE_VIDEOMOTIONESTIMATOR = 1183, + D3D12_MESSAGE_ID_LIVE_VIDEOMOTIONESTIMATOR = 1184, + D3D12_MESSAGE_ID_DESTROY_VIDEOMOTIONESTIMATOR = 1185, + D3D12_MESSAGE_ID_CREATE_VIDEOMOTIONVECTORHEAP = 1186, + D3D12_MESSAGE_ID_LIVE_VIDEOMOTIONVECTORHEAP = 1187, + D3D12_MESSAGE_ID_DESTROY_VIDEOMOTIONVECTORHEAP = 1188, + D3D12_MESSAGE_ID_MULTIPLE_TRACKED_WORKLOADS = 1189, + D3D12_MESSAGE_ID_MULTIPLE_TRACKED_WORKLOAD_PAIRS = 1190, + D3D12_MESSAGE_ID_OUT_OF_ORDER_TRACKED_WORKLOAD_PAIR = 1191, + D3D12_MESSAGE_ID_CANNOT_ADD_TRACKED_WORKLOAD = 1192, + D3D12_MESSAGE_ID_INCOMPLETE_TRACKED_WORKLOAD_PAIR = 1193, + D3D12_MESSAGE_ID_CREATE_STATE_OBJECT_ERROR = 1194, + D3D12_MESSAGE_ID_GET_SHADER_IDENTIFIER_ERROR = 1195, + D3D12_MESSAGE_ID_GET_SHADER_STACK_SIZE_ERROR = 1196, + D3D12_MESSAGE_ID_GET_PIPELINE_STACK_SIZE_ERROR = 1197, + D3D12_MESSAGE_ID_SET_PIPELINE_STACK_SIZE_ERROR = 1198, + D3D12_MESSAGE_ID_GET_SHADER_IDENTIFIER_SIZE_INVALID = 1199, + D3D12_MESSAGE_ID_CHECK_DRIVER_MATCHING_IDENTIFIER_INVALID = 1200, + D3D12_MESSAGE_ID_CHECK_DRIVER_MATCHING_IDENTIFIER_DRIVER_REPORTED_ISSUE = 1201, + D3D12_MESSAGE_ID_RENDER_PASS_INVALID_RESOURCE_BARRIER = 1202, + D3D12_MESSAGE_ID_RENDER_PASS_DISALLOWED_API_CALLED = 1203, + D3D12_MESSAGE_ID_RENDER_PASS_CANNOT_NEST_RENDER_PASSES = 1204, + D3D12_MESSAGE_ID_RENDER_PASS_CANNOT_END_WITHOUT_BEGIN = 1205, + D3D12_MESSAGE_ID_RENDER_PASS_CANNOT_CLOSE_COMMAND_LIST = 1206, + D3D12_MESSAGE_ID_RENDER_PASS_GPU_WORK_WHILE_SUSPENDED = 1207, + D3D12_MESSAGE_ID_RENDER_PASS_MISMATCHING_SUSPEND_RESUME = 1208, + D3D12_MESSAGE_ID_RENDER_PASS_NO_PRIOR_SUSPEND_WITHIN_EXECUTECOMMANDLISTS = 1209, + D3D12_MESSAGE_ID_RENDER_PASS_NO_SUBSEQUENT_RESUME_WITHIN_EXECUTECOMMANDLISTS = 1210, + D3D12_MESSAGE_ID_TRACKED_WORKLOAD_COMMAND_QUEUE_MISMATCH = 1211, + D3D12_MESSAGE_ID_TRACKED_WORKLOAD_NOT_SUPPORTED = 1212, + D3D12_MESSAGE_ID_RENDER_PASS_MISMATCHING_NO_ACCESS = 1213, + D3D12_MESSAGE_ID_RENDER_PASS_UNSUPPORTED_RESOLVE = 1214, + D3D12_MESSAGE_ID_CLEARUNORDEREDACCESSVIEW_INVALID_RESOURCE_PTR = 1215, + D3D12_MESSAGE_ID_WINDOWS7_FENCE_OUTOFORDER_SIGNAL = 1216, + D3D12_MESSAGE_ID_WINDOWS7_FENCE_OUTOFORDER_WAIT = 1217, + D3D12_MESSAGE_ID_VIDEO_CREATE_MOTION_ESTIMATOR_INVALID_ARGUMENT = 1218, + D3D12_MESSAGE_ID_VIDEO_CREATE_MOTION_VECTOR_HEAP_INVALID_ARGUMENT = 1219, + D3D12_MESSAGE_ID_ESTIMATE_MOTION_INVALID_ARGUMENT = 1220, + D3D12_MESSAGE_ID_RESOLVE_MOTION_VECTOR_HEAP_INVALID_ARGUMENT = 1221, + D3D12_MESSAGE_ID_GETGPUVIRTUALADDRESS_INVALID_HEAP_TYPE = 1222, + D3D12_MESSAGE_ID_SET_BACKGROUND_PROCESSING_MODE_INVALID_ARGUMENT = 1223, + D3D12_MESSAGE_ID_CREATE_COMMAND_LIST_INVALID_COMMAND_LIST_TYPE_FOR_FEATURE_LEVEL = 1224, + D3D12_MESSAGE_ID_CREATE_VIDEOEXTENSIONCOMMAND = 1225, + D3D12_MESSAGE_ID_LIVE_VIDEOEXTENSIONCOMMAND = 1226, + D3D12_MESSAGE_ID_DESTROY_VIDEOEXTENSIONCOMMAND = 1227, + D3D12_MESSAGE_ID_INVALID_VIDEO_EXTENSION_COMMAND_ID = 1228, + D3D12_MESSAGE_ID_VIDEO_EXTENSION_COMMAND_INVALID_ARGUMENT = 1229, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_NOT_UNIQUE_IN_DXIL_LIBRARY = 1230, + D3D12_MESSAGE_ID_VARIABLE_SHADING_RATE_NOT_ALLOWED_WITH_TIR = 1231, + D3D12_MESSAGE_ID_GEOMETRY_SHADER_OUTPUTTING_BOTH_VIEWPORT_ARRAY_INDEX_AND_SHADING_RATE_NOT_SUPPORTED_ON_DEVICE = 1232, + D3D12_MESSAGE_ID_RSSETSHADING_RATE_INVALID_SHADING_RATE = 1233, + D3D12_MESSAGE_ID_RSSETSHADING_RATE_SHADING_RATE_NOT_PERMITTED_BY_CAP = 1234, + D3D12_MESSAGE_ID_RSSETSHADING_RATE_INVALID_COMBINER = 1235, + D3D12_MESSAGE_ID_RSSETSHADINGRATEIMAGE_REQUIRES_TIER_2 = 1236, + D3D12_MESSAGE_ID_RSSETSHADINGRATE_REQUIRES_TIER_1 = 1237, + D3D12_MESSAGE_ID_SHADING_RATE_IMAGE_INCORRECT_FORMAT = 1238, + D3D12_MESSAGE_ID_SHADING_RATE_IMAGE_INCORRECT_ARRAY_SIZE = 1239, + D3D12_MESSAGE_ID_SHADING_RATE_IMAGE_INCORRECT_MIP_LEVEL = 1240, + D3D12_MESSAGE_ID_SHADING_RATE_IMAGE_INCORRECT_SAMPLE_COUNT = 1241, + D3D12_MESSAGE_ID_SHADING_RATE_IMAGE_INCORRECT_SAMPLE_QUALITY = 1242, + D3D12_MESSAGE_ID_NON_RETAIL_SHADER_MODEL_WONT_VALIDATE = 1243, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_AS_ROOT_SIGNATURE_MISMATCH = 1244, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_MS_ROOT_SIGNATURE_MISMATCH = 1245, + D3D12_MESSAGE_ID_ADD_TO_STATE_OBJECT_ERROR = 1246, + D3D12_MESSAGE_ID_CREATE_PROTECTED_RESOURCE_SESSION_INVALID_ARGUMENT = 1247, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_MS_PSO_DESC_MISMATCH = 1248, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_MS_INCOMPLETE_TYPE = 1249, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_AS_NOT_MS_MISMATCH = 1250, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_MS_NOT_PS_MISMATCH = 1251, + D3D12_MESSAGE_ID_NONZERO_SAMPLER_FEEDBACK_MIP_REGION_WITH_INCOMPATIBLE_FORMAT = 1252, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INPUTLAYOUT_SHADER_MISMATCH = 1253, + D3D12_MESSAGE_ID_EMPTY_DISPATCH = 1254, + D3D12_MESSAGE_ID_RESOURCE_FORMAT_REQUIRES_SAMPLER_FEEDBACK_CAPABILITY = 1255, + D3D12_MESSAGE_ID_SAMPLER_FEEDBACK_MAP_INVALID_MIP_REGION = 1256, + D3D12_MESSAGE_ID_SAMPLER_FEEDBACK_MAP_INVALID_DIMENSION = 1257, + D3D12_MESSAGE_ID_SAMPLER_FEEDBACK_MAP_INVALID_SAMPLE_COUNT = 1258, + D3D12_MESSAGE_ID_SAMPLER_FEEDBACK_MAP_INVALID_SAMPLE_QUALITY = 1259, + D3D12_MESSAGE_ID_SAMPLER_FEEDBACK_MAP_INVALID_LAYOUT = 1260, + D3D12_MESSAGE_ID_SAMPLER_FEEDBACK_MAP_REQUIRES_UNORDERED_ACCESS_FLAG = 1261, + D3D12_MESSAGE_ID_SAMPLER_FEEDBACK_CREATE_UAV_NULL_ARGUMENTS = 1262, + D3D12_MESSAGE_ID_SAMPLER_FEEDBACK_UAV_REQUIRES_SAMPLER_FEEDBACK_CAPABILITY = 1263, + D3D12_MESSAGE_ID_SAMPLER_FEEDBACK_CREATE_UAV_REQUIRES_FEEDBACK_MAP_FORMAT = 1264, + D3D12_MESSAGE_ID_CREATEMESHSHADER_INVALIDSHADERBYTECODE = 1265, + D3D12_MESSAGE_ID_CREATEMESHSHADER_OUTOFMEMORY = 1266, + D3D12_MESSAGE_ID_CREATEMESHSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = 1267, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_SAMPLER_FEEDBACK_TRANSCODE_INVALID_FORMAT = 1268, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_SAMPLER_FEEDBACK_INVALID_MIP_LEVEL_COUNT = 1269, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_SAMPLER_FEEDBACK_TRANSCODE_ARRAY_SIZE_MISMATCH = 1270, + D3D12_MESSAGE_ID_SAMPLER_FEEDBACK_CREATE_UAV_MISMATCHING_TARGETED_RESOURCE = 1271, + D3D12_MESSAGE_ID_CREATEMESHSHADER_OUTPUTEXCEEDSMAXSIZE = 1272, + D3D12_MESSAGE_ID_CREATEMESHSHADER_GROUPSHAREDEXCEEDSMAXSIZE = 1273, + D3D12_MESSAGE_ID_VERTEX_SHADER_OUTPUTTING_BOTH_VIEWPORT_ARRAY_INDEX_AND_SHADING_RATE_NOT_SUPPORTED_ON_DEVICE = 1274, + D3D12_MESSAGE_ID_MESH_SHADER_OUTPUTTING_BOTH_VIEWPORT_ARRAY_INDEX_AND_SHADING_RATE_NOT_SUPPORTED_ON_DEVICE = 1275, + D3D12_MESSAGE_ID_CREATEMESHSHADER_MISMATCHEDASMSPAYLOADSIZE = 1276, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_UNBOUNDED_STATIC_DESCRIPTORS = 1277, + D3D12_MESSAGE_ID_CREATEAMPLIFICATIONSHADER_INVALIDSHADERBYTECODE = 1278, + D3D12_MESSAGE_ID_CREATEAMPLIFICATIONSHADER_OUTOFMEMORY = 1279, + D3D12_MESSAGE_ID_CREATE_SHADERCACHESESSION = 1280, + D3D12_MESSAGE_ID_LIVE_SHADERCACHESESSION = 1281, + D3D12_MESSAGE_ID_DESTROY_SHADERCACHESESSION = 1282, + D3D12_MESSAGE_ID_CREATESHADERCACHESESSION_INVALIDARGS = 1283, + D3D12_MESSAGE_ID_CREATESHADERCACHESESSION_DISABLED = 1284, + D3D12_MESSAGE_ID_CREATESHADERCACHESESSION_ALREADYOPEN = 1285, + D3D12_MESSAGE_ID_SHADERCACHECONTROL_DEVELOPERMODE = 1286, + D3D12_MESSAGE_ID_SHADERCACHECONTROL_INVALIDFLAGS = 1287, + D3D12_MESSAGE_ID_SHADERCACHECONTROL_STATEALREADYSET = 1288, + D3D12_MESSAGE_ID_SHADERCACHECONTROL_IGNOREDFLAG = 1289, + D3D12_MESSAGE_ID_SHADERCACHESESSION_STOREVALUE_ALREADYPRESENT = 1290, + D3D12_MESSAGE_ID_SHADERCACHESESSION_STOREVALUE_HASHCOLLISION = 1291, + D3D12_MESSAGE_ID_SHADERCACHESESSION_STOREVALUE_CACHEFULL = 1292, + D3D12_MESSAGE_ID_SHADERCACHESESSION_FINDVALUE_NOTFOUND = 1293, + D3D12_MESSAGE_ID_SHADERCACHESESSION_CORRUPT = 1294, + D3D12_MESSAGE_ID_SHADERCACHESESSION_DISABLED = 1295, + D3D12_MESSAGE_ID_OVERSIZED_DISPATCH = 1296, + D3D12_MESSAGE_ID_CREATE_VIDEOENCODER = 1297, + D3D12_MESSAGE_ID_LIVE_VIDEOENCODER = 1298, + D3D12_MESSAGE_ID_DESTROY_VIDEOENCODER = 1299, + D3D12_MESSAGE_ID_CREATE_VIDEOENCODERHEAP = 1300, + D3D12_MESSAGE_ID_LIVE_VIDEOENCODERHEAP = 1301, + D3D12_MESSAGE_ID_DESTROY_VIDEOENCODERHEAP = 1302, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_MISMATCH_ENCODE_REFERENCE_ONLY_FLAG = 1303, + D3D12_MESSAGE_ID_COPYRESOURCE_MISMATCH_ENCODE_REFERENCE_ONLY_FLAG = 1304, + D3D12_MESSAGE_ID_ENCODE_FRAME_INVALID_PARAMETERS = 1305, + D3D12_MESSAGE_ID_ENCODE_FRAME_UNSUPPORTED_PARAMETERS = 1306, + D3D12_MESSAGE_ID_RESOLVE_ENCODER_OUTPUT_METADATA_INVALID_PARAMETERS = 1307, + D3D12_MESSAGE_ID_RESOLVE_ENCODER_OUTPUT_METADATA_UNSUPPORTED_PARAMETERS = 1308, + D3D12_MESSAGE_ID_CREATE_VIDEO_ENCODER_INVALID_PARAMETERS = 1309, + D3D12_MESSAGE_ID_CREATE_VIDEO_ENCODER_UNSUPPORTED_PARAMETERS = 1310, + D3D12_MESSAGE_ID_CREATE_VIDEO_ENCODER_HEAP_INVALID_PARAMETERS = 1311, + D3D12_MESSAGE_ID_CREATE_VIDEO_ENCODER_HEAP_UNSUPPORTED_PARAMETERS = 1312, + D3D12_MESSAGE_ID_CREATECOMMANDLIST_NULL_COMMANDALLOCATOR = 1313, + D3D12_MESSAGE_ID_CLEAR_UNORDERED_ACCESS_VIEW_INVALID_DESCRIPTOR_HANDLE = 1314, + D3D12_MESSAGE_ID_DESCRIPTOR_HEAP_NOT_SHADER_VISIBLE = 1315, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_BLENDOP_WARNING = 1316, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_BLENDOPALPHA_WARNING = 1317, + D3D12_MESSAGE_ID_WRITE_COMBINE_PERFORMANCE_WARNING = 1318, + D3D12_MESSAGE_ID_RESOLVE_QUERY_INVALID_QUERY_STATE = 1319, + D3D12_MESSAGE_ID_SETPRIVATEDATA_NO_ACCESS = 1320, + D3D12_MESSAGE_ID_COMMAND_LIST_STATIC_DESCRIPTOR_SAMPLER_MODE_MISMATCH = 1321, + D3D12_MESSAGE_ID_GETCOPYABLEFOOTPRINTS_UNSUPPORTED_BUFFER_WIDTH = 1322, + D3D12_MESSAGE_ID_CREATEMESHSHADER_TOPOLOGY_MISMATCH = 1323, + D3D12_MESSAGE_ID_VRS_SUM_COMBINER_REQUIRES_CAPABILITY = 1324, + D3D12_MESSAGE_ID_SETTING_SHADING_RATE_FROM_MS_REQUIRES_CAPABILITY = 1325, + D3D12_MESSAGE_ID_SHADERCACHESESSION_SHADERCACHEDELETE_NOTSUPPORTED = 1326, + D3D12_MESSAGE_ID_SHADERCACHECONTROL_SHADERCACHECLEAR_NOTSUPPORTED = 1327, + D3D12_MESSAGE_ID_CREATERESOURCE_STATE_IGNORED = 1328, + D3D12_MESSAGE_ID_UNUSED_CROSS_EXECUTE_SPLIT_BARRIER = 1329, + D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_HANDLE_ACCESS_DENIED = 1330, + D3D12_MESSAGE_ID_INCOMPATIBLE_BARRIER_VALUES = 1331, + D3D12_MESSAGE_ID_INCOMPATIBLE_BARRIER_ACCESS = 1332, + D3D12_MESSAGE_ID_INCOMPATIBLE_BARRIER_SYNC = 1333, + D3D12_MESSAGE_ID_INCOMPATIBLE_BARRIER_LAYOUT = 1334, + D3D12_MESSAGE_ID_INCOMPATIBLE_BARRIER_TYPE = 1335, + D3D12_MESSAGE_ID_OUT_OF_BOUNDS_BARRIER_SUBRESOURCE_RANGE = 1336, + D3D12_MESSAGE_ID_INCOMPATIBLE_BARRIER_RESOURCE_DIMENSION = 1337, + D3D12_MESSAGE_ID_SET_SCISSOR_RECTS_INVALID_RECT = 1338, + D3D12_MESSAGE_ID_SHADING_RATE_SOURCE_REQUIRES_DIMENSION_TEXTURE2D = 1339, + D3D12_MESSAGE_ID_BUFFER_BARRIER_SUBREGION_OUT_OF_BOUNDS = 1340, + D3D12_MESSAGE_ID_UNSUPPORTED_BARRIER_LAYOUT = 1341, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALID_PARAMETERS = 1342, + D3D12_MESSAGE_ID_ENHANCED_BARRIERS_NOT_SUPPORTED = 1343, + D3D12_MESSAGE_ID_LEGACY_BARRIER_VALIDATION_FORCED_ON = 1346, + D3D12_MESSAGE_ID_EMPTY_ROOT_DESCRIPTOR_TABLE = 1347, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_ELEMENT_OFFSET_UNALIGNED = 1348, + D3D12_MESSAGE_ID_ALPHA_BLEND_FACTOR_NOT_SUPPORTED = 1349, + D3D12_MESSAGE_ID_BARRIER_INTEROP_INVALID_LAYOUT = 1350, + D3D12_MESSAGE_ID_BARRIER_INTEROP_INVALID_STATE = 1351, + D3D12_MESSAGE_ID_GRAPHICS_PIPELINE_STATE_DESC_ZERO_SAMPLE_MASK = 1352, + D3D12_MESSAGE_ID_INDEPENDENT_STENCIL_REF_NOT_SUPPORTED = 1353, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INDEPENDENT_MASKS_UNSUPPORTED = 1354, + D3D12_MESSAGE_ID_TEXTURE_BARRIER_SUBRESOURCES_OUT_OF_BOUNDS = 1355, + D3D12_MESSAGE_ID_NON_OPTIMAL_BARRIER_ONLY_EXECUTE_COMMAND_LISTS = 1356, + D3D12_MESSAGE_ID_EXECUTE_INDIRECT_ZERO_COMMAND_COUNT = 1357, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INCOMPATIBLE_TEXTURE_LAYOUT = 1358, + D3D12_MESSAGE_ID_DYNAMIC_INDEX_BUFFER_STRIP_CUT_NOT_SUPPORTED = 1359, + D3D12_MESSAGE_ID_PRIMITIVE_TOPOLOGY_TRIANGLE_FANS_NOT_SUPPORTED = 1360, + D3D12_MESSAGE_ID_CREATE_SAMPLER_COMPARISON_FUNC_IGNORED = 1361, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDHEAPTYPE = 1362, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDHEAPTYPE = 1363, + D3D12_MESSAGE_ID_DYNAMIC_DEPTH_BIAS_NOT_SUPPORTED = 1364, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_NON_WHOLE_DYNAMIC_DEPTH_BIAS = 1365, + D3D12_MESSAGE_ID_DYNAMIC_DEPTH_BIAS_FLAG_MISSING = 1366, + D3D12_MESSAGE_ID_DYNAMIC_DEPTH_BIAS_NO_PIPELINE = 1367, + D3D12_MESSAGE_ID_DYNAMIC_INDEX_BUFFER_STRIP_CUT_FLAG_MISSING = 1368, + D3D12_MESSAGE_ID_DYNAMIC_INDEX_BUFFER_STRIP_CUT_NO_PIPELINE = 1369, + D3D12_MESSAGE_ID_NONNORMALIZED_COORDINATE_SAMPLING_NOT_SUPPORTED = 1370, + D3D12_MESSAGE_ID_INVALID_CAST_TARGET = 1371, + D3D12_MESSAGE_ID_RENDER_PASS_COMMANDLIST_INVALID_END_STATE = 1372, + D3D12_MESSAGE_ID_RENDER_PASS_COMMANDLIST_INVALID_START_STATE = 1373, + D3D12_MESSAGE_ID_RENDER_PASS_MISMATCHING_ACCESS = 1374, + D3D12_MESSAGE_ID_RENDER_PASS_MISMATCHING_LOCAL_PRESERVE_PARAMETERS = 1375, + D3D12_MESSAGE_ID_RENDER_PASS_LOCAL_PRESERVE_RENDER_PARAMETERS_ERROR = 1376, + D3D12_MESSAGE_ID_RENDER_PASS_LOCAL_DEPTH_STENCIL_ERROR = 1377, + D3D12_MESSAGE_ID_DRAW_POTENTIALLY_OUTSIDE_OF_VALID_RENDER_AREA = 1378, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALID_LINERASTERIZATIONMODE = 1379, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDALIGNMENT_SMALLRESOURCE = 1380, + D3D12_MESSAGE_ID_GENERIC_DEVICE_OPERATION_UNSUPPORTED = 1381, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RENDER_TARGET_WRONG_WRITE_MASK = 1382, + D3D12_MESSAGE_ID_PROBABLE_PIX_EVENT_LEAK = 1383, + D3D12_MESSAGE_ID_PIX_EVENT_UNDERFLOW = 1384, + D3D12_MESSAGE_ID_RECREATEAT_INVALID_TARGET = 1385, + D3D12_MESSAGE_ID_RECREATEAT_INSUFFICIENT_SUPPORT = 1386, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_STRUCTURED_BUFFER_STRIDE_MISMATCH = 1387, + D3D12_MESSAGE_ID_DISPATCH_GRAPH_INVALID = 1388, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_TARGET_FORMAT_INVALID = 1389, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_TARGET_DIMENSION_INVALID = 1390, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_SOURCE_COLOR_FORMAT_INVALID = 1391, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_SOURCE_DEPTH_FORMAT_INVALID = 1392, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_EXPOSURE_SCALE_FORMAT_INVALID = 1393, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_ENGINE_CREATE_FLAGS_INVALID = 1394, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_EXTENSION_INTERNAL_LOAD_FAILURE = 1395, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_EXTENSION_INTERNAL_ENGINE_CREATION_ERROR = 1396, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_EXTENSION_INTERNAL_UPSCALER_CREATION_ERROR = 1397, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_EXTENSION_INTERNAL_UPSCALER_EXECUTION_ERROR = 1398, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_UPSCALER_EXECUTE_REGION_INVALID = 1399, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_UPSCALER_EXECUTE_TIME_DELTA_INVALID = 1400, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_UPSCALER_EXECUTE_REQUIRED_TEXTURE_IS_NULL = 1401, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_UPSCALER_EXECUTE_MOTION_VECTORS_FORMAT_INVALID = 1402, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_UPSCALER_EXECUTE_FLAGS_INVALID = 1403, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_UPSCALER_EXECUTE_FORMAT_INVALID = 1404, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_UPSCALER_EXECUTE_EXPOSURE_SCALE_TEXTURE_SIZE_INVALID = 1405, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_VARIANT_INDEX_OUT_OF_BOUNDS = 1406, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_VARIANT_ID_NOT_FOUND = 1407, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_DUPLICATE_VARIANT_ID = 1408, + D3D12_MESSAGE_ID_DIRECTSR_OUT_OF_MEMORY = 1409, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_UPSCALER_EXECUTE_UNEXPECTED_TEXTURE_IS_IGNORED = 1410, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_UPSCALER_EVICT_UNDERFLOW = 1411, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_UPSCALER_EXECUTE_OPTIONAL_TEXTURE_IS_NULL = 1412, + D3D12_MESSAGE_ID_DIRECTSR_SUPERRES_UPSCALER_EXECUTE_INVALID_CAMERA_JITTER = 1413, + D3D12_MESSAGE_ID_CREATE_STATE_OBJECT_WARNING = 1414, + D3D12_MESSAGE_ID_GUID_TEXTURE_LAYOUT_UNSUPPORTED = 1415, + D3D12_MESSAGE_ID_RESOLVE_ENCODER_INPUT_PARAM_LAYOUT_INVALID_PARAMETERS = 1416, + D3D12_MESSAGE_ID_INVALID_BARRIER_ACCESS = 1417, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INSTANCE_COUNT_ZERO = 1418, + D3D12_MESSAGE_ID_DESCRIPTOR_HEAP_NOT_SET_BEFORE_ROOT_SIGNATURE_WITH_DIRECTLY_INDEXED_FLAG = 1419, + D3D12_MESSAGE_ID_DIFFERENT_DESCRIPTOR_HEAP_SET_AFTER_ROOT_SIGNATURE_WITH_DIRECTLY_INDEXED_FLAG = 1420, + D3D12_MESSAGE_ID_D3D12_MESSAGES_END = ( D3D12_MESSAGE_ID_DIFFERENT_DESCRIPTOR_HEAP_SET_AFTER_ROOT_SIGNATURE_WITH_DIRECTLY_INDEXED_FLAG + 1 ) + } D3D12_MESSAGE_ID; + +typedef struct D3D12_MESSAGE + { + D3D12_MESSAGE_CATEGORY Category; + D3D12_MESSAGE_SEVERITY Severity; + D3D12_MESSAGE_ID ID; + _Field_size_(DescriptionByteLength) const char *pDescription; + SIZE_T DescriptionByteLength; + } D3D12_MESSAGE; + +typedef struct D3D12_INFO_QUEUE_FILTER_DESC + { + UINT NumCategories; + _Field_size_(NumCategories) D3D12_MESSAGE_CATEGORY *pCategoryList; + UINT NumSeverities; + _Field_size_(NumSeverities) D3D12_MESSAGE_SEVERITY *pSeverityList; + UINT NumIDs; + _Field_size_(NumIDs) D3D12_MESSAGE_ID *pIDList; + } D3D12_INFO_QUEUE_FILTER_DESC; + +typedef struct D3D12_INFO_QUEUE_FILTER + { + D3D12_INFO_QUEUE_FILTER_DESC AllowList; + D3D12_INFO_QUEUE_FILTER_DESC DenyList; + } D3D12_INFO_QUEUE_FILTER; + +#define D3D12_INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT 1024 + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0018_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0018_v0_0_s_ifspec; + +#ifndef __ID3D12InfoQueue_INTERFACE_DEFINED__ +#define __ID3D12InfoQueue_INTERFACE_DEFINED__ + +/* interface ID3D12InfoQueue */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12InfoQueue; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0742a90b-c387-483f-b946-30a7e4e61458") + ID3D12InfoQueue : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetMessageCountLimit( + _In_ UINT64 MessageCountLimit) = 0; + + virtual void STDMETHODCALLTYPE ClearStoredMessages( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMessage( + _In_ UINT64 MessageIndex, + _Out_writes_bytes_opt_(*pMessageByteLength) D3D12_MESSAGE *pMessage, + _Inout_ SIZE_T *pMessageByteLength) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumMessagesAllowedByStorageFilter( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumMessagesDeniedByStorageFilter( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumStoredMessages( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumStoredMessagesAllowedByRetrievalFilter( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumMessagesDiscardedByMessageCountLimit( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetMessageCountLimit( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddStorageFilterEntries( + _In_ D3D12_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStorageFilter( + _Out_writes_bytes_opt_(*pFilterByteLength) D3D12_INFO_QUEUE_FILTER *pFilter, + _Inout_ SIZE_T *pFilterByteLength) = 0; + + virtual void STDMETHODCALLTYPE ClearStorageFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushEmptyStorageFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushCopyOfStorageFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushStorageFilter( + _In_ D3D12_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual void STDMETHODCALLTYPE PopStorageFilter( void) = 0; + + virtual UINT STDMETHODCALLTYPE GetStorageFilterStackSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddRetrievalFilterEntries( + _In_ D3D12_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRetrievalFilter( + _Out_writes_bytes_opt_(*pFilterByteLength) D3D12_INFO_QUEUE_FILTER *pFilter, + _Inout_ SIZE_T *pFilterByteLength) = 0; + + virtual void STDMETHODCALLTYPE ClearRetrievalFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushEmptyRetrievalFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushCopyOfRetrievalFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushRetrievalFilter( + _In_ D3D12_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual void STDMETHODCALLTYPE PopRetrievalFilter( void) = 0; + + virtual UINT STDMETHODCALLTYPE GetRetrievalFilterStackSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddMessage( + _In_ D3D12_MESSAGE_CATEGORY Category, + _In_ D3D12_MESSAGE_SEVERITY Severity, + _In_ D3D12_MESSAGE_ID ID, + _In_ LPCSTR pDescription) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddApplicationMessage( + _In_ D3D12_MESSAGE_SEVERITY Severity, + _In_ LPCSTR pDescription) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBreakOnCategory( + _In_ D3D12_MESSAGE_CATEGORY Category, + _In_ BOOL bEnable) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBreakOnSeverity( + _In_ D3D12_MESSAGE_SEVERITY Severity, + _In_ BOOL bEnable) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBreakOnID( + _In_ D3D12_MESSAGE_ID ID, + _In_ BOOL bEnable) = 0; + + virtual BOOL STDMETHODCALLTYPE GetBreakOnCategory( + _In_ D3D12_MESSAGE_CATEGORY Category) = 0; + + virtual BOOL STDMETHODCALLTYPE GetBreakOnSeverity( + _In_ D3D12_MESSAGE_SEVERITY Severity) = 0; + + virtual BOOL STDMETHODCALLTYPE GetBreakOnID( + _In_ D3D12_MESSAGE_ID ID) = 0; + + virtual void STDMETHODCALLTYPE SetMuteDebugOutput( + _In_ BOOL bMute) = 0; + + virtual BOOL STDMETHODCALLTYPE GetMuteDebugOutput( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12InfoQueueVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12InfoQueue * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, SetMessageCountLimit) + HRESULT ( STDMETHODCALLTYPE *SetMessageCountLimit )( + ID3D12InfoQueue * This, + _In_ UINT64 MessageCountLimit); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, ClearStoredMessages) + void ( STDMETHODCALLTYPE *ClearStoredMessages )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetMessage) + HRESULT ( STDMETHODCALLTYPE *GetMessage )( + ID3D12InfoQueue * This, + _In_ UINT64 MessageIndex, + _Out_writes_bytes_opt_(*pMessageByteLength) D3D12_MESSAGE *pMessage, + _Inout_ SIZE_T *pMessageByteLength); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetNumMessagesAllowedByStorageFilter) + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesAllowedByStorageFilter )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetNumMessagesDeniedByStorageFilter) + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesDeniedByStorageFilter )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetNumStoredMessages) + UINT64 ( STDMETHODCALLTYPE *GetNumStoredMessages )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetNumStoredMessagesAllowedByRetrievalFilter) + UINT64 ( STDMETHODCALLTYPE *GetNumStoredMessagesAllowedByRetrievalFilter )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetNumMessagesDiscardedByMessageCountLimit) + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesDiscardedByMessageCountLimit )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetMessageCountLimit) + UINT64 ( STDMETHODCALLTYPE *GetMessageCountLimit )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, AddStorageFilterEntries) + HRESULT ( STDMETHODCALLTYPE *AddStorageFilterEntries )( + ID3D12InfoQueue * This, + _In_ D3D12_INFO_QUEUE_FILTER *pFilter); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetStorageFilter) + HRESULT ( STDMETHODCALLTYPE *GetStorageFilter )( + ID3D12InfoQueue * This, + _Out_writes_bytes_opt_(*pFilterByteLength) D3D12_INFO_QUEUE_FILTER *pFilter, + _Inout_ SIZE_T *pFilterByteLength); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, ClearStorageFilter) + void ( STDMETHODCALLTYPE *ClearStorageFilter )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PushEmptyStorageFilter) + HRESULT ( STDMETHODCALLTYPE *PushEmptyStorageFilter )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PushCopyOfStorageFilter) + HRESULT ( STDMETHODCALLTYPE *PushCopyOfStorageFilter )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PushStorageFilter) + HRESULT ( STDMETHODCALLTYPE *PushStorageFilter )( + ID3D12InfoQueue * This, + _In_ D3D12_INFO_QUEUE_FILTER *pFilter); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PopStorageFilter) + void ( STDMETHODCALLTYPE *PopStorageFilter )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetStorageFilterStackSize) + UINT ( STDMETHODCALLTYPE *GetStorageFilterStackSize )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, AddRetrievalFilterEntries) + HRESULT ( STDMETHODCALLTYPE *AddRetrievalFilterEntries )( + ID3D12InfoQueue * This, + _In_ D3D12_INFO_QUEUE_FILTER *pFilter); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetRetrievalFilter) + HRESULT ( STDMETHODCALLTYPE *GetRetrievalFilter )( + ID3D12InfoQueue * This, + _Out_writes_bytes_opt_(*pFilterByteLength) D3D12_INFO_QUEUE_FILTER *pFilter, + _Inout_ SIZE_T *pFilterByteLength); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, ClearRetrievalFilter) + void ( STDMETHODCALLTYPE *ClearRetrievalFilter )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PushEmptyRetrievalFilter) + HRESULT ( STDMETHODCALLTYPE *PushEmptyRetrievalFilter )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PushCopyOfRetrievalFilter) + HRESULT ( STDMETHODCALLTYPE *PushCopyOfRetrievalFilter )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PushRetrievalFilter) + HRESULT ( STDMETHODCALLTYPE *PushRetrievalFilter )( + ID3D12InfoQueue * This, + _In_ D3D12_INFO_QUEUE_FILTER *pFilter); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PopRetrievalFilter) + void ( STDMETHODCALLTYPE *PopRetrievalFilter )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetRetrievalFilterStackSize) + UINT ( STDMETHODCALLTYPE *GetRetrievalFilterStackSize )( + ID3D12InfoQueue * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, AddMessage) + HRESULT ( STDMETHODCALLTYPE *AddMessage )( + ID3D12InfoQueue * This, + _In_ D3D12_MESSAGE_CATEGORY Category, + _In_ D3D12_MESSAGE_SEVERITY Severity, + _In_ D3D12_MESSAGE_ID ID, + _In_ LPCSTR pDescription); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, AddApplicationMessage) + HRESULT ( STDMETHODCALLTYPE *AddApplicationMessage )( + ID3D12InfoQueue * This, + _In_ D3D12_MESSAGE_SEVERITY Severity, + _In_ LPCSTR pDescription); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, SetBreakOnCategory) + HRESULT ( STDMETHODCALLTYPE *SetBreakOnCategory )( + ID3D12InfoQueue * This, + _In_ D3D12_MESSAGE_CATEGORY Category, + _In_ BOOL bEnable); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, SetBreakOnSeverity) + HRESULT ( STDMETHODCALLTYPE *SetBreakOnSeverity )( + ID3D12InfoQueue * This, + _In_ D3D12_MESSAGE_SEVERITY Severity, + _In_ BOOL bEnable); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, SetBreakOnID) + HRESULT ( STDMETHODCALLTYPE *SetBreakOnID )( + ID3D12InfoQueue * This, + _In_ D3D12_MESSAGE_ID ID, + _In_ BOOL bEnable); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetBreakOnCategory) + BOOL ( STDMETHODCALLTYPE *GetBreakOnCategory )( + ID3D12InfoQueue * This, + _In_ D3D12_MESSAGE_CATEGORY Category); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetBreakOnSeverity) + BOOL ( STDMETHODCALLTYPE *GetBreakOnSeverity )( + ID3D12InfoQueue * This, + _In_ D3D12_MESSAGE_SEVERITY Severity); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetBreakOnID) + BOOL ( STDMETHODCALLTYPE *GetBreakOnID )( + ID3D12InfoQueue * This, + _In_ D3D12_MESSAGE_ID ID); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, SetMuteDebugOutput) + void ( STDMETHODCALLTYPE *SetMuteDebugOutput )( + ID3D12InfoQueue * This, + _In_ BOOL bMute); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetMuteDebugOutput) + BOOL ( STDMETHODCALLTYPE *GetMuteDebugOutput )( + ID3D12InfoQueue * This); + + END_INTERFACE + } ID3D12InfoQueueVtbl; + + interface ID3D12InfoQueue + { + CONST_VTBL struct ID3D12InfoQueueVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12InfoQueue_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12InfoQueue_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12InfoQueue_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12InfoQueue_SetMessageCountLimit(This,MessageCountLimit) \ + ( (This)->lpVtbl -> SetMessageCountLimit(This,MessageCountLimit) ) + +#define ID3D12InfoQueue_ClearStoredMessages(This) \ + ( (This)->lpVtbl -> ClearStoredMessages(This) ) + +#define ID3D12InfoQueue_GetMessage(This,MessageIndex,pMessage,pMessageByteLength) \ + ( (This)->lpVtbl -> GetMessage(This,MessageIndex,pMessage,pMessageByteLength) ) + +#define ID3D12InfoQueue_GetNumMessagesAllowedByStorageFilter(This) \ + ( (This)->lpVtbl -> GetNumMessagesAllowedByStorageFilter(This) ) + +#define ID3D12InfoQueue_GetNumMessagesDeniedByStorageFilter(This) \ + ( (This)->lpVtbl -> GetNumMessagesDeniedByStorageFilter(This) ) + +#define ID3D12InfoQueue_GetNumStoredMessages(This) \ + ( (This)->lpVtbl -> GetNumStoredMessages(This) ) + +#define ID3D12InfoQueue_GetNumStoredMessagesAllowedByRetrievalFilter(This) \ + ( (This)->lpVtbl -> GetNumStoredMessagesAllowedByRetrievalFilter(This) ) + +#define ID3D12InfoQueue_GetNumMessagesDiscardedByMessageCountLimit(This) \ + ( (This)->lpVtbl -> GetNumMessagesDiscardedByMessageCountLimit(This) ) + +#define ID3D12InfoQueue_GetMessageCountLimit(This) \ + ( (This)->lpVtbl -> GetMessageCountLimit(This) ) + +#define ID3D12InfoQueue_AddStorageFilterEntries(This,pFilter) \ + ( (This)->lpVtbl -> AddStorageFilterEntries(This,pFilter) ) + +#define ID3D12InfoQueue_GetStorageFilter(This,pFilter,pFilterByteLength) \ + ( (This)->lpVtbl -> GetStorageFilter(This,pFilter,pFilterByteLength) ) + +#define ID3D12InfoQueue_ClearStorageFilter(This) \ + ( (This)->lpVtbl -> ClearStorageFilter(This) ) + +#define ID3D12InfoQueue_PushEmptyStorageFilter(This) \ + ( (This)->lpVtbl -> PushEmptyStorageFilter(This) ) + +#define ID3D12InfoQueue_PushCopyOfStorageFilter(This) \ + ( (This)->lpVtbl -> PushCopyOfStorageFilter(This) ) + +#define ID3D12InfoQueue_PushStorageFilter(This,pFilter) \ + ( (This)->lpVtbl -> PushStorageFilter(This,pFilter) ) + +#define ID3D12InfoQueue_PopStorageFilter(This) \ + ( (This)->lpVtbl -> PopStorageFilter(This) ) + +#define ID3D12InfoQueue_GetStorageFilterStackSize(This) \ + ( (This)->lpVtbl -> GetStorageFilterStackSize(This) ) + +#define ID3D12InfoQueue_AddRetrievalFilterEntries(This,pFilter) \ + ( (This)->lpVtbl -> AddRetrievalFilterEntries(This,pFilter) ) + +#define ID3D12InfoQueue_GetRetrievalFilter(This,pFilter,pFilterByteLength) \ + ( (This)->lpVtbl -> GetRetrievalFilter(This,pFilter,pFilterByteLength) ) + +#define ID3D12InfoQueue_ClearRetrievalFilter(This) \ + ( (This)->lpVtbl -> ClearRetrievalFilter(This) ) + +#define ID3D12InfoQueue_PushEmptyRetrievalFilter(This) \ + ( (This)->lpVtbl -> PushEmptyRetrievalFilter(This) ) + +#define ID3D12InfoQueue_PushCopyOfRetrievalFilter(This) \ + ( (This)->lpVtbl -> PushCopyOfRetrievalFilter(This) ) + +#define ID3D12InfoQueue_PushRetrievalFilter(This,pFilter) \ + ( (This)->lpVtbl -> PushRetrievalFilter(This,pFilter) ) + +#define ID3D12InfoQueue_PopRetrievalFilter(This) \ + ( (This)->lpVtbl -> PopRetrievalFilter(This) ) + +#define ID3D12InfoQueue_GetRetrievalFilterStackSize(This) \ + ( (This)->lpVtbl -> GetRetrievalFilterStackSize(This) ) + +#define ID3D12InfoQueue_AddMessage(This,Category,Severity,ID,pDescription) \ + ( (This)->lpVtbl -> AddMessage(This,Category,Severity,ID,pDescription) ) + +#define ID3D12InfoQueue_AddApplicationMessage(This,Severity,pDescription) \ + ( (This)->lpVtbl -> AddApplicationMessage(This,Severity,pDescription) ) + +#define ID3D12InfoQueue_SetBreakOnCategory(This,Category,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnCategory(This,Category,bEnable) ) + +#define ID3D12InfoQueue_SetBreakOnSeverity(This,Severity,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnSeverity(This,Severity,bEnable) ) + +#define ID3D12InfoQueue_SetBreakOnID(This,ID,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnID(This,ID,bEnable) ) + +#define ID3D12InfoQueue_GetBreakOnCategory(This,Category) \ + ( (This)->lpVtbl -> GetBreakOnCategory(This,Category) ) + +#define ID3D12InfoQueue_GetBreakOnSeverity(This,Severity) \ + ( (This)->lpVtbl -> GetBreakOnSeverity(This,Severity) ) + +#define ID3D12InfoQueue_GetBreakOnID(This,ID) \ + ( (This)->lpVtbl -> GetBreakOnID(This,ID) ) + +#define ID3D12InfoQueue_SetMuteDebugOutput(This,bMute) \ + ( (This)->lpVtbl -> SetMuteDebugOutput(This,bMute) ) + +#define ID3D12InfoQueue_GetMuteDebugOutput(This) \ + ( (This)->lpVtbl -> GetMuteDebugOutput(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12InfoQueue_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12sdklayers_0000_0019 */ +/* [local] */ + +typedef +enum D3D12_MESSAGE_CALLBACK_FLAGS + { + D3D12_MESSAGE_CALLBACK_FLAG_NONE = 0, + D3D12_MESSAGE_CALLBACK_IGNORE_FILTERS = 0x1 + } D3D12_MESSAGE_CALLBACK_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_MESSAGE_CALLBACK_FLAGS) +typedef void ( __stdcall *D3D12MessageFunc )( + D3D12_MESSAGE_CATEGORY Category, + D3D12_MESSAGE_SEVERITY Severity, + D3D12_MESSAGE_ID ID, + LPCSTR pDescription, + void *pContext); + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0019_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0019_v0_0_s_ifspec; + +#ifndef __ID3D12InfoQueue1_INTERFACE_DEFINED__ +#define __ID3D12InfoQueue1_INTERFACE_DEFINED__ + +/* interface ID3D12InfoQueue1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12InfoQueue1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2852dd88-b484-4c0c-b6b1-67168500e600") + ID3D12InfoQueue1 : public ID3D12InfoQueue + { + public: + virtual HRESULT STDMETHODCALLTYPE RegisterMessageCallback( + _In_ D3D12MessageFunc CallbackFunc, + _In_ D3D12_MESSAGE_CALLBACK_FLAGS CallbackFilterFlags, + _Inout_ void *pContext, + _Inout_ DWORD *pCallbackCookie) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnregisterMessageCallback( + _In_ DWORD CallbackCookie) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12InfoQueue1Vtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12InfoQueue1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, SetMessageCountLimit) + HRESULT ( STDMETHODCALLTYPE *SetMessageCountLimit )( + ID3D12InfoQueue1 * This, + _In_ UINT64 MessageCountLimit); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, ClearStoredMessages) + void ( STDMETHODCALLTYPE *ClearStoredMessages )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetMessage) + HRESULT ( STDMETHODCALLTYPE *GetMessage )( + ID3D12InfoQueue1 * This, + _In_ UINT64 MessageIndex, + _Out_writes_bytes_opt_(*pMessageByteLength) D3D12_MESSAGE *pMessage, + _Inout_ SIZE_T *pMessageByteLength); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetNumMessagesAllowedByStorageFilter) + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesAllowedByStorageFilter )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetNumMessagesDeniedByStorageFilter) + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesDeniedByStorageFilter )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetNumStoredMessages) + UINT64 ( STDMETHODCALLTYPE *GetNumStoredMessages )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetNumStoredMessagesAllowedByRetrievalFilter) + UINT64 ( STDMETHODCALLTYPE *GetNumStoredMessagesAllowedByRetrievalFilter )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetNumMessagesDiscardedByMessageCountLimit) + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesDiscardedByMessageCountLimit )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetMessageCountLimit) + UINT64 ( STDMETHODCALLTYPE *GetMessageCountLimit )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, AddStorageFilterEntries) + HRESULT ( STDMETHODCALLTYPE *AddStorageFilterEntries )( + ID3D12InfoQueue1 * This, + _In_ D3D12_INFO_QUEUE_FILTER *pFilter); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetStorageFilter) + HRESULT ( STDMETHODCALLTYPE *GetStorageFilter )( + ID3D12InfoQueue1 * This, + _Out_writes_bytes_opt_(*pFilterByteLength) D3D12_INFO_QUEUE_FILTER *pFilter, + _Inout_ SIZE_T *pFilterByteLength); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, ClearStorageFilter) + void ( STDMETHODCALLTYPE *ClearStorageFilter )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PushEmptyStorageFilter) + HRESULT ( STDMETHODCALLTYPE *PushEmptyStorageFilter )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PushCopyOfStorageFilter) + HRESULT ( STDMETHODCALLTYPE *PushCopyOfStorageFilter )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PushStorageFilter) + HRESULT ( STDMETHODCALLTYPE *PushStorageFilter )( + ID3D12InfoQueue1 * This, + _In_ D3D12_INFO_QUEUE_FILTER *pFilter); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PopStorageFilter) + void ( STDMETHODCALLTYPE *PopStorageFilter )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetStorageFilterStackSize) + UINT ( STDMETHODCALLTYPE *GetStorageFilterStackSize )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, AddRetrievalFilterEntries) + HRESULT ( STDMETHODCALLTYPE *AddRetrievalFilterEntries )( + ID3D12InfoQueue1 * This, + _In_ D3D12_INFO_QUEUE_FILTER *pFilter); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetRetrievalFilter) + HRESULT ( STDMETHODCALLTYPE *GetRetrievalFilter )( + ID3D12InfoQueue1 * This, + _Out_writes_bytes_opt_(*pFilterByteLength) D3D12_INFO_QUEUE_FILTER *pFilter, + _Inout_ SIZE_T *pFilterByteLength); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, ClearRetrievalFilter) + void ( STDMETHODCALLTYPE *ClearRetrievalFilter )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PushEmptyRetrievalFilter) + HRESULT ( STDMETHODCALLTYPE *PushEmptyRetrievalFilter )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PushCopyOfRetrievalFilter) + HRESULT ( STDMETHODCALLTYPE *PushCopyOfRetrievalFilter )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PushRetrievalFilter) + HRESULT ( STDMETHODCALLTYPE *PushRetrievalFilter )( + ID3D12InfoQueue1 * This, + _In_ D3D12_INFO_QUEUE_FILTER *pFilter); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, PopRetrievalFilter) + void ( STDMETHODCALLTYPE *PopRetrievalFilter )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetRetrievalFilterStackSize) + UINT ( STDMETHODCALLTYPE *GetRetrievalFilterStackSize )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, AddMessage) + HRESULT ( STDMETHODCALLTYPE *AddMessage )( + ID3D12InfoQueue1 * This, + _In_ D3D12_MESSAGE_CATEGORY Category, + _In_ D3D12_MESSAGE_SEVERITY Severity, + _In_ D3D12_MESSAGE_ID ID, + _In_ LPCSTR pDescription); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, AddApplicationMessage) + HRESULT ( STDMETHODCALLTYPE *AddApplicationMessage )( + ID3D12InfoQueue1 * This, + _In_ D3D12_MESSAGE_SEVERITY Severity, + _In_ LPCSTR pDescription); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, SetBreakOnCategory) + HRESULT ( STDMETHODCALLTYPE *SetBreakOnCategory )( + ID3D12InfoQueue1 * This, + _In_ D3D12_MESSAGE_CATEGORY Category, + _In_ BOOL bEnable); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, SetBreakOnSeverity) + HRESULT ( STDMETHODCALLTYPE *SetBreakOnSeverity )( + ID3D12InfoQueue1 * This, + _In_ D3D12_MESSAGE_SEVERITY Severity, + _In_ BOOL bEnable); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, SetBreakOnID) + HRESULT ( STDMETHODCALLTYPE *SetBreakOnID )( + ID3D12InfoQueue1 * This, + _In_ D3D12_MESSAGE_ID ID, + _In_ BOOL bEnable); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetBreakOnCategory) + BOOL ( STDMETHODCALLTYPE *GetBreakOnCategory )( + ID3D12InfoQueue1 * This, + _In_ D3D12_MESSAGE_CATEGORY Category); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetBreakOnSeverity) + BOOL ( STDMETHODCALLTYPE *GetBreakOnSeverity )( + ID3D12InfoQueue1 * This, + _In_ D3D12_MESSAGE_SEVERITY Severity); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetBreakOnID) + BOOL ( STDMETHODCALLTYPE *GetBreakOnID )( + ID3D12InfoQueue1 * This, + _In_ D3D12_MESSAGE_ID ID); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, SetMuteDebugOutput) + void ( STDMETHODCALLTYPE *SetMuteDebugOutput )( + ID3D12InfoQueue1 * This, + _In_ BOOL bMute); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue, GetMuteDebugOutput) + BOOL ( STDMETHODCALLTYPE *GetMuteDebugOutput )( + ID3D12InfoQueue1 * This); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue1, RegisterMessageCallback) + HRESULT ( STDMETHODCALLTYPE *RegisterMessageCallback )( + ID3D12InfoQueue1 * This, + _In_ D3D12MessageFunc CallbackFunc, + _In_ D3D12_MESSAGE_CALLBACK_FLAGS CallbackFilterFlags, + _Inout_ void *pContext, + _Inout_ DWORD *pCallbackCookie); + + DECLSPEC_XFGVIRT(ID3D12InfoQueue1, UnregisterMessageCallback) + HRESULT ( STDMETHODCALLTYPE *UnregisterMessageCallback )( + ID3D12InfoQueue1 * This, + _In_ DWORD CallbackCookie); + + END_INTERFACE + } ID3D12InfoQueue1Vtbl; + + interface ID3D12InfoQueue1 + { + CONST_VTBL struct ID3D12InfoQueue1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12InfoQueue1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12InfoQueue1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12InfoQueue1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12InfoQueue1_SetMessageCountLimit(This,MessageCountLimit) \ + ( (This)->lpVtbl -> SetMessageCountLimit(This,MessageCountLimit) ) + +#define ID3D12InfoQueue1_ClearStoredMessages(This) \ + ( (This)->lpVtbl -> ClearStoredMessages(This) ) + +#define ID3D12InfoQueue1_GetMessage(This,MessageIndex,pMessage,pMessageByteLength) \ + ( (This)->lpVtbl -> GetMessage(This,MessageIndex,pMessage,pMessageByteLength) ) + +#define ID3D12InfoQueue1_GetNumMessagesAllowedByStorageFilter(This) \ + ( (This)->lpVtbl -> GetNumMessagesAllowedByStorageFilter(This) ) + +#define ID3D12InfoQueue1_GetNumMessagesDeniedByStorageFilter(This) \ + ( (This)->lpVtbl -> GetNumMessagesDeniedByStorageFilter(This) ) + +#define ID3D12InfoQueue1_GetNumStoredMessages(This) \ + ( (This)->lpVtbl -> GetNumStoredMessages(This) ) + +#define ID3D12InfoQueue1_GetNumStoredMessagesAllowedByRetrievalFilter(This) \ + ( (This)->lpVtbl -> GetNumStoredMessagesAllowedByRetrievalFilter(This) ) + +#define ID3D12InfoQueue1_GetNumMessagesDiscardedByMessageCountLimit(This) \ + ( (This)->lpVtbl -> GetNumMessagesDiscardedByMessageCountLimit(This) ) + +#define ID3D12InfoQueue1_GetMessageCountLimit(This) \ + ( (This)->lpVtbl -> GetMessageCountLimit(This) ) + +#define ID3D12InfoQueue1_AddStorageFilterEntries(This,pFilter) \ + ( (This)->lpVtbl -> AddStorageFilterEntries(This,pFilter) ) + +#define ID3D12InfoQueue1_GetStorageFilter(This,pFilter,pFilterByteLength) \ + ( (This)->lpVtbl -> GetStorageFilter(This,pFilter,pFilterByteLength) ) + +#define ID3D12InfoQueue1_ClearStorageFilter(This) \ + ( (This)->lpVtbl -> ClearStorageFilter(This) ) + +#define ID3D12InfoQueue1_PushEmptyStorageFilter(This) \ + ( (This)->lpVtbl -> PushEmptyStorageFilter(This) ) + +#define ID3D12InfoQueue1_PushCopyOfStorageFilter(This) \ + ( (This)->lpVtbl -> PushCopyOfStorageFilter(This) ) + +#define ID3D12InfoQueue1_PushStorageFilter(This,pFilter) \ + ( (This)->lpVtbl -> PushStorageFilter(This,pFilter) ) + +#define ID3D12InfoQueue1_PopStorageFilter(This) \ + ( (This)->lpVtbl -> PopStorageFilter(This) ) + +#define ID3D12InfoQueue1_GetStorageFilterStackSize(This) \ + ( (This)->lpVtbl -> GetStorageFilterStackSize(This) ) + +#define ID3D12InfoQueue1_AddRetrievalFilterEntries(This,pFilter) \ + ( (This)->lpVtbl -> AddRetrievalFilterEntries(This,pFilter) ) + +#define ID3D12InfoQueue1_GetRetrievalFilter(This,pFilter,pFilterByteLength) \ + ( (This)->lpVtbl -> GetRetrievalFilter(This,pFilter,pFilterByteLength) ) + +#define ID3D12InfoQueue1_ClearRetrievalFilter(This) \ + ( (This)->lpVtbl -> ClearRetrievalFilter(This) ) + +#define ID3D12InfoQueue1_PushEmptyRetrievalFilter(This) \ + ( (This)->lpVtbl -> PushEmptyRetrievalFilter(This) ) + +#define ID3D12InfoQueue1_PushCopyOfRetrievalFilter(This) \ + ( (This)->lpVtbl -> PushCopyOfRetrievalFilter(This) ) + +#define ID3D12InfoQueue1_PushRetrievalFilter(This,pFilter) \ + ( (This)->lpVtbl -> PushRetrievalFilter(This,pFilter) ) + +#define ID3D12InfoQueue1_PopRetrievalFilter(This) \ + ( (This)->lpVtbl -> PopRetrievalFilter(This) ) + +#define ID3D12InfoQueue1_GetRetrievalFilterStackSize(This) \ + ( (This)->lpVtbl -> GetRetrievalFilterStackSize(This) ) + +#define ID3D12InfoQueue1_AddMessage(This,Category,Severity,ID,pDescription) \ + ( (This)->lpVtbl -> AddMessage(This,Category,Severity,ID,pDescription) ) + +#define ID3D12InfoQueue1_AddApplicationMessage(This,Severity,pDescription) \ + ( (This)->lpVtbl -> AddApplicationMessage(This,Severity,pDescription) ) + +#define ID3D12InfoQueue1_SetBreakOnCategory(This,Category,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnCategory(This,Category,bEnable) ) + +#define ID3D12InfoQueue1_SetBreakOnSeverity(This,Severity,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnSeverity(This,Severity,bEnable) ) + +#define ID3D12InfoQueue1_SetBreakOnID(This,ID,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnID(This,ID,bEnable) ) + +#define ID3D12InfoQueue1_GetBreakOnCategory(This,Category) \ + ( (This)->lpVtbl -> GetBreakOnCategory(This,Category) ) + +#define ID3D12InfoQueue1_GetBreakOnSeverity(This,Severity) \ + ( (This)->lpVtbl -> GetBreakOnSeverity(This,Severity) ) + +#define ID3D12InfoQueue1_GetBreakOnID(This,ID) \ + ( (This)->lpVtbl -> GetBreakOnID(This,ID) ) + +#define ID3D12InfoQueue1_SetMuteDebugOutput(This,bMute) \ + ( (This)->lpVtbl -> SetMuteDebugOutput(This,bMute) ) + +#define ID3D12InfoQueue1_GetMuteDebugOutput(This) \ + ( (This)->lpVtbl -> GetMuteDebugOutput(This) ) + + +#define ID3D12InfoQueue1_RegisterMessageCallback(This,CallbackFunc,CallbackFilterFlags,pContext,pCallbackCookie) \ + ( (This)->lpVtbl -> RegisterMessageCallback(This,CallbackFunc,CallbackFilterFlags,pContext,pCallbackCookie) ) + +#define ID3D12InfoQueue1_UnregisterMessageCallback(This,CallbackCookie) \ + ( (This)->lpVtbl -> UnregisterMessageCallback(This,CallbackCookie) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12InfoQueue1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12sdklayers_0000_0020 */ +/* [local] */ + +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */ +#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_ID3D12Debug2,0x93a665c4,0xa3b2,0x4e5d,0xb6,0x92,0xa2,0x6a,0xe1,0x4e,0x33,0x74); +DEFINE_GUID(IID_ID3D12Debug3,0x5cf4e58f,0xf671,0x4ff1,0xa5,0x42,0x36,0x86,0xe3,0xd1,0x53,0xd1); +DEFINE_GUID(IID_ID3D12Debug4,0x014b816e,0x9ec5,0x4a2f,0xa8,0x45,0xff,0xbe,0x44,0x1c,0xe1,0x3a); +DEFINE_GUID(IID_ID3D12Debug5,0x548d6b12,0x09fa,0x40e0,0x90,0x69,0x5d,0xcd,0x58,0x9a,0x52,0xc9); +DEFINE_GUID(IID_ID3D12Debug6,0x82a816d6,0x5d01,0x4157,0x97,0xd0,0x49,0x75,0x46,0x3f,0xd1,0xed); +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_ID3D12DebugDevice2,0x60eccbc1,0x378d,0x4df1,0x89,0x4c,0xf8,0xac,0x5c,0xe4,0xd7,0xdd); +DEFINE_GUID(IID_ID3D12DebugCommandQueue,0x09e0bf36,0x54ac,0x484f,0x88,0x47,0x4b,0xae,0xea,0xb6,0x05,0x3a); +DEFINE_GUID(IID_ID3D12DebugCommandQueue1,0x16be35a2,0xbfd6,0x49f2,0xbc,0xae,0xea,0xae,0x4a,0xff,0x86,0x2d); +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_ID3D12DebugCommandList2,0xaeb575cf,0x4e06,0x48be,0xba,0x3b,0xc4,0x50,0xfc,0x96,0x65,0x2e); +DEFINE_GUID(IID_ID3D12DebugCommandList3,0x197d5e15,0x4d37,0x4d34,0xaf,0x78,0x72,0x4c,0xd7,0x0f,0xdb,0x1f); +DEFINE_GUID(IID_ID3D12SharingContract,0x0adf7d52,0x929c,0x4e61,0xad,0xdb,0xff,0xed,0x30,0xde,0x66,0xef); +DEFINE_GUID(IID_ID3D12ManualWriteTrackingResource,0x86ca3b85,0x49ad,0x4b6e,0xae,0xd5,0xed,0xdb,0x18,0x54,0x0f,0x41); +DEFINE_GUID(IID_ID3D12InfoQueue,0x0742a90b,0xc387,0x483f,0xb9,0x46,0x30,0xa7,0xe4,0xe6,0x14,0x58); +DEFINE_GUID(IID_ID3D12InfoQueue1,0x2852dd88,0xb484,0x4c0c,0xb6,0xb1,0x67,0x16,0x85,0x00,0xe6,0x00); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0020_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0020_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + From 1954ac407fd06f2b2b2b1877e9ec4a91e4fcf04e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 31 Jul 2024 18:34:42 -0700 Subject: [PATCH 091/253] Don't mix keyboard and mouse raw input timestamps We want to keep mouse timestamps consistently using the same interval, and it's helpful to know when multiple keyboard events come in at the same time. --- src/video/windows/SDL_windowsevents.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index fd41ab15bc8fe..c5d36039726af 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -785,25 +785,31 @@ void WIN_PollRawInput(SDL_VideoDevice *_this) now = SDL_GetTicksNS(); if (total > 0) { - Uint64 timestamp, increment; + Uint64 mouse_timestamp, mouse_increment; Uint64 delta = (now - data->last_rawinput_poll); - if (total > 1 && delta <= SDL_MS_TO_NS(100)) { + UINT total_mouse = 0; + for (i = 0, input = (RAWINPUT *)data->rawinput; i < total; ++i, input = NEXTRAWINPUTBLOCK(input)) { + if (input->header.dwType == RIM_TYPEMOUSE) { + ++total_mouse; + } + } + if (total_mouse > 1 && delta <= SDL_MS_TO_NS(100)) { /* We'll spread these events over the time since the last poll */ - timestamp = data->last_rawinput_poll; - increment = delta / total; + mouse_timestamp = data->last_rawinput_poll; + mouse_increment = delta / total_mouse; } else { /* Do we want to track the update rate per device? */ - timestamp = now; - increment = 0; + mouse_timestamp = now; + mouse_increment = 0; } for (i = 0, input = (RAWINPUT *)data->rawinput; i < total; ++i, input = NEXTRAWINPUTBLOCK(input)) { - timestamp += increment; if (input->header.dwType == RIM_TYPEMOUSE) { RAWMOUSE *rawmouse = (RAWMOUSE *)((BYTE *)input + data->rawinput_offset); - WIN_HandleRawMouseInput(timestamp, data, input->header.hDevice, rawmouse); + mouse_timestamp += mouse_increment; + WIN_HandleRawMouseInput(mouse_timestamp, data, input->header.hDevice, rawmouse); } else if (input->header.dwType == RIM_TYPEKEYBOARD) { RAWKEYBOARD *rawkeyboard = (RAWKEYBOARD *)((BYTE *)input + data->rawinput_offset); - WIN_HandleRawKeyboardInput(timestamp, data, input->header.hDevice, rawkeyboard); + WIN_HandleRawKeyboardInput(now, data, input->header.hDevice, rawkeyboard); } } } From de30400a7b264f68f37bfe6cdc49d92aa7db9b93 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 31 Jul 2024 18:35:59 -0700 Subject: [PATCH 092/253] Fixed uninitialized variable warning --- src/test/SDL_test_memory.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/test/SDL_test_memory.c b/src/test/SDL_test_memory.c index ac8e823325efe..27f3cbd09207f 100644 --- a/src/test/SDL_test_memory.c +++ b/src/test/SDL_test_memory.c @@ -385,16 +385,15 @@ void SDLTest_LogAllocations(void) pSymbol->MaxNameLen = MAX_SYM_NAME; IMAGEHLP_LINE64 dbg_line; dbg_line.SizeOfStruct = sizeof(dbg_line); + dbg_line.FileName = ""; + dbg_line.LineNumber = 0; if (dyn_dbghelp.module) { if (!dyn_dbghelp.pSymFromAddr(GetCurrentProcess(), entry->stack[stack_index], &dwDisplacement, pSymbol)) { SDL_strlcpy(pSymbol->Name, "???", MAX_SYM_NAME); dwDisplacement = 0; } - if (!dyn_dbghelp.pSymGetLineFromAddr64(GetCurrentProcess(), (DWORD64)entry->stack[stack_index], &lineColumn, &dbg_line)) { - dbg_line.FileName = ""; - dbg_line.LineNumber = 0; - } + dyn_dbghelp.pSymGetLineFromAddr64(GetCurrentProcess(), (DWORD64)entry->stack[stack_index], &lineColumn, &dbg_line); } SDL_snprintf(stack_entry_description, sizeof(stack_entry_description), "%s+0x%I64x %s:%u", pSymbol->Name, dwDisplacement, dbg_line.FileName, (Uint32)dbg_line.LineNumber); } From 445983fc793200cec66f5e5e1e677903a6a2a55e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 31 Jul 2024 18:53:20 -0700 Subject: [PATCH 093/253] Remove D3D12 call hacks now that we have a good set of D3D12 headers --- src/render/direct3d12/SDL_render_d3d12.c | 76 +++++------------------- 1 file changed, 14 insertions(+), 62 deletions(-) diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index 06c5d0a8e1543..1f4bc7b4aa630 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -86,54 +86,6 @@ #define D3D_GUID(X) &(X) #endif -/* - * Older MS Windows SDK headers declare some d3d12 functions with the wrong function prototype. - * - ID3D12Heap::GetDesc - * - ID3D12Resource::GetDesc - * - ID3D12DescriptorHeap::GetDesc - * (and 9 more) - * This is fixed in SDKs since WDK_NTDDI_VERSION >= NTDDI_WIN10_FE (0x0A00000A) - */ - -#if !(defined(__MINGW32__) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) \ - && (WDK_NTDDI_VERSION < 0x0A00000A) - -#define D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(THIS, ...) do { \ - void (STDMETHODCALLTYPE * func)(ID3D12DescriptorHeap * This, D3D12_CPU_DESCRIPTOR_HANDLE * Handle) = \ - (void*)(THIS)->lpVtbl->GetCPUDescriptorHandleForHeapStart; \ - func((THIS), ##__VA_ARGS__); \ - } while (0) - -#define D3D_CALL_RET_ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(THIS, ...) do { \ - void (STDMETHODCALLTYPE * func)(ID3D12DescriptorHeap * This, D3D12_GPU_DESCRIPTOR_HANDLE * Handle) = \ - (void*)(THIS)->lpVtbl->GetGPUDescriptorHandleForHeapStart; \ - func((THIS), ##__VA_ARGS__); \ - } while (0) - -#define D3D_CALL_RET_ID3D12Resource_GetDesc(THIS, ...) do { \ - void (STDMETHODCALLTYPE * func)(ID3D12Resource * This, D3D12_RESOURCE_DESC * Desc) = \ - (void*)(THIS)->lpVtbl->GetDesc; \ - func((THIS), ##__VA_ARGS__); \ - } while (0) - -#else - -/* - * MinGW has correct function prototypes in the vtables, but defines wrong functions - * Xbox just needs these macros defined as used below (because CINTERFACE doesn't exist) - */ - -#define D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(THIS, ...) \ - D3D_CALL_RET(THIS, GetCPUDescriptorHandleForHeapStart, ##__VA_ARGS__); - -#define D3D_CALL_RET_ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(THIS, ...) \ - D3D_CALL_RET(THIS, GetGPUDescriptorHandleForHeapStart, ##__VA_ARGS__); - -#define D3D_CALL_RET_ID3D12Resource_GetDesc(THIS, ...) \ - D3D_CALL_RET(THIS, GetDesc, ##__VA_ARGS__); - -#endif - /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { @@ -550,10 +502,10 @@ static D3D12_GPU_DESCRIPTOR_HANDLE D3D12_CPUtoGPUHandle(ID3D12DescriptorHeap *he SIZE_T offset; /* Calculate the correct offset into the heap */ - D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(heap, &CPUHeapStart); + D3D_CALL_RET(heap, GetCPUDescriptorHandleForHeapStart, &CPUHeapStart); offset = CPUHandle.ptr - CPUHeapStart.ptr; - D3D_CALL_RET_ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(heap, &GPUHandle); + D3D_CALL_RET(heap, GetGPUDescriptorHandleForHeapStart, &GPUHandle); GPUHandle.ptr += offset; return GPUHandle; @@ -584,7 +536,7 @@ static D3D12_CPU_DESCRIPTOR_HANDLE D3D12_GetCurrentRenderTargetView(SDL_Renderer } SDL_zero(rtvDescriptor); - D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(data->rtvDescriptorHeap, &rtvDescriptor); + D3D_CALL_RET(data->rtvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &rtvDescriptor); rtvDescriptor.ptr += data->currentBackBufferIndex * data->rtvDescriptorSize; return rtvDescriptor; } @@ -1203,7 +1155,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) samplerDesc.ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS; samplerDesc.MinLOD = 0.0f; samplerDesc.MaxLOD = D3D12_FLOAT32_MAX; - D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(data->samplerDescriptorHeap, &data->samplers[0]); + D3D_CALL_RET(data->samplerDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &data->samplers[0]); for (i = 0; i < SDL_arraysize(samplerParams); ++i) { samplerDesc.Filter = samplerParams[i].filter; samplerDesc.AddressU = samplerParams[i].address; @@ -1539,7 +1491,7 @@ static HRESULT D3D12_CreateWindowSizeDependentResources(SDL_Renderer *renderer) rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; SDL_zero(rtvDescriptor); - D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(data->rtvDescriptorHeap, &rtvDescriptor); + D3D_CALL_RET(data->rtvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &rtvDescriptor); rtvDescriptor.ptr += i * data->rtvDescriptorSize; D3D_CALL(data->d3dDevice, CreateRenderTargetView, data->renderTargets[i], &rtvDesc, rtvDescriptor); } @@ -1796,7 +1748,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL resourceViewDesc.Texture2D.MipLevels = textureDesc.MipLevels; textureData->mainSRVIndex = D3D12_GetAvailableSRVIndex(renderer); - D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(rendererData->srvDescriptorHeap, &textureData->mainTextureResourceView); + D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceView); textureData->mainTextureResourceView.ptr += textureData->mainSRVIndex * rendererData->srvDescriptorSize; D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, @@ -1805,7 +1757,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL textureData->mainTextureResourceView); #if SDL_HAVE_YUV if (textureData->yuv) { - D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(rendererData->srvDescriptorHeap, &textureData->mainTextureResourceViewU); + D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceViewU); textureData->mainSRVIndexU = D3D12_GetAvailableSRVIndex(renderer); textureData->mainTextureResourceViewU.ptr += textureData->mainSRVIndexU * rendererData->srvDescriptorSize; D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, @@ -1813,7 +1765,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL &resourceViewDesc, textureData->mainTextureResourceViewU); - D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(rendererData->srvDescriptorHeap, &textureData->mainTextureResourceViewV); + D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceViewV); textureData->mainSRVIndexV = D3D12_GetAvailableSRVIndex(renderer); textureData->mainTextureResourceViewV.ptr += textureData->mainSRVIndexV * rendererData->srvDescriptorSize; D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, @@ -1832,7 +1784,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL } nvResourceViewDesc.Texture2D.PlaneSlice = 1; - D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(rendererData->srvDescriptorHeap, &textureData->mainTextureResourceViewNV); + D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceViewNV); textureData->mainSRVIndexNV = D3D12_GetAvailableSRVIndex(renderer); textureData->mainTextureResourceViewNV.ptr += textureData->mainSRVIndexNV * rendererData->srvDescriptorSize; D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, @@ -1849,7 +1801,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL renderTargetViewDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; renderTargetViewDesc.Texture2D.MipSlice = 0; - D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(rendererData->textureRTVDescriptorHeap, &textureData->mainTextureRenderTargetView); + D3D_CALL_RET(rendererData->textureRTVDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureRenderTargetView); textureData->mainTextureRenderTargetView.ptr += textureData->mainSRVIndex * rendererData->rtvDescriptorSize; D3D_CALL(rendererData->d3dDevice, CreateRenderTargetView, @@ -1913,7 +1865,7 @@ static int D3D12_UpdateTextureInternal(D3D12_RenderData *rendererData, ID3D12Res /* Create an upload buffer, which will be used to write to the main texture. */ SDL_zero(textureDesc); - D3D_CALL_RET_ID3D12Resource_GetDesc(texture, &textureDesc); + D3D_CALL_RET(texture, GetDesc, &textureDesc); textureDesc.Width = w; textureDesc.Height = h; if (textureDesc.Format == DXGI_FORMAT_NV12 || @@ -2169,7 +2121,7 @@ static int D3D12_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, /* Create an upload buffer, which will be used to write to the main texture. */ SDL_zero(textureDesc); - D3D_CALL_RET_ID3D12Resource_GetDesc(textureData->mainTexture, &textureDesc); + D3D_CALL_RET(textureData->mainTexture, GetDesc, &textureDesc); textureDesc.Width = rect->w; textureDesc.Height = rect->h; @@ -2278,7 +2230,7 @@ static void D3D12_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture) D3D_CALL(textureData->stagingBuffer, Unmap, 0, NULL); SDL_zero(textureDesc); - D3D_CALL_RET_ID3D12Resource_GetDesc(textureData->mainTexture, &textureDesc); + D3D_CALL_RET(textureData->mainTexture, GetDesc, &textureDesc); textureDesc.Width = textureData->lockedRect.w; textureDesc.Height = textureData->lockedRect.h; @@ -3068,7 +3020,7 @@ static SDL_Surface *D3D12_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rec /* Create a staging texture to copy the screen's data to: */ SDL_zero(textureDesc); - D3D_CALL_RET_ID3D12Resource_GetDesc(backBuffer, &textureDesc); + D3D_CALL_RET(backBuffer, GetDesc, &textureDesc); textureDesc.Width = rect->w; textureDesc.Height = rect->h; From 091960441b70f776928c279acc6f912b2666fe50 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 31 Jul 2024 18:53:44 -0700 Subject: [PATCH 094/253] Don't check SDL_RENDER_DRIVER in automated tests This might be set in the environment for testing purposes --- test/testautomation_hints.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/testautomation_hints.c b/test/testautomation_hints.c index b9589fcd508e9..95cbe2a792c16 100644 --- a/test/testautomation_hints.c +++ b/test/testautomation_hints.c @@ -14,7 +14,6 @@ static const char *HintsEnum[] = { SDL_HINT_MOUSE_RELATIVE_MODE_WARP, SDL_HINT_ORIENTATIONS, SDL_HINT_RENDER_DIRECT3D_THREADSAFE, - SDL_HINT_RENDER_DRIVER, SDL_HINT_RENDER_VSYNC, SDL_HINT_TIMER_RESOLUTION, SDL_HINT_VIDEO_ALLOW_SCREENSAVER, @@ -32,7 +31,6 @@ static const char *HintsVerbose[] = { "SDL_MOUSE_RELATIVE_MODE_WARP", "SDL_ORIENTATIONS", "SDL_RENDER_DIRECT3D_THREADSAFE", - "SDL_RENDER_DRIVER", "SDL_RENDER_VSYNC", "SDL_TIMER_RESOLUTION", "SDL_VIDEO_ALLOW_SCREENSAVER", From a1c6f99877a22f7a4b1af8df8f92e89c90c23976 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 31 Jul 2024 00:05:54 +0200 Subject: [PATCH 095/253] android: add script in Android archive to create a SDK Also, - Move mingw's pkg-support into build-scripts - Add type annotations to python scripts for mypy - ci: use v4 tag of actions/cache - cmake: use PYTHON3_EXECUTABLE for running xxd.py (Python3::Interpreter is not always recognized.) --- .github/actions/setup-ninja/action.yml | 4 +- .github/workflows/release.yml | 26 ++- CMakeLists.txt | 3 + build-scripts/build-release.py | 90 ++++++----- build-scripts/create-android-project.py | 42 ++--- build-scripts/pkg-support/android/__main__.py | 104 ++++++++++++ .../android/cmake/SDL3Config.cmake | 148 ++++++++++++++++++ .../android/cmake/SDL3ConfigVersion.cmake | 57 +++++++ .../pkg-support/mingw}/INSTALL.txt | 0 .../pkg-support/mingw}/Makefile | 0 .../pkg-support/mingw/cmake/SDL3Config.cmake | 0 .../mingw/cmake/SDL3ConfigVersion.cmake | 0 test/CMakeLists.txt | 2 +- 13 files changed, 414 insertions(+), 62 deletions(-) create mode 100644 build-scripts/pkg-support/android/__main__.py create mode 100644 build-scripts/pkg-support/android/cmake/SDL3Config.cmake create mode 100644 build-scripts/pkg-support/android/cmake/SDL3ConfigVersion.cmake rename {mingw/pkg-support => build-scripts/pkg-support/mingw}/INSTALL.txt (100%) rename {mingw/pkg-support => build-scripts/pkg-support/mingw}/Makefile (100%) rename mingw/pkg-support/cmake/sdl3-config.cmake => build-scripts/pkg-support/mingw/cmake/SDL3Config.cmake (100%) rename mingw/pkg-support/cmake/sdl3-config-version.cmake => build-scripts/pkg-support/mingw/cmake/SDL3ConfigVersion.cmake (100%) diff --git a/.github/actions/setup-ninja/action.yml b/.github/actions/setup-ninja/action.yml index e013c8321492f..b9283598d773d 100644 --- a/.github/actions/setup-ninja/action.yml +++ b/.github/actions/setup-ninja/action.yml @@ -36,7 +36,7 @@ runs: echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT} - name: 'Restore cached ${{ steps.calc.outputs.archive }}' id: cache-restore - uses: actions/cache/restore@main + uses: actions/cache/restore@v4 with: path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}' key: ${{ steps.calc.outputs.cache-key }} @@ -47,7 +47,7 @@ runs: Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}" - name: 'Cache ${{ steps.calc.outputs.archive }}' if: ${{ !steps.cache-restore.outputs.cache-hit }} - uses: actions/cache/save@main + uses: actions/cache/save@v4 with: path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}' key: ${{ steps.calc.outputs.cache-key }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 21bf742e24ef8..7cf940ce91836 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -596,9 +596,6 @@ jobs: echo "Project contents:" echo "" find "/tmp/projects/org.libsdl.testspriteminimal" - - name: 'Remove SDL sources to make sure they are not used' - run: | - rm -rf "${{ steps.src.outputs.path }}" - name: 'Copy SDL3 aar into Gradle project' run: | cp "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}" "${{ steps.create-gradle-project.outputs.path }}/app/libs" @@ -615,3 +612,26 @@ jobs: run: | cd "${{ steps.create-gradle-project.outputs.path }}" ./gradlew -i assembleRelease + - name: 'Extract Android SDK from AAR' + id: sdk + run: | + python "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}" -o /tmp/SDL3-android + echo "prefix=/tmp/SDL3-android" >>$GITHUB_OUTPUT + - name: 'CMake (configure + build) x86, x64, arm32, arm64' + run: | + android_abis="x86 x86_64 armeabi-v7a arm64-v8a" + for android_abi in ${android_abis}; do + echo "Configure ${android_abi}" + cmake -S "${{ steps.src.outputs.path }}/cmake/test" \ + -DTEST_FULL=TRUE \ + -DTEST_STATIC=FALSE \ + -DTEST_TEST=TRUE \ + -DCMAKE_PREFIX_PATH="${{ steps.sdk.outputs.prefix }}" \ + -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \ + -DANDROID_ABI=${android_abi} \ + -Werror=dev \ + -DCMAKE_BUILD_TYPE=Release \ + -B "${android_abi}" + done + echo "Build ${android_abi}" + cmake --build "${android_abi}" --config Release --verbose diff --git a/CMakeLists.txt b/CMakeLists.txt index 688e25fe10a5f..048622b7e39a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3583,8 +3583,11 @@ if(NOT SDL_DISABLE_INSTALL) if(ANDROID) if(TARGET SDL3-jar) set(SDL_INSTALL_JAVADIR "${CMAKE_INSTALL_DATAROOTDIR}/java" CACHE PATH "Path where to install java clases + java sources") + set(PROGUARD_RULES_PATH "${CMAKE_CURRENT_SOURCE_DIR}/android-project/app/proguard-rules.pro") install(FILES $ DESTINATION "${SDL_INSTALL_JAVADIR}/SDL3") + install(FILES "${PROGUARD_RULES_PATH}" RENAME "proguard.txt" + DESTINATION "${SDL_INSTALL_JAVADIR}/SDL3") configure_package_config_file(cmake/SDL3jarTargets.cmake.in SDL3jarTargets.cmake INSTALL_DESTINATION "${SDL_SDL_INSTALL_CMAKEDIR}" PATH_VARS SDL_INSTALL_JAVADIR diff --git a/build-scripts/build-release.py b/build-scripts/build-release.py index 735890005ba9d..248c2227fb12c 100755 --- a/build-scripts/build-release.py +++ b/build-scripts/build-release.py @@ -82,7 +82,7 @@ def __init__(self, executer: Executer, year: typing.Optional[str]=None): self.msbuild = self.find_msbuild() @property - def dry(self): + def dry(self) -> bool: return self.executer.dry VS_YEAR_TO_VERSION = { @@ -97,7 +97,7 @@ def find_vsdevcmd(self, year: typing.Optional[str]=None) -> typing.Optional[Path vswhere_spec = ["-latest"] if year is not None: try: - version = cls.VS_YEAR_TO_VERSION[year] + version = self.VS_YEAR_TO_VERSION[year] except KeyError: logger.error("Invalid Visual Studio year") return None @@ -115,7 +115,7 @@ def find_vsdevcmd(self, year: typing.Optional[str]=None) -> typing.Optional[Path return vsdevcmd_path def find_msbuild(self) -> typing.Optional[Path]: - vswhere_cmd = ["vswhere", "-latest", "-requires", "Microsoft.Component.MSBuild", "-find", "MSBuild\**\Bin\MSBuild.exe"] + vswhere_cmd = ["vswhere", "-latest", "-requires", "Microsoft.Component.MSBuild", "-find", r"MSBuild\**\Bin\MSBuild.exe"] msbuild_path = Path(self.executer.run(vswhere_cmd, stdout=True, dry_out="/tmp/MSBuild.exe").stdout.strip()) logger.info("MSBuild path = %s", msbuild_path) if self.dry: @@ -150,10 +150,10 @@ def __init__(self, project: str, commit: str, root: Path, dist_path: Path, secti self.executer = executer self.cmake_generator = cmake_generator - self.artifacts = {} + self.artifacts: dict[str, Path] = {} @property - def dry(self): + def dry(self) -> bool: return self.executer.dry def prepare(self): @@ -161,7 +161,7 @@ def prepare(self): self.dist_path.mkdir(parents=True, exist_ok=True) TreeItem = collections.namedtuple("TreeItem", ("path", "mode", "data", "time")) - def _get_file_times(self, paths: tuple[str]) -> dict[str, datetime.datetime]: + def _get_file_times(self, paths: tuple[str, ...]) -> dict[str, datetime.datetime]: dry_out = textwrap.dedent("""\ time=2024-03-14T15:40:25-07:00 @@ -170,18 +170,18 @@ def _get_file_times(self, paths: tuple[str]) -> dict[str, datetime.datetime]: git_log_out = self.executer.run(["git", "log", "--name-status", '--pretty=time=%cI', self.commit], stdout=True, dry_out=dry_out).stdout.splitlines(keepends=False) current_time = None set_paths = set(paths) - path_times = {} + path_times: dict[str, datetime.datetime] = {} for line in git_log_out: if not line: continue if line.startswith("time="): current_time = datetime.datetime.fromisoformat(line.removeprefix("time=")) continue - mod_type, paths = line.split(maxsplit=1) + mod_type, file_paths = line.split(maxsplit=1) assert current_time is not None - for path in paths.split(): - if path in set_paths and path not in path_times: - path_times[path] = current_time + for file_path in file_paths.split(): + if file_path in set_paths and file_path not in path_times: + path_times[file_path] = current_time assert set(path_times.keys()) == set_paths return path_times @@ -191,19 +191,25 @@ def _path_filter(path: str): return False return True - def _get_git_contents(self) -> dict[str, (TreeItem, bytes, datetime.datetime)]: + def _get_git_contents(self) -> dict[str, TreeItem]: contents_tgz = subprocess.check_output(["git", "archive", "--format=tar.gz", self.commit, "-o", "/dev/stdout"], text=False) contents = tarfile.open(fileobj=io.BytesIO(contents_tgz), mode="r:gz") filenames = tuple(m.name for m in contents if m.isfile()) assert "src/SDL.c" in filenames assert "include/SDL3/SDL.h" in filenames file_times = self._get_file_times(filenames) - git_contents = { - ti.name: self.TreeItem(path=ti.name, mode=ti.mode, data=contents.extractfile(ti.name).read(), time=file_times[ti.name]) for ti in contents if ti.isfile() and self._path_filter(ti.name) - } + git_contents = {} + for ti in contents: + if not ti.isfile(): + continue + if not self._path_filter(ti.name): + continue + contents_file = contents.extractfile(ti.name) + assert contents_file, f"{ti.name} is not a file" + git_contents[ti.name] = self.TreeItem(path=ti.name, mode=ti.mode, data=contents_file.read(), time=file_times[ti.name]) return git_contents - def create_source_archives(self): + def create_source_archives(self) -> None: archive_base = f"{self.project}-{self.version}" git_contents = self._get_git_contents() @@ -257,7 +263,7 @@ def create_source_archives(self): self.artifacts[f"src-tar-{comp}"] = tar_path - def create_xcframework(self, configuration: str="Release"): + def create_xcframework(self, configuration: str="Release") -> None: dmg_in = self.root / f"Xcode/SDL/build/SDL3.dmg" dmg_in.unlink(missing_ok=True) self.executer.run(["xcodebuild", "-project", str(self.root / "Xcode/SDL/SDL.xcodeproj"), "-target", "SDL3.dmg", "-configuration", configuration]) @@ -272,7 +278,7 @@ def create_xcframework(self, configuration: str="Release"): self.artifacts["dmg"] = dmg_out @property - def git_hash_data(self): + def git_hash_data(self) -> bytes: return f"{self.commit}\n".encode() def _tar_add_git_hash(self, tar_object: tarfile.TarFile, root: typing.Optional[str]=None, time: typing.Optional[datetime.datetime]=None): @@ -285,7 +291,7 @@ def _tar_add_git_hash(self, tar_object: tarfile.TarFile, root: typing.Optional[s tar_info = tarfile.TarInfo(path) tar_info.mode = 0o100644 tar_info.size = len(self.git_hash_data) - tar_info.mtime = time.timestamp() + tar_info.mtime = int(time.timestamp()) tar_object.addfile(tar_info, fileobj=io.BytesIO(self.git_hash_data)) def _zip_add_git_hash(self, zip_file: zipfile.ZipFile, root: typing.Optional[str]=None, time: typing.Optional[datetime.datetime]=None): @@ -301,7 +307,7 @@ def _zip_add_git_hash(self, zip_file: zipfile.ZipFile, root: typing.Optional[str zip_info.compress_type = zipfile.ZIP_DEFLATED zip_file.writestr(zip_info, data=self.git_hash_data) - def create_mingw_archives(self): + def create_mingw_archives(self) -> None: build_type = "Release" mingw_archs = ("i686", "x86_64") build_parent_dir = self.root / "build-mingw" @@ -345,18 +351,18 @@ def create_mingw_archives(self): self.executer.run(["cmake", "--install", str(build_path), "--strip", "--config", build_type]) arch_files[arch] = list(Path(r) / f for r, _, files in os.walk(install_path) for f in files) - extra_files = [ - ("mingw/pkg-support/INSTALL.txt", ""), - ("mingw/pkg-support/Makefile", ""), - ("mingw/pkg-support/cmake/sdl3-config.cmake", "cmake/"), - ("mingw/pkg-support/cmake/sdl3-config-version.cmake", "cmake/"), + extra_files = ( + ("build-scripts/pkg-support/mingw/INSTALL.txt", ""), + ("build-scripts/pkg-support/mingw/Makefile", ""), + ("build-scripts/pkg-support/mingw/cmake/SDL3Config.cmake", "cmake/"), + ("build-scripts/pkg-support/mingw/cmake/SDL3ConfigVersion.cmake", "cmake/"), ("BUGS.txt", ""), ("CREDITS.md", ""), ("README-SDL.txt", ""), ("WhatsNew.txt", ""), ("LICENSE.txt", ""), ("README.md", ""), - ] + ) test_files = list(Path(r) / f for r, _, files in os.walk(self.root / "test") for f in files) # FIXME: split SDL3.dll debug information into debug library @@ -385,7 +391,7 @@ def create_mingw_archives(self): self.artifacts[f"mingw-devel-tar-{comp}"] = tar_paths[comp] - def build_vs(self, arch: str, platform: str, vs: VisualStudio, configuration: str="Release"): + def build_vs(self, arch: str, platform: str, vs: VisualStudio, configuration: str="Release") -> VcArchDevel: dll_path = self.root / f"VisualC/SDL/{platform}/{configuration}/{self.project}.dll" pdb_path = self.root / f"VisualC/SDL/{platform}/{configuration}/{self.project}.pdb" imp_path = self.root / f"VisualC/SDL/{platform}/{configuration}/{self.project}.lib" @@ -430,7 +436,7 @@ def build_vs(self, arch: str, platform: str, vs: VisualStudio, configuration: st return VcArchDevel(dll=dll_path, pdb=pdb_path, imp=imp_path, test=test_path) - def build_vs_cmake(self, arch: str, arch_cmake: str): + def build_vs_cmake(self, arch: str, arch_cmake: str) -> VcArchDevel: build_path = self.root / f"build-vs-{arch}" install_path = build_path / "prefix" dll_path = install_path / f"bin/{self.project}.dll" @@ -500,7 +506,7 @@ def build_vs_cmake(self, arch: str, arch_cmake: str): return VcArchDevel(dll=dll_path, pdb=pdb_path, imp=imp_path, test=test_path) - def build_vs_devel(self, arch_vc: dict[str, VcArchDevel]): + def build_vs_devel(self, arch_vc: dict[str, VcArchDevel]) -> None: zip_path = self.dist_path / f"{self.project}-devel-{self.version}-VC.zip" archive_prefix = f"{self.project}-{self.version}" @@ -554,7 +560,7 @@ def detect_android_api(self, android_home: str) -> typing.Optional[int]: logger.info("Selected API version %d", android_api) return android_api - def get_prefab_json_text(self): + def get_prefab_json_text(self) -> str: return textwrap.dedent(f"""\ {{ "schema_version": 2, @@ -564,7 +570,7 @@ def get_prefab_json_text(self): }} """) - def get_prefab_module_json_text(self, library_name: str, extra_libs: list[str]): + def get_prefab_module_json_text(self, library_name: str, extra_libs: list[str]) -> str: export_libraries_str = ", ".join(f"\"-l{lib}\"" for lib in extra_libs) return textwrap.dedent(f"""\ {{ @@ -573,7 +579,7 @@ def get_prefab_module_json_text(self, library_name: str, extra_libs: list[str]): }} """) - def get_prefab_abi_json_text(self, abi: str, cpp: bool, shared: bool): + def get_prefab_abi_json_text(self, abi: str, cpp: bool, shared: bool) -> str: return textwrap.dedent(f"""\ {{ "abi": "{abi}", @@ -584,7 +590,7 @@ def get_prefab_abi_json_text(self, abi: str, cpp: bool, shared: bool): }} """) - def get_android_manifest_text(self): + def get_android_manifest_text(self) -> str: return textwrap.dedent(f"""\ """) - def create_android_archives(self, android_api: int, android_home: Path, android_ndk_home: Path, android_abis: list[str]): + def create_android_archives(self, android_api: int, android_home: Path, android_ndk_home: Path, android_abis: list[str]) -> None: cmake_toolchain_file = Path(android_ndk_home) / "build/cmake/android.toolchain.cmake" if not cmake_toolchain_file.exists(): logger.error("CMake toolchain file does not exist (%s)", cmake_toolchain_file) @@ -603,9 +609,19 @@ def create_android_archives(self, android_api: int, android_home: Path, android_ aar_path = self.dist_path / f"{self.project}-{self.version}.aar" added_global_files = False with zipfile.ZipFile(aar_path, "w", compression=zipfile.ZIP_DEFLATED) as zip_object: + project_description = { + "name": self.project, + "version": self.version, + "git-hash": self.commit, + } + zip_object.writestr("description.json", json.dumps(project_description, indent=0)) zip_object.writestr("AndroidManifest.xml", self.get_android_manifest_text()) zip_object.write(self.root / "android-project/app/proguard-rules.pro", arcname="proguard.txt") zip_object.write(self.root / "LICENSE.txt", arcname="META-INF/LICENSE.txt") + zip_object.write(self.root / "cmake/sdlcpu.cmake", arcname="cmake/sdlcpu.cmake") + zip_object.write(self.root / "build-scripts/pkg-support/android/__main__.py", arcname="__main__.py") + zip_object.write(self.root / "build-scripts/pkg-support/android/cmake/SDL3Config.cmake", arcname="cmake/SDL3Config.cmake") + zip_object.write(self.root / "build-scripts/pkg-support/android/cmake/SDL3ConfigVersion.cmake", arcname="cmake/SDL3ConfigVersion.cmake") zip_object.writestr("prefab/prefab.json", self.get_prefab_json_text()) self._zip_add_git_hash(zip_file=zip_object) @@ -701,7 +717,7 @@ def create_android_archives(self, android_api: int, android_home: Path, android_ self.artifacts[f"android-aar"] = aar_path @classmethod - def extract_sdl_version(cls, root: Path, project: str): + def extract_sdl_version(cls, root: Path, project: str) -> str: with open(root / f"include/{project}/SDL_version.h", "r") as f: text = f.read() major = next(re.finditer(r"^#define SDL_MAJOR_VERSION\s+([0-9]+)$", text, flags=re.M)).group(1) @@ -710,7 +726,7 @@ def extract_sdl_version(cls, root: Path, project: str): return f"{major}.{minor}.{micro}" -def main(argv=None): +def main(argv=None) -> int: parser = argparse.ArgumentParser(allow_abbrev=False, description="Create SDL release artifacts") parser.add_argument("--root", metavar="DIR", type=Path, default=Path(__file__).absolute().parents[1], help="Root of SDL") parser.add_argument("--out", "-o", metavar="DIR", dest="dist_path", type=Path, default="dist", help="Output directory") @@ -739,7 +755,7 @@ def main(argv=None): args.dist_path = args.dist_path / "dry" if args.github: - section_printer = GitHubSectionPrinter() + section_printer: SectionPrinter = GitHubSectionPrinter() else: section_printer = SectionPrinter() diff --git a/build-scripts/create-android-project.py b/build-scripts/create-android-project.py index 84dbf9b1ac98c..e1cb2eb6e444a 100755 --- a/build-scripts/create-android-project.py +++ b/build-scripts/create-android-project.py @@ -10,7 +10,7 @@ SDL_ROOT = Path(__file__).resolve().parents[1] -def extract_sdl_version(): +def extract_sdl_version() -> str: """ Extract SDL version from SDL3/SDL_version.h """ @@ -23,8 +23,8 @@ def extract_sdl_version(): micro = int(next(re.finditer(r"#define\s+SDL_MICRO_VERSION\s+([0-9]+)", data)).group(1)) return f"{major}.{minor}.{micro}" -def replace_in_file(path, regex_what, replace_with): - with open(path, "r") as f: +def replace_in_file(path: Path, regex_what: str, replace_with: str) -> None: + with path.open("r") as f: data = f.read() new_data, count = re.subn(regex_what, replace_with, data) @@ -35,12 +35,12 @@ def replace_in_file(path, regex_what, replace_with): f.write(new_data) -def android_mk_use_prefab(path): +def android_mk_use_prefab(path: Path) -> None: """ Replace relative SDL inclusion with dependency on prefab package """ - with open(path) as f: + with path.open() as f: data = "".join(line for line in f.readlines() if "# SDL" not in line) data, _ = re.subn("[\n]{3,}", "\n\n", data) @@ -55,18 +55,19 @@ def android_mk_use_prefab(path): $(call import-module,prefab/SDL3) """) - with open(path, "w") as f: + with path.open("w") as f: f.write(newdata) -def cmake_mk_no_sdl(path): + +def cmake_mk_no_sdl(path: Path) -> None: """ Don't add the source directories of SDL/SDL_image/SDL_mixer/... """ - with open(path) as f: + with path.open() as f: lines = f.readlines() - newlines = [] + newlines: list[str] = [] for line in lines: if "add_subdirectory(SDL" in line: while newlines[-1].startswith("#"): @@ -76,11 +77,12 @@ def cmake_mk_no_sdl(path): newdata, _ = re.subn("[\n]{3,}", "\n\n", "".join(newlines)) - with open(path, "w") as f: + with path.open("w") as f: f.write(newdata) -def gradle_add_prefab_and_aar(path, aar): - with open(path) as f: + +def gradle_add_prefab_and_aar(path: Path, aar: str) -> None: + with path.open() as f: data = f.read() data, count = re.subn("android {", textwrap.dedent(""" @@ -95,25 +97,26 @@ def gradle_add_prefab_and_aar(path, aar): implementation files('libs/{aar}')"""), data) assert count == 1 - with open(path, "w") as f: + with path.open("w") as f: f.write(data) -def gradle_add_package_name(path, package_name): - with open(path) as f: + +def gradle_add_package_name(path: Path, package_name: str) -> None: + with path.open() as f: data = f.read() data, count = re.subn("org.libsdl.app", package_name, data) assert count >= 1 - with open(path, "w") as f: + with path.open("w") as f: f.write(data) -def main(): +def main() -> int: description = "Create a simple Android gradle project from input sources." epilog = "You need to manually copy a prebuilt SDL3 Android archive into the project tree when using the aar variant." - parser = ArgumentParser(description=description, allow_abbrev=False) - parser.add_argument("package_name", metavar="PACKAGENAME", help="Android package name e.g. com.yourcompany.yourapp") + parser = ArgumentParser(description=description, epilog=epilog, allow_abbrev=False) + parser.add_argument("package_name", metavar="PACKAGENAME", help="Android package name (e.g. com.yourcompany.yourapp)") parser.add_argument("sources", metavar="SOURCE", nargs="*", help="Source code of your application. The files are copied to the output directory.") parser.add_argument("--variant", choices=["copy", "symlink", "aar"], default="copy", help="Choose variant of SDL project (copy: copy SDL sources, symlink: symlink SDL sources, aar: use Android aar archive)") parser.add_argument("--output", "-o", default=SDL_ROOT / "build", type=Path, help="Location where to store the Android project") @@ -225,6 +228,7 @@ def main(): print("To build and install to a device for testing, run the following:") print(f"cd {build_path}") print("./gradlew installDebug") + return 0 if __name__ == "__main__": raise SystemExit(main()) diff --git a/build-scripts/pkg-support/android/__main__.py b/build-scripts/pkg-support/android/__main__.py new file mode 100644 index 0000000000000..c27a63316186b --- /dev/null +++ b/build-scripts/pkg-support/android/__main__.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python + +""" +Create a SDL SDK prefix from an Android archive +This file is meant to be placed in a the root of an android .aar archive + +Example usage: +```sh +python SDL3-3.2.0.aar -o /usr/opt/android-sdks +cmake -S my-project \ + -DCMAKE_PREFIX_PATH=/usr/opt/android-sdks \ + -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \ + -B build-arm64 -DANDROID_ABI=arm64-v8a \ + -DCMAKE_BUILD_TYPE=Releaase +cmake --build build-arm64 +``` +""" +import argparse +import io +import json +import os +import pathlib +import re +import stat +import zipfile + + +AAR_PATH = pathlib.Path(__file__).resolve().parent +ANDROID_ARCHS = { "armeabi-v7a", "arm64-v8a", "x86", "x86_64" } + + +def main(): + parser = argparse.ArgumentParser( + description="Convert an Android .aar archive into a SDK", + allow_abbrev=False, + ) + parser.add_argument("-o", dest="output", type=pathlib.Path, required=True, help="Folder where to store the SDK") + args = parser.parse_args() + + print(f"Creating a SDK at {args.output}...") + + prefix = args.output + incdir = prefix / "include" + libdir = prefix / "lib" + + RE_LIB_MODULE_ARCH = re.compile(r"prefab/modules/(?P[A-Za-z0-9_-]+)/libs/android\.(?P[a-zA-Z0-9_-]+)/(?Plib[A-Za-z0-9_]+\.(?:so|a))") + RE_INC_MODULE_ARCH = re.compile(r"prefab/modules/(?P[A-Za-z0-9_-]+)/include/(?P
[a-zA-Z0-9_./-]+)") + RE_LICENSE = re.compile(r"(?:.*/)?(?P(?:license|copying)(?:\.md|\.txt)?)", flags=re.I) + RE_PROGUARD = re.compile(r"(?:.*/)?(?Pproguard.*\.(?:pro|txt))", flags=re.I) + RE_CMAKE = re.compile(r"(?:.*/)?(?P.*\.cmake)", flags=re.I) + + with zipfile.ZipFile(AAR_PATH) as zf: + project_description = json.loads(zf.read("description.json")) + project_name = project_description["name"] + project_version = project_description["version"] + licensedir = prefix / "share/licenses" / project_name + cmakedir = libdir / "cmake" / project_name + javadir = prefix / "share/java" / project_name + javadocdir = prefix / "share/javadoc" / project_name + + def read_zipfile_and_write(path: pathlib.Path, zippath: str): + data = zf.read(zippath) + path.parent.mkdir(parents=True, exist_ok=True) + path.write_bytes(data) + + for zip_info in zf.infolist(): + zippath = zip_info.filename + if m := RE_LIB_MODULE_ARCH.match(zippath): + lib_path = libdir / m["arch"] / m["filename"] + read_zipfile_and_write(lib_path, zippath) + if m["filename"].endswith(".so"): + os.chmod(lib_path, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH) + + elif m := RE_INC_MODULE_ARCH.match(zippath): + header_path = incdir / m["header"] + read_zipfile_and_write(header_path, zippath) + elif m:= RE_LICENSE.match(zippath): + license_path = licensedir / m["filename"] + read_zipfile_and_write(license_path, zippath) + elif m:= RE_PROGUARD.match(zippath): + proguard_path = javadir / m["filename"] + read_zipfile_and_write(proguard_path, zippath) + elif m:= RE_CMAKE.match(zippath): + cmake_path = cmakedir / m["filename"] + read_zipfile_and_write(cmake_path, zippath) + elif zippath == "classes.jar": + versioned_jar_path = javadir / f"{project_name}-{project_version}.jar" + unversioned_jar_path = javadir / f"{project_name}.jar" + read_zipfile_and_write(versioned_jar_path, zippath) + os.symlink(src=versioned_jar_path.name, dst=unversioned_jar_path) + elif zippath == "classes-sources.jar": + jarpath = javadir / f"{project_name}-{project_version}-sources.jar" + read_zipfile_and_write(jarpath, zippath) + elif zippath == "classes-doc.jar": + data = zf.read(zippath) + with zipfile.ZipFile(io.BytesIO(data)) as doc_zf: + doc_zf.extractall(javadocdir) + + print("... done") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/build-scripts/pkg-support/android/cmake/SDL3Config.cmake b/build-scripts/pkg-support/android/cmake/SDL3Config.cmake new file mode 100644 index 0000000000000..fb914701ff940 --- /dev/null +++ b/build-scripts/pkg-support/android/cmake/SDL3Config.cmake @@ -0,0 +1,148 @@ +# SDL CMake configuration file: +# This file is meant to be placed in lib/cmake/SDL3 subfolder of a reconstructed Android SDL3 SDK + +cmake_minimum_required(VERSION 3.0...3.5) + +include(FeatureSummary) +set_package_properties(SDL3 PROPERTIES + URL "https://www.libsdl.org/" + DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" +) + +# Copied from `configure_package_config_file` +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +# Copied from `configure_package_config_file` +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + +set(SDL3_FOUND TRUE) + +if(SDL_CPU_X86) + set(_sdl_arch_subdir "x86") +elseif(SDL_CPU_X64) + set(_sdl_arch_subdir "x86_64") +elseif(SDL_CPU_ARM32) + set(_sdl_arch_subdir "armeabi-v7a") +elseif(SDL_CPU_ARM64) + set(_sdl_arch_subdir "arm64-v8a") +else() + set(SDL3_FOUND FALSE) + return() +endif() + +get_filename_component(_sdl3_prefix "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) +get_filename_component(_sdl3_prefix "${_sdl3_prefix}/.." ABSOLUTE) +get_filename_component(_sdl3_prefix "${_sdl3_prefix}/.." ABSOLUTE) +set_and_check(_sdl3_prefix "${_sdl3_prefix}") +set(_sdl3_include_dirs "${_sdl3_prefix}/include") + +set(_sdl3_lib "${_sdl3_prefix}/lib/${_sdl_arch_subdir}/libSDL3.so") +set(_sdl3test_lib "${_sdl3_prefix}/lib/${_sdl_arch_subdir}/libSDL3_test.a") +set(_sdl3_jar "${_sdl3_prefix}/share/java/SDL3/SDL3-${SDL3_VERSION}.jar") + +unset(_sdl_arch_subdir) +unset(_sdl3_prefix) + +# All targets are created, even when some might not be requested though COMPONENTS. +# This is done for compatibility with CMake generated SDL3-target.cmake files. + +if(NOT TARGET SDL3::Headers) + add_library(SDL3::Headers INTERFACE IMPORTED) + set_target_properties(SDL3::Headers + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_include_dirs}" + ) +endif() +set(SDL3_Headers_FOUND TRUE) +unset(_sdl3_include_dirs) + +if(EXISTS "${_sdl3_lib}") + if(NOT TARGET SDL3::SDL3-shared) + add_library(SDL3::SDL3-shared SHARED IMPORTED) + set_target_properties(SDL3::SDL3-shared + PROPERTIES + INTERFACE_LINK_LIBRARIES "SDL3::Headers" + IMPORTED_LOCATION "${_sdl3_lib}" + COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED" + INTERFACE_SDL3_SHARED "ON" + COMPATIBLE_INTERFACE_STRING "SDL_VERSION" + INTERFACE_SDL_VERSION "SDL3" + ) + endif() + set(SDL3_SDL3-shared_FOUND TRUE) +else() + set(SDL3_SDL3-shared_FOUND FALSE) +endif() +unset(_sdl3_lib) + +set(SDL3_SDL3-static_FOUND FALSE) + +if(EXISTS "${_sdl3test_lib}") + if(NOT TARGET SDL3::SDL3_test) + add_library(SDL3::SDL3_test STATIC IMPORTED) + set_target_properties(SDL3::SDL3_test + PROPERTIES + INTERFACE_LINK_LIBRARIES "SDL3::Headers" + IMPORTED_LOCATION "${_sdl3test_lib}" + COMPATIBLE_INTERFACE_STRING "SDL_VERSION" + INTERFACE_SDL_VERSION "SDL3" + ) + endif() + set(SDL3_SDL3_test_FOUND TRUE) +else() + set(SDL3_SDL3_test_FOUND FALSE) +endif() +unset(_sdl3test_lib) + +if(SDL3_SDL3-shared_FOUND) + set(SDL3_SDL3_FOUND TRUE) +endif() + +function(_sdl_create_target_alias_compat NEW_TARGET TARGET) + if(CMAKE_VERSION VERSION_LESS "3.18") + # Aliasing local targets is not supported on CMake < 3.18, so make it global. + add_library(${NEW_TARGET} INTERFACE IMPORTED) + set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}") + else() + add_library(${NEW_TARGET} ALIAS ${TARGET}) + endif() +endfunction() + +# Make sure SDL3::SDL3 always exists +if(NOT TARGET SDL3::SDL3) + if(TARGET SDL3::SDL3-shared) + _sdl_create_target_alias_compat(SDL3::SDL3 SDL3::SDL3-shared) + endif() +endif() + +if(EXISTS "${_sdl3_jar}") + if(NOT TARGET SDL3::Jar) + add_library(SDL3::Jar INTERFACE IMPORTED) + set_property(TARGET SDL3::Jar PROPERTY JAR_FILE "${_sdl3_jar}") + endif() + set(SDL3_Jar_FOUND TRUE) +else() + set(SDL3_Jar_FOUND FALSE) +endif() +unset(_sdl3_jar) + +check_required_components(SDL3) + +set(SDL3_LIBRARIES SDL3::SDL3) +set(SDL3_STATIC_LIBRARIES SDL3::SDL3-static) +set(SDL3_STATIC_PRIVATE_LIBS) + +set(SDL3TEST_LIBRARY SDL3::SDL3_test) diff --git a/build-scripts/pkg-support/android/cmake/SDL3ConfigVersion.cmake b/build-scripts/pkg-support/android/cmake/SDL3ConfigVersion.cmake new file mode 100644 index 0000000000000..d2663c35ee8a1 --- /dev/null +++ b/build-scripts/pkg-support/android/cmake/SDL3ConfigVersion.cmake @@ -0,0 +1,57 @@ +# based on the files generated by CMake's write_basic_package_version_file + +# SDL CMake version configuration file: +# This file is meant to be placed in a lib/cmake/SDL3 subfolder of a reconstructed Android SDL3 SDK + +if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../../include/SDL3/SDL_version.h") + message(AUTHOR_WARNING "Could not find SDL3/SDL_version.h. This script is meant to be placed in the root of SDL3-devel-3.x.y-VC") + return() +endif() + +file(READ "${CMAKE_CURRENT_LIST_DIR}/../../../include/SDL3/SDL_version.h" _sdl_version_h) +string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}") +set(_sdl_major "${CMAKE_MATCH_1}") +string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}") +set(_sdl_minor "${CMAKE_MATCH_1}") +string(REGEX MATCH "#define[ \t]+SDL_MICRO_VERSION[ \t]+([0-9]+)" _sdl_micro_re "${_sdl_version_h}") +set(_sdl_micro "${CMAKE_MATCH_1}") +if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re) + set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}") +else() + message(AUTHOR_WARNING "Could not extract version from SDL3/SDL_version.h.") + return() +endif() + +if(PACKAGE_FIND_VERSION_RANGE) + # Package version must be in the requested version range + if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN) + OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX) + OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX))) + set(PACKAGE_VERSION_COMPATIBLE FALSE) + else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + endif() +else() + if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_COMPATIBLE FALSE) + else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() + endif() +endif() + +# if the using project doesn't have CMAKE_SIZEOF_VOID_P set, fail. +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() + +include("${CMAKE_CURRENT_LIST_DIR}/sdlcpu.cmake") +SDL_DetectTargetCPUArchitectures(_detected_archs) + +# check that the installed version has a compatible architecture as the one which is currently searching: +if(NOT(SDL_CPU_X86 OR SDL_CPU_X64 OR SDL_CPU_ARM32 OR SDL_CPU_ARM64)) + set(PACKAGE_VERSION "${PACKAGE_VERSION} (X86,X64,ARM32,ARM64)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() diff --git a/mingw/pkg-support/INSTALL.txt b/build-scripts/pkg-support/mingw/INSTALL.txt similarity index 100% rename from mingw/pkg-support/INSTALL.txt rename to build-scripts/pkg-support/mingw/INSTALL.txt diff --git a/mingw/pkg-support/Makefile b/build-scripts/pkg-support/mingw/Makefile similarity index 100% rename from mingw/pkg-support/Makefile rename to build-scripts/pkg-support/mingw/Makefile diff --git a/mingw/pkg-support/cmake/sdl3-config.cmake b/build-scripts/pkg-support/mingw/cmake/SDL3Config.cmake similarity index 100% rename from mingw/pkg-support/cmake/sdl3-config.cmake rename to build-scripts/pkg-support/mingw/cmake/SDL3Config.cmake diff --git a/mingw/pkg-support/cmake/sdl3-config-version.cmake b/build-scripts/pkg-support/mingw/cmake/SDL3ConfigVersion.cmake similarity index 100% rename from mingw/pkg-support/cmake/sdl3-config-version.cmake rename to build-scripts/pkg-support/mingw/cmake/SDL3ConfigVersion.cmake diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 70efce63f1154..7dfeaf9324b6c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -334,7 +334,7 @@ function(files2headers OUTPUT) # Don't add the 'output' header to the output, to avoid marking them as GENERATED # (generated files are removed when running the CLEAN target) add_custom_command(OUTPUT "${intermediate}" - COMMAND Python3::Interpreter "${xxd}" -i "${CMAKE_CURRENT_SOURCE_DIR}/${input}" "-o" "${intermediate}" + COMMAND "${Python3_EXECUTABLE}" "${xxd}" -i "${CMAKE_CURRENT_SOURCE_DIR}/${input}" "-o" "${intermediate}" COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${intermediate}" "${output}" DEPENDS "${xxd}" "${bmp}" ) From a5f18048b21fd3ae43bd9089e351ca56ca9690d2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 31 Jul 2024 22:09:42 -0700 Subject: [PATCH 096/253] Extend the 9-grid functions to handle a non-uniform grid layout (thanks @zaun!) Fixes https://github.com/libsdl-org/SDL/issues/10389 --- include/SDL3/SDL_render.h | 17 ++-- include/SDL3/SDL_surface.h | 11 ++- src/dynapi/SDL_dynapi_procs.h | 4 +- src/render/SDL_render.c | 86 ++++++++++------- src/video/SDL_surface.c | 85 ++++++++++------- test/testautomation_render.c | 168 +++++++++++++++++++++++++++------- test/testautomation_surface.c | 138 +++++++++++++++++++++------- 7 files changed, 358 insertions(+), 151 deletions(-) diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index 855247c8f54d9..a7e3fd096f41b 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -1919,17 +1919,20 @@ extern SDL_DECLSPEC int SDLCALL SDL_RenderTextureTiled(SDL_Renderer *renderer, S * Perform a scaled copy using the 9-grid algorithm to the current rendering * target at subpixel precision. * - * The pixels in the texture are split into a 3x3 grid, using the corner size - * for each corner, and the sides and center making up the remaining pixels. - * The corners are then scaled using `scale` and fit into the corners of the - * destination rectangle. The sides and center are then stretched into place - * to cover the remaining destination rectangle. + * The pixels in the texture are split into a 3x3 grid, using the different + * corner sizes for each corner, and the sides and center making up the + * remaining pixels. The corners are then scaled using `scale` and fit into + * the corners of the destination rectangle. The sides and center are then + * stretched into place to cover the remaining destination rectangle. * * \param renderer the renderer which should copy parts of a texture. * \param texture the source texture. * \param srcrect the SDL_Rect structure representing the rectangle to be used * for the 9-grid, or NULL to use the entire texture. - * \param corner_size the size, in pixels, of the corner in `srcrect`. + * \param left_width the width, in pixels, of the left corners in `srcrect`. + * \param right_width the width, in pixels, of the right corners in `srcrect`. + * \param top_height the height, in pixels, of the top corners in `srcrect`. + * \param bottom_height the height, in pixels, of the bottom corners in `srcrect`. * \param scale the scale used to transform the corner of `srcrect` into the * corner of `dstrect`, or 0.0f for an unscaled copy. * \param dstrect a pointer to the destination rectangle, or NULL for the @@ -1941,7 +1944,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_RenderTextureTiled(SDL_Renderer *renderer, S * * \sa SDL_RenderTexture */ -extern SDL_DECLSPEC int SDLCALL SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float corner_size, float scale, const SDL_FRect *dstrect); +extern SDL_DECLSPEC int SDLCALL SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect); /** * Render a list of triangles, optionally using a texture and indices into the diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index 8074e2e1b660c..7a941d27dc473 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -1105,8 +1105,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, * Perform a scaled blit using the 9-grid algorithm to a destination surface, * which may be of a different format. * - * The pixels in the source surface are split into a 3x3 grid, using the - * corner size for each corner, and the sides and center making up the + * The pixels in the source surface are split into a 3x3 grid, using the different + * corner sizes for each corner, and the sides and center making up the * remaining pixels. The corners are then scaled using `scale` and fit into * the corners of the destination rectangle. The sides and center are then * stretched into place to cover the remaining destination rectangle. @@ -1114,7 +1114,10 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, * \param src the SDL_Surface structure to be copied from. * \param srcrect the SDL_Rect structure representing the rectangle to be used * for the 9-grid, or NULL to use the entire surface. - * \param corner_size the size, in pixels, of the corner in `srcrect`. + * \param left_width the width, in pixels, of the left corners in `srcrect`. + * \param right_width the width, in pixels, of the right corners in `srcrect`. + * \param top_height the height, in pixels, of the top corners in `srcrect`. + * \param bottom_height the height, in pixels, of the bottom corners in `srcrect`. * \param scale the scale used to transform the corner of `srcrect` into the * corner of `dstrect`, or 0.0f for an unscaled blit. * \param scaleMode scale algorithm to be used. @@ -1132,7 +1135,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, * * \sa SDL_BlitSurface */ -extern SDL_DECLSPEC int SDLCALL SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int corner_size, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect); +extern SDL_DECLSPEC int SDLCALL SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int left_width, int right_width, int top_height, int bottom_height, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect); /** * Map an RGB triple to an opaque pixel value for a surface. diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 1bdb1b0b628d5..d66790999b443 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -68,7 +68,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_AudioDevicePaused,(SDL_AudioDeviceID a),(a),return) SDL_DYNAPI_PROC(int,SDL_BindAudioStream,(SDL_AudioDeviceID a, SDL_AudioStream *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_BindAudioStreams,(SDL_AudioDeviceID a, SDL_AudioStream **b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_BlitSurface,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(int,SDL_BlitSurface9Grid,(SDL_Surface *a, const SDL_Rect *b, int c, float d, SDL_ScaleMode e, SDL_Surface *f, const SDL_Rect *g),(a,b,c,d,e,f,g),return) +SDL_DYNAPI_PROC(int,SDL_BlitSurface9Grid,(SDL_Surface *a, const SDL_Rect *b, int c, int d, int e, int f, float g, SDL_ScaleMode h, SDL_Surface *i, const SDL_Rect *j),(a,b,c,d,e,f,g,h,i,j),return) SDL_DYNAPI_PROC(int,SDL_BlitSurfaceScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d, SDL_ScaleMode e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_BlitSurfaceTiled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_BlitSurfaceTiledWithScale,(SDL_Surface *a, const SDL_Rect *b, float c, SDL_ScaleMode d, SDL_Surface *e, const SDL_Rect *f),(a,b,c,d,e,f),return) @@ -700,7 +700,7 @@ SDL_DYNAPI_PROC(SDL_Surface*,SDL_RenderReadPixels,(SDL_Renderer *a, const SDL_Re SDL_DYNAPI_PROC(int,SDL_RenderRect,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_RenderRects,(SDL_Renderer *a, const SDL_FRect *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_RenderTexture,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, const SDL_FRect *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(int,SDL_RenderTexture9Grid,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, float d, float e, const SDL_FRect *f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(int,SDL_RenderTexture9Grid,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, float d, float e, float f, float g, float h, const SDL_FRect *i),(a,b,c,d,e,f,g,h,i),return) SDL_DYNAPI_PROC(int,SDL_RenderTextureRotated,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, const SDL_FRect *d, const double e, const SDL_FPoint *f, const SDL_FlipMode g),(a,b,c,d,e,f,g),return) SDL_DYNAPI_PROC(int,SDL_RenderTextureTiled,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, float d, const SDL_FRect *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_bool,SDL_RenderViewportSet,(SDL_Renderer *a),(a),return) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 5759cd6b898c8..17b24a171d21e 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -4213,11 +4213,14 @@ int SDL_RenderTextureTiled(SDL_Renderer *renderer, SDL_Texture *texture, const S } } -int SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float corner_size, float scale, const SDL_FRect *dstrect) +int SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect) { SDL_FRect full_src, full_dst; SDL_FRect curr_src, curr_dst; - float dst_corner_size; + float dst_left_width; + float dst_right_width; + float dst_top_height; + float dst_bottom_height; CHECK_RENDERER_MAGIC(renderer, -1); CHECK_TEXTURE_MAGIC(texture, -1); @@ -4240,96 +4243,111 @@ int SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const S } if (scale <= 0.0f || scale == 1.0f) { - dst_corner_size = corner_size; + dst_left_width = left_width; + dst_right_width = right_width; + dst_top_height = top_height; + dst_bottom_height = bottom_height; } else { - dst_corner_size = (corner_size * scale); + dst_left_width = (left_width * scale); + dst_right_width = (right_width * scale); + dst_top_height = (top_height * scale); + dst_bottom_height = (bottom_height * scale); } // Upper-left corner curr_src.x = srcrect->x; curr_src.y = srcrect->y; - curr_src.w = corner_size; - curr_src.h = corner_size; + curr_src.w = left_width; + curr_src.h = top_height; curr_dst.x = dstrect->x; curr_dst.y = dstrect->y; - curr_dst.w = dst_corner_size; - curr_dst.h = dst_corner_size; + curr_dst.w = dst_left_width; + curr_dst.h = dst_top_height; if (SDL_RenderTexture(renderer, texture, &curr_src, &curr_dst) < 0) { return -1; } // Upper-right corner - curr_src.x = srcrect->x + srcrect->w - corner_size; - curr_dst.x = dstrect->x + dstrect->w - dst_corner_size; + curr_src.x = srcrect->x + srcrect->w - right_width; + curr_src.w = right_width; + curr_dst.x = dstrect->x + dstrect->w - dst_right_width; + curr_dst.w = dst_right_width; if (SDL_RenderTexture(renderer, texture, &curr_src, &curr_dst) < 0) { return -1; } // Lower-right corner - curr_src.y = srcrect->y + srcrect->h - corner_size; - curr_dst.y = dstrect->y + dstrect->h - dst_corner_size; + curr_src.y = srcrect->y + srcrect->h - bottom_height; + curr_dst.y = dstrect->y + dstrect->h - dst_bottom_height; + curr_dst.h = dst_bottom_height; if (SDL_RenderTexture(renderer, texture, &curr_src, &curr_dst) < 0) { return -1; } // Lower-left corner curr_src.x = srcrect->x; + curr_src.w = left_width; curr_dst.x = dstrect->x; + curr_dst.w = dst_left_width; if (SDL_RenderTexture(renderer, texture, &curr_src, &curr_dst) < 0) { return -1; } // Left - curr_src.y = srcrect->y + corner_size; - curr_src.h = srcrect->h - 2 * corner_size; - curr_dst.y = dstrect->y + dst_corner_size; - curr_dst.h = dstrect->h - 2 * dst_corner_size; + curr_src.y = srcrect->y + top_height; + curr_src.h = srcrect->h - top_height - bottom_height; + curr_dst.y = dstrect->y + dst_top_height; + curr_dst.h = dstrect->h - dst_top_height - dst_bottom_height; if (SDL_RenderTexture(renderer, texture, &curr_src, &curr_dst) < 0) { return -1; } // Right - curr_src.x = srcrect->x + srcrect->w - corner_size; - curr_dst.x = dstrect->x + dstrect->w - dst_corner_size; + curr_src.x = srcrect->x + srcrect->w - right_width; + curr_src.w = right_width; + curr_dst.x = dstrect->x + dstrect->w - dst_right_width; + curr_dst.w = dst_right_width; if (SDL_RenderTexture(renderer, texture, &curr_src, &curr_dst) < 0) { return -1; } // Top - curr_src.x = srcrect->x + corner_size; + curr_src.x = srcrect->x + left_width; curr_src.y = srcrect->y; - curr_src.w = srcrect->w - 2 * corner_size; - curr_src.h = corner_size; - curr_dst.x = dstrect->x + dst_corner_size; + curr_src.w = srcrect->w - left_width - right_width; + curr_src.h = top_height; + curr_dst.x = dstrect->x + dst_left_width; curr_dst.y = dstrect->y; - curr_dst.w = dstrect->w - 2 * dst_corner_size; - curr_dst.h = dst_corner_size; + curr_dst.w = dstrect->w - dst_left_width - dst_right_width; + curr_dst.h = dst_top_height; if (SDL_RenderTexture(renderer, texture, &curr_src, &curr_dst) < 0) { return -1; } // Bottom - curr_src.y = srcrect->y + srcrect->h - corner_size; - curr_dst.y = dstrect->y + dstrect->h - dst_corner_size; + curr_src.y = srcrect->y + srcrect->h - bottom_height; + curr_dst.y = dstrect->y + dstrect->h - dst_bottom_height; + curr_dst.h = dst_bottom_height; if (SDL_RenderTexture(renderer, texture, &curr_src, &curr_dst) < 0) { return -1; } // Center - curr_src.x = srcrect->x + corner_size; - curr_src.y = srcrect->y + corner_size; - curr_src.w = srcrect->w - 2 * corner_size; - curr_src.h = srcrect->h - 2 * corner_size; - curr_dst.x = dstrect->x + dst_corner_size; - curr_dst.y = dstrect->y + dst_corner_size; - curr_dst.w = dstrect->w - 2 * dst_corner_size; - curr_dst.h = dstrect->h - 2 * dst_corner_size; + curr_src.x = srcrect->x + left_width; + curr_src.y = srcrect->y + top_height; + curr_src.w = srcrect->w - left_width - right_width; + curr_src.h = srcrect->h - top_height - bottom_height; + curr_dst.x = dstrect->x + dst_left_width; + curr_dst.y = dstrect->y + dst_top_height; + curr_dst.w = dstrect->w - dst_left_width - dst_right_width; + curr_dst.h = dstrect->h - dst_top_height - dst_bottom_height; if (SDL_RenderTexture(renderer, texture, &curr_src, &curr_dst) < 0) { return -1; } return 0; } + int SDL_RenderGeometry(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Vertex *vertices, int num_vertices, diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 63351d5ce4260..1eedfd7b0b521 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -1422,11 +1422,14 @@ int SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, const SDL_Rect *srcrect, flo return 0; } -int SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int corner_size, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect) +int SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int left_width, int right_width, int top_height, int bottom_height, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect) { SDL_Rect full_src, full_dst; SDL_Rect curr_src, curr_dst; - int dst_corner_size; + int dst_left_width; + int dst_right_width; + int dst_top_height; + int dst_bottom_height; /* Make sure the surfaces aren't locked */ if (!SDL_SurfaceValid(src)) { @@ -1452,90 +1455,104 @@ int SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int corner_s } if (scale <= 0.0f || scale == 1.0f) { - dst_corner_size = corner_size; + dst_left_width = left_width; + dst_right_width = right_width; + dst_top_height = top_height; + dst_bottom_height = bottom_height; } else { - dst_corner_size = (int)SDL_roundf(corner_size * scale); + dst_left_width = (int)SDL_roundf(left_width * scale); + dst_right_width = (int)SDL_roundf(right_width * scale); + dst_top_height = (int)SDL_roundf(top_height * scale); + dst_bottom_height = (int)SDL_roundf(bottom_height * scale); } // Upper-left corner curr_src.x = srcrect->x; curr_src.y = srcrect->y; - curr_src.w = corner_size; - curr_src.h = corner_size; + curr_src.w = left_width; + curr_src.h = top_height; curr_dst.x = dstrect->x; curr_dst.y = dstrect->y; - curr_dst.w = dst_corner_size; - curr_dst.h = dst_corner_size; + curr_dst.w = dst_left_width; + curr_dst.h = dst_top_height; if (SDL_BlitSurfaceScaled(src, &curr_src, dst, &curr_dst, scaleMode) < 0) { return -1; } // Upper-right corner - curr_src.x = srcrect->x + srcrect->w - corner_size; - curr_dst.x = dstrect->x + dstrect->w - dst_corner_size; + curr_src.x = srcrect->x + srcrect->w - right_width; + curr_src.w = right_width; + curr_dst.x = dstrect->x + dstrect->w - dst_right_width; + curr_dst.w = dst_right_width; if (SDL_BlitSurfaceScaled(src, &curr_src, dst, &curr_dst, scaleMode) < 0) { return -1; } // Lower-right corner - curr_src.y = srcrect->y + srcrect->h - corner_size; - curr_dst.y = dstrect->y + dstrect->h - dst_corner_size; + curr_src.y = srcrect->y + srcrect->h - bottom_height; + curr_dst.y = dstrect->y + dstrect->h - dst_bottom_height; + curr_dst.h = dst_bottom_height; if (SDL_BlitSurfaceScaled(src, &curr_src, dst, &curr_dst, scaleMode) < 0) { return -1; } // Lower-left corner curr_src.x = srcrect->x; + curr_src.w = left_width; curr_dst.x = dstrect->x; + curr_dst.w = dst_left_width; if (SDL_BlitSurfaceScaled(src, &curr_src, dst, &curr_dst, scaleMode) < 0) { return -1; } // Left - curr_src.y = srcrect->y + corner_size; - curr_src.h = srcrect->h - 2 * corner_size; - curr_dst.y = dstrect->y + dst_corner_size; - curr_dst.h = dstrect->h - 2 * dst_corner_size; + curr_src.y = srcrect->y + top_height; + curr_src.h = srcrect->h - top_height - bottom_height; + curr_dst.y = dstrect->y + dst_top_height; + curr_dst.h = dstrect->h - dst_top_height - dst_bottom_height; if (SDL_BlitSurfaceScaled(src, &curr_src, dst, &curr_dst, scaleMode) < 0) { return -1; } // Right - curr_src.x = srcrect->x + srcrect->w - corner_size; - curr_dst.x = dstrect->x + dstrect->w - dst_corner_size; + curr_src.x = srcrect->x + srcrect->w - right_width; + curr_src.w = right_width; + curr_dst.x = dstrect->x + dstrect->w - dst_right_width; + curr_dst.w = dst_right_width; if (SDL_BlitSurfaceScaled(src, &curr_src, dst, &curr_dst, scaleMode) < 0) { return -1; } // Top - curr_src.x = srcrect->x + corner_size; + curr_src.x = srcrect->x + left_width; curr_src.y = srcrect->y; - curr_src.w = srcrect->w - 2 * corner_size; - curr_src.h = corner_size; - curr_dst.x = dstrect->x + dst_corner_size; + curr_src.w = srcrect->w - left_width - right_width; + curr_src.h = top_height; + curr_dst.x = dstrect->x + dst_left_width; curr_dst.y = dstrect->y; - curr_dst.w = dstrect->w - 2 * dst_corner_size; - curr_dst.h = dst_corner_size; + curr_dst.w = dstrect->w - dst_left_width - dst_right_width; + curr_dst.h = dst_top_height; if (SDL_BlitSurfaceScaled(src, &curr_src, dst, &curr_dst, scaleMode) < 0) { return -1; } // Bottom - curr_src.y = srcrect->y + srcrect->h - corner_size; - curr_dst.y = dstrect->y + dstrect->h - dst_corner_size; + curr_src.y = srcrect->y + srcrect->h - bottom_height; + curr_dst.y = dstrect->y + dstrect->h - dst_bottom_height; + curr_dst.h = dst_bottom_height; if (SDL_BlitSurfaceScaled(src, &curr_src, dst, &curr_dst, scaleMode) < 0) { return -1; } // Center - curr_src.x = srcrect->x + corner_size; - curr_src.y = srcrect->y + corner_size; - curr_src.w = srcrect->w - 2 * corner_size; - curr_src.h = srcrect->h - 2 * corner_size; - curr_dst.x = dstrect->x + dst_corner_size; - curr_dst.y = dstrect->y + dst_corner_size; - curr_dst.w = dstrect->w - 2 * dst_corner_size; - curr_dst.h = dstrect->h - 2 * dst_corner_size; + curr_src.x = srcrect->x + left_width; + curr_src.y = srcrect->y + top_height; + curr_src.w = srcrect->w - left_width - right_width; + curr_src.h = srcrect->h - top_height - bottom_height; + curr_dst.x = dstrect->x + dst_left_width; + curr_dst.y = dstrect->y + dst_top_height; + curr_dst.w = dstrect->w - dst_left_width - dst_right_width; + curr_dst.h = dstrect->h - dst_top_height - dst_bottom_height; if (SDL_BlitSurfaceScaled(src, &curr_src, dst, &curr_dst, scaleMode) < 0) { return -1; } diff --git a/test/testautomation_render.c b/test/testautomation_render.c index faba33fb71c4b..640e6705bbf16 100644 --- a/test/testautomation_render.c +++ b/test/testautomation_render.c @@ -367,71 +367,71 @@ static int render_testBlitTiled(void *arg) static const Uint8 COLOR_SEPARATION = 85; -static void Fill9GridReferenceSurface(SDL_Surface *surface, int corner_size) +static void Fill9GridReferenceSurface(SDL_Surface *surface, int left_width, int right_width, int top_height, int bottom_height) { SDL_Rect rect; // Upper left rect.x = 0; rect.y = 0; - rect.w = corner_size; - rect.h = corner_size; + rect.w = left_width; + rect.h = top_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 1 * COLOR_SEPARATION, 1 * COLOR_SEPARATION, 0)); // Top - rect.x = corner_size; + rect.x = left_width; rect.y = 0; - rect.w = surface->w - 2 * corner_size; - rect.h = corner_size; + rect.w = surface->w - left_width - right_width; + rect.h = top_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 2 * COLOR_SEPARATION, 1 * COLOR_SEPARATION, 0)); // Upper right - rect.x = surface->w - corner_size; + rect.x = surface->w - right_width; rect.y = 0; - rect.w = corner_size; - rect.h = corner_size; + rect.w = right_width; + rect.h = top_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 3 * COLOR_SEPARATION, 1 * COLOR_SEPARATION, 0)); // Left rect.x = 0; - rect.y = corner_size; - rect.w = corner_size; - rect.h = surface->h - 2 * corner_size; + rect.y = top_height; + rect.w = left_width; + rect.h = surface->h - top_height - bottom_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 1 * COLOR_SEPARATION, 2 * COLOR_SEPARATION, 0)); // Center - rect.x = corner_size; - rect.y = corner_size; - rect.w = surface->w - 2 * corner_size; - rect.h = surface->h - 2 * corner_size; + rect.x = left_width; + rect.y = top_height; + rect.w = surface->w - right_width - left_width; + rect.h = surface->h - top_height - bottom_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 2 * COLOR_SEPARATION, 2 * COLOR_SEPARATION, 0)); // Right - rect.x = surface->w - corner_size; - rect.y = corner_size; - rect.w = corner_size; - rect.h = surface->h - 2 * corner_size; + rect.x = surface->w - right_width; + rect.y = top_height; + rect.w = right_width; + rect.h = surface->h - top_height - bottom_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 3 * COLOR_SEPARATION, 2 * COLOR_SEPARATION, 0)); // Lower left rect.x = 0; - rect.y = surface->h - corner_size; - rect.w = corner_size; - rect.h = corner_size; + rect.y = surface->h - bottom_height; + rect.w = left_width; + rect.h = bottom_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 1 * COLOR_SEPARATION, 3 * COLOR_SEPARATION, 0)); // Bottom - rect.x = corner_size; - rect.y = surface->h - corner_size; - rect.w = surface->w - 2 * corner_size; - rect.h = corner_size; + rect.x = left_width; + rect.y = surface->h - bottom_height; + rect.w = surface->w - left_width - right_width; + rect.h = bottom_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 2 * COLOR_SEPARATION, 3 * COLOR_SEPARATION, 0)); // Lower right - rect.x = surface->w - corner_size; - rect.y = surface->h - corner_size; - rect.w = corner_size; - rect.h = corner_size; + rect.x = surface->w - right_width; + rect.y = surface->h - bottom_height; + rect.w = right_width; + rect.h = bottom_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 3 * COLOR_SEPARATION, 3 * COLOR_SEPARATION, 0)); } @@ -462,11 +462,12 @@ static int render_testBlit9Grid(void *arg) /* 9-grid blit - 1.0 scale */ { + SDLTest_Log("9-grid blit - 1.0 scale"); /* Create reference surface */ SDL_DestroySurface(referenceSurface); referenceSurface = SDL_CreateSurface(TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, SDL_PIXELFORMAT_RGBA32); SDLTest_AssertCheck(referenceSurface != NULL, "Verify reference surface is not NULL"); - Fill9GridReferenceSurface(referenceSurface, 1); + Fill9GridReferenceSurface(referenceSurface, 1, 1, 1, 1); /* Clear surface. */ clearScreen(); @@ -476,7 +477,7 @@ static int render_testBlit9Grid(void *arg) rect.y = 0.0f; rect.w = (float)TESTRENDER_SCREEN_W; rect.h = (float)TESTRENDER_SCREEN_H; - ret = SDL_RenderTexture9Grid(renderer, texture, NULL, 1.0f, 1.0f, &rect); + ret = SDL_RenderTexture9Grid(renderer, texture, NULL, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, &rect); SDLTest_AssertCheck(ret == 0, "Validate results from call to SDL_RenderTexture9Grid, expected: 0, got: %i", ret); /* See if it's the same */ @@ -488,11 +489,12 @@ static int render_testBlit9Grid(void *arg) /* 9-grid blit - 2.0 scale */ { + SDLTest_Log("9-grid blit - 2.0 scale"); /* Create reference surface */ SDL_DestroySurface(referenceSurface); referenceSurface = SDL_CreateSurface(TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, SDL_PIXELFORMAT_RGBA32); SDLTest_AssertCheck(referenceSurface != NULL, "Verify reference surface is not NULL"); - Fill9GridReferenceSurface(referenceSurface, 2); + Fill9GridReferenceSurface(referenceSurface, 2, 2, 2, 2); /* Clear surface. */ clearScreen(); @@ -502,7 +504,103 @@ static int render_testBlit9Grid(void *arg) rect.y = 0.0f; rect.w = (float)TESTRENDER_SCREEN_W; rect.h = (float)TESTRENDER_SCREEN_H; - ret = SDL_RenderTexture9Grid(renderer, texture, NULL, 1.0f, 2.0f, &rect); + ret = SDL_RenderTexture9Grid(renderer, texture, NULL, 1.0f, 1.0f, 1.0f, 1.0f, 2.0f, &rect); + SDLTest_AssertCheck(ret == 0, "Validate results from call to SDL_RenderTexture9Grid, expected: 0, got: %i", ret); + + /* See if it's the same */ + compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE); + + /* Make current */ + SDL_RenderPresent(renderer); + } + + /* Clean up. */ + SDL_DestroySurface(source); + SDL_DestroyTexture(texture); + + /* Create complex source surface */ + source = SDL_CreateSurface(5, 5, SDL_PIXELFORMAT_RGBA32); + SDLTest_AssertCheck(source != NULL, "Verify source surface is not NULL"); + SDL_WriteSurfacePixel(source, 0, 0, (Uint8)((1) * COLOR_SEPARATION), (Uint8)((1) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 1, 0, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((1) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 2, 0, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((1) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 3, 0, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((1) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 4, 0, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((1) * COLOR_SEPARATION), 0, 255); + + SDL_WriteSurfacePixel(source, 0, 1, (Uint8)((1) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 1, 1, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 2, 1, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 3, 1, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 4, 1, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + + SDL_WriteSurfacePixel(source, 0, 2, (Uint8)((1) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 1, 2, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 2, 2, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 3, 2, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 4, 2, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + + SDL_WriteSurfacePixel(source, 0, 3, (Uint8)((1) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 1, 3, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 2, 3, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 3, 3, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 4, 3, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + + SDL_WriteSurfacePixel(source, 0, 4, (Uint8)((1) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 1, 4, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 2, 4, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 3, 4, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 4, 4, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + + texture = SDL_CreateTextureFromSurface(renderer, source); + SDLTest_AssertCheck(texture != NULL, "Verify source texture is not NULL"); + ret = SDL_SetTextureScaleMode(texture, SDL_SCALEMODE_NEAREST); + SDLTest_AssertCheck(ret == 0, "Validate results from call to SDL_SetTextureScaleMode, expected: 0, got: %i", ret); + + /* complex 9-grid blit - 1.0 scale */ + { + SDLTest_Log("complex 9-grid blit - 1.0 scale"); + /* Create reference surface */ + SDL_DestroySurface(referenceSurface); + referenceSurface = SDL_CreateSurface(TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, SDL_PIXELFORMAT_RGBA32); + SDLTest_AssertCheck(referenceSurface != NULL, "Verify reference surface is not NULL"); + Fill9GridReferenceSurface(referenceSurface, 1, 2, 1, 2); + + /* Clear surface. */ + clearScreen(); + + /* Tiled blit. */ + rect.x = 0.0f; + rect.y = 0.0f; + rect.w = (float)TESTRENDER_SCREEN_W; + rect.h = (float)TESTRENDER_SCREEN_H; + ret = SDL_RenderTexture9Grid(renderer, texture, NULL, 1.0f, 2.0f, 1.0f, 2.0f, 1.0f, &rect); + SDLTest_AssertCheck(ret == 0, "Validate results from call to SDL_RenderTexture9Grid, expected: 0, got: %i", ret); + + /* See if it's the same */ + compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE); + + /* Make current */ + SDL_RenderPresent(renderer); + } + + /* complex 9-grid blit - 2.0 scale */ + { + SDLTest_Log("complex 9-grid blit - 2.0 scale"); + /* Create reference surface */ + SDL_DestroySurface(referenceSurface); + referenceSurface = SDL_CreateSurface(TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, SDL_PIXELFORMAT_RGBA32); + SDLTest_AssertCheck(referenceSurface != NULL, "Verify reference surface is not NULL"); + Fill9GridReferenceSurface(referenceSurface, 2, 4, 2, 4); + + /* Clear surface. */ + clearScreen(); + + /* Tiled blit. */ + rect.x = 0.0f; + rect.y = 0.0f; + rect.w = (float)TESTRENDER_SCREEN_W; + rect.h = (float)TESTRENDER_SCREEN_H; + ret = SDL_RenderTexture9Grid(renderer, texture, NULL, 1.0f, 2.0f, 1.0f, 2.0f, 2.0f, &rect); SDLTest_AssertCheck(ret == 0, "Validate results from call to SDL_RenderTexture9Grid, expected: 0, got: %i", ret); /* See if it's the same */ diff --git a/test/testautomation_surface.c b/test/testautomation_surface.c index 64d15c64ddaa8..955f1a4cc7e98 100644 --- a/test/testautomation_surface.c +++ b/test/testautomation_surface.c @@ -417,71 +417,71 @@ static int surface_testBlitTiled(void *arg) static const Uint8 COLOR_SEPARATION = 85; -static void Fill9GridReferenceSurface(SDL_Surface *surface, int corner_size) +static void Fill9GridReferenceSurface(SDL_Surface *surface, int left_width, int right_width, int top_height, int bottom_height) { SDL_Rect rect; // Upper left rect.x = 0; rect.y = 0; - rect.w = corner_size; - rect.h = corner_size; + rect.w = left_width; + rect.h = top_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 1 * COLOR_SEPARATION, 1 * COLOR_SEPARATION, 0)); // Top - rect.x = corner_size; + rect.x = left_width; rect.y = 0; - rect.w = surface->w - 2 * corner_size; - rect.h = corner_size; + rect.w = surface->w - left_width - right_width; + rect.h = top_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 2 * COLOR_SEPARATION, 1 * COLOR_SEPARATION, 0)); // Upper right - rect.x = surface->w - corner_size; + rect.x = surface->w - right_width; rect.y = 0; - rect.w = corner_size; - rect.h = corner_size; + rect.w = right_width; + rect.h = top_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 3 * COLOR_SEPARATION, 1 * COLOR_SEPARATION, 0)); // Left rect.x = 0; - rect.y = corner_size; - rect.w = corner_size; - rect.h = surface->h - 2 * corner_size; + rect.y = top_height; + rect.w = left_width; + rect.h = surface->h - top_height - bottom_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 1 * COLOR_SEPARATION, 2 * COLOR_SEPARATION, 0)); // Center - rect.x = corner_size; - rect.y = corner_size; - rect.w = surface->w - 2 * corner_size; - rect.h = surface->h - 2 * corner_size; + rect.x = left_width; + rect.y = top_height; + rect.w = surface->w - right_width - left_width; + rect.h = surface->h - top_height - bottom_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 2 * COLOR_SEPARATION, 2 * COLOR_SEPARATION, 0)); // Right - rect.x = surface->w - corner_size; - rect.y = corner_size; - rect.w = corner_size; - rect.h = surface->h - 2 * corner_size; + rect.x = surface->w - right_width; + rect.y = top_height; + rect.w = right_width; + rect.h = surface->h - top_height - bottom_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 3 * COLOR_SEPARATION, 2 * COLOR_SEPARATION, 0)); // Lower left rect.x = 0; - rect.y = surface->h - corner_size; - rect.w = corner_size; - rect.h = corner_size; + rect.y = surface->h - bottom_height; + rect.w = left_width; + rect.h = bottom_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 1 * COLOR_SEPARATION, 3 * COLOR_SEPARATION, 0)); // Bottom - rect.x = corner_size; - rect.y = surface->h - corner_size; - rect.w = surface->w - 2 * corner_size; - rect.h = corner_size; + rect.x = left_width; + rect.y = surface->h - bottom_height; + rect.w = surface->w - left_width - right_width; + rect.h = bottom_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 2 * COLOR_SEPARATION, 3 * COLOR_SEPARATION, 0)); // Lower right - rect.x = surface->w - corner_size; - rect.y = surface->h - corner_size; - rect.w = corner_size; - rect.h = corner_size; + rect.x = surface->w - right_width; + rect.y = surface->h - bottom_height; + rect.w = right_width; + rect.h = bottom_height; SDL_FillSurfaceRect(surface, &rect, SDL_MapSurfaceRGB(surface, 3 * COLOR_SEPARATION, 3 * COLOR_SEPARATION, 0)); } @@ -509,9 +509,9 @@ static int surface_testBlit9Grid(void *arg) SDL_DestroySurface(referenceSurface); referenceSurface = SDL_CreateSurface(testSurface->w, testSurface->h, testSurface->format); SDLTest_AssertCheck(referenceSurface != NULL, "Verify reference surface is not NULL"); - Fill9GridReferenceSurface(referenceSurface, 1); + Fill9GridReferenceSurface(referenceSurface, 1, 1, 1, 1); - ret = SDL_BlitSurface9Grid(source, NULL, 1, 0.0f, SDL_SCALEMODE_NEAREST, testSurface, NULL); + ret = SDL_BlitSurface9Grid(source, NULL, 1, 1, 1, 1, 0.0f, SDL_SCALEMODE_NEAREST, testSurface, NULL); SDLTest_AssertCheck(ret == 0, "Validate result from SDL_BlitSurface9Grid, expected: 0, got: %i", ret); ret = SDLTest_CompareSurfaces(testSurface, referenceSurface, 0); @@ -524,9 +524,77 @@ static int surface_testBlit9Grid(void *arg) SDL_DestroySurface(referenceSurface); referenceSurface = SDL_CreateSurface(testSurface->w, testSurface->h, testSurface->format); SDLTest_AssertCheck(referenceSurface != NULL, "Verify reference surface is not NULL"); - Fill9GridReferenceSurface(referenceSurface, 2); + Fill9GridReferenceSurface(referenceSurface, 2, 2, 2, 2); - ret = SDL_BlitSurface9Grid(source, NULL, 1, 2.0f, SDL_SCALEMODE_NEAREST, testSurface, NULL); + ret = SDL_BlitSurface9Grid(source, NULL, 1, 1, 1, 1, 2.0f, SDL_SCALEMODE_NEAREST, testSurface, NULL); + SDLTest_AssertCheck(ret == 0, "Validate result from SDL_BlitSurface9Grid, expected: 0, got: %i", ret); + + ret = SDLTest_CompareSurfaces(testSurface, referenceSurface, 0); + SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret); + } + + /* Clean up. */ + SDL_DestroySurface(source); + + /* Create complex source surface */ + source = SDL_CreateSurface(5, 5, SDL_PIXELFORMAT_RGBA32); + SDLTest_AssertCheck(source != NULL, "Verify source surface is not NULL"); + SDL_WriteSurfacePixel(source, 0, 0, (Uint8)((1) * COLOR_SEPARATION), (Uint8)((1) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 1, 0, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((1) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 2, 0, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((1) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 3, 0, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((1) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 4, 0, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((1) * COLOR_SEPARATION), 0, 255); + + SDL_WriteSurfacePixel(source, 0, 1, (Uint8)((1) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 1, 1, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 2, 1, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 3, 1, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 4, 1, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + + SDL_WriteSurfacePixel(source, 0, 2, (Uint8)((1) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 1, 2, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 2, 2, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 3, 2, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 4, 2, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((2) * COLOR_SEPARATION), 0, 255); + + SDL_WriteSurfacePixel(source, 0, 3, (Uint8)((1) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 1, 3, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 2, 3, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 3, 3, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 4, 3, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + + SDL_WriteSurfacePixel(source, 0, 4, (Uint8)((1) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 1, 4, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 2, 4, (Uint8)((2) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 3, 4, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + SDL_WriteSurfacePixel(source, 4, 4, (Uint8)((3) * COLOR_SEPARATION), (Uint8)((3) * COLOR_SEPARATION), 0, 255); + + /* complex 9-grid blit - 1.0 scale */ + { + SDLTest_Log("complex 9-grid blit - 1.0 scale"); + /* Create reference surface */ + SDL_DestroySurface(referenceSurface); + referenceSurface = SDL_CreateSurface(testSurface->w, testSurface->h, testSurface->format); + SDLTest_AssertCheck(referenceSurface != NULL, "Verify reference surface is not NULL"); + Fill9GridReferenceSurface(referenceSurface, 1, 2, 1, 2); + + ret = SDL_BlitSurface9Grid(source, NULL, 1, 2, 1, 2, 0.0f, SDL_SCALEMODE_NEAREST, testSurface, NULL); + SDLTest_AssertCheck(ret == 0, "Validate result from SDL_BlitSurface9Grid, expected: 0, got: %i", ret); + + ret = SDLTest_CompareSurfaces(testSurface, referenceSurface, 0); + SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret); + } + + /* complex 9-grid blit - 2.0 scale */ + { + SDLTest_Log("complex 9-grid blit - 2.0 scale"); + /* Create reference surface */ + SDL_DestroySurface(referenceSurface); + referenceSurface = SDL_CreateSurface(testSurface->w, testSurface->h, testSurface->format); + SDLTest_AssertCheck(referenceSurface != NULL, "Verify reference surface is not NULL"); + Fill9GridReferenceSurface(referenceSurface, 2, 4, 2, 4); + + ret = SDL_BlitSurface9Grid(source, NULL, 1, 2, 1, 2, 2.0f, SDL_SCALEMODE_NEAREST, testSurface, NULL); SDLTest_AssertCheck(ret == 0, "Validate result from SDL_BlitSurface9Grid, expected: 0, got: %i", ret); ret = SDLTest_CompareSurfaces(testSurface, referenceSurface, 0); From 2e058ba7a403eee45c7648a6384091c873f5f6ed Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Thu, 1 Aug 2024 05:37:11 +0000 Subject: [PATCH 097/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_render.h | 3 ++- include/SDL3/SDL_surface.h | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index a7e3fd096f41b..69bf515c5833e 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -1932,7 +1932,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_RenderTextureTiled(SDL_Renderer *renderer, S * \param left_width the width, in pixels, of the left corners in `srcrect`. * \param right_width the width, in pixels, of the right corners in `srcrect`. * \param top_height the height, in pixels, of the top corners in `srcrect`. - * \param bottom_height the height, in pixels, of the bottom corners in `srcrect`. + * \param bottom_height the height, in pixels, of the bottom corners in + * `srcrect`. * \param scale the scale used to transform the corner of `srcrect` into the * corner of `dstrect`, or 0.0f for an unscaled copy. * \param dstrect a pointer to the destination rectangle, or NULL for the diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index 7a941d27dc473..552b0acc103c1 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -1105,11 +1105,11 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, * Perform a scaled blit using the 9-grid algorithm to a destination surface, * which may be of a different format. * - * The pixels in the source surface are split into a 3x3 grid, using the different - * corner sizes for each corner, and the sides and center making up the - * remaining pixels. The corners are then scaled using `scale` and fit into - * the corners of the destination rectangle. The sides and center are then - * stretched into place to cover the remaining destination rectangle. + * The pixels in the source surface are split into a 3x3 grid, using the + * different corner sizes for each corner, and the sides and center making up + * the remaining pixels. The corners are then scaled using `scale` and fit + * into the corners of the destination rectangle. The sides and center are + * then stretched into place to cover the remaining destination rectangle. * * \param src the SDL_Surface structure to be copied from. * \param srcrect the SDL_Rect structure representing the rectangle to be used @@ -1117,7 +1117,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, * \param left_width the width, in pixels, of the left corners in `srcrect`. * \param right_width the width, in pixels, of the right corners in `srcrect`. * \param top_height the height, in pixels, of the top corners in `srcrect`. - * \param bottom_height the height, in pixels, of the bottom corners in `srcrect`. + * \param bottom_height the height, in pixels, of the bottom corners in + * `srcrect`. * \param scale the scale used to transform the corner of `srcrect` into the * corner of `dstrect`, or 0.0f for an unscaled blit. * \param scaleMode scale algorithm to be used. From efefc4a1f35812007663f4afccd7bae68496238f Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Thu, 1 Aug 2024 01:50:19 -0400 Subject: [PATCH 098/253] d3d12: Move platform-specific includes/defines to SDL_d3d12.h --- src/render/direct3d12/SDL_render_d3d12.c | 111 ++++++------------ src/render/direct3d12/SDL_render_d3d12_xbox.h | 7 +- src/render/direct3d12/SDL_shaders_d3d12.c | 12 +- src/video/directx/SDL_d3d12.h | 87 ++++++++++++++ 4 files changed, 124 insertions(+), 93 deletions(-) create mode 100644 src/video/directx/SDL_d3d12.h diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index 1f4bc7b4aa630..7c54149f7f6d6 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -31,29 +31,10 @@ #include "../../video/windows/SDL_windowswindow.h" #include "../SDL_sysrender.h" #include "../SDL_d3dmath.h" +#include "../../video/directx/SDL_d3d12.h" #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) #include "SDL_render_d3d12_xbox.h" -#ifndef D3D12_TEXTURE_DATA_PITCH_ALIGNMENT -#define D3D12_TEXTURE_DATA_PITCH_ALIGNMENT 256 -#endif -#else - -/* From the DirectX-Headers build system: - * "MinGW has RPC headers which define old versions, and complain if D3D - * headers are included before the RPC headers, since D3D headers were - * generated with new MIDL and "require" new RPC headers." - */ -#define __REQUIRED_RPCNDR_H_VERSION__ 475 -#ifndef WINAPI_PARTITION_GAMES -#define WINAPI_PARTITION_GAMES 0 -#endif /* WINAPI_PARTITION_GAMES */ -#include "../../video/directx/d3d12.h" - -#include -#include -#include -#include #endif #include "SDL_shaders_d3d12.h" @@ -64,28 +45,6 @@ #define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str #endif -#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) -#define SAFE_RELEASE(X) \ - if (X) { \ - (X)->Release(); \ - X = NULL; \ - } -#define D3D_CALL(THIS, FUNC, ...) (THIS)->FUNC(__VA_ARGS__) -#define D3D_CALL_RET(THIS, FUNC, RETVAL, ...) *(RETVAL) = (THIS)->FUNC(__VA_ARGS__) -#define D3D_GUID(X) (X) -/* DXGI_PRESENT flags are removed on Xbox */ -#define DXGI_PRESENT_ALLOW_TEARING 0 -#else -#define SAFE_RELEASE(X) \ - if (X) { \ - (X)->lpVtbl->Release(X); \ - X = NULL; \ - } -#define D3D_CALL(THIS, FUNC, ...) (THIS)->lpVtbl->FUNC((THIS), ##__VA_ARGS__) -#define D3D_CALL_RET(THIS, FUNC, ...) (THIS)->lpVtbl->FUNC((THIS), ##__VA_ARGS__) -#define D3D_GUID(X) &(X) -#endif - /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { @@ -431,39 +390,39 @@ static void D3D12_ReleaseAll(SDL_Renderer *renderer) int i; #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) - SAFE_RELEASE(data->dxgiFactory); - SAFE_RELEASE(data->dxgiAdapter); - SAFE_RELEASE(data->swapChain); + D3D_SAFE_RELEASE(data->dxgiFactory); + D3D_SAFE_RELEASE(data->dxgiAdapter); + D3D_SAFE_RELEASE(data->swapChain); #endif - SAFE_RELEASE(data->d3dDevice); - SAFE_RELEASE(data->debugInterface); - SAFE_RELEASE(data->commandQueue); - SAFE_RELEASE(data->commandList); - SAFE_RELEASE(data->rtvDescriptorHeap); - SAFE_RELEASE(data->textureRTVDescriptorHeap); - SAFE_RELEASE(data->srvDescriptorHeap); - SAFE_RELEASE(data->samplerDescriptorHeap); - SAFE_RELEASE(data->fence); + D3D_SAFE_RELEASE(data->d3dDevice); + D3D_SAFE_RELEASE(data->debugInterface); + D3D_SAFE_RELEASE(data->commandQueue); + D3D_SAFE_RELEASE(data->commandList); + D3D_SAFE_RELEASE(data->rtvDescriptorHeap); + D3D_SAFE_RELEASE(data->textureRTVDescriptorHeap); + D3D_SAFE_RELEASE(data->srvDescriptorHeap); + D3D_SAFE_RELEASE(data->samplerDescriptorHeap); + D3D_SAFE_RELEASE(data->fence); for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) { - SAFE_RELEASE(data->commandAllocators[i]); - SAFE_RELEASE(data->renderTargets[i]); + D3D_SAFE_RELEASE(data->commandAllocators[i]); + D3D_SAFE_RELEASE(data->renderTargets[i]); } if (data->pipelineStateCount > 0) { for (i = 0; i < data->pipelineStateCount; ++i) { - SAFE_RELEASE(data->pipelineStates[i].pipelineState); + D3D_SAFE_RELEASE(data->pipelineStates[i].pipelineState); } SDL_free(data->pipelineStates); data->pipelineStateCount = 0; } for (i = 0; i < NUM_ROOTSIGS; ++i) { - SAFE_RELEASE(data->rootSignatures[i]); + D3D_SAFE_RELEASE(data->rootSignatures[i]); } for (i = 0; i < SDL_D3D12_NUM_VERTEX_BUFFERS; ++i) { - SAFE_RELEASE(data->vertexBuffers[i].resource); + D3D_SAFE_RELEASE(data->vertexBuffers[i].resource); data->vertexBuffers[i].size = 0; } @@ -477,7 +436,7 @@ static void D3D12_ReleaseAll(SDL_Renderer *renderer) if (data->dxgiDebug) { DXGI_DEBUG_RLO_FLAGS rloFlags = (DXGI_DEBUG_RLO_FLAGS)(DXGI_DEBUG_RLO_DETAIL | DXGI_DEBUG_RLO_IGNORE_INTERNAL); D3D_CALL(data->dxgiDebug, ReportLiveObjects, SDL_DXGI_DEBUG_ALL, rloFlags); - SAFE_RELEASE(data->dxgiDebug); + D3D_SAFE_RELEASE(data->dxgiDebug); } #endif @@ -578,7 +537,7 @@ static void D3D12_ResetCommandList(D3D12_RenderData *data) /* Release any upload buffers that were inflight */ for (i = 0; i < data->currentUploadBuffer; ++i) { - SAFE_RELEASE(data->uploadBuffers[i]); + D3D_SAFE_RELEASE(data->uploadBuffers[i]); } data->currentUploadBuffer = 0; @@ -737,7 +696,7 @@ static D3D12_PipelineState *D3D12_CreatePipelineState(SDL_Renderer *renderer, pipelineStates = (D3D12_PipelineState *)SDL_realloc(data->pipelineStates, (data->pipelineStateCount + 1) * sizeof(*pipelineStates)); if (!pipelineStates) { - SAFE_RELEASE(pipelineState); + D3D_SAFE_RELEASE(pipelineState); return NULL; } @@ -758,7 +717,7 @@ static HRESULT D3D12_CreateVertexBuffer(D3D12_RenderData *data, size_t vbidx, si D3D12_RESOURCE_DESC vbufferDesc; HRESULT result; - SAFE_RELEASE(data->vertexBuffers[vbidx].resource); + D3D_SAFE_RELEASE(data->vertexBuffers[vbidx].resource); SDL_zero(vbufferHeapProps); vbufferHeapProps.Type = D3D12_HEAP_TYPE_UPLOAD; @@ -914,7 +873,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) D3D_CALL(dxgiInfoQueue, SetBreakOnSeverity, SDL_DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, TRUE); D3D_CALL(dxgiInfoQueue, SetBreakOnSeverity, SDL_DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION, TRUE); - SAFE_RELEASE(dxgiInfoQueue); + D3D_SAFE_RELEASE(dxgiInfoQueue); #endif /* __IDXGIInfoQueue_INTERFACE_DEFINED__ */ creationFlags = DXGI_CREATE_FACTORY_DEBUG; } @@ -965,7 +924,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) D3D_CALL(infoQueue, SetBreakOnSeverity, D3D12_MESSAGE_SEVERITY_ERROR, TRUE); D3D_CALL(infoQueue, SetBreakOnSeverity, D3D12_MESSAGE_SEVERITY_CORRUPTION, TRUE); - SAFE_RELEASE(infoQueue); + D3D_SAFE_RELEASE(infoQueue); } #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ @@ -1178,7 +1137,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) SDL_SetPointerProperty(props, SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER, data->commandQueue); done: - SAFE_RELEASE(d3dDevice); + D3D_SAFE_RELEASE(d3dDevice); return result; } @@ -1361,7 +1320,7 @@ static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h) SDL_SetPointerProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER, data->swapChain); done: - SAFE_RELEASE(swapChain); + D3D_SAFE_RELEASE(swapChain); return result; } #endif @@ -1414,7 +1373,7 @@ static HRESULT D3D12_CreateWindowSizeDependentResources(SDL_Renderer *renderer) /* Release render targets */ for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) { - SAFE_RELEASE(data->renderTargets[i]); + D3D_SAFE_RELEASE(data->renderTargets[i]); } /* The width and height of the swap chain must be based on the display's @@ -1827,12 +1786,12 @@ static void D3D12_DestroyTexture(SDL_Renderer *renderer, Unfortunately, this means that deleting a lot of textures mid-frame will have poor performance. */ D3D12_IssueBatch(rendererData); - SAFE_RELEASE(textureData->mainTexture); - SAFE_RELEASE(textureData->stagingBuffer); + D3D_SAFE_RELEASE(textureData->mainTexture); + D3D_SAFE_RELEASE(textureData->stagingBuffer); D3D12_FreeSRVIndex(renderer, textureData->mainSRVIndex); #if SDL_HAVE_YUV - SAFE_RELEASE(textureData->mainTextureU); - SAFE_RELEASE(textureData->mainTextureV); + D3D_SAFE_RELEASE(textureData->mainTextureU); + D3D_SAFE_RELEASE(textureData->mainTextureV); if (textureData->yuv) { D3D12_FreeSRVIndex(renderer, textureData->mainSRVIndexU); D3D12_FreeSRVIndex(renderer, textureData->mainSRVIndexV); @@ -1923,7 +1882,7 @@ static int D3D12_UpdateTextureInternal(D3D12_RenderData *rendererData, ID3D12Res NULL, (void **)&textureMemory); if (FAILED(result)) { - SAFE_RELEASE(rendererData->uploadBuffers[rendererData->currentUploadBuffer]); + D3D_SAFE_RELEASE(rendererData->uploadBuffers[rendererData->currentUploadBuffer]); return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Resource::Map [map staging texture]"), result); } @@ -2172,7 +2131,7 @@ static int D3D12_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, NULL, (void **)&textureMemory); if (FAILED(result)) { - SAFE_RELEASE(rendererData->uploadBuffers[rendererData->currentUploadBuffer]); + D3D_SAFE_RELEASE(rendererData->uploadBuffers[rendererData->currentUploadBuffer]); return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Resource::Map [map staging texture]"), result); } @@ -2277,7 +2236,7 @@ static void D3D12_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture) /* Execute the command list before releasing the staging buffer */ D3D12_IssueBatch(rendererData); - SAFE_RELEASE(textureData->stagingBuffer); + D3D_SAFE_RELEASE(textureData->stagingBuffer); } static void D3D12_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode) @@ -3136,7 +3095,7 @@ static SDL_Surface *D3D12_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rec D3D_CALL(readbackBuffer, Unmap, 0, NULL); done: - SAFE_RELEASE(readbackBuffer); + D3D_SAFE_RELEASE(readbackBuffer); return output; } diff --git a/src/render/direct3d12/SDL_render_d3d12_xbox.h b/src/render/direct3d12/SDL_render_d3d12_xbox.h index cd95526998f52..d90541a469d05 100644 --- a/src/render/direct3d12/SDL_render_d3d12_xbox.h +++ b/src/render/direct3d12/SDL_render_d3d12_xbox.h @@ -23,12 +23,7 @@ #define SDL_render_d3d12_xbox_h_ #include "../../SDL_internal.h" - -#if defined(SDL_PLATFORM_XBOXONE) -#include -#else /* SDL_PLATFORM_XBOXSERIES */ -#include -#endif +#include "../../video/directx/SDL_d3d12.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus diff --git a/src/render/direct3d12/SDL_shaders_d3d12.c b/src/render/direct3d12/SDL_shaders_d3d12.c index bddd46e8e37ee..edf63dcad5365 100644 --- a/src/render/direct3d12/SDL_shaders_d3d12.c +++ b/src/render/direct3d12/SDL_shaders_d3d12.c @@ -23,17 +23,7 @@ #if SDL_VIDEO_RENDER_D3D12 && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) #include "../../core/windows/SDL_windows.h" - -/* From the DirectX-Headers build system: - * "MinGW has RPC headers which define old versions, and complain if D3D - * headers are included before the RPC headers, since D3D headers were - * generated with new MIDL and "require" new RPC headers." - */ -#define __REQUIRED_RPCNDR_H_VERSION__ 475 -#ifndef WINAPI_PARTITION_GAMES -#define WINAPI_PARTITION_GAMES 0 -#endif /* WINAPI_PARTITION_GAMES */ -#include "../../video/directx/d3d12.h" +#include "../../video/directx/SDL_d3d12.h" #include "SDL_shaders_d3d12.h" diff --git a/src/video/directx/SDL_d3d12.h b/src/video/directx/SDL_d3d12.h new file mode 100644 index 0000000000000..db3429aa1c66c --- /dev/null +++ b/src/video/directx/SDL_d3d12.h @@ -0,0 +1,87 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_internal.h" + +#ifndef SDL_D3D12_H +#define SDL_D3D12_H + +#if !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) + +/* From the DirectX-Headers build system: + * "MinGW has RPC headers which define old versions, and complain if D3D + * headers are included before the RPC headers, since D3D headers were + * generated with new MIDL and "require" new RPC headers." + */ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 + +/* May not be defined in winapifamily.h, can safely be ignored */ +#ifndef WINAPI_PARTITION_GAMES +#define WINAPI_PARTITION_GAMES 0 +#endif /* WINAPI_PARTITION_GAMES */ + +#define COBJMACROS +#include "d3d12.h" +#include +#include + +#define D3D_GUID(X) &(X) + +#define D3D_SAFE_RELEASE(X) \ + if (X) { \ + (X)->lpVtbl->Release(X); \ + X = NULL; \ + } + +/* FIXME: Remove this in favor of the COBJMACROS defines */ +#define D3D_CALL(THIS, FUNC, ...) (THIS)->lpVtbl->FUNC((THIS), ##__VA_ARGS__) +#define D3D_CALL_RET(THIS, FUNC, ...) (THIS)->lpVtbl->FUNC((THIS), ##__VA_ARGS__) + +#else /* !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) */ + +#if defined(SDL_PLATFORM_XBOXONE) +#include +#else /* SDL_PLATFORM_XBOXSERIES */ +#include +#endif + +#define D3D_GUID(X) (X) + +#define D3D_SAFE_RELEASE(X) \ + if (X) { \ + (X)->Release(); \ + X = NULL; \ + } + +/* Older versions of the Xbox GDK may not have this defined */ +#ifndef D3D12_TEXTURE_DATA_PITCH_ALIGNMENT +#define D3D12_TEXTURE_DATA_PITCH_ALIGNMENT 256 +#endif + +/* DXGI_PRESENT flags are removed on Xbox */ +#define DXGI_PRESENT_ALLOW_TEARING 0 + +/* FIXME: Xbox D3D12 does not define the COBJMACROS, so we need to define them ourselves */ +#define D3D_CALL(THIS, FUNC, ...) (THIS)->FUNC(__VA_ARGS__) +#define D3D_CALL_RET(THIS, FUNC, RETVAL, ...) *(RETVAL) = (THIS)->FUNC(__VA_ARGS__) + +#endif /* !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) */ + +#endif /* SDL_D3D12_H */ From 808c312b2acf5596a6960bb367dc77e1f2e9d0b2 Mon Sep 17 00:00:00 2001 From: Dragon-Baroque <74261498+Dragon-Baroque@users.noreply.github.com> Date: Tue, 5 Sep 2023 09:15:12 +0200 Subject: [PATCH 099/253] Support SDL_EVENT_DROP_FILE in Windows with IDropTarget instead of WM_DROPFILES Support SDL_EVENT_DROP_TEXT in Windows src/video/windows/SDL_windowsvideo.c + .h Connect to COM WIN_CoInitialize + OLE OleInitialize in WIN_VideoInit Disconnect from COM WIN_CoUninitialize + OLE OleUninitialize in WIN_VideoQuit src/video/windows/SDL_windowswindow.c + .h Create / Destroy IDropTarget or use fallback WM_DROPFILES depending on OleInitialize success in WIN_VideoInit Handle text/uri-list, text/plain;charset=utf-8, CF_UNICODE_TEXT, CF_TEXT, CF_HDROP Call terminating WIN_AcceptDragAndDrop from WIN_DestroyWindow ( CleanupVideoData ) --- src/video/windows/SDL_windowsvideo.c | 26 ++ src/video/windows/SDL_windowsvideo.h | 3 + src/video/windows/SDL_windowswindow.c | 516 ++++++++++++++++++++++++-- src/video/windows/SDL_windowswindow.h | 11 + 4 files changed, 530 insertions(+), 26 deletions(-) diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c index 5fd38ad2b0a09..118717b9a0355 100644 --- a/src/video/windows/SDL_windowsvideo.c +++ b/src/video/windows/SDL_windowsvideo.c @@ -467,6 +467,21 @@ static void WIN_InitDPIAwareness(SDL_VideoDevice *_this) int WIN_VideoInit(SDL_VideoDevice *_this) { SDL_VideoData *data = _this->internal; + HRESULT hr; + + hr = WIN_CoInitialize(); + if (SUCCEEDED(hr)) { + data->coinitialized = SDL_TRUE; + + hr = OleInitialize(NULL); + if (SUCCEEDED(hr)) { + data->oleinitialized = SDL_TRUE; + } else { + SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "OleInitialize() failed: 0x%.8x, using fallback drag-n-drop functionality\n", (unsigned int)hr); + } + } else { + SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "CoInitialize() failed: 0x%.8x, using fallback drag-n-drop functionality\n", (unsigned int)hr); + } WIN_InitDPIAwareness(_this); @@ -511,6 +526,8 @@ int WIN_VideoInit(SDL_VideoDevice *_this) void WIN_VideoQuit(SDL_VideoDevice *_this) { + SDL_VideoData *data = _this->internal; + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) WIN_QuitModes(_this); WIN_QuitDeviceNotification(); @@ -525,6 +542,15 @@ void WIN_VideoQuit(SDL_VideoDevice *_this) WIN_SetRawMouseEnabled(_this, SDL_FALSE); WIN_SetRawKeyboardEnabled(_this, SDL_FALSE); + + if (data->oleinitialized) { + OleUninitialize(); + data->oleinitialized = SDL_FALSE; + } + if (data->coinitialized) { + WIN_CoUninitialize(); + data->coinitialized = SDL_FALSE; + } } #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) diff --git a/src/video/windows/SDL_windowsvideo.h b/src/video/windows/SDL_windowsvideo.h index ea0867beb6f5c..fa3aba980df74 100644 --- a/src/video/windows/SDL_windowsvideo.h +++ b/src/video/windows/SDL_windowsvideo.h @@ -379,6 +379,9 @@ struct SDL_VideoData { int render; + SDL_bool coinitialized; + SDL_bool oleinitialized; + DWORD clipboard_count; #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) /* Xbox doesn't support user32/shcore*/ diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 66299c6aa0ef6..c0f3692f192d0 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -24,12 +24,13 @@ #include "../../core/windows/SDL_windows.h" -#include "../SDL_sysvideo.h" -#include "../SDL_pixels_c.h" +#include "../../SDL_hints_c.h" +#include "../../events/SDL_dropevents_c.h" #include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_mouse_c.h" #include "../../events/SDL_windowevents_c.h" -#include "../../SDL_hints_c.h" +#include "../SDL_pixels_c.h" +#include "../SDL_sysvideo.h" #include "SDL_windowsvideo.h" #include "SDL_windowswindow.h" @@ -188,26 +189,27 @@ static int WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, DWORD /* Client rect, in points */ switch (rect_type) { - case SDL_WINDOWRECT_CURRENT: - SDL_RelativeToGlobalForWindow(window, window->x, window->y, x, y); - *width = window->w; - *height = window->h; - break; - case SDL_WINDOWRECT_WINDOWED: - SDL_RelativeToGlobalForWindow(window, window->windowed.x, window->windowed.y, x, y); - *width = window->windowed.w; - *height = window->windowed.h; - break; - case SDL_WINDOWRECT_FLOATING: - SDL_RelativeToGlobalForWindow(window, window->floating.x, window->floating.y, x, y); - *width = window->floating.w; - *height = window->floating.h; - break; - default: - /* Should never be here */ - SDL_assert_release(SDL_FALSE); - *width = 0; - *height = 0; + case SDL_WINDOWRECT_CURRENT: + SDL_RelativeToGlobalForWindow(window, window->x, window->y, x, y); + *width = window->w; + *height = window->h; + break; + case SDL_WINDOWRECT_WINDOWED: + SDL_RelativeToGlobalForWindow(window, window->windowed.x, window->windowed.y, x, y); + *width = window->windowed.w; + *height = window->windowed.h; + break; + case SDL_WINDOWRECT_FLOATING: + SDL_RelativeToGlobalForWindow(window, window->floating.x, window->floating.y, x, y); + *width = window->floating.w; + *height = window->floating.h; + break; + default: + /* Should never be here */ + SDL_assert_release(SDL_FALSE); + *width = 0; + *height = 0; + break; } /* Copy the client size in pixels into this rect structure, @@ -587,6 +589,10 @@ static void CleanupWindowData(SDL_VideoDevice *_this, SDL_Window *window) if (data) { SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, WIN_MouseRelativeModeCenterChanged, data); + if (data->drop_target) { + WIN_AcceptDragAndDrop(window, SDL_FALSE); + } + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) if (data->ICMFileName) { SDL_free(data->ICMFileName); @@ -1136,7 +1142,7 @@ void WIN_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window) SetWindowPos(hwnd, HWND_TOP, fx, fy, fw, fh, data->copybits_flag | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOACTIVATE); data->expected_resize = SDL_FALSE; } - }else { + } else { data->windowed_mode_was_maximized = SDL_TRUE; } } @@ -1693,10 +1699,468 @@ int WIN_SetWindowOpacity(SDL_VideoDevice *_this, SDL_Window *window, float opaci } #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) + +static const char *SDLGetClipboardFormatName(UINT cf, char *text, int len) +{ + switch (cf) { + case CF_TEXT: + return "CF_TEXT"; + case CF_BITMAP: + return "CF_BITMAP"; + case CF_METAFILEPICT: + return "CF_METAFILEPICT"; + case CF_SYLK: + return "CF_SYLK"; + case CF_DIF: + return "CF_DIF"; + case CF_TIFF: + return "CF_TIFF"; + case CF_OEMTEXT: + return "CF_OEMTEXT"; + case CF_DIB: + return "CF_DIB"; + case CF_PALETTE: + return "CF_PALETTE"; + case CF_PENDATA: + return "CF_PENDATA"; + case CF_RIFF: + return "CF_RIFF"; + case CF_WAVE: + return "CF_WAVE"; + case CF_UNICODETEXT: + return "CF_UNICODETEXT"; + case CF_ENHMETAFILE: + return "CF_ENHMETAFILE"; + case CF_HDROP: + return "CF_HDROP"; + case CF_LOCALE: + return "CF_LOCALE"; + case CF_DIBV5: + return "CF_DIBV5"; + case CF_OWNERDISPLAY: + return "CF_OWNERDISPLAY"; + case CF_DSPTEXT: + return "CF_DSPTEXT"; + case CF_DSPBITMAP: + return "CF_DSPBITMAP"; + case CF_DSPMETAFILEPICT: + return "CF_DSPMETAFILEPICT"; + case CF_DSPENHMETAFILE: + return "CF_DSPENHMETAFILE"; + default: + if (GetClipboardFormatNameA(cf, text, len)) { + return text; + } else { + return NULL; + } + } +} + +static STDMETHODIMP_(ULONG) SDLDropTarget_AddRef(SDLDropTarget *target) +{ + return ++target->refcount; +} + +static STDMETHODIMP_(ULONG) SDLDropTarget_Release(SDLDropTarget *target) +{ + --target->refcount; + if (target->refcount == 0) { + SDL_free(target); + return 0; + } + return target->refcount; +} + +static STDMETHODIMP SDLDropTarget_QueryInterface(SDLDropTarget *target, REFIID riid, PVOID *ppv) +{ + if (ppv == NULL) { + return E_INVALIDARG; + } + + *ppv = NULL; + if (WIN_IsEqualIID(riid, &IID_IUnknown) || + WIN_IsEqualIID(riid, &IID_IDropTarget)) { + *ppv = (void *)target; + } + if (*ppv) { + SDLDropTarget_AddRef(target); + return S_OK; + } + return E_NOINTERFACE; +} + +static STDMETHODIMP SDLDropTarget_DragEnter(SDLDropTarget *target, + IDataObject *pDataObject, DWORD grfKeyState, + POINTL pt, DWORD *pdwEffect) +{ + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In DragEnter at %ld, %ld\n", pt.x, pt.y); + *pdwEffect = DROPEFFECT_COPY; + POINT pnt = { pt.x, pt.y }; + if (ScreenToClient(target->hwnd, &pnt)) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In DragEnter at %ld, %ld => window %u at %ld, %ld\n", pt.x, pt.y, target->window->id, pnt.x, pnt.y); + SDL_SendDropPosition(target->window, pnt.x, pnt.y); + } else { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In DragEnter at %ld, %ld => nil, nil\n", pt.x, pt.y); + } + return S_OK; +} + +static STDMETHODIMP SDLDropTarget_DragOver(SDLDropTarget *target, + DWORD grfKeyState, + POINTL pt, DWORD *pdwEffect) +{ + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In DragOver at %ld, %ld\n", pt.x, pt.y); + *pdwEffect = DROPEFFECT_COPY; + POINT pnt = { pt.x, pt.y }; + if (ScreenToClient(target->hwnd, &pnt)) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In DragOver at %ld, %ld => window %u at %ld, %ld\n", pt.x, pt.y, target->window->id, pnt.x, pnt.y); + SDL_SendDropPosition(target->window, pnt.x, pnt.y); + } else { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In DragOver at %ld, %ld => nil, nil\n", pt.x, pt.y); + } + return S_OK; +} + +static STDMETHODIMP SDLDropTarget_DragLeave(SDLDropTarget *target) +{ + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In DragLeave\n"); + SDL_SendDropComplete(target->window); + return S_OK; +} + +static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, + IDataObject *pDataObject, DWORD grfKeyState, + POINTL pt, DWORD *pdwEffect) +{ + *pdwEffect = DROPEFFECT_COPY; + POINT pnt = { pt.x, pt.y }; + if (ScreenToClient(target->hwnd, &pnt)) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop at %ld, %ld => window %u at %ld, %ld\n", pt.x, pt.y, target->window->id, pnt.x, pnt.y); + SDL_SendDropPosition(target->window, pnt.x, pnt.y); + } else { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop at %ld, %ld => nil, nil\n", pt.x, pt.y); + } + + { + IEnumFORMATETC *pEnumFormatEtc; + HRESULT hres; + hres = pDataObject->lpVtbl->EnumFormatEtc(pDataObject, DATADIR_GET, &pEnumFormatEtc); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop for EnumFormatEtc, HRESULT is %08lx\n", hres); + if (hres == S_OK) { + FORMATETC fetc; + while (pEnumFormatEtc->lpVtbl->Next(pEnumFormatEtc, 1, &fetc, NULL) == S_OK) { + char name[257] = { 0 }; + const char *cfnm = SDLGetClipboardFormatName(fetc.cfFormat, name, 256); + if (cfnm) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop, Supported format is %08x, '%s'\n", fetc.cfFormat, cfnm); + } else { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop, Supported format is %08x, Predefined\n", fetc.cfFormat); + } + } + } + } + + { + FORMATETC fetc; + fetc.cfFormat = target->format_file; + fetc.ptd = NULL; + fetc.dwAspect = DVASPECT_CONTENT; + fetc.lindex = -1; + fetc.tymed = TYMED_HGLOBAL; + const char *format_mime = "text/uri-list"; + if (SUCCEEDED(pDataObject->lpVtbl->QueryGetData(pDataObject, &fetc))) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop File for QueryGetData, format %08x '%s', success\n", + fetc.cfFormat, format_mime); + STGMEDIUM med; + HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop File for GetData, format %08x '%s', HRESULT is %08lx\n", + fetc.cfFormat, format_mime, hres); + if (SUCCEEDED(hres)) { + const size_t bsize = GlobalSize(med.hGlobal); + const void *buffer = (void *)GlobalLock(med.hGlobal); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop File for GlobalLock, format %08x '%s', memory (%lu) %p\n", + fetc.cfFormat, format_mime, (unsigned long)bsize, buffer); + if (buffer) { + char *text = SDL_malloc(bsize + sizeof(Uint32)); + SDL_memcpy((Uint8 *)text, buffer, bsize); + SDL_memset((Uint8 *)text + bsize, 0, sizeof(Uint32)); + char *saveptr = NULL; + char *token = SDL_strtok_r(text, "\r\n", &saveptr); + while (token != NULL) { + if (SDL_URIToLocal(token, token) >= 0) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop File, file (%lu of %lu) '%s'\n", + (unsigned long)strlen(token), (unsigned long)bsize, token); + SDL_SendDropFile(target->window, NULL, token); + } + token = SDL_strtok_r(NULL, "\r\n", &saveptr); + } + SDL_free(text); + } + GlobalUnlock(med.hGlobal); + ReleaseStgMedium(&med); + SDL_SendDropComplete(target->window); + return S_OK; + } + } + } + + { + FORMATETC fetc; + fetc.cfFormat = target->format_text; + fetc.ptd = NULL; + fetc.dwAspect = DVASPECT_CONTENT; + fetc.lindex = -1; + fetc.tymed = TYMED_HGLOBAL; + const char *format_mime = "text/plain;charset=utf-8"; + if (SUCCEEDED(pDataObject->lpVtbl->QueryGetData(pDataObject, &fetc))) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop Text for QueryGetData, format %08x '%s', success\n", + fetc.cfFormat, format_mime); + STGMEDIUM med; + HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop Text for GetData, format %08x '%s', HRESULT is %08lx\n", + fetc.cfFormat, format_mime, hres); + if (SUCCEEDED(hres)) { + const size_t bsize = GlobalSize(med.hGlobal); + const void *buffer = (void *)GlobalLock(med.hGlobal); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop Text for GlobalLock, format %08x '%s', memory (%lu) %p\n", + fetc.cfFormat, format_mime, (unsigned long)bsize, buffer); + if (buffer) { + char *text = SDL_malloc(bsize + sizeof(Uint32)); + SDL_memcpy((Uint8 *)text, buffer, bsize); + SDL_memset((Uint8 *)text + bsize, 0, sizeof(Uint32)); + char *saveptr = NULL; + char *token = SDL_strtok_r(text, "\r\n", &saveptr); + while (token != NULL) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop Text, text (%lu of %lu) '%s'\n", + (unsigned long)strlen(token), (unsigned long)bsize, token); + SDL_SendDropText(target->window, (char *)token); + token = SDL_strtok_r(NULL, "\r\n", &saveptr); + } + SDL_free(text); + } + GlobalUnlock(med.hGlobal); + ReleaseStgMedium(&med); + SDL_SendDropComplete(target->window); + return S_OK; + } + } + } + + { + FORMATETC fetc; + fetc.cfFormat = CF_UNICODETEXT; + fetc.ptd = NULL; + fetc.dwAspect = DVASPECT_CONTENT; + fetc.lindex = -1; + fetc.tymed = TYMED_HGLOBAL; + const char *format_mime = "CF_UNICODETEXT"; + if (SUCCEEDED(pDataObject->lpVtbl->QueryGetData(pDataObject, &fetc))) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop Text for QueryGetData, format %08x '%s', success\n", + fetc.cfFormat, format_mime); + STGMEDIUM med; + HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop Text for GetData, format %08x '%s', HRESULT is %08lx\n", + fetc.cfFormat, format_mime, hres); + if (SUCCEEDED(hres)) { + const size_t bsize = GlobalSize(med.hGlobal); + const void *buffer = (void *)GlobalLock(med.hGlobal); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop Text for GlobalLock, format %08x '%s', memory (%lu) %p\n", + fetc.cfFormat, format_mime, (unsigned long)bsize, buffer); + if (buffer) { + buffer = WIN_StringToUTF8(buffer); + if (buffer) { + const size_t lbuffer = strlen(buffer); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop Text for StringToUTF8, format %08x '%s', memory (%lu) %p\n", + fetc.cfFormat, format_mime, (unsigned long)lbuffer, buffer); + char *text = SDL_malloc(lbuffer + sizeof(Uint32)); + SDL_memcpy((Uint8 *)text, buffer, lbuffer); + SDL_memset((Uint8 *)text + lbuffer, 0, sizeof(Uint32)); + char *saveptr = NULL; + char *token = SDL_strtok_r(text, "\r\n", &saveptr); + while (token != NULL) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop Text, text (%lu of %lu) '%s'\n", + (unsigned long)strlen(token), (unsigned long)lbuffer, token); + SDL_SendDropText(target->window, (char *)token); + token = SDL_strtok_r(NULL, "\r\n", &saveptr); + } + SDL_free(text); + SDL_free((void *)buffer); + } + } + GlobalUnlock(med.hGlobal); + ReleaseStgMedium(&med); + SDL_SendDropComplete(target->window); + return S_OK; + } + } + } + + { + FORMATETC fetc; + fetc.cfFormat = CF_TEXT; + fetc.ptd = NULL; + fetc.dwAspect = DVASPECT_CONTENT; + fetc.lindex = -1; + fetc.tymed = TYMED_HGLOBAL; + const char *format_mime = "CF_TEXT"; + if (SUCCEEDED(pDataObject->lpVtbl->QueryGetData(pDataObject, &fetc))) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop Text for QueryGetData, format %08x '%s', success\n", + fetc.cfFormat, format_mime); + STGMEDIUM med; + HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop Text for GetData, format %08x '%s', HRESULT is %08lx\n", + fetc.cfFormat, format_mime, hres); + if (SUCCEEDED(hres)) { + const size_t bsize = GlobalSize(med.hGlobal); + const void *buffer = (void *)GlobalLock(med.hGlobal); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop Text for GlobalLock, format %08x '%s', memory (%lu) %p\n", + fetc.cfFormat, format_mime, (unsigned long)bsize, buffer); + if (buffer) { + char *text = SDL_malloc(bsize + sizeof(Uint32)); + SDL_memcpy((Uint8 *)text, buffer, bsize); + SDL_memset((Uint8 *)text + bsize, 0, sizeof(Uint32)); + char *saveptr = NULL; + char *token = SDL_strtok_r(text, "\r\n", &saveptr); + while (token != NULL) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop Text, text (%lu of %lu) '%s'\n", + (unsigned long)strlen(token), (unsigned long)bsize, token); + SDL_SendDropText(target->window, (char *)token); + token = SDL_strtok_r(NULL, "\r\n", &saveptr); + } + SDL_free(text); + } + GlobalUnlock(med.hGlobal); + ReleaseStgMedium(&med); + SDL_SendDropComplete(target->window); + return S_OK; + } + } + } + + { + FORMATETC fetc; + fetc.cfFormat = CF_HDROP; + fetc.ptd = NULL; + fetc.dwAspect = DVASPECT_CONTENT; + fetc.lindex = -1; + fetc.tymed = TYMED_HGLOBAL; + const char *format_mime = "CF_HDROP"; + if (SUCCEEDED(pDataObject->lpVtbl->QueryGetData(pDataObject, &fetc))) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop File for QueryGetData, format %08x '%s', success\n", + fetc.cfFormat, format_mime); + STGMEDIUM med; + HRESULT hres = pDataObject->lpVtbl->GetData(pDataObject, &fetc, &med); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop File for GetData, format %08x '%s', HRESULT is %08lx\n", + fetc.cfFormat, format_mime, hres); + if (SUCCEEDED(hres)) { + const size_t bsize = GlobalSize(med.hGlobal); + HDROP drop = (HDROP)GlobalLock(med.hGlobal); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop File for GlobalLock, format %08x '%s', memory (%lu) %p\n", + fetc.cfFormat, format_mime, (unsigned long)bsize, drop); + UINT count = DragQueryFile(drop, 0xFFFFFFFF, NULL, 0); + for (UINT i = 0; i < count; ++i) { + SDL_bool isstack; + UINT size = DragQueryFile(drop, i, NULL, 0) + 1; + LPTSTR buffer = SDL_small_alloc(TCHAR, size, &isstack); + if (buffer) { + if (DragQueryFile(drop, i, buffer, size)) { + char *file = WIN_StringToUTF8(buffer); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Drop File, file (%lu of %lu) '%s'\n", + (unsigned long)strlen(file), (unsigned long)bsize, file); + SDL_SendDropFile(target->window, NULL, file); + SDL_free(file); + } + SDL_small_free(buffer, isstack); + } + } + GlobalUnlock(med.hGlobal); + ReleaseStgMedium(&med); + SDL_SendDropComplete(target->window); + return S_OK; + } + } + } + + SDL_SendDropComplete(target->window); + return S_OK; +} + +static void *vtDropTarget[] = { + (void *)(SDLDropTarget_QueryInterface), + (void *)(SDLDropTarget_AddRef), + (void *)(SDLDropTarget_Release), + (void *)(SDLDropTarget_DragEnter), + (void *)(SDLDropTarget_DragOver), + (void *)(SDLDropTarget_DragLeave), + (void *)(SDLDropTarget_Drop) +}; + void WIN_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept) { - const SDL_WindowData *data = window->internal; - DragAcceptFiles(data->hwnd, accept ? TRUE : FALSE); + SDL_WindowData *data = window->internal; + if (data->videodata->oleinitialized) { + if (accept && !data->drop_target) { + SDLDropTarget *drop_target = (SDLDropTarget *)SDL_calloc(1, sizeof(SDLDropTarget)); + if (drop_target != NULL) { + drop_target->lpVtbl = vtDropTarget; + drop_target->window = window; + drop_target->hwnd = data->hwnd; + drop_target->format_file = RegisterClipboardFormat(L"text/uri-list"); + drop_target->format_text = RegisterClipboardFormat(L"text/plain;charset=utf-8"); + data->drop_target = drop_target; + SDLDropTarget_AddRef(drop_target); + RegisterDragDrop(data->hwnd, (LPDROPTARGET)drop_target); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Accept Drag and Drop, window %u, enabled Full OLE IDropTarget\n", + window->id); + } + } else if (!accept && data->drop_target) { + RevokeDragDrop(data->hwnd); + SDLDropTarget_Release(data->drop_target); + data->drop_target = NULL; + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Accept Drag and Drop, window %u, disabled Full OLE IDropTarget\n", + window->id); + } + } else { + DragAcceptFiles(data->hwnd, accept ? TRUE : FALSE); + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + ". In Accept Drag and Drop, window %u, %s Fallback WM_DROPFILES\n", + window->id, (accept ? "enabled" : "disabled")); + } } int WIN_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation) diff --git a/src/video/windows/SDL_windowswindow.h b/src/video/windows/SDL_windowswindow.h index 3cf0f833e3b78..1b3ebfb0bb8c5 100644 --- a/src/video/windows/SDL_windowswindow.h +++ b/src/video/windows/SDL_windowswindow.h @@ -48,6 +48,16 @@ typedef enum SDL_WindowEraseBackgroundMode SDL_ERASEBACKGROUNDMODE_ALWAYS, } SDL_WindowEraseBackgroundMode; +typedef struct +{ + void **lpVtbl; + int refcount; + SDL_Window *window; + HWND hwnd; + UINT format_text; + UINT format_file; +} SDLDropTarget; + struct SDL_WindowData { SDL_Window *window; @@ -89,6 +99,7 @@ struct SDL_WindowData /* Whether we retain the content of the window when changing state */ UINT copybits_flag; + SDLDropTarget *drop_target; }; extern int WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props); From 349540f73f2df9c4ce68d8d56039567445ac0e57 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 1 Aug 2024 17:39:42 +0200 Subject: [PATCH 100/253] Document the new SDL3 Android archive artifact --- android-project/app/proguard-rules.pro | 2 +- build-scripts/build-release.py | 4 ++ build-scripts/create-android-project.py | 6 +- .../pkg-support/android/INSTALL.md.in | 58 +++++++++++++++++++ docs/README-android.md | 47 ++++++++++++++- 5 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 build-scripts/pkg-support/android/INSTALL.md.in diff --git a/android-project/app/proguard-rules.pro b/android-project/app/proguard-rules.pro index 9a28afe743428..ffc6976e5b3a6 100644 --- a/android-project/app/proguard-rules.pro +++ b/android-project/app/proguard-rules.pro @@ -5,7 +5,7 @@ # directive in build.gradle. # # For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html +# https://developer.android.com/build/shrink-code # Add any project specific keep options here: diff --git a/build-scripts/build-release.py b/build-scripts/build-release.py index 248c2227fb12c..8224fbdf01acd 100755 --- a/build-scripts/build-release.py +++ b/build-scripts/build-release.py @@ -609,6 +609,10 @@ def create_android_archives(self, android_api: int, android_home: Path, android_ aar_path = self.dist_path / f"{self.project}-{self.version}.aar" added_global_files = False with zipfile.ZipFile(aar_path, "w", compression=zipfile.ZIP_DEFLATED) as zip_object: + install_txt = (self.root / "build-scripts/pkg-support/android/INSTALL.md.in").read_text() + install_txt = install_txt.replace("@PROJECT_VERSION@", self.version) + install_txt = install_txt.replace("@PROJECT_NAME@", self.project) + zip_object.writestr("INSTALL.md", install_txt) project_description = { "name": self.project, "version": self.version, diff --git a/build-scripts/create-android-project.py b/build-scripts/create-android-project.py index e1cb2eb6e444a..76ad853d29e6e 100755 --- a/build-scripts/create-android-project.py +++ b/build-scripts/create-android-project.py @@ -114,7 +114,11 @@ def gradle_add_package_name(path: Path, package_name: str) -> None: def main() -> int: description = "Create a simple Android gradle project from input sources." - epilog = "You need to manually copy a prebuilt SDL3 Android archive into the project tree when using the aar variant." + epilog = textwrap.dedent("""\ + You need to manually copy a prebuilt SDL3 Android archive into the project tree when using the aar variant. + + Any changes you have done to the sources in the Android project will be lost + """) parser = ArgumentParser(description=description, epilog=epilog, allow_abbrev=False) parser.add_argument("package_name", metavar="PACKAGENAME", help="Android package name (e.g. com.yourcompany.yourapp)") parser.add_argument("sources", metavar="SOURCE", nargs="*", help="Source code of your application. The files are copied to the output directory.") diff --git a/build-scripts/pkg-support/android/INSTALL.md.in b/build-scripts/pkg-support/android/INSTALL.md.in new file mode 100644 index 0000000000000..9d633f4a2d00c --- /dev/null +++ b/build-scripts/pkg-support/android/INSTALL.md.in @@ -0,0 +1,58 @@ + +This Android archive allows use of @PROJECT_NAME@ in your Android project, without needing to copy any SDL source. +For integration with CMake/ndk-build, it uses [prefab](https://google.github.io/prefab/). + +Copy this archive (@PROJECT_NAME@-@PROJECT_VERSION@.aar) to a `app/libs` directory of your project. + +In `app/gradle.build` of your Android project, add: +``` +android { + /* ... */ + buildFeatures { + prefab true + } +} +dependencies { + implementation files('libs/@PROJECT_NAME@-@PROJECT_VERSION@.aar') + /* ... */ +} +``` + +If you're using CMake, add the following to your CMakeLists.txt: +``` +find_package(@PROJECT_NAME@ REQUIRED CONFIG) +target_link_libraries(yourgame PRIVATE @PROJECT_NAME@::@PROJECT_NAME@) +``` + +If you're using ndk-build, add the following somewhere after `LOCAL_MODULE := yourgame` to your `Android.mk` or `Application.mk`: +``` +# https://google.github.io/prefab/build-systems.html + +# Add the prefab modules to the import path. +$(call import-add-path,/out) + +# Import @PROJECT_NAME@ so we can depend on it. +$(call import-module,prefab/@PROJECT_NAME@) +``` + +--- + +For advanced users: + +If you want to build a 3rd party library outside Gradle, +running the following command will extract the Android archive into a more common directory structure. +``` +python @PROJECT_NAME@-@PROJECT_VERSION@.aar -o android_prefix +``` +Add `--help` for a list of all available options. + + +Look at the example programs in ./test (of the source archive), and check out online documentation: + https://wiki.libsdl.org/SDL3/FrontPage + +Join the SDL discourse server if you want to join the community: + https://discourse.libsdl.org/ + + +That's it! +Sam Lantinga diff --git a/docs/README-android.md b/docs/README-android.md index 754d2edfae2ad..e6065715b9e94 100644 --- a/docs/README-android.md +++ b/docs/README-android.md @@ -57,15 +57,16 @@ run: One limitation of this script is that all sources provided will be aggregated into a single directory, thus all your source files should have a unique name. -Once the project is complete the script will tell you where the debug APK is located. +Once the project is complete the script will tell you how to build the project. If you want to create a signed release APK, you can use the project created by this utility to generate it. +Running the script with `--help` will list all available options, and their purposes. + Finally, a word of caution: re running create-android-project.py wipes any changes you may have done in the build directory for the app! - For more complex projects, follow these instructions: 1. Get the source code for SDL and copy the 'android-project' directory located at SDL/android-project to a suitable location. Also make sure to rename it to your project name (In these examples: YOURPROJECT). @@ -122,6 +123,48 @@ Here's an explanation of the files in the Android project, so you can customize src/main/java/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding to SDL. Be very careful changing this, as the SDL library relies on this implementation. You should instead subclass this for your application. +Using the SDL3 Android Archive (.aar) +================================================================================ + +The `create-android-project.py` script can +./create-android-project.py com.yourcompany.yourapp < sources.list + +The Android archive allows use of SDL3 in your Android project, without needing to copy any SDL c or java source. +For integration with CMake/ndk-build, it uses [prefab](https://google.github.io/prefab/). + +Copy the archive to a `app/libs` directory of your project and add the following to `app/gradle.build`: +``` +android { + /* ... */ + buildFeatures { + prefab true + } +} +dependencies { + implementation files('libs/@PROJECT_NAME@-@PROJECT_VERSION@.aar') + /* ... */ +} +``` + +If you're using CMake, add the following to your CMakeLists.txt: +``` +find_package(@PROJECT_NAME@ REQUIRED CONFIG) +target_link_libraries(yourgame PRIVATE @PROJECT_NAME@::@PROJECT_NAME@) +``` + +If you're using ndk-build, add the following somewhere after `LOCAL_MODULE := yourgame` to your `Android.mk` or `Application.mk`: +``` +# https://google.github.io/prefab/build-systems.html + +# Add the prefab modules to the import path. +$(call import-add-path,/out) + +# Import @PROJECT_NAME@ so we can depend on it. +$(call import-module,prefab/@PROJECT_NAME@) +``` + +If you want to avoid adding the complete SDL source base as a subproject, or adding the Java sources of the bindings to your Android project + Customizing your application name ================================================================================ From 0c5bb532c337b6191a2f799f037e9866b0662c20 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 1 Aug 2024 17:46:55 +0200 Subject: [PATCH 101/253] Remove support for building a SDL3 library from gradle --- android-project/app/build.gradle | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/android-project/app/build.gradle b/android-project/app/build.gradle index d34ba31457712..514e594a4c1f2 100644 --- a/android-project/app/build.gradle +++ b/android-project/app/build.gradle @@ -1,17 +1,11 @@ -def buildWithCMake = project.hasProperty('BUILD_WITH_CMAKE'); -def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY'); -def buildAsApplication = !buildAsLibrary -if (buildAsApplication) { - apply plugin: 'com.android.application' -} -else { - apply plugin: 'com.android.library' +plugins { + id 'com.android.application' } +def buildWithCMake = project.hasProperty('BUILD_WITH_CMAKE'); + android { - if (buildAsApplication) { - namespace "org.libsdl.app" - } + namespace "org.libsdl.app" compileSdkVersion 34 defaultConfig { minSdkVersion 19 @@ -61,18 +55,6 @@ android { lint { abortOnError false } - - if (buildAsLibrary) { - libraryVariants.all { variant -> - variant.outputs.each { output -> - def outputFile = output.outputFile - if (outputFile != null && outputFile.name.endsWith(".aar")) { - def fileName = "org.libsdl.app.aar"; - output.outputFile = new File(outputFile.parent, fileName); - } - } - } - } } dependencies { From 68fb07787b9f3e84f28077b3bbc748483f65b668 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 1 Aug 2024 15:49:02 +0200 Subject: [PATCH 102/253] cmake: Remove HAVE_D3D12_H from sources and introduce SDL_RENDER_D3D(11|12) --- CMakeLists.txt | 24 ++++++++----------- cmake/PreseedMSVCCache.cmake | 4 +--- include/build_config/SDL_build_config.h.cmake | 2 -- .../build_config/SDL_build_config_windows.h | 7 +----- .../build_config/SDL_build_config_wingdk.h | 3 +-- include/build_config/SDL_build_config_xbox.h | 3 +-- 6 files changed, 14 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 048622b7e39a5..ca5e5f07408c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -327,7 +327,9 @@ dep_option(SDL_COCOA "Use Cocoa video driver" ON "APPLE" OFF) dep_option(SDL_DIRECTX "Use DirectX for Windows audio/video" ON "SDL_AUDIO OR SDL_VIDEO;WINDOWS" OFF) dep_option(SDL_XINPUT "Use Xinput for Windows" ON "WINDOWS" OFF) dep_option(SDL_WASAPI "Use the Windows WASAPI audio driver" ON "WINDOWS;SDL_AUDIO" OFF) -dep_option(SDL_RENDER_D3D "Enable the Direct3D render driver" ON "SDL_RENDER" OFF) +dep_option(SDL_RENDER_D3D "Enable the Direct3D 9 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF) +dep_option(SDL_RENDER_D3D11 "Enable the Direct3D 11 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF) +dep_option(SDL_RENDER_D3D12 "Enable the Direct3D 12 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF) dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;${APPLE}" OFF) dep_option(SDL_VIVANTE "Use Vivante EGL video driver" ON "${UNIX_SYS};SDL_CPU_ARM32" OFF) dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS" OFF) @@ -1838,14 +1840,8 @@ elseif(WINDOWS) string(APPEND CMAKE_REQUIRED_FLAGS " /I\"$ENV{DXSDK_DIR}\\Include\"") endif() - check_include_file(d3d9.h HAVE_D3D_H) + check_include_file(d3d9.h HAVE_D3D9_H) check_include_file(d3d11_1.h HAVE_D3D11_H) - check_c_source_compiles(" - #include - #include - ID3D12Device1 *device; - int main(int argc, char **argv) { return 0; } - " HAVE_D3D12_H) check_include_file(ddraw.h HAVE_DDRAW_H) check_include_file(dsound.h HAVE_DSOUND_H) check_include_file(dinput.h HAVE_DINPUT_H) @@ -1854,7 +1850,7 @@ elseif(WINDOWS) endif() check_include_file(dxgi.h HAVE_DXGI_H) cmake_pop_check_state() - if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_D3D12_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H) + if(HAVE_D3D9_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H) set(HAVE_DIRECTX TRUE) if(NOT MINGW AND NOT USE_WINSDK_DIRECTX) if(CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -1929,17 +1925,17 @@ elseif(WINDOWS) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/video/windows/*.c") endif() - if(SDL_RENDER_D3D AND HAVE_D3D_H AND NOT WINDOWS_STORE) + if(SDL_RENDER_D3D AND HAVE_D3D9_H AND NOT WINDOWS_STORE) set(SDL_VIDEO_RENDER_D3D 1) set(HAVE_RENDER_D3D TRUE) endif() - if(SDL_RENDER_D3D AND HAVE_D3D11_H) + if(SDL_RENDER_D3D11 AND HAVE_D3D11_H) set(SDL_VIDEO_RENDER_D3D11 1) - set(HAVE_RENDER_D3D TRUE) + set(HAVE_RENDER_D3D11 TRUE) endif() - if(SDL_RENDER_D3D AND HAVE_D3D12_H AND NOT WINDOWS_STORE) + if(SDL_RENDER_D3D12 AND NOT WINDOWS_STORE) set(SDL_VIDEO_RENDER_D3D12 1) - set(HAVE_RENDER_D3D TRUE) + set(HAVE_RENDER_D3D12 TRUE) endif() set(HAVE_SDL_VIDEO TRUE) endif() diff --git a/cmake/PreseedMSVCCache.cmake b/cmake/PreseedMSVCCache.cmake index 370dcadd33395..a4095275e9ce8 100644 --- a/cmake/PreseedMSVCCache.cmake +++ b/cmake/PreseedMSVCCache.cmake @@ -4,7 +4,7 @@ if(MSVC) set(HAVE_ALLOCA_H "" CACHE INTERNAL "Have include alloca.h") set(HAVE_AUDIOCLIENT_H "1" CACHE INTERNAL "Have include audioclient.h") set(HAVE_D3D11_H "1" CACHE INTERNAL "Have include d3d11_1.h") - set(HAVE_D3D_H "1" CACHE INTERNAL "Have include d3d9.h") + set(HAVE_D3D9_H "1" CACHE INTERNAL "Have include d3d9.h") set(HAVE_DDRAW_H "1" CACHE INTERNAL "Have include ddraw.h") set(HAVE_DINPUT_H "1" CACHE INTERNAL "Have include dinput.h") set(HAVE_DSOUND_H "1" CACHE INTERNAL "Have include dsound.h") @@ -170,11 +170,9 @@ if(MSVC) endif() if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "19.1") - set(HAVE_D3D12_H "1" CACHE INTERNAL "Test HAVE_D3D12_H") set(HAVE_ROAPI_H "1" CACHE INTERNAL "Have include roapi.h") set(HAVE_WINDOWS_GAMING_INPUT_H "1" CACHE INTERNAL "Test HAVE_WINDOWS_GAMING_INPUT_H") else() - set(HAVE_D3D12_H "" CACHE INTERNAL "Test HAVE_D3D12_H") set(HAVE_ROAPI_H "" CACHE INTERNAL "Have include roapi.h") set(HAVE_WINDOWS_GAMING_INPUT_H "" CACHE INTERNAL "Test HAVE_WINDOWS_GAMING_INPUT_H") endif() diff --git a/include/build_config/SDL_build_config.h.cmake b/include/build_config/SDL_build_config.h.cmake index 0e3645e293809..1e0cdc9db550b 100644 --- a/include/build_config/SDL_build_config.h.cmake +++ b/include/build_config/SDL_build_config.h.cmake @@ -226,9 +226,7 @@ #cmakedefine HAVE_LIBUDEV_H 1 #cmakedefine HAVE_LIBDECOR_H 1 -#cmakedefine HAVE_D3D_H @HAVE_D3D_H@ #cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ -#cmakedefine HAVE_D3D12_H @HAVE_D3D12_H@ #cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@ #cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@ #cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@ diff --git a/include/build_config/SDL_build_config_windows.h b/include/build_config/SDL_build_config_windows.h index 457b58e00d420..6feab76aa82a2 100644 --- a/include/build_config/SDL_build_config_windows.h +++ b/include/build_config/SDL_build_config_windows.h @@ -93,11 +93,6 @@ typedef unsigned int uintptr_t; #define HAVE_D3D11_H 1 #define HAVE_ROAPI_H 1 #endif -#if defined(__has_include) -#if __has_include() && __has_include() -#define HAVE_D3D12_H 1 -#endif -#endif #if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0603 /* Windows 8.1 SDK */ #define HAVE_SHELLSCALINGAPI_H 1 #endif @@ -282,7 +277,7 @@ typedef unsigned int uintptr_t; #if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) #define SDL_VIDEO_RENDER_D3D11 1 #endif -#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) +#if !defined(SDL_VIDEO_RENDER_D3D12) #define SDL_VIDEO_RENDER_D3D12 1 #endif diff --git a/include/build_config/SDL_build_config_wingdk.h b/include/build_config/SDL_build_config_wingdk.h index 896499060e43f..e46c4593f9332 100644 --- a/include/build_config/SDL_build_config_wingdk.h +++ b/include/build_config/SDL_build_config_wingdk.h @@ -42,7 +42,6 @@ #define HAVE_WINDOWS_GAMING_INPUT_H 1 #define HAVE_D3D11_H 1 #define HAVE_ROAPI_H 1 -#define HAVE_D3D12_H 1 #define HAVE_SHELLSCALINGAPI_H 1 #define HAVE_MMDEVICEAPI_H 1 #define HAVE_AUDIOCLIENT_H 1 @@ -215,7 +214,7 @@ #if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) #define SDL_VIDEO_RENDER_D3D11 1 #endif -#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) +#if !defined(SDL_VIDEO_RENDER_D3D12) #define SDL_VIDEO_RENDER_D3D12 1 #endif diff --git a/include/build_config/SDL_build_config_xbox.h b/include/build_config/SDL_build_config_xbox.h index 80c5d95a3dcb1..7bba464324931 100644 --- a/include/build_config/SDL_build_config_xbox.h +++ b/include/build_config/SDL_build_config_xbox.h @@ -41,7 +41,6 @@ /*#define HAVE_WINDOWS_GAMING_INPUT_H 1*/ /*#define HAVE_D3D11_H 1*/ /*#define HAVE_ROAPI_H 1*/ -#define HAVE_D3D12_H 1 /*#define HAVE_SHELLSCALINGAPI_H 1*/ #define HAVE_MMDEVICEAPI_H 1 #define HAVE_AUDIOCLIENT_H 1 @@ -208,7 +207,7 @@ #define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_WINDOWS 1 -#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) +#if !defined(SDL_VIDEO_RENDER_D3D12) #define SDL_VIDEO_RENDER_D3D12 1 #endif From 7d27a97402be6a06188e68fd7ed912cde40e4914 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Thu, 1 Aug 2024 21:45:02 +0300 Subject: [PATCH 103/253] d3d12.h, d3d12sdklayers.h: fix build against older mingw-w64 versions. Fixes: https://github.com/libsdl-org/SDL/issues/10452 . --- src/video/directx/d3d12.h | 11 +++++++++++ src/video/directx/d3d12sdklayers.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/src/video/directx/d3d12.h b/src/video/directx/d3d12.h index 684ef13d7b6bf..e670c3cd4669f 100644 --- a/src/video/directx/d3d12.h +++ b/src/video/directx/d3d12.h @@ -50,6 +50,13 @@ #endif #endif +#ifndef _In_opt_count_ +#define _In_opt_count_(x) +#endif +#ifndef _In_count_ +#define _In_count_(x) +#endif + /* Forward Declarations */ #ifndef __ID3D12Object_FWD_DEFINED__ @@ -586,7 +593,9 @@ extern "C"{ /* [local] */ #include +#ifdef _MSC_VER #pragma region App Family +#endif #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) #ifndef _D3D12_CONSTANTS #define _D3D12_CONSTANTS @@ -34845,7 +34854,9 @@ EXTERN_C const IID IID_ID3D12GBVDiagnostics; /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */ +#ifdef _MSC_VER #pragma endregion +#endif DEFINE_GUID(IID_ID3D12Object,0xc4fec28f,0x7966,0x4e95,0x9f,0x94,0xf4,0x31,0xcb,0x56,0xc3,0xb8); DEFINE_GUID(IID_ID3D12DeviceChild,0x905db94b,0xa00c,0x4140,0x9d,0xf5,0x2b,0x64,0xca,0x9e,0xa3,0x57); DEFINE_GUID(IID_ID3D12RootSignature,0xc54a6b66,0x72df,0x4ee8,0x8b,0xe5,0xa9,0x46,0xa1,0x42,0x92,0x14); diff --git a/src/video/directx/d3d12sdklayers.h b/src/video/directx/d3d12sdklayers.h index 3bab2e37eabba..2628d6280d959 100644 --- a/src/video/directx/d3d12sdklayers.h +++ b/src/video/directx/d3d12sdklayers.h @@ -206,7 +206,9 @@ extern "C"{ /* [local] */ #include +#ifdef _MSC_VER #pragma region App Family +#endif #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) @@ -4224,7 +4226,9 @@ EXTERN_C const IID IID_ID3D12InfoQueue1; /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */ +#ifdef _MSC_VER #pragma endregion +#endif 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_ID3D12Debug2,0x93a665c4,0xa3b2,0x4e5d,0xb6,0x92,0xa2,0x6a,0xe1,0x4e,0x33,0x74); From 15f68a86ff3bba9633b21c58d997db92acd4a152 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 1 Aug 2024 11:24:54 -0700 Subject: [PATCH 104/253] Group the blit copy flags to simplify code --- src/video/SDL_blit.c | 2 +- src/video/SDL_blit.h | 2 + src/video/SDL_blit_auto.c | 480 +++++++++++++++++++------------------- src/video/SDL_blit_slow.c | 4 +- src/video/SDL_surface.c | 8 +- src/video/sdlgenblit.pl | 6 +- 6 files changed, 251 insertions(+), 251 deletions(-) diff --git a/src/video/SDL_blit.c b/src/video/SDL_blit.c index 6efa3f6edc847..447e96d26fa90 100644 --- a/src/video/SDL_blit.c +++ b/src/video/SDL_blit.c @@ -125,7 +125,7 @@ static SDL_bool SDL_UseAltivecPrefetch(void) static SDL_BlitFunc SDL_ChooseBlitFunc(SDL_PixelFormat src_format, SDL_PixelFormat dst_format, int flags, SDL_BlitFuncEntry *entries) { - int i, flagcheck = (flags & (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_COLORKEY | SDL_COPY_NEAREST)); + int i, flagcheck = (flags & (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_COLORKEY | SDL_COPY_NEAREST)); static unsigned int features = 0x7fffffff; /* Get the available CPU features */ diff --git a/src/video/SDL_blit.h b/src/video/SDL_blit.h index 5cf7bcc04aaa5..fea3a3632593e 100644 --- a/src/video/SDL_blit.h +++ b/src/video/SDL_blit.h @@ -30,12 +30,14 @@ extern const Uint16 SDL_expand_byte_10[]; /* SDL blit copy flags */ #define SDL_COPY_MODULATE_COLOR 0x00000001 #define SDL_COPY_MODULATE_ALPHA 0x00000002 +#define SDL_COPY_MODULATE_MASK (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA) #define SDL_COPY_BLEND 0x00000010 #define SDL_COPY_BLEND_PREMULTIPLIED 0x00000020 #define SDL_COPY_ADD 0x00000040 #define SDL_COPY_ADD_PREMULTIPLIED 0x00000080 #define SDL_COPY_MOD 0x00000100 #define SDL_COPY_MUL 0x00000200 +#define SDL_COPY_BLEND_MASK (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL) #define SDL_COPY_COLORKEY 0x00000400 #define SDL_COPY_NEAREST 0x00000800 #define SDL_COPY_RLE_DESIRED 0x00001000 diff --git a/src/video/SDL_blit_auto.c b/src/video/SDL_blit_auto.c index 9b45dda5b01b8..d039bb67a9b3f 100644 --- a/src/video/SDL_blit_auto.c +++ b/src/video/SDL_blit_auto.c @@ -75,7 +75,7 @@ static void SDL_Blit_XRGB8888_XRGB8888_Blend(SDL_BlitInfo *info) srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; dstpixel = *dst; dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -142,7 +142,7 @@ static void SDL_Blit_XRGB8888_XRGB8888_Blend_Scale(SDL_BlitInfo *info) srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; dstpixel = *dst; dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -288,7 +288,7 @@ static void SDL_Blit_XRGB8888_XRGB8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -391,7 +391,7 @@ static void SDL_Blit_XRGB8888_XRGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -499,7 +499,7 @@ static void SDL_Blit_XRGB8888_XBGR8888_Blend(SDL_BlitInfo *info) srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; dstpixel = *dst; dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -566,7 +566,7 @@ static void SDL_Blit_XRGB8888_XBGR8888_Blend_Scale(SDL_BlitInfo *info) srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; dstpixel = *dst; dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -712,7 +712,7 @@ static void SDL_Blit_XRGB8888_XBGR8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -815,7 +815,7 @@ static void SDL_Blit_XRGB8888_XBGR8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -922,7 +922,7 @@ static void SDL_Blit_XRGB8888_ARGB8888_Blend(SDL_BlitInfo *info) srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; dstpixel = *dst; dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -991,7 +991,7 @@ static void SDL_Blit_XRGB8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; dstpixel = *dst; dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -1143,7 +1143,7 @@ static void SDL_Blit_XRGB8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -1251,7 +1251,7 @@ static void SDL_Blit_XRGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -1365,7 +1365,7 @@ static void SDL_Blit_XRGB8888_ABGR8888_Blend(SDL_BlitInfo *info) srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; dstpixel = *dst; dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -1434,7 +1434,7 @@ static void SDL_Blit_XRGB8888_ABGR8888_Blend_Scale(SDL_BlitInfo *info) srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; dstpixel = *dst; dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -1586,7 +1586,7 @@ static void SDL_Blit_XRGB8888_ABGR8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -1694,7 +1694,7 @@ static void SDL_Blit_XRGB8888_ABGR8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -1807,7 +1807,7 @@ static void SDL_Blit_XBGR8888_XRGB8888_Blend(SDL_BlitInfo *info) srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -1874,7 +1874,7 @@ static void SDL_Blit_XBGR8888_XRGB8888_Blend_Scale(SDL_BlitInfo *info) srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -2020,7 +2020,7 @@ static void SDL_Blit_XBGR8888_XRGB8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -2123,7 +2123,7 @@ static void SDL_Blit_XBGR8888_XRGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -2226,7 +2226,7 @@ static void SDL_Blit_XBGR8888_XBGR8888_Blend(SDL_BlitInfo *info) srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -2293,7 +2293,7 @@ static void SDL_Blit_XBGR8888_XBGR8888_Blend_Scale(SDL_BlitInfo *info) srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -2439,7 +2439,7 @@ static void SDL_Blit_XBGR8888_XBGR8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -2542,7 +2542,7 @@ static void SDL_Blit_XBGR8888_XBGR8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -2651,7 +2651,7 @@ static void SDL_Blit_XBGR8888_ARGB8888_Blend(SDL_BlitInfo *info) srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -2720,7 +2720,7 @@ static void SDL_Blit_XBGR8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -2872,7 +2872,7 @@ static void SDL_Blit_XBGR8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -2980,7 +2980,7 @@ static void SDL_Blit_XBGR8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -3092,7 +3092,7 @@ static void SDL_Blit_XBGR8888_ABGR8888_Blend(SDL_BlitInfo *info) srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -3161,7 +3161,7 @@ static void SDL_Blit_XBGR8888_ABGR8888_Blend_Scale(SDL_BlitInfo *info) srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; dstpixel = *dst; dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24); - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: dstR = srcR; dstG = srcG; @@ -3313,7 +3313,7 @@ static void SDL_Blit_XBGR8888_ABGR8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -3421,7 +3421,7 @@ static void SDL_Blit_XBGR8888_ABGR8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -3539,7 +3539,7 @@ static void SDL_Blit_ARGB8888_XRGB8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -3632,7 +3632,7 @@ static void SDL_Blit_ARGB8888_XRGB8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -3799,7 +3799,7 @@ static void SDL_Blit_ARGB8888_XRGB8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -3904,7 +3904,7 @@ static void SDL_Blit_ARGB8888_XRGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -4019,7 +4019,7 @@ static void SDL_Blit_ARGB8888_XBGR8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -4112,7 +4112,7 @@ static void SDL_Blit_ARGB8888_XBGR8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -4279,7 +4279,7 @@ static void SDL_Blit_ARGB8888_XBGR8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -4384,7 +4384,7 @@ static void SDL_Blit_ARGB8888_XBGR8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -4494,7 +4494,7 @@ static void SDL_Blit_ARGB8888_ARGB8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -4592,7 +4592,7 @@ static void SDL_Blit_ARGB8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -4772,7 +4772,7 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -4882,7 +4882,7 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -5002,7 +5002,7 @@ static void SDL_Blit_ARGB8888_ABGR8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -5100,7 +5100,7 @@ static void SDL_Blit_ARGB8888_ABGR8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -5280,7 +5280,7 @@ static void SDL_Blit_ARGB8888_ABGR8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -5390,7 +5390,7 @@ static void SDL_Blit_ARGB8888_ABGR8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -5508,7 +5508,7 @@ static void SDL_Blit_RGBA8888_XRGB8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -5601,7 +5601,7 @@ static void SDL_Blit_RGBA8888_XRGB8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -5768,7 +5768,7 @@ static void SDL_Blit_RGBA8888_XRGB8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -5873,7 +5873,7 @@ static void SDL_Blit_RGBA8888_XRGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -5988,7 +5988,7 @@ static void SDL_Blit_RGBA8888_XBGR8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -6081,7 +6081,7 @@ static void SDL_Blit_RGBA8888_XBGR8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -6248,7 +6248,7 @@ static void SDL_Blit_RGBA8888_XBGR8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -6353,7 +6353,7 @@ static void SDL_Blit_RGBA8888_XBGR8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -6466,7 +6466,7 @@ static void SDL_Blit_RGBA8888_ARGB8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -6564,7 +6564,7 @@ static void SDL_Blit_RGBA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -6744,7 +6744,7 @@ static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -6854,7 +6854,7 @@ static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -6974,7 +6974,7 @@ static void SDL_Blit_RGBA8888_ABGR8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -7072,7 +7072,7 @@ static void SDL_Blit_RGBA8888_ABGR8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -7252,7 +7252,7 @@ static void SDL_Blit_RGBA8888_ABGR8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -7362,7 +7362,7 @@ static void SDL_Blit_RGBA8888_ABGR8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -7482,7 +7482,7 @@ static void SDL_Blit_ABGR8888_XRGB8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -7575,7 +7575,7 @@ static void SDL_Blit_ABGR8888_XRGB8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -7742,7 +7742,7 @@ static void SDL_Blit_ABGR8888_XRGB8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -7847,7 +7847,7 @@ static void SDL_Blit_ABGR8888_XRGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -7960,7 +7960,7 @@ static void SDL_Blit_ABGR8888_XBGR8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -8053,7 +8053,7 @@ static void SDL_Blit_ABGR8888_XBGR8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -8220,7 +8220,7 @@ static void SDL_Blit_ABGR8888_XBGR8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -8325,7 +8325,7 @@ static void SDL_Blit_ABGR8888_XBGR8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -8440,7 +8440,7 @@ static void SDL_Blit_ABGR8888_ARGB8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -8538,7 +8538,7 @@ static void SDL_Blit_ABGR8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -8718,7 +8718,7 @@ static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -8828,7 +8828,7 @@ static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -8943,7 +8943,7 @@ static void SDL_Blit_ABGR8888_ABGR8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -9041,7 +9041,7 @@ static void SDL_Blit_ABGR8888_ABGR8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -9221,7 +9221,7 @@ static void SDL_Blit_ABGR8888_ABGR8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -9331,7 +9331,7 @@ static void SDL_Blit_ABGR8888_ABGR8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -9451,7 +9451,7 @@ static void SDL_Blit_BGRA8888_XRGB8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -9544,7 +9544,7 @@ static void SDL_Blit_BGRA8888_XRGB8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -9711,7 +9711,7 @@ static void SDL_Blit_BGRA8888_XRGB8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -9816,7 +9816,7 @@ static void SDL_Blit_BGRA8888_XRGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -9929,7 +9929,7 @@ static void SDL_Blit_BGRA8888_XBGR8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -10022,7 +10022,7 @@ static void SDL_Blit_BGRA8888_XBGR8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -10189,7 +10189,7 @@ static void SDL_Blit_BGRA8888_XBGR8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -10294,7 +10294,7 @@ static void SDL_Blit_BGRA8888_XBGR8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -10409,7 +10409,7 @@ static void SDL_Blit_BGRA8888_ARGB8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -10507,7 +10507,7 @@ static void SDL_Blit_BGRA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -10687,7 +10687,7 @@ static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -10797,7 +10797,7 @@ static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -10915,7 +10915,7 @@ static void SDL_Blit_BGRA8888_ABGR8888_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -11013,7 +11013,7 @@ static void SDL_Blit_BGRA8888_ABGR8888_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -11193,7 +11193,7 @@ static void SDL_Blit_BGRA8888_ABGR8888_Modulate_Blend(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -11303,7 +11303,7 @@ static void SDL_Blit_BGRA8888_ABGR8888_Modulate_Blend_Scale(SDL_BlitInfo *info) MULT_DIV_255(srcB, srcA, srcB); } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: MULT_DIV_255((255 - srcA), dstR, dstR); dstR += srcR; @@ -11367,173 +11367,173 @@ static void SDL_Blit_BGRA8888_ABGR8888_Modulate_Blend_Scale(SDL_BlitInfo *info) SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XRGB8888_Scale }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XRGB8888_XRGB8888_Blend }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XRGB8888_Blend_Scale }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_XRGB8888_XRGB8888_Modulate }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XRGB8888_Modulate_Scale }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XRGB8888_XRGB8888_Modulate_Blend }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XRGB8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XRGB8888_XRGB8888_Blend }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XRGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_XRGB8888_XRGB8888_Modulate }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XRGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XRGB8888_XRGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XRGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XBGR8888_Scale }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XRGB8888_XBGR8888_Blend }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XBGR8888_Blend_Scale }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_XRGB8888_XBGR8888_Modulate }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XBGR8888_Modulate_Scale }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XRGB8888_XBGR8888_Modulate_Blend }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XBGR8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XRGB8888_XBGR8888_Blend }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XBGR8888_Blend_Scale }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_XRGB8888_XBGR8888_Modulate }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XBGR8888_Modulate_Scale }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XRGB8888_XBGR8888_Modulate_Blend }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_XBGR8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ARGB8888_Scale }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XRGB8888_ARGB8888_Blend }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ARGB8888_Blend_Scale }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_XRGB8888_ARGB8888_Modulate }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ARGB8888_Modulate_Scale }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XRGB8888_ARGB8888_Modulate_Blend }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ARGB8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XRGB8888_ARGB8888_Blend }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ARGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_XRGB8888_ARGB8888_Modulate }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ARGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XRGB8888_ARGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ARGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ABGR8888_Scale }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XRGB8888_ABGR8888_Blend }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ABGR8888_Blend_Scale }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_XRGB8888_ABGR8888_Modulate }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ABGR8888_Modulate_Scale }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XRGB8888_ABGR8888_Modulate_Blend }, - { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ABGR8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XRGB8888_ABGR8888_Blend }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ABGR8888_Blend_Scale }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_XRGB8888_ABGR8888_Modulate }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ABGR8888_Modulate_Scale }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XRGB8888_ABGR8888_Modulate_Blend }, + { SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XRGB8888_ABGR8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XRGB8888_Scale }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XBGR8888_XRGB8888_Blend }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XRGB8888_Blend_Scale }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_XBGR8888_XRGB8888_Modulate }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XRGB8888_Modulate_Scale }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XBGR8888_XRGB8888_Modulate_Blend }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XRGB8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XBGR8888_XRGB8888_Blend }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XRGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_XBGR8888_XRGB8888_Modulate }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XRGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XBGR8888_XRGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XRGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XBGR8888_Scale }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XBGR8888_XBGR8888_Blend }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XBGR8888_Blend_Scale }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_XBGR8888_XBGR8888_Modulate }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XBGR8888_Modulate_Scale }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XBGR8888_XBGR8888_Modulate_Blend }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XBGR8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XBGR8888_XBGR8888_Blend }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XBGR8888_Blend_Scale }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_XBGR8888_XBGR8888_Modulate }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XBGR8888_Modulate_Scale }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XBGR8888_XBGR8888_Modulate_Blend }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_XBGR8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ARGB8888_Scale }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XBGR8888_ARGB8888_Blend }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ARGB8888_Blend_Scale }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_XBGR8888_ARGB8888_Modulate }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ARGB8888_Modulate_Scale }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XBGR8888_ARGB8888_Modulate_Blend }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ARGB8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XBGR8888_ARGB8888_Blend }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ARGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_XBGR8888_ARGB8888_Modulate }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ARGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XBGR8888_ARGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ARGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ABGR8888_Scale }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XBGR8888_ABGR8888_Blend }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ABGR8888_Blend_Scale }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_XBGR8888_ABGR8888_Modulate }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ABGR8888_Modulate_Scale }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_XBGR8888_ABGR8888_Modulate_Blend }, - { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ABGR8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XBGR8888_ABGR8888_Blend }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ABGR8888_Blend_Scale }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_XBGR8888_ABGR8888_Modulate }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ABGR8888_Modulate_Scale }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_XBGR8888_ABGR8888_Modulate_Blend }, + { SDL_PIXELFORMAT_XBGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_XBGR8888_ABGR8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XRGB8888_Scale }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_XRGB8888_Blend }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XRGB8888_Blend_Scale }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_XRGB8888_Modulate }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XRGB8888_Modulate_Scale }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_XRGB8888_Modulate_Blend }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XRGB8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ARGB8888_XRGB8888_Blend }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XRGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_ARGB8888_XRGB8888_Modulate }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XRGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ARGB8888_XRGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XRGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XBGR8888_Scale }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_XBGR8888_Blend }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XBGR8888_Blend_Scale }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_XBGR8888_Modulate }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XBGR8888_Modulate_Scale }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_XBGR8888_Modulate_Blend }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XBGR8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ARGB8888_XBGR8888_Blend }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XBGR8888_Blend_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_ARGB8888_XBGR8888_Modulate }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XBGR8888_Modulate_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ARGB8888_XBGR8888_Modulate_Blend }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_XBGR8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Scale }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend_Scale }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ABGR8888_Scale }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_ABGR8888_Blend }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ABGR8888_Blend_Scale }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_ABGR8888_Modulate }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ABGR8888_Modulate_Scale }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ARGB8888_ABGR8888_Modulate_Blend }, - { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ABGR8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ARGB8888_ABGR8888_Blend }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ABGR8888_Blend_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_ARGB8888_ABGR8888_Modulate }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ABGR8888_Modulate_Scale }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ARGB8888_ABGR8888_Modulate_Blend }, + { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_ABGR8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XRGB8888_Scale }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_XRGB8888_Blend }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XRGB8888_Blend_Scale }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_XRGB8888_Modulate }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XRGB8888_Modulate_Scale }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_XRGB8888_Modulate_Blend }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XRGB8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_RGBA8888_XRGB8888_Blend }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XRGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_RGBA8888_XRGB8888_Modulate }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XRGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_RGBA8888_XRGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XRGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XBGR8888_Scale }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_XBGR8888_Blend }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XBGR8888_Blend_Scale }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_XBGR8888_Modulate }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XBGR8888_Modulate_Scale }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_XBGR8888_Modulate_Blend }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XBGR8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_RGBA8888_XBGR8888_Blend }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XBGR8888_Blend_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_RGBA8888_XBGR8888_Modulate }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XBGR8888_Modulate_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_RGBA8888_XBGR8888_Modulate_Blend }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_XBGR8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Scale }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend_Scale }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ABGR8888_Scale }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_ABGR8888_Blend }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ABGR8888_Blend_Scale }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_ABGR8888_Modulate }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ABGR8888_Modulate_Scale }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_RGBA8888_ABGR8888_Modulate_Blend }, - { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ABGR8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_RGBA8888_ABGR8888_Blend }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ABGR8888_Blend_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_RGBA8888_ABGR8888_Modulate }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ABGR8888_Modulate_Scale }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_RGBA8888_ABGR8888_Modulate_Blend }, + { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_ABGR8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XRGB8888_Scale }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_XRGB8888_Blend }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XRGB8888_Blend_Scale }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_XRGB8888_Modulate }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XRGB8888_Modulate_Scale }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_XRGB8888_Modulate_Blend }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XRGB8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ABGR8888_XRGB8888_Blend }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XRGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_ABGR8888_XRGB8888_Modulate }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XRGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ABGR8888_XRGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XRGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XBGR8888_Scale }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_XBGR8888_Blend }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XBGR8888_Blend_Scale }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_XBGR8888_Modulate }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XBGR8888_Modulate_Scale }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_XBGR8888_Modulate_Blend }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XBGR8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ABGR8888_XBGR8888_Blend }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XBGR8888_Blend_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_ABGR8888_XBGR8888_Modulate }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XBGR8888_Modulate_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ABGR8888_XBGR8888_Modulate_Blend }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_XBGR8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Scale }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend_Scale }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ABGR8888_Scale }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_ABGR8888_Blend }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ABGR8888_Blend_Scale }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_ABGR8888_Modulate }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ABGR8888_Modulate_Scale }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_ABGR8888_ABGR8888_Modulate_Blend }, - { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ABGR8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ABGR8888_ABGR8888_Blend }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ABGR8888_Blend_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_ABGR8888_ABGR8888_Modulate }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ABGR8888_Modulate_Scale }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_ABGR8888_ABGR8888_Modulate_Blend }, + { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_ABGR8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XRGB8888_Scale }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_XRGB8888_Blend }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XRGB8888_Blend_Scale }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_XRGB8888_Modulate }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XRGB8888_Modulate_Scale }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_XRGB8888_Modulate_Blend }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XRGB8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_BGRA8888_XRGB8888_Blend }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XRGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_BGRA8888_XRGB8888_Modulate }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XRGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_BGRA8888_XRGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XRGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XRGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XBGR8888_Scale }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_XBGR8888_Blend }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XBGR8888_Blend_Scale }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_XBGR8888_Modulate }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XBGR8888_Modulate_Scale }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_XBGR8888_Modulate_Blend }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XBGR8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_BGRA8888_XBGR8888_Blend }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XBGR8888_Blend_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_BGRA8888_XBGR8888_Modulate }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XBGR8888_Modulate_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_BGRA8888_XBGR8888_Modulate_Blend }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_XBGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_XBGR8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Scale }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend_Scale }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Blend_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale }, { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ABGR8888_Scale }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_ABGR8888_Blend }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ABGR8888_Blend_Scale }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_ABGR8888_Modulate }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ABGR8888_Modulate_Scale }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL), SDL_CPU_ANY, SDL_Blit_BGRA8888_ABGR8888_Modulate_Blend }, - { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ABGR8888_Modulate_Blend_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_BGRA8888_ABGR8888_Blend }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ABGR8888_Blend_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK), SDL_CPU_ANY, SDL_Blit_BGRA8888_ABGR8888_Modulate }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ABGR8888_Modulate_Scale }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK), SDL_CPU_ANY, SDL_Blit_BGRA8888_ABGR8888_Modulate_Blend }, + { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR8888, (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_ABGR8888_Modulate_Blend_Scale }, { 0, 0, 0, 0, NULL } }; diff --git a/src/video/SDL_blit_slow.c b/src/video/SDL_blit_slow.c index 68b693cd8b2ff..3b8703e19c176 100644 --- a/src/video/SDL_blit_slow.c +++ b/src/video/SDL_blit_slow.c @@ -146,7 +146,7 @@ void SDL_Blit_Slow(SDL_BlitInfo *info) continue; } } - if ((flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL))) { + if (flags & SDL_COPY_BLEND_MASK) { switch (dst_access) { case SlowBlitPixelAccess_Index8: dstpixel = *dst; @@ -206,7 +206,7 @@ void SDL_Blit_Slow(SDL_BlitInfo *info) srcB = (srcB * srcA) / 255; } } - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case 0: dstR = srcR; dstG = srcG; diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 1eedfd7b0b521..c41b850723c6c 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -722,7 +722,7 @@ int SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode) status = 0; flags = surface->internal->map.info.flags; - surface->internal->map.info.flags &= ~(SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL); + surface->internal->map.info.flags &= ~SDL_COPY_BLEND_MASK; switch (blendMode) { case SDL_BLENDMODE_NONE: break; @@ -770,7 +770,7 @@ int SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode) return 0; } - switch (surface->internal->map.info.flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (surface->internal->map.info.flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: *blendMode = SDL_BLENDMODE_BLEND; break; @@ -1103,9 +1103,7 @@ int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode) { - static const Uint32 complex_copy_flags = (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | - SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | - SDL_COPY_COLORKEY); + static const Uint32 complex_copy_flags = (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_COLORKEY); if (srcrect->w > SDL_MAX_UINT16 || srcrect->h > SDL_MAX_UINT16 || dstrect->w > SDL_MAX_UINT16 || dstrect->h > SDL_MAX_UINT16) { diff --git a/src/video/sdlgenblit.pl b/src/video/sdlgenblit.pl index a1c795ea8033d..4cd78faa973b1 100755 --- a/src/video/sdlgenblit.pl +++ b/src/video/sdlgenblit.pl @@ -337,7 +337,7 @@ sub output_copycore __EOF__ } print FILE <<__EOF__; - switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) { + switch (flags & SDL_COPY_BLEND_MASK) { case SDL_COPY_BLEND: __EOF__ if ($A_is_const_FF) { @@ -658,7 +658,7 @@ sub output_copyfunctable my $flags = ""; my $flag = ""; if ( $modulate ) { - $flag = "SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA"; + $flag = "SDL_COPY_MODULATE_MASK"; if ( $flags eq "" ) { $flags = $flag; } else { @@ -666,7 +666,7 @@ sub output_copyfunctable } } if ( $blend ) { - $flag = "SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL"; + $flag = "SDL_COPY_BLEND_MASK"; if ( $flags eq "" ) { $flags = $flag; } else { From 22ffb487d0db50a8c59ccbb3816b6682087cd0a2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 1 Aug 2024 10:18:29 -0700 Subject: [PATCH 105/253] Added SDL_ScaleSurface() --- include/SDL3/SDL_surface.h | 20 +++++++- src/dynapi/SDL_dynapi.sym | 1 + src/dynapi/SDL_dynapi_overrides.h | 1 + src/dynapi/SDL_dynapi_procs.h | 1 + src/video/SDL_surface.c | 82 +++++++++++++++++++++++++++++++ 5 files changed, 104 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index 552b0acc103c1..6bde401785f6e 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -691,6 +691,24 @@ extern SDL_DECLSPEC int SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMo */ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_DuplicateSurface(SDL_Surface *surface); +/** + * Creates a new surface identical to the existing surface, scaled to the desired size. + * + * The returned surface should be freed with SDL_DestroySurface(). + * + * \param surface the surface to duplicate and scale. + * \param width the width of the new surface. + * \param height the height of the new surface. + * \param scaleMode the SDL_ScaleMode to be used. + * \returns a copy of the surface or NULL on failure; call SDL_GetError() for + * more information. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_DestroySurface + */ +extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ScaleSurface(SDL_Surface *surface, int width, int height, SDL_ScaleMode scaleMode); + /** * Copy an existing surface to a new surface of the specified format. * @@ -1031,7 +1049,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SD * \param dst the SDL_Surface structure that is the blit target. * \param dstrect the SDL_Rect structure representing the target rectangle in * the destination surface, may not be NULL. - * \param scaleMode scale algorithm to be used. + * \param scaleMode the SDL_ScaleMode to be used. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 299fb40380835..49a9f25843dc6 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -687,6 +687,7 @@ SDL3_0.0.0 { SDL_RunHapticEffect; SDL_SaveBMP; SDL_SaveBMP_IO; + SDL_ScaleSurface; SDL_ScreenKeyboardShown; SDL_ScreenSaverEnabled; SDL_SeekIO; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 6c7b6b158d85b..b1e0dce8e1c75 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -712,6 +712,7 @@ #define SDL_RunHapticEffect SDL_RunHapticEffect_REAL #define SDL_SaveBMP SDL_SaveBMP_REAL #define SDL_SaveBMP_IO SDL_SaveBMP_IO_REAL +#define SDL_ScaleSurface SDL_ScaleSurface_REAL #define SDL_ScreenKeyboardShown SDL_ScreenKeyboardShown_REAL #define SDL_ScreenSaverEnabled SDL_ScreenSaverEnabled_REAL #define SDL_SeekIO SDL_SeekIO_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index d66790999b443..be11aa8eb642d 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -723,6 +723,7 @@ SDL_DYNAPI_PROC(int,SDL_RunApp,(int a, char *b[], SDL_main_func c, void *d),(a,b SDL_DYNAPI_PROC(int,SDL_RunHapticEffect,(SDL_Haptic *a, int b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_SaveBMP,(SDL_Surface *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SaveBMP_IO,(SDL_Surface *a, SDL_IOStream *b, SDL_bool c),(a,b,c),return) +SDL_DYNAPI_PROC(SDL_Surface*,SDL_ScaleSurface,(SDL_Surface *a, int b, int c, SDL_ScaleMode d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_bool,SDL_ScreenKeyboardShown,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_ScreenSaverEnabled,(void),(),return) SDL_DYNAPI_PROC(Sint64,SDL_SeekIO,(SDL_IOStream *a, Sint64 b, SDL_IOWhence c),(a,b,c),return) diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index c41b850723c6c..7f83fd6fa3079 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -1968,6 +1968,88 @@ SDL_Surface *SDL_DuplicateSurface(SDL_Surface *surface) return SDL_ConvertSurfaceAndColorspace(surface, surface->format, surface->internal->palette, surface->internal->colorspace, surface->internal->props); } +SDL_Surface *SDL_ScaleSurface(SDL_Surface *surface, int width, int height, SDL_ScaleMode scaleMode) +{ + SDL_Surface *convert = NULL; + Uint32 copy_flags; + SDL_Color copy_color; + int ret; + + if (!SDL_SurfaceValid(surface)) { + SDL_InvalidParamError("surface"); + goto error; + } + + if (SDL_ISPIXELFORMAT_FOURCC(surface->format)) { + // We can't directly scale a YUV surface (yet!) + SDL_Surface *tmp = SDL_CreateSurface(surface->w, surface->h, SDL_PIXELFORMAT_ARGB8888); + if (!tmp) { + return NULL; + } + + SDL_Surface *scaled = SDL_ScaleSurface(tmp, width, height, scaleMode); + SDL_DestroySurface(tmp); + if (!scaled) { + return NULL; + } + tmp = scaled; + + SDL_Surface *result = SDL_ConvertSurfaceAndColorspace(tmp, surface->format, NULL, surface->internal->colorspace, surface->internal->props); + SDL_DestroySurface(tmp); + return result; + } + + /* Create a new surface with the desired size */ + convert = SDL_CreateSurface(width, height, surface->format); + if (!convert) { + goto error; + } + SDL_SetSurfacePalette(convert, surface->internal->palette); + SDL_SetSurfaceColorspace(convert, surface->internal->colorspace); + + /* Save the original copy flags */ + copy_flags = surface->internal->map.info.flags; + copy_color.r = surface->internal->map.info.r; + copy_color.g = surface->internal->map.info.g; + copy_color.b = surface->internal->map.info.b; + copy_color.a = surface->internal->map.info.a; + surface->internal->map.info.r = 0xFF; + surface->internal->map.info.g = 0xFF; + surface->internal->map.info.b = 0xFF; + surface->internal->map.info.a = 0xFF; + surface->internal->map.info.flags = (copy_flags & (SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY)); + SDL_InvalidateMap(&surface->internal->map); + + ret = SDL_BlitSurfaceScaled(surface, NULL, convert, NULL, scaleMode); + + /* Clean up the original surface, and update converted surface */ + convert->internal->map.info.r = copy_color.r; + convert->internal->map.info.g = copy_color.g; + convert->internal->map.info.b = copy_color.b; + convert->internal->map.info.a = copy_color.a; + convert->internal->map.info.flags = (copy_flags & ~(SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY)); + surface->internal->map.info.r = copy_color.r; + surface->internal->map.info.g = copy_color.g; + surface->internal->map.info.b = copy_color.b; + surface->internal->map.info.a = copy_color.a; + surface->internal->map.info.flags = copy_flags; + SDL_InvalidateMap(&surface->internal->map); + + /* SDL_BlitSurfaceScaled failed, and so the conversion */ + if (ret < 0) { + goto error; + } + + /* We're ready to go! */ + return convert; + +error: + if (convert) { + SDL_DestroySurface(convert); + } + return NULL; +} + SDL_Surface *SDL_ConvertSurface(SDL_Surface *surface, SDL_PixelFormat format) { if (!SDL_SurfaceValid(surface)) { From b8f3cd0a104d20e4c2ac6bb065eb2652ac8b1732 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 1 Aug 2024 08:17:44 -0700 Subject: [PATCH 106/253] Added SDL_CursorData for internal cursor data --- src/events/SDL_mouse_c.h | 4 +- src/video/android/SDL_androidmouse.c | 11 ++-- src/video/cocoa/SDL_cocoamouse.m | 2 +- src/video/emscripten/SDL_emscriptenmouse.c | 14 ++--- src/video/emscripten/SDL_emscriptenmouse.h | 11 ++-- src/video/emscripten/SDL_emscriptenvideo.c | 2 +- src/video/haiku/SDL_bvideo.cc | 46 +++++++++------ src/video/kmsdrm/SDL_kmsdrmmouse.c | 10 ++-- src/video/kmsdrm/SDL_kmsdrmmouse.h | 4 +- src/video/raspberry/SDL_rpimouse.c | 18 +++--- src/video/raspberry/SDL_rpimouse.h | 3 +- src/video/wayland/SDL_waylandevents_c.h | 2 +- src/video/wayland/SDL_waylandmouse.c | 22 +++---- src/video/windows/SDL_windowsmouse.c | 68 +++++++++++++--------- src/video/winrt/SDL_winrtmouse.cpp | 2 +- src/video/x11/SDL_x11mouse.c | 53 ++++++++++------- 16 files changed, 150 insertions(+), 122 deletions(-) diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h index 6959ba697aef2..acd2e7785b8eb 100644 --- a/src/events/SDL_mouse_c.h +++ b/src/events/SDL_mouse_c.h @@ -29,10 +29,12 @@ /* The default mouse input device, for platforms that don't have multiple mice */ #define SDL_DEFAULT_MOUSE_ID 1 +typedef struct SDL_CursorData SDL_CursorData; + struct SDL_Cursor { struct SDL_Cursor *next; - void *internal; + SDL_CursorData *internal; }; typedef struct diff --git a/src/video/android/SDL_androidmouse.c b/src/video/android/SDL_androidmouse.c index d46847033e0b3..1ff75b4883c31 100644 --- a/src/video/android/SDL_androidmouse.c +++ b/src/video/android/SDL_androidmouse.c @@ -41,12 +41,11 @@ #define BUTTON_BACK 8 #define BUTTON_FORWARD 16 -typedef struct +struct SDL_CursorData { int custom_cursor; int system_cursor; - -} SDL_AndroidCursorData; +}; /* Last known Android mouse button state (includes all buttons) */ static int last_state; @@ -60,7 +59,7 @@ static SDL_Cursor *Android_WrapCursor(int custom_cursor, int system_cursor) cursor = SDL_calloc(1, sizeof(*cursor)); if (cursor) { - SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)SDL_calloc(1, sizeof(*data)); + SDL_CursorData *data = (SDL_CursorData *)SDL_calloc(1, sizeof(*data)); if (data) { data->custom_cursor = custom_cursor; data->system_cursor = system_cursor; @@ -104,7 +103,7 @@ static SDL_Cursor *Android_CreateSystemCursor(SDL_SystemCursor id) static void Android_FreeCursor(SDL_Cursor *cursor) { - SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)cursor->internal; + SDL_CursorData *data = cursor->internal; if (data->custom_cursor != 0) { Android_JNI_DestroyCustomCursor(data->custom_cursor); } @@ -139,7 +138,7 @@ static int Android_ShowCursor(SDL_Cursor *cursor) cursor = Android_CreateEmptyCursor(); } if (cursor) { - SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)cursor->internal; + SDL_CursorData *data = cursor->internal; if (data->custom_cursor) { if (!Android_JNI_SetCustomCursor(data->custom_cursor)) { return SDL_Unsupported(); diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index a68d0ea1cc21c..acb733f670825 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -232,7 +232,7 @@ + (NSCursor *)invisibleCursor static void Cocoa_FreeCursor(SDL_Cursor *cursor) { @autoreleasepool { - CFBridgingRelease(cursor->internal); + CFBridgingRelease((void *)cursor->internal); SDL_free(cursor); } } diff --git a/src/video/emscripten/SDL_emscriptenmouse.c b/src/video/emscripten/SDL_emscriptenmouse.c index 189e4da180a4a..75e3852980c25 100644 --- a/src/video/emscripten/SDL_emscriptenmouse.c +++ b/src/video/emscripten/SDL_emscriptenmouse.c @@ -43,10 +43,10 @@ static SDL_Cursor *Emscripten_CreateCursorFromString(const char *cursor_str, SDL_bool is_custom) { - Emscripten_CursorData *curdata; + SDL_CursorData *curdata; SDL_Cursor *cursor = SDL_calloc(1, sizeof(SDL_Cursor)); if (cursor) { - curdata = (Emscripten_CursorData *)SDL_calloc(1, sizeof(*curdata)); + curdata = (SDL_CursorData *)SDL_calloc(1, sizeof(*curdata)); if (!curdata) { SDL_free(cursor); return NULL; @@ -125,9 +125,9 @@ static SDL_Cursor *Emscripten_CreateSystemCursor(SDL_SystemCursor id) static void Emscripten_FreeCursor(SDL_Cursor *cursor) { - Emscripten_CursorData *curdata; + SDL_CursorData *curdata; if (cursor) { - curdata = (Emscripten_CursorData *)cursor->internal; + curdata = cursor->internal; if (curdata) { if (curdata->is_custom) { @@ -142,10 +142,10 @@ static void Emscripten_FreeCursor(SDL_Cursor *cursor) static int Emscripten_ShowCursor(SDL_Cursor *cursor) { - Emscripten_CursorData *curdata; + SDL_CursorData *curdata; if (SDL_GetMouseFocus() != NULL) { if (cursor && cursor->internal) { - curdata = (Emscripten_CursorData *)cursor->internal; + curdata = cursor->internal; if (curdata->system_cursor) { /* *INDENT-OFF* */ /* clang-format off */ @@ -207,7 +207,7 @@ void Emscripten_InitMouse(void) SDL_SetDefaultCursor(Emscripten_CreateDefaultCursor()); } -void Emscripten_FiniMouse(void) +void Emscripten_QuitMouse(void) { } diff --git a/src/video/emscripten/SDL_emscriptenmouse.h b/src/video/emscripten/SDL_emscriptenmouse.h index f78b2c205d981..113e4006a74ea 100644 --- a/src/video/emscripten/SDL_emscriptenmouse.h +++ b/src/video/emscripten/SDL_emscriptenmouse.h @@ -22,16 +22,13 @@ #ifndef SDL_emscriptenmouse_h_ #define SDL_emscriptenmouse_h_ -typedef struct _Emscripten_CursorData +struct SDL_CursorData { const char *system_cursor; SDL_bool is_custom; -} Emscripten_CursorData; +}; -extern void -Emscripten_InitMouse(); - -extern void -Emscripten_FiniMouse(); +extern void Emscripten_InitMouse(void); +extern void Emscripten_QuitMouse(void); #endif /* SDL_emscriptenmouse_h_ */ diff --git a/src/video/emscripten/SDL_emscriptenvideo.c b/src/video/emscripten/SDL_emscriptenvideo.c index a629ad4a056d0..12fb0ae2a51aa 100644 --- a/src/video/emscripten/SDL_emscriptenvideo.c +++ b/src/video/emscripten/SDL_emscriptenvideo.c @@ -152,7 +152,7 @@ static int Emscripten_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *d static void Emscripten_VideoQuit(SDL_VideoDevice *_this) { - Emscripten_FiniMouse(); + Emscripten_QuitMouse(); } static int Emscripten_GetDisplayUsableBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect) diff --git a/src/video/haiku/SDL_bvideo.cc b/src/video/haiku/SDL_bvideo.cc index 30e6cc6366daf..8b61285f91040 100644 --- a/src/video/haiku/SDL_bvideo.cc +++ b/src/video/haiku/SDL_bvideo.cc @@ -120,6 +120,26 @@ void HAIKU_DeleteDevice(SDL_VideoDevice * device) SDL_free(device); } +struct SDL_CursorData +{ + BCursor *cursor; +}; + +static SDL_Cursor *HAIKU_CreateCursorAndData(BCursor *bcursor) +{ + SDL_Cursor *cursor = (SDL_Cursor *)SDL_calloc(1, sizeof(*cursor)); + if (cursor) { + SDL_CursorData *data = (SDL_CursorData *)SDL_calloc(1, sizeof(*data)); + if (!data) { + SDL_free(cursor); + return NULL; + } + data->cursor = bcursor; + cursor->internal = data; + } + return cursor; +} + static SDL_Cursor * HAIKU_CreateSystemCursor(SDL_SystemCursor id) { BCursorID cursorId = B_CURSOR_ID_SYSTEM_DEFAULT; @@ -153,12 +173,7 @@ static SDL_Cursor * HAIKU_CreateSystemCursor(SDL_SystemCursor id) return NULL; } - SDL_Cursor *cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor)); - if (cursor) { - cursor->internal = (void *)new BCursor(cursorId); - } - - return cursor; + return HAIKU_CreateCursorAndData(new BCursor(cursorId)); } static SDL_Cursor * HAIKU_CreateDefaultCursor() @@ -168,15 +183,17 @@ static SDL_Cursor * HAIKU_CreateDefaultCursor() static void HAIKU_FreeCursor(SDL_Cursor * cursor) { - if (cursor->internal) { - delete (BCursor*) cursor->internal; + SDL_CursorData *data = cursor->internal; + + if (data) { + delete data->cursor; } + SDL_free(data); SDL_free(cursor); } static SDL_Cursor * HAIKU_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) { - SDL_Cursor *cursor; SDL_Surface *converted; converted = SDL_ConvertSurface(surface, SDL_PIXELFORMAT_ARGB8888); @@ -188,14 +205,7 @@ static SDL_Cursor * HAIKU_CreateCursor(SDL_Surface * surface, int hot_x, int hot cursorBitmap->SetBits(converted->pixels, converted->h * converted->pitch, 0, B_RGBA32); SDL_DestroySurface(converted); - cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor)); - if (cursor) { - cursor->internal = (void *)new BCursor(cursorBitmap, BPoint(hot_x, hot_y)); - } else { - return NULL; - } - - return cursor; + return HAIKU_CreateCursorAndData(new BCursor(cursorBitmap, BPoint(hot_x, hot_y))); } static int HAIKU_ShowCursor(SDL_Cursor *cursor) @@ -207,7 +217,7 @@ static int HAIKU_ShowCursor(SDL_Cursor *cursor) } if (cursor) { - BCursor *hCursor = (BCursor*)cursor->internal; + BCursor *hCursor = cursor->internal->cursor; be_app->SetCursor(hCursor); } else { BCursor *hCursor = new BCursor(B_CURSOR_ID_NO_CURSOR); diff --git a/src/video/kmsdrm/SDL_kmsdrmmouse.c b/src/video/kmsdrm/SDL_kmsdrmmouse.c index 2b9a796dfbb92..503ac142ddbb2 100644 --- a/src/video/kmsdrm/SDL_kmsdrmmouse.c +++ b/src/video/kmsdrm/SDL_kmsdrmmouse.c @@ -134,7 +134,7 @@ static int KMSDRM_RemoveCursorFromBO(SDL_VideoDisplay *display) static int KMSDRM_DumpCursorToBO(SDL_VideoDisplay *display, SDL_Cursor *cursor) { SDL_DisplayData *dispdata = display->internal; - KMSDRM_CursorData *curdata = (KMSDRM_CursorData *)cursor->internal; + SDL_CursorData *curdata = cursor->internal; SDL_VideoDevice *video_device = SDL_GetVideoDevice(); SDL_VideoData *viddata = video_device->internal; @@ -206,11 +206,11 @@ static int KMSDRM_DumpCursorToBO(SDL_VideoDisplay *display, SDL_Cursor *cursor) /* This is only for freeing the SDL_cursor.*/ static void KMSDRM_FreeCursor(SDL_Cursor *cursor) { - KMSDRM_CursorData *curdata; + SDL_CursorData *curdata; /* Even if the cursor is not ours, free it. */ if (cursor) { - curdata = (KMSDRM_CursorData *)cursor->internal; + curdata = cursor->internal; /* Free cursor buffer */ if (curdata->buffer) { SDL_free(curdata->buffer); @@ -229,7 +229,7 @@ static void KMSDRM_FreeCursor(SDL_Cursor *cursor) in dispata) is destroyed and recreated when we recreate windows, etc. */ static SDL_Cursor *KMSDRM_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) { - KMSDRM_CursorData *curdata; + SDL_CursorData *curdata; SDL_Cursor *cursor, *ret; curdata = NULL; @@ -239,7 +239,7 @@ static SDL_Cursor *KMSDRM_CreateCursor(SDL_Surface *surface, int hot_x, int hot_ if (!cursor) { goto cleanup; } - curdata = (KMSDRM_CursorData *)SDL_calloc(1, sizeof(*curdata)); + curdata = (SDL_CursorData *)SDL_calloc(1, sizeof(*curdata)); if (!curdata) { goto cleanup; } diff --git a/src/video/kmsdrm/SDL_kmsdrmmouse.h b/src/video/kmsdrm/SDL_kmsdrmmouse.h index 69b8b4c2b0fd1..95196e273ead5 100644 --- a/src/video/kmsdrm/SDL_kmsdrmmouse.h +++ b/src/video/kmsdrm/SDL_kmsdrmmouse.h @@ -29,7 +29,7 @@ #define MAX_CURSOR_W 512 #define MAX_CURSOR_H 512 -typedef struct KMSDRM_CursorData +struct SDL_CursorData { int hot_x, hot_y; int w, h; @@ -41,7 +41,7 @@ typedef struct KMSDRM_CursorData size_t buffer_size; size_t buffer_pitch; -} KMSDRM_CursorData; +}; extern void KMSDRM_InitMouse(SDL_VideoDevice *_this, SDL_VideoDisplay *display); extern void KMSDRM_QuitMouse(SDL_VideoDevice *_this); diff --git a/src/video/raspberry/SDL_rpimouse.c b/src/video/raspberry/SDL_rpimouse.c index 52ed4203b9ba0..016deceb8c8d5 100644 --- a/src/video/raspberry/SDL_rpimouse.c +++ b/src/video/raspberry/SDL_rpimouse.c @@ -55,7 +55,7 @@ static SDL_Cursor *RPI_CreateDefaultCursor(void) /* Create a cursor from a surface */ static SDL_Cursor *RPI_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) { - RPI_CursorData *curdata; + SDL_CursorData *curdata; SDL_Cursor *cursor; int ret; VC_RECT_T dst_rect; @@ -68,7 +68,7 @@ static SDL_Cursor *RPI_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) if (!cursor) { return NULL; } - curdata = (RPI_CursorData *)SDL_calloc(1, sizeof(*curdata)); + curdata = (SDL_CursorData *)SDL_calloc(1, sizeof(*curdata)); if (!curdata) { SDL_free(cursor); return NULL; @@ -102,7 +102,7 @@ static int RPI_ShowCursor(SDL_Cursor *cursor) { int ret; DISPMANX_UPDATE_HANDLE_T update; - RPI_CursorData *curdata; + SDL_CursorData *curdata; VC_RECT_T src_rect, dst_rect; SDL_Mouse *mouse; SDL_DisplayData *data; @@ -117,7 +117,7 @@ static int RPI_ShowCursor(SDL_Cursor *cursor) if (cursor != global_cursor) { if (global_cursor) { - curdata = (RPI_CursorData *)global_cursor->internal; + curdata = global_cursor->internal; if (curdata && curdata->element > DISPMANX_NO_HANDLE) { update = vc_dispmanx_update_start(0); SDL_assert(update); @@ -135,7 +135,7 @@ static int RPI_ShowCursor(SDL_Cursor *cursor) return 0; } - curdata = (RPI_CursorData *)cursor->internal; + curdata = cursor->internal; if (!curdata) { return -1; } @@ -184,10 +184,10 @@ static void RPI_FreeCursor(SDL_Cursor *cursor) { int ret; DISPMANX_UPDATE_HANDLE_T update; - RPI_CursorData *curdata; + SDL_CursorData *curdata; if (cursor) { - curdata = (RPI_CursorData *)cursor->internal; + curdata = cursor->internal; if (curdata) { if (curdata->element != DISPMANX_NO_HANDLE) { @@ -215,7 +215,7 @@ static void RPI_FreeCursor(SDL_Cursor *cursor) static int RPI_WarpMouseGlobalGraphically(float x, float y) { - RPI_CursorData *curdata; + SDL_CursorData *curdata; DISPMANX_UPDATE_HANDLE_T update; int ret; VC_RECT_T dst_rect; @@ -226,7 +226,7 @@ static int RPI_WarpMouseGlobalGraphically(float x, float y) return 0; } - curdata = (RPI_CursorData *)mouse->cur_cursor->internal; + curdata = mouse->cur_cursor->internal; if (curdata->element == DISPMANX_NO_HANDLE) { return 0; } diff --git a/src/video/raspberry/SDL_rpimouse.h b/src/video/raspberry/SDL_rpimouse.h index d1872caa85c35..0b902b54fae19 100644 --- a/src/video/raspberry/SDL_rpimouse.h +++ b/src/video/raspberry/SDL_rpimouse.h @@ -24,8 +24,7 @@ #include "../SDL_sysvideo.h" -typedef struct _RPI_CursorData RPI_CursorData; -struct _RPI_CursorData +struct SDL_CursorData { DISPMANX_RESOURCE_HANDLE_T resource; DISPMANX_ELEMENT_HANDLE_T element; diff --git a/src/video/wayland/SDL_waylandevents_c.h b/src/video/wayland/SDL_waylandevents_c.h index d32e8cd0a4083..a65216f0c6848 100644 --- a/src/video/wayland/SDL_waylandevents_c.h +++ b/src/video/wayland/SDL_waylandevents_c.h @@ -110,7 +110,7 @@ struct SDL_WaylandInput struct zwp_input_timestamps_v1 *touch_timestamps; SDL_WindowData *pointer_focus; SDL_WindowData *keyboard_focus; - struct Wayland_CursorData *current_cursor; + SDL_CursorData *current_cursor; Uint32 keyboard_id; Uint32 pointer_id; uint32_t pointer_enter_serial; diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index 078ad471d2e0c..156e8a7ac0011 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -66,7 +66,7 @@ typedef struct SDL_SystemCursor id; } Wayland_SystemCursor; -struct Wayland_CursorData +struct SDL_CursorData { union { @@ -287,7 +287,7 @@ struct wl_callback_listener cursor_frame_listener = { static void cursor_frame_done(void *data, struct wl_callback *cb, uint32_t time) { - struct Wayland_CursorData *c = (struct Wayland_CursorData *)data; + SDL_CursorData *c = (SDL_CursorData *)data; const Uint64 now = SDL_GetTicks(); const Uint64 elapsed = (now - c->cursor_data.system.last_frame_time_ms) % c->cursor_data.system.total_duration; @@ -318,7 +318,7 @@ static void cursor_frame_done(void *data, struct wl_callback *cb, uint32_t time) wl_surface_commit(c->surface); } -static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, struct Wayland_CursorData *cdata, float *scale) +static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, SDL_CursorData *cdata, float *scale) { struct wl_cursor_theme *theme = NULL; struct wl_cursor *cursor; @@ -422,12 +422,12 @@ static SDL_Cursor *Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot if (cursor) { SDL_VideoDevice *vd = SDL_GetVideoDevice(); SDL_VideoData *wd = vd->internal; - struct Wayland_CursorData *data = SDL_calloc(1, sizeof(struct Wayland_CursorData)); + SDL_CursorData *data = SDL_calloc(1, sizeof(*data)); if (!data) { SDL_free(cursor); return NULL; } - cursor->internal = (void *)data; + cursor->internal = data; /* Allocate shared memory buffer for this cursor */ if (Wayland_AllocSHMBuffer(surface->w, surface->h, &data->cursor_data.custom) != 0) { @@ -458,12 +458,12 @@ static SDL_Cursor *Wayland_CreateSystemCursor(SDL_SystemCursor id) SDL_VideoData *data = SDL_GetVideoDevice()->internal; SDL_Cursor *cursor = SDL_calloc(1, sizeof(*cursor)); if (cursor) { - struct Wayland_CursorData *cdata = SDL_calloc(1, sizeof(struct Wayland_CursorData)); + SDL_CursorData *cdata = SDL_calloc(1, sizeof(*cdata)); if (!cdata) { SDL_free(cursor); return NULL; } - cursor->internal = (void *)cdata; + cursor->internal = cdata; /* The surface is only necessary if the cursor shape manager is not present. * @@ -487,7 +487,7 @@ static SDL_Cursor *Wayland_CreateDefaultCursor(void) return Wayland_CreateSystemCursor(SDL_SYSTEM_CURSOR_DEFAULT); } -static void Wayland_FreeCursorData(struct Wayland_CursorData *d) +static void Wayland_FreeCursorData(SDL_CursorData *d) { /* Buffers for system cursors must not be destroyed. */ if (d->is_system_cursor) { @@ -516,7 +516,7 @@ static void Wayland_FreeCursor(SDL_Cursor *cursor) return; } - Wayland_FreeCursorData((struct Wayland_CursorData *)cursor->internal); + Wayland_FreeCursorData(cursor->internal); SDL_free(cursor->internal); SDL_free(cursor); @@ -615,7 +615,7 @@ static int Wayland_ShowCursor(SDL_Cursor *cursor) } if (cursor) { - struct Wayland_CursorData *data = cursor->internal; + SDL_CursorData *data = cursor->internal; /* TODO: High-DPI custom cursors? -flibit */ if (data->is_system_cursor) { @@ -764,7 +764,7 @@ static SDL_MouseButtonFlags SDLCALL Wayland_GetGlobalMouseState(float *x, float #if 0 /* TODO RECONNECT: See waylandvideo.c for more information! */ static void Wayland_RecreateCursor(SDL_Cursor *cursor, SDL_VideoData *vdata) { - Wayland_CursorData *cdata = (Wayland_CursorData *) cursor->internal; + SDL_CursorData *cdata = cursor->internal; /* Probably not a cursor we own */ if (cdata == NULL) { diff --git a/src/video/windows/SDL_windowsmouse.c b/src/video/windows/SDL_windowsmouse.c index 8c1c1999158a4..b42024ba5b80d 100644 --- a/src/video/windows/SDL_windowsmouse.c +++ b/src/video/windows/SDL_windowsmouse.c @@ -30,20 +30,40 @@ #include "../../events/SDL_mouse_c.h" #include "../../joystick/usb_ids.h" + +struct SDL_CursorData +{ + HCURSOR cursor; +}; + DWORD SDL_last_warp_time = 0; HCURSOR SDL_cursor = NULL; static SDL_Cursor *SDL_blank_cursor = NULL; -static SDL_Cursor *WIN_CreateDefaultCursor(void) +static SDL_Cursor *WIN_CreateCursorAndData(HCURSOR hcursor) { + if (!hcursor) { + return NULL; + } + SDL_Cursor *cursor = (SDL_Cursor *)SDL_calloc(1, sizeof(*cursor)); if (cursor) { - cursor->internal = LoadCursor(NULL, IDC_ARROW); + SDL_CursorData *data = (SDL_CursorData *)SDL_calloc(1, sizeof(*data)); + if (!data) { + SDL_free(cursor); + return NULL; + } + data->cursor = hcursor; + cursor->internal = data; } - return cursor; } +static SDL_Cursor *WIN_CreateDefaultCursor(void) +{ + return WIN_CreateCursorAndData(LoadCursor(NULL, IDC_ARROW)); +} + static SDL_bool IsMonochromeSurface(SDL_Surface *surface) { int x, y; @@ -155,10 +175,9 @@ static HBITMAP CreateMaskBitmap(SDL_Surface *surface, SDL_bool is_monochrome) return bitmap; } -static SDL_Cursor *WIN_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) +static HCURSOR WIN_CreateHCursor(SDL_Surface *surface, int hot_x, int hot_y) { HCURSOR hcursor; - SDL_Cursor *cursor; ICONINFO ii; SDL_bool is_monochrome = IsMonochromeSurface(surface); @@ -184,15 +203,16 @@ static SDL_Cursor *WIN_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) WIN_SetError("CreateIconIndirect()"); return NULL; } + return hcursor; +} - cursor = (SDL_Cursor *)SDL_calloc(1, sizeof(*cursor)); - if (cursor) { - cursor->internal = hcursor; - } else { - DestroyCursor(hcursor); +static SDL_Cursor *WIN_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) +{ + HCURSOR hcursor = WIN_CreateHCursor(surface, hot_x, hot_y); + if (!hcursor) { + return NULL; } - - return cursor; + return WIN_CreateCursorAndData(hcursor); } static SDL_Cursor *WIN_CreateBlankCursor(void) @@ -208,12 +228,11 @@ static SDL_Cursor *WIN_CreateBlankCursor(void) static SDL_Cursor *WIN_CreateSystemCursor(SDL_SystemCursor id) { - SDL_Cursor *cursor; LPCTSTR name; switch (id) { default: - SDL_assert(0); + SDL_assert(!"Unknown system cursor ID"); return NULL; case SDL_SYSTEM_CURSOR_DEFAULT: name = IDC_ARROW; @@ -276,24 +295,17 @@ static SDL_Cursor *WIN_CreateSystemCursor(SDL_SystemCursor id) name = IDC_SIZEWE; break; } - - cursor = (SDL_Cursor *)SDL_calloc(1, sizeof(*cursor)); - if (cursor) { - HCURSOR hcursor; - - hcursor = LoadCursor(NULL, name); - - cursor->internal = hcursor; - } - - return cursor; + return WIN_CreateCursorAndData(LoadCursor(NULL, name)); } static void WIN_FreeCursor(SDL_Cursor *cursor) { - HCURSOR hcursor = (HCURSOR)cursor->internal; + SDL_CursorData *data = cursor->internal; - DestroyCursor(hcursor); + if (data->cursor) { + DestroyCursor(data->cursor); + } + SDL_free(data); SDL_free(cursor); } @@ -303,7 +315,7 @@ static int WIN_ShowCursor(SDL_Cursor *cursor) cursor = SDL_blank_cursor; } if (cursor) { - SDL_cursor = (HCURSOR)cursor->internal; + SDL_cursor = cursor->internal->cursor; } else { SDL_cursor = NULL; } diff --git a/src/video/winrt/SDL_winrtmouse.cpp b/src/video/winrt/SDL_winrtmouse.cpp index bb9c5dd09efdb..236bb59532f3f 100644 --- a/src/video/winrt/SDL_winrtmouse.cpp +++ b/src/video/winrt/SDL_winrtmouse.cpp @@ -125,7 +125,7 @@ static SDL_Cursor *WINRT_CreateSystemCursor(SDL_SystemCursor id) */ CoreCursor ^ *theCursor = new CoreCursor ^ (nullptr); *theCursor = ref new CoreCursor(cursorType, 0); - cursor->internal = (void *)theCursor; + cursor->internal = (SDL_CursorData *)theCursor; } return cursor; diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index 3bb88b0648921..835863b32d56d 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -29,6 +29,11 @@ #include "../SDL_video_c.h" #include "../../events/SDL_mouse_c.h" +struct SDL_CursorData +{ + Cursor cursor; +}; + /* FIXME: Find a better place to put this... */ static Cursor x11_empty_cursor = None; static SDL_bool x11_cursor_visible = SDL_TRUE; @@ -69,16 +74,27 @@ static void X11_DestroyEmptyCursor(void) } } -static SDL_Cursor *X11_CreateDefaultCursor(void) +static SDL_Cursor *X11_CreateCursorAndData(Cursor x11_cursor) { - SDL_Cursor *cursor = SDL_calloc(1, sizeof(*cursor)); + SDL_Cursor *cursor = (SDL_Cursor *)SDL_calloc(1, sizeof(*cursor)); if (cursor) { - /* None is used to indicate the default cursor */ - cursor->internal = (void *)(uintptr_t)None; + SDL_CursorData *data = (SDL_CursorData *)SDL_calloc(1, sizeof(*data)); + if (!data) { + SDL_free(cursor); + return NULL; + } + data->cursor = x11_cursor; + cursor->internal = data; } return cursor; } +static SDL_Cursor *X11_CreateDefaultCursor(void) +{ + /* None is used to indicate the default cursor */ + return X11_CreateCursorAndData(None); +} + #ifdef SDL_VIDEO_DRIVER_X11_XCURSOR static Cursor X11_CreateXCursorCursor(SDL_Surface *surface, int hot_x, int hot_y) { @@ -195,22 +211,17 @@ static Cursor X11_CreatePixmapCursor(SDL_Surface *surface, int hot_x, int hot_y) static SDL_Cursor *X11_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) { - SDL_Cursor *cursor = SDL_calloc(1, sizeof(*cursor)); - if (cursor) { - Cursor x11_cursor = None; + Cursor x11_cursor = None; #ifdef SDL_VIDEO_DRIVER_X11_XCURSOR - if (SDL_X11_HAVE_XCURSOR) { - x11_cursor = X11_CreateXCursorCursor(surface, hot_x, hot_y); - } + if (SDL_X11_HAVE_XCURSOR) { + x11_cursor = X11_CreateXCursorCursor(surface, hot_x, hot_y); + } #endif - if (x11_cursor == None) { - x11_cursor = X11_CreatePixmapCursor(surface, hot_x, hot_y); - } - cursor->internal = (void *)(uintptr_t)x11_cursor; + if (x11_cursor == None) { + x11_cursor = X11_CreatePixmapCursor(surface, hot_x, hot_y); } - - return cursor; + return X11_CreateCursorAndData(x11_cursor); } static unsigned int GetLegacySystemCursorShape(SDL_SystemCursor id) @@ -262,10 +273,7 @@ static SDL_Cursor *X11_CreateSystemCursor(SDL_SystemCursor id) } if (x11_cursor != None) { - cursor = SDL_calloc(1, sizeof(*cursor)); - if (cursor) { - cursor->internal = (void *)(uintptr_t)x11_cursor; - } + cursor = X11_CreateCursorAndData(x11_cursor); } return cursor; @@ -273,11 +281,12 @@ static SDL_Cursor *X11_CreateSystemCursor(SDL_SystemCursor id) static void X11_FreeCursor(SDL_Cursor *cursor) { - Cursor x11_cursor = (Cursor)cursor->internal; + Cursor x11_cursor = cursor->internal->cursor; if (x11_cursor != None) { X11_XFreeCursor(GetDisplay(), x11_cursor); } + SDL_free(cursor->internal); SDL_free(cursor); } @@ -286,7 +295,7 @@ static int X11_ShowCursor(SDL_Cursor *cursor) Cursor x11_cursor = 0; if (cursor) { - x11_cursor = (Cursor)cursor->internal; + x11_cursor = cursor->internal->cursor; } else { x11_cursor = X11_CreateEmptyCursor(); } From b8dc97c57772db9926bc3702b7aba8b5fefe2969 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 31 Jul 2024 09:57:02 -0700 Subject: [PATCH 107/253] Use SDL_PremultiplySurfaceAlpha() when creating NSImages --- src/video/cocoa/SDL_cocoavideo.m | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index edeca11a5732e..5013d23c7468a 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/src/video/cocoa/SDL_cocoavideo.m @@ -253,7 +253,6 @@ SDL_SystemTheme Cocoa_GetSystemTheme(void) SDL_Surface *converted; NSBitmapImageRep *imgrep; Uint8 *pixels; - int i; NSImage *img; converted = SDL_ConvertSurface(surface, SDL_PIXELFORMAT_RGBA32); @@ -261,6 +260,9 @@ SDL_SystemTheme Cocoa_GetSystemTheme(void) return nil; } + /* Premultiply the alpha channel */ + SDL_PremultiplySurfaceAlpha(converted, SDL_FALSE); + imgrep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:converted->w pixelsHigh:converted->h @@ -281,15 +283,6 @@ SDL_SystemTheme Cocoa_GetSystemTheme(void) SDL_memcpy(pixels, converted->pixels, (size_t)converted->h * converted->pitch); SDL_DestroySurface(converted); - /* Premultiply the alpha channel */ - for (i = (surface->h * surface->w); i--;) { - Uint8 alpha = pixels[3]; - pixels[0] = (Uint8)(((Uint16)pixels[0] * alpha) / 255); - pixels[1] = (Uint8)(((Uint16)pixels[1] * alpha) / 255); - pixels[2] = (Uint8)(((Uint16)pixels[2] * alpha) / 255); - pixels += 4; - } - img = [[NSImage alloc] initWithSize:NSMakeSize(surface->w, surface->h)]; if (img != nil) { [img addRepresentation:imgrep]; From 94d9229ce2158c96d0ba1c46feacaf3327ebbddd Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 31 Jul 2024 21:39:37 -0700 Subject: [PATCH 108/253] Added SDL_AddSurfaceAlternateImage(), SDL_SurfaceHasAlternateImages(), SDL_GetSurfaceImages() and SDL_RemoveSurfaceAlternateImages() These functions allow you to create surfaces with alternate high DPI content, and will be used for high DPI icon and cursor support. --- include/SDL3/SDL_surface.h | 76 ++++++++++++++++++ src/dynapi/SDL_dynapi.sym | 4 + src/dynapi/SDL_dynapi_overrides.h | 4 + src/dynapi/SDL_dynapi_procs.h | 4 + src/video/SDL_surface.c | 129 ++++++++++++++++++++++++++++++ src/video/SDL_surface_c.h | 5 ++ 6 files changed, 222 insertions(+) diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index 6bde401785f6e..d7342a4f78f02 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -306,6 +306,76 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL_ */ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_GetSurfacePalette(SDL_Surface *surface); +/** + * Add an alternate version of a surface. + * + * This function adds an alternate version of this surface, usually used for content with high DPI representations like cursors or icons. The size, format, and content do not need to match the original surface, and these alternate versions will not be updated when the original surface changes. + * + * This function adds a reference to the alternate version, so you should call SDL_DestroySurface() on the image after this call. + * + * \param surface the SDL_Surface structure to update. + * \param image a pointer to an alternate SDL_Surface to associate with this surface. + * \returns SDL_TRUE if alternate versions are available or SDL_TRUE otherwise. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_RemoveSurfaceAlternateImages + * \sa SDL_GetSurfaceImages + * \sa SDL_SurfaceHasAlternateImages + */ +extern SDL_DECLSPEC int SDLCALL SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image); + +/** + * Return whether a surface has alternate versions available. + * + * \param surface the SDL_Surface structure to query. + * \returns SDL_TRUE if alternate versions are available or SDL_TRUE otherwise. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_AddSurfaceAlternateImage + * \sa SDL_RemoveSurfaceAlternateImages + * \sa SDL_GetSurfaceImages + */ +extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasAlternateImages(SDL_Surface *surface); + +/** + * Get an array including all versions of a surface. + * + * This returns all versions of a surface, with the surface being queried as the first element in the returned array. + * + * Freeing the array of surfaces does not affect the surfaces in the array. They are still referenced by the surface being queried and will be cleaned up normally. + * + * \param surface the SDL_Surface structure to query. + * \param count a pointer filled in with the number of surface pointers returned, may + * be NULL. + * \returns a NULL terminated array of SDL_Surface pointers or NULL on failure; + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_AddSurfaceAlternateImage + * \sa SDL_RemoveSurfaceAlternateImages + * \sa SDL_SurfaceHasAlternateImages + */ +extern SDL_DECLSPEC SDL_Surface ** SDLCALL SDL_GetSurfaceImages(SDL_Surface *surface, int *count); + +/** + * Remove all alternate versions of a surface. + * + * This function removes a reference from all the alternative versions, destroying them if this is the last reference to them. + * + * \param surface the SDL_Surface structure to update. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_AddSurfaceAlternateImage + * \sa SDL_GetSurfaceImages + * \sa SDL_SurfaceHasAlternateImages + */ +extern SDL_DECLSPEC void SDLCALL SDL_RemoveSurfaceAlternateImages(SDL_Surface *surface); + /** * Set up a surface for directly accessing the pixels. * @@ -679,6 +749,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMo /** * Creates a new surface identical to the existing surface. * + * If the original surface has alternate images, the new surface will have a reference to them as well. + * * The returned surface should be freed with SDL_DestroySurface(). * * \param surface the surface to duplicate. @@ -720,6 +792,8 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ScaleSurface(SDL_Surface *surface, * If you are converting to an indexed surface and want to map colors to a * palette, you can use SDL_ConvertSurfaceAndColorspace() instead. * + * If the original surface has alternate images, the new surface will have a reference to them as well. + * * \param surface the existing SDL_Surface structure to convert. * \param format the new pixel format. * \returns the new SDL_Surface structure that is created or NULL on failure; @@ -740,6 +814,8 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface(SDL_Surface *surfac * and returns the new surface. This will perform any pixel format and * colorspace conversion needed. * + * If the original surface has alternate images, the new surface will have a reference to them as well. + * * \param surface the existing SDL_Surface structure to convert. * \param format the new pixel format. * \param palette an optional palette to use for indexed formats, may be NULL. diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 49a9f25843dc6..bf7a2276b3153 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -8,6 +8,7 @@ SDL3_0.0.0 { SDL_AddGamepadMappingsFromFile; SDL_AddGamepadMappingsFromIO; SDL_AddHintCallback; + SDL_AddSurfaceAlternateImage; SDL_AddTimer; SDL_AddTimerNS; SDL_AddVulkanRenderSemaphores; @@ -438,6 +439,7 @@ SDL3_0.0.0 { SDL_GetSurfaceColorKey; SDL_GetSurfaceColorMod; SDL_GetSurfaceColorspace; + SDL_GetSurfaceImages; SDL_GetSurfacePalette; SDL_GetSurfaceProperties; SDL_GetSystemRAM; @@ -644,6 +646,7 @@ SDL3_0.0.0 { SDL_ReloadGamepadMappings; SDL_RemovePath; SDL_RemoveStoragePath; + SDL_RemoveSurfaceAlternateImages; SDL_RemoveTimer; SDL_RenamePath; SDL_RenameStoragePath; @@ -820,6 +823,7 @@ SDL3_0.0.0 { SDL_StopTextInput; SDL_StorageReady; SDL_StringToGUID; + SDL_SurfaceHasAlternateImages; SDL_SurfaceHasColorKey; SDL_SurfaceHasRLE; SDL_SyncWindow; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index b1e0dce8e1c75..96d40eaa36afc 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -33,6 +33,7 @@ #define SDL_AddGamepadMappingsFromFile SDL_AddGamepadMappingsFromFile_REAL #define SDL_AddGamepadMappingsFromIO SDL_AddGamepadMappingsFromIO_REAL #define SDL_AddHintCallback SDL_AddHintCallback_REAL +#define SDL_AddSurfaceAlternateImage SDL_AddSurfaceAlternateImage_REAL #define SDL_AddTimer SDL_AddTimer_REAL #define SDL_AddTimerNS SDL_AddTimerNS_REAL #define SDL_AddVulkanRenderSemaphores SDL_AddVulkanRenderSemaphores_REAL @@ -463,6 +464,7 @@ #define SDL_GetSurfaceColorKey SDL_GetSurfaceColorKey_REAL #define SDL_GetSurfaceColorMod SDL_GetSurfaceColorMod_REAL #define SDL_GetSurfaceColorspace SDL_GetSurfaceColorspace_REAL +#define SDL_GetSurfaceImages SDL_GetSurfaceImages_REAL #define SDL_GetSurfacePalette SDL_GetSurfacePalette_REAL #define SDL_GetSurfaceProperties SDL_GetSurfaceProperties_REAL #define SDL_GetSystemRAM SDL_GetSystemRAM_REAL @@ -669,6 +671,7 @@ #define SDL_ReloadGamepadMappings SDL_ReloadGamepadMappings_REAL #define SDL_RemovePath SDL_RemovePath_REAL #define SDL_RemoveStoragePath SDL_RemoveStoragePath_REAL +#define SDL_RemoveSurfaceAlternateImages SDL_RemoveSurfaceAlternateImages_REAL #define SDL_RemoveTimer SDL_RemoveTimer_REAL #define SDL_RenamePath SDL_RenamePath_REAL #define SDL_RenameStoragePath SDL_RenameStoragePath_REAL @@ -845,6 +848,7 @@ #define SDL_StopTextInput SDL_StopTextInput_REAL #define SDL_StorageReady SDL_StorageReady_REAL #define SDL_StringToGUID SDL_StringToGUID_REAL +#define SDL_SurfaceHasAlternateImages SDL_SurfaceHasAlternateImages_REAL #define SDL_SurfaceHasColorKey SDL_SurfaceHasColorKey_REAL #define SDL_SurfaceHasRLE SDL_SurfaceHasRLE_REAL #define SDL_SyncWindow SDL_SyncWindow_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index be11aa8eb642d..749af3ce25ff2 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -53,6 +53,7 @@ SDL_DYNAPI_PROC(int,SDL_AddGamepadMapping,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_AddGamepadMappingsFromFile,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_AddGamepadMappingsFromIO,(SDL_IOStream *a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_AddHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_AddSurfaceAlternateImage,(SDL_Surface *a, SDL_Surface *b),(a,b),return) SDL_DYNAPI_PROC(SDL_TimerID,SDL_AddTimer,(Uint32 a, SDL_TimerCallback b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_TimerID,SDL_AddTimerNS,(Uint64 a, SDL_NSTimerCallback b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_AddVulkanRenderSemaphores,(SDL_Renderer *a, Uint32 b, Sint64 c, Sint64 d),(a,b,c,d),return) @@ -483,6 +484,7 @@ SDL_DYNAPI_PROC(int,SDL_GetSurfaceClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),r SDL_DYNAPI_PROC(int,SDL_GetSurfaceColorKey,(SDL_Surface *a, Uint32 *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetSurfaceColorMod,(SDL_Surface *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_Colorspace,SDL_GetSurfaceColorspace,(SDL_Surface *a),(a),return) +SDL_DYNAPI_PROC(SDL_Surface**,SDL_GetSurfaceImages,(SDL_Surface *a, int *b),(a,b),return) SDL_DYNAPI_PROC(SDL_Palette*,SDL_GetSurfacePalette,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetSurfaceProperties,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetSystemRAM,(void),(),return) @@ -680,6 +682,7 @@ SDL_DYNAPI_PROC(int,SDL_ReleaseCameraFrame,(SDL_Camera *a, SDL_Surface *b),(a,b) SDL_DYNAPI_PROC(int,SDL_ReloadGamepadMappings,(void),(),return) SDL_DYNAPI_PROC(int,SDL_RemovePath,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_RemoveStoragePath,(SDL_Storage *a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(void,SDL_RemoveSurfaceAlternateImages,(SDL_Surface *a),(a),) SDL_DYNAPI_PROC(int,SDL_RemoveTimer,(SDL_TimerID a),(a),return) SDL_DYNAPI_PROC(int,SDL_RenamePath,(const char *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_RenameStoragePath,(SDL_Storage *a, const char *b, const char *c),(a,b,c),return) @@ -855,6 +858,7 @@ SDL_DYNAPI_PROC(int,SDL_StopHapticRumble,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_StopTextInput,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_StorageReady,(SDL_Storage *a),(a),return) SDL_DYNAPI_PROC(SDL_GUID,SDL_StringToGUID,(const char *a),(a),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasAlternateImages,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasColorKey,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasRLE,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SyncWindow,(SDL_Window *a),(a),return) diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 7f83fd6fa3079..5aeead4627ca8 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -436,6 +436,126 @@ SDL_Palette *SDL_GetSurfacePalette(SDL_Surface *surface) return surface->internal->palette; } +int SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image) +{ + if (!SDL_SurfaceValid(surface)) { + return SDL_InvalidParamError("surface"); + } + + if (!SDL_SurfaceValid(image)) { + return SDL_InvalidParamError("image"); + } + + SDL_Surface **images = (SDL_Surface **)SDL_realloc(surface->internal->images, (surface->internal->num_images + 1) * sizeof(*images)); + if (!images) { + return -1; + } + images[surface->internal->num_images] = image; + surface->internal->images = images; + ++surface->internal->num_images; + ++image->refcount; + return 0; +} + +SDL_bool SDL_SurfaceHasAlternateImages(SDL_Surface *surface) +{ + if (!SDL_SurfaceValid(surface)) { + return SDL_FALSE; + } + + return (surface->internal->num_images > 0); +} + +SDL_Surface **SDL_GetSurfaceImages(SDL_Surface *surface, int *count) +{ + if (count) { + *count = 0; + } + + if (!SDL_SurfaceValid(surface)) { + SDL_InvalidParamError("surface"); + return NULL; + } + + int num_images = 1 + surface->internal->num_images; + SDL_Surface **images = (SDL_Surface **)SDL_malloc((num_images + 1) * sizeof(*images)); + if (!images) { + return NULL; + } + images[0] = surface; + if (surface->internal->num_images > 0) { + SDL_memcpy(&images[1], surface->internal->images, (surface->internal->num_images * sizeof(images[1]))); + } + images[num_images] = NULL; + + if (count) { + *count = num_images; + } + return images; +} + +SDL_Surface *SDL_GetSurfaceImage(SDL_Surface *surface, float display_scale) +{ + if (!SDL_SurfaceValid(surface)) { + SDL_InvalidParamError("surface"); + return NULL; + } + + if (!SDL_SurfaceHasAlternateImages(surface)) { + ++surface->refcount; + return surface; + } + + // This surface has high DPI images, pick the best one available, or scale one to the correct size + SDL_Surface **images = SDL_GetSurfaceImages(surface, NULL); + if (!images) { + // Failure, fall back to the existing surface + ++surface->refcount; + return surface; + } + + SDL_Surface *closest = NULL; + int desired_w = (int)SDL_round(surface->w * display_scale); + int desired_h = (int)SDL_round(surface->h * display_scale); + int closest_distance = -1; + for (int i = 0; images[i]; ++i) { + SDL_Surface *candidate = images[i]; + int delta_w = (candidate->w - desired_w); + int delta_h = (candidate->h - desired_h); + int distance = (delta_w * delta_w) + (delta_h * delta_h); + if (closest_distance < 0 || distance < closest_distance) { + closest = candidate; + closest_distance = distance; + } + } + SDL_free(images); + SDL_assert(closest != NULL); // We should always have at least one surface + + if (closest->w == desired_w && closest->h == desired_h) { + ++closest->refcount; + return closest; + } + + // We need to scale an image to the correct size + return SDL_ScaleSurface(closest, desired_w, desired_h, SDL_SCALEMODE_LINEAR); +} + +void SDL_RemoveSurfaceAlternateImages(SDL_Surface *surface) +{ + if (!SDL_SurfaceValid(surface)) { + return; + } + + if (surface->internal->num_images > 0) { + for (int i = 0; i < surface->internal->num_images; ++i) { + SDL_DestroySurface(surface->internal->images[i]); + } + SDL_free(surface->internal->images); + surface->internal->images = NULL; + surface->internal->num_images = 0; + } +} + int SDL_SetSurfaceRLE(SDL_Surface *surface, SDL_bool enabled) { int flags; @@ -1945,6 +2065,13 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm SDL_SetSurfaceRLE(convert, SDL_TRUE); } + /* Copy alternate images */ + for (int i = 0; i < surface->internal->num_images; ++i) { + if (SDL_AddSurfaceAlternateImage(convert, surface->internal->images[i]) < 0) { + goto error; + } + } + /* We're ready to go! */ return convert; @@ -2788,6 +2915,8 @@ void SDL_DestroySurface(SDL_Surface *surface) return; } + SDL_RemoveSurfaceAlternateImages(surface); + SDL_DestroyProperties(surface->internal->props); SDL_InvalidateMap(&surface->internal->map); diff --git a/src/video/SDL_surface_c.h b/src/video/SDL_surface_c.h index 7aa23703abf7e..db3c8060a6846 100644 --- a/src/video/SDL_surface_c.h +++ b/src/video/SDL_surface_c.h @@ -52,6 +52,10 @@ struct SDL_SurfaceData /** palette for indexed surfaces */ SDL_Palette *palette; + /** Alternate representation of images */ + int num_images; + SDL_Surface **images; + /** information needed for surfaces requiring locks */ int locked; @@ -76,6 +80,7 @@ extern float SDL_GetDefaultSDRWhitePoint(SDL_Colorspace colorspace); extern float SDL_GetSurfaceSDRWhitePoint(SDL_Surface *surface, SDL_Colorspace colorspace); extern float SDL_GetDefaultHDRHeadroom(SDL_Colorspace colorspace); extern float SDL_GetSurfaceHDRHeadroom(SDL_Surface *surface, SDL_Colorspace colorspace); +extern SDL_Surface *SDL_GetSurfaceImage(SDL_Surface *surface, float display_scale); extern int SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode); #endif /* SDL_surface_c_h_ */ From 31ed3665adcbba20d3d0eecb7259ccbc3bc1c31f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 1 Aug 2024 11:38:17 -0700 Subject: [PATCH 109/253] Added support for high-DPI cursors and icons Fixes https://github.com/libsdl-org/SDL/issues/9838 --- include/SDL3/SDL_mouse.h | 2 + include/SDL3/SDL_video.h | 2 + src/video/cocoa/SDL_cocoavideo.m | 63 ++++++++------- src/video/windows/SDL_windowsmouse.c | 111 +++++++++++++++++++++++++-- test/icon2x.bmp | Bin 0 -> 2198 bytes test/testcustomcursor.c | 52 +++++++++++-- 6 files changed, 194 insertions(+), 36 deletions(-) create mode 100644 test/icon2x.bmp diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index 185757aee9a4f..d8489bcb86429 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -413,6 +413,8 @@ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor(const Uint8 * data, /** * Create a color cursor. * + * If this function is passed a surface with alternate representations, the surface will be interpreted as the content to be used for 100% display scale, and the alternate representations will be used for high DPI situations. For example, if the original surface is 32x32, then on a 2x macOS display or 200% display scale on Windows, a 64x64 version of the image will be used, if available. If a matching version of the image isn't available, the closest size image will be scaled to the appropriate size and be used instead. + * * \param surface an SDL_Surface structure representing the cursor image. * \param hot_x the x position of the cursor hot spot. * \param hot_y the y position of the cursor hot spot. diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index 387f911404e5e..c73f5b72c89cf 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -1334,6 +1334,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetWindowTitle(SDL_Window *window); /** * Set the icon for a window. * + * If this function is passed a surface with alternate representations, the surface will be interpreted as the content to be used for 100% display scale, and the alternate representations will be used for high DPI situations. For example, if the original surface is 32x32, then on a 2x macOS display or 200% display scale on Windows, a 64x64 version of the image will be used, if available. If a matching version of the image isn't available, the closest size image will be scaled to the appropriate size and be used instead. + * * \param window the window to change. * \param icon an SDL_Surface structure containing the icon for the window. * \returns 0 on success or a negative error code on failure; call diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index 5013d23c7468a..7b1aecc2f413d 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/src/video/cocoa/SDL_cocoavideo.m @@ -250,43 +250,54 @@ SDL_SystemTheme Cocoa_GetSystemTheme(void) /* This function assumes that it's called from within an autorelease pool */ NSImage *Cocoa_CreateImage(SDL_Surface *surface) { - SDL_Surface *converted; - NSBitmapImageRep *imgrep; - Uint8 *pixels; NSImage *img; - converted = SDL_ConvertSurface(surface, SDL_PIXELFORMAT_RGBA32); - if (!converted) { + img = [[NSImage alloc] initWithSize:NSMakeSize(surface->w, surface->h)]; + if (img == nil) { return nil; } - /* Premultiply the alpha channel */ - SDL_PremultiplySurfaceAlpha(converted, SDL_FALSE); - - imgrep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL - pixelsWide:converted->w - pixelsHigh:converted->h - bitsPerSample:8 - samplesPerPixel:4 - hasAlpha:YES - isPlanar:NO - colorSpaceName:NSDeviceRGBColorSpace - bytesPerRow:converted->pitch - bitsPerPixel:SDL_BITSPERPIXEL(converted->format)]; - if (imgrep == nil) { - SDL_DestroySurface(converted); + SDL_Surface **images = SDL_GetSurfaceImages(surface, NULL); + if (!images) { return nil; } - /* Copy the pixels */ - pixels = [imgrep bitmapData]; - SDL_memcpy(pixels, converted->pixels, (size_t)converted->h * converted->pitch); - SDL_DestroySurface(converted); + for (int i = 0; images[i]; ++i) { + SDL_Surface *converted = SDL_ConvertSurface(images[i], SDL_PIXELFORMAT_RGBA32); + if (!converted) { + SDL_free(images); + return nil; + } - img = [[NSImage alloc] initWithSize:NSMakeSize(surface->w, surface->h)]; - if (img != nil) { + /* Premultiply the alpha channel */ + SDL_PremultiplySurfaceAlpha(converted, SDL_FALSE); + + NSBitmapImageRep *imgrep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL + pixelsWide:converted->w + pixelsHigh:converted->h + bitsPerSample:8 + samplesPerPixel:4 + hasAlpha:YES + isPlanar:NO + colorSpaceName:NSDeviceRGBColorSpace + bytesPerRow:converted->pitch + bitsPerPixel:SDL_BITSPERPIXEL(converted->format)]; + if (imgrep == nil) { + SDL_free(images); + SDL_DestroySurface(converted); + return nil; + } + + /* Copy the pixels */ + Uint8 *pixels = [imgrep bitmapData]; + SDL_memcpy(pixels, converted->pixels, (size_t)converted->h * converted->pitch); + SDL_DestroySurface(converted); + + /* Add the image representation */ [img addRepresentation:imgrep]; } + SDL_free(images); + return img; } diff --git a/src/video/windows/SDL_windowsmouse.c b/src/video/windows/SDL_windowsmouse.c index b42024ba5b80d..b9f177a970be1 100644 --- a/src/video/windows/SDL_windowsmouse.c +++ b/src/video/windows/SDL_windowsmouse.c @@ -27,12 +27,24 @@ #include "SDL_windowsrawinput.h" #include "../SDL_video_c.h" +#include "../SDL_blit.h" #include "../../events/SDL_mouse_c.h" #include "../../joystick/usb_ids.h" +typedef struct CachedCursor +{ + float scale; + HCURSOR cursor; + struct CachedCursor *next; +} CachedCursor; + struct SDL_CursorData { + SDL_Surface *surface; + int hot_x; + int hot_y; + CachedCursor *cache; HCURSOR cursor; }; @@ -189,6 +201,7 @@ static HCURSOR WIN_CreateHCursor(SDL_Surface *surface, int hot_x, int hot_y) ii.hbmColor = is_monochrome ? NULL : CreateColorBitmap(surface); if (!ii.hbmMask || (!is_monochrome && !ii.hbmColor)) { + SDL_SetError("Couldn't create cursor bitmaps"); return NULL; } @@ -208,11 +221,29 @@ static HCURSOR WIN_CreateHCursor(SDL_Surface *surface, int hot_x, int hot_y) static SDL_Cursor *WIN_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) { - HCURSOR hcursor = WIN_CreateHCursor(surface, hot_x, hot_y); - if (!hcursor) { - return NULL; + if (!SDL_SurfaceHasAlternateImages(surface)) { + HCURSOR hcursor = WIN_CreateHCursor(surface, hot_x, hot_y); + if (!hcursor) { + return NULL; + } + return WIN_CreateCursorAndData(hcursor); + } + + // Dynamically generate cursors at the appropriate DPI + SDL_Cursor *cursor = (SDL_Cursor *)SDL_calloc(1, sizeof(*cursor)); + if (cursor) { + SDL_CursorData *data = (SDL_CursorData *)SDL_calloc(1, sizeof(*data)); + if (!data) { + SDL_free(cursor); + return NULL; + } + data->hot_x = hot_x; + data->hot_y = hot_y; + data->surface = surface; + ++surface->refcount; + cursor->internal = data; } - return WIN_CreateCursorAndData(hcursor); + return cursor; } static SDL_Cursor *WIN_CreateBlankCursor(void) @@ -302,6 +333,15 @@ static void WIN_FreeCursor(SDL_Cursor *cursor) { SDL_CursorData *data = cursor->internal; + if (data->surface) { + SDL_DestroySurface(data->surface); + } + while (data->cache) { + CachedCursor *entry = data->cache; + data->cache = entry->next; + DestroyCursor(entry->cursor); + SDL_free(entry); + } if (data->cursor) { DestroyCursor(data->cursor); } @@ -309,13 +349,74 @@ static void WIN_FreeCursor(SDL_Cursor *cursor) SDL_free(cursor); } +static HCURSOR GetCachedCursor(SDL_Cursor *cursor) +{ + SDL_CursorData *data = cursor->internal; + + SDL_Window *focus = SDL_GetMouseFocus(); + if (!focus) { + return NULL; + } + + float scale = SDL_GetDisplayContentScale(SDL_GetDisplayForWindow(focus)); + for (CachedCursor *entry = data->cache; entry; entry = entry->next) { + if (scale == entry->scale) { + return entry->cursor; + } + } + + // Need to create a cursor for this content scale + SDL_Surface *surface = NULL; + HCURSOR hcursor = NULL; + CachedCursor *entry = NULL; + + surface = SDL_GetSurfaceImage(data->surface, scale); + if (!surface) { + goto error; + } + + int hot_x = (int)SDL_round(data->hot_x * scale); + int hot_y = (int)SDL_round(data->hot_x * scale); + hcursor = WIN_CreateHCursor(surface, hot_x, hot_y); + if (!hcursor) { + goto error; + } + + entry = (CachedCursor *)SDL_malloc(sizeof(*entry)); + if (!entry) { + goto error; + } + entry->cursor = hcursor; + entry->scale = scale; + entry->next = data->cache; + data->cache = entry; + + SDL_DestroySurface(surface); + + return hcursor; + +error: + if (surface) { + SDL_DestroySurface(surface); + } + if (hcursor) { + DestroyCursor(hcursor); + } + SDL_free(entry); + return NULL; +} + static int WIN_ShowCursor(SDL_Cursor *cursor) { if (!cursor) { cursor = SDL_blank_cursor; } if (cursor) { - SDL_cursor = cursor->internal->cursor; + if (cursor->internal->surface) { + SDL_cursor = GetCachedCursor(cursor); + } else { + SDL_cursor = cursor->internal->cursor; + } } else { SDL_cursor = NULL; } diff --git a/test/icon2x.bmp b/test/icon2x.bmp new file mode 100644 index 0000000000000000000000000000000000000000..21e71860ee2d877652926d09bc1b258619d1ec7e GIT binary patch literal 2198 zcmeH{I}XAy3_#6iKw`=jI0@>)#KJw8x^j+Qx7cx9JD)b8hyj7s#7>_-aZ<5%6~)_dcHX`A?tBjzL#&8wfEU68qhSmw^1f;d;o zP~jBK1<1$~R5)VU9u>+GRCt672`Zei_D^fuLIamz(P_NA7i~GF&&4>jbG;JSM|BZP1d?_zo6T>518t5e$zfQanrhQL(6mg66YOTkEnbhLBi7n mDX#L^Aq!7-P~f1S=Bob>9v9sJi9I=MGo9zw_ium42|NK=kY67F literal 0 HcmV?d00001 diff --git a/test/testcustomcursor.c b/test/testcustomcursor.c index 6a4910fa83afb..79cb20cca1328 100644 --- a/test/testcustomcursor.c +++ b/test/testcustomcursor.c @@ -109,10 +109,8 @@ static const char *cross[] = { "0,0" }; -static SDL_Cursor * -init_color_cursor(const char *file) +static SDL_Surface *load_image_file(const char *file) { - SDL_Cursor *cursor = NULL; SDL_Surface *surface = SDL_LoadBMP(file); if (surface) { if (SDL_GetSurfacePalette(surface)) { @@ -138,14 +136,50 @@ init_color_cursor(const char *file) break; } } + } + return surface; +} + +static SDL_Surface *load_image(const char *file) +{ + SDL_Surface *surface = load_image_file(file); + if (surface) { + /* Add a 2x version of this image, if available */ + SDL_Surface *surface2x = NULL; + const char *ext = SDL_strrchr(file, '.'); + size_t len = SDL_strlen(file) + 2 + 1; + char *file2x = (char *)SDL_malloc(len); + if (file2x) { + SDL_strlcpy(file2x, file, len); + if (ext) { + SDL_memcpy(file2x + (ext - file), "2x", 3); + SDL_strlcat(file2x, ext, len); + } else { + SDL_strlcat(file2x, "2x", len); + } + surface2x = load_image_file(file2x); + SDL_free(file2x); + } + if (surface2x) { + SDL_AddSurfaceAlternateImage(surface, surface2x); + SDL_DestroySurface(surface2x); + } + } + return surface; +} + +static SDL_Cursor *init_color_cursor(const char *file) +{ + SDL_Cursor *cursor = NULL; + SDL_Surface *surface = load_image(file); + if (surface) { cursor = SDL_CreateColorCursor(surface, 0, 0); SDL_DestroySurface(surface); } return cursor; } -static SDL_Cursor * -init_system_cursor(const char *image[]) +static SDL_Cursor *init_system_cursor(const char *image[]) { int i, row, col; Uint8 data[4 * 32]; @@ -373,6 +407,14 @@ int main(int argc, char *argv[]) num_cursors = 0; if (color_cursor) { + SDL_Surface *icon = load_image(color_cursor); + if (icon) { + for (i = 0; i < state->num_windows; ++i) { + SDL_SetWindowIcon(state->windows[i], icon); + } + SDL_DestroySurface(icon); + } + cursor = init_color_cursor(color_cursor); if (cursor) { cursors[num_cursors] = cursor; From f01d4278c66e065e64bc934cd01e4f2952f613d7 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Thu, 1 Aug 2024 20:49:00 +0000 Subject: [PATCH 110/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_mouse.h | 9 ++++++- include/SDL3/SDL_surface.h | 49 +++++++++++++++++++++++++------------- include/SDL3/SDL_video.h | 9 ++++++- 3 files changed, 48 insertions(+), 19 deletions(-) diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index d8489bcb86429..4284eccca141c 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -413,7 +413,14 @@ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor(const Uint8 * data, /** * Create a color cursor. * - * If this function is passed a surface with alternate representations, the surface will be interpreted as the content to be used for 100% display scale, and the alternate representations will be used for high DPI situations. For example, if the original surface is 32x32, then on a 2x macOS display or 200% display scale on Windows, a 64x64 version of the image will be used, if available. If a matching version of the image isn't available, the closest size image will be scaled to the appropriate size and be used instead. + * If this function is passed a surface with alternate representations, the + * surface will be interpreted as the content to be used for 100% display + * scale, and the alternate representations will be used for high DPI + * situations. For example, if the original surface is 32x32, then on a 2x + * macOS display or 200% display scale on Windows, a 64x64 version of the + * image will be used, if available. If a matching version of the image isn't + * available, the closest size image will be scaled to the appropriate size + * and be used instead. * * \param surface an SDL_Surface structure representing the cursor image. * \param hot_x the x position of the cursor hot spot. diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index d7342a4f78f02..57745ac0f90b2 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -309,13 +309,19 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_GetSurfacePalette(SDL_Surface *sur /** * Add an alternate version of a surface. * - * This function adds an alternate version of this surface, usually used for content with high DPI representations like cursors or icons. The size, format, and content do not need to match the original surface, and these alternate versions will not be updated when the original surface changes. + * This function adds an alternate version of this surface, usually used for + * content with high DPI representations like cursors or icons. The size, + * format, and content do not need to match the original surface, and these + * alternate versions will not be updated when the original surface changes. * - * This function adds a reference to the alternate version, so you should call SDL_DestroySurface() on the image after this call. + * This function adds a reference to the alternate version, so you should call + * SDL_DestroySurface() on the image after this call. * * \param surface the SDL_Surface structure to update. - * \param image a pointer to an alternate SDL_Surface to associate with this surface. - * \returns SDL_TRUE if alternate versions are available or SDL_TRUE otherwise. + * \param image a pointer to an alternate SDL_Surface to associate with this + * surface. + * \returns SDL_TRUE if alternate versions are available or SDL_TRUE + * otherwise. * * \since This function is available since SDL 3.0.0. * @@ -329,7 +335,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddSurfaceAlternateImage(SDL_Surface *surfac * Return whether a surface has alternate versions available. * * \param surface the SDL_Surface structure to query. - * \returns SDL_TRUE if alternate versions are available or SDL_TRUE otherwise. + * \returns SDL_TRUE if alternate versions are available or SDL_TRUE + * otherwise. * * \since This function is available since SDL 3.0.0. * @@ -342,16 +349,19 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasAlternateImages(SDL_Surface * /** * Get an array including all versions of a surface. * - * This returns all versions of a surface, with the surface being queried as the first element in the returned array. + * This returns all versions of a surface, with the surface being queried as + * the first element in the returned array. * - * Freeing the array of surfaces does not affect the surfaces in the array. They are still referenced by the surface being queried and will be cleaned up normally. + * Freeing the array of surfaces does not affect the surfaces in the array. + * They are still referenced by the surface being queried and will be cleaned + * up normally. * * \param surface the SDL_Surface structure to query. - * \param count a pointer filled in with the number of surface pointers returned, may - * be NULL. - * \returns a NULL terminated array of SDL_Surface pointers or NULL on failure; - * call SDL_GetError() for more information. This should be freed - * with SDL_free() when it is no longer needed. + * \param count a pointer filled in with the number of surface pointers + * returned, may be NULL. + * \returns a NULL terminated array of SDL_Surface pointers or NULL on + * failure; call SDL_GetError() for more information. This should be + * freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * @@ -364,7 +374,8 @@ extern SDL_DECLSPEC SDL_Surface ** SDLCALL SDL_GetSurfaceImages(SDL_Surface *sur /** * Remove all alternate versions of a surface. * - * This function removes a reference from all the alternative versions, destroying them if this is the last reference to them. + * This function removes a reference from all the alternative versions, + * destroying them if this is the last reference to them. * * \param surface the SDL_Surface structure to update. * @@ -749,7 +760,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMo /** * Creates a new surface identical to the existing surface. * - * If the original surface has alternate images, the new surface will have a reference to them as well. + * If the original surface has alternate images, the new surface will have a + * reference to them as well. * * The returned surface should be freed with SDL_DestroySurface(). * @@ -764,7 +776,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMo extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_DuplicateSurface(SDL_Surface *surface); /** - * Creates a new surface identical to the existing surface, scaled to the desired size. + * Creates a new surface identical to the existing surface, scaled to the + * desired size. * * The returned surface should be freed with SDL_DestroySurface(). * @@ -792,7 +805,8 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ScaleSurface(SDL_Surface *surface, * If you are converting to an indexed surface and want to map colors to a * palette, you can use SDL_ConvertSurfaceAndColorspace() instead. * - * If the original surface has alternate images, the new surface will have a reference to them as well. + * If the original surface has alternate images, the new surface will have a + * reference to them as well. * * \param surface the existing SDL_Surface structure to convert. * \param format the new pixel format. @@ -814,7 +828,8 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface(SDL_Surface *surfac * and returns the new surface. This will perform any pixel format and * colorspace conversion needed. * - * If the original surface has alternate images, the new surface will have a reference to them as well. + * If the original surface has alternate images, the new surface will have a + * reference to them as well. * * \param surface the existing SDL_Surface structure to convert. * \param format the new pixel format. diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index c73f5b72c89cf..f78a9c16e07cd 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -1334,7 +1334,14 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetWindowTitle(SDL_Window *window); /** * Set the icon for a window. * - * If this function is passed a surface with alternate representations, the surface will be interpreted as the content to be used for 100% display scale, and the alternate representations will be used for high DPI situations. For example, if the original surface is 32x32, then on a 2x macOS display or 200% display scale on Windows, a 64x64 version of the image will be used, if available. If a matching version of the image isn't available, the closest size image will be scaled to the appropriate size and be used instead. + * If this function is passed a surface with alternate representations, the + * surface will be interpreted as the content to be used for 100% display + * scale, and the alternate representations will be used for high DPI + * situations. For example, if the original surface is 32x32, then on a 2x + * macOS display or 200% display scale on Windows, a 64x64 version of the + * image will be used, if available. If a matching version of the image isn't + * available, the closest size image will be scaled to the appropriate size + * and be used instead. * * \param window the window to change. * \param icon an SDL_Surface structure containing the icon for the window. From bffd35995cb7bfb6fba3dca30b24e8569055e6cc Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Aug 2024 06:48:39 -0700 Subject: [PATCH 111/253] Added unifont-15.1.05.hex to the Xcode project for testime --- Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj b/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj index e40038e4c9931..0d28405ff1966 100644 --- a/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj +++ b/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj @@ -184,6 +184,7 @@ F3C17CEC28E417EB00E1A26D /* testutils.c in Sources */ = {isa = PBXBuildFile; fileRef = F3C17C7328E40ADE00E1A26D /* testutils.c */; }; F3C17D3928E424B800E1A26D /* sample.wav in Resources */ = {isa = PBXBuildFile; fileRef = 00794E6209D20839003FC8A1 /* sample.wav */; }; F3C17D3B28E4252900E1A26D /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; }; + F3C2CAC62C5C8BD6004D7998 /* unifont-15.1.05.hex in Resources */ = {isa = PBXBuildFile; fileRef = F3C2CAC52C5C8BD6004D7998 /* unifont-15.1.05.hex */; }; F3CB56892A7895F800766177 /* SDL3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL3.framework */; }; F3CB568A2A7895F800766177 /* SDL3.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL3.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; F3CB568C2A7896BF00766177 /* SDL3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL3.framework */; }; @@ -1359,6 +1360,7 @@ F3C17C7328E40ADE00E1A26D /* testutils.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testutils.c; sourceTree = ""; }; F3C17CD628E416AC00E1A26D /* testgeometry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testgeometry.c; sourceTree = ""; }; F3C17CDC28E416CF00E1A26D /* testgeometry.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testgeometry.app; sourceTree = BUILT_PRODUCTS_DIR; }; + F3C2CAC52C5C8BD6004D7998 /* unifont-15.1.05.hex */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "unifont-15.1.05.hex"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1757,6 +1759,7 @@ 00794E5F09D20839003FC8A1 /* picture.xbm */, 00794E6109D20839003FC8A1 /* sample.bmp */, 00794E6209D20839003FC8A1 /* sample.wav */, + F3C2CAC52C5C8BD6004D7998 /* unifont-15.1.05.hex */, 00794E6309D20839003FC8A1 /* utf8.txt */, ); name = Resources; @@ -2051,6 +2054,7 @@ 0017977B107432AE00F5D044 /* Sources */, 0017977C107432AE00F5D044 /* Frameworks */, F3CB56C22A78979600766177 /* Embed Frameworks */, + F3C2CAC42C5C8BAF004D7998 /* Resources */, ); buildRules = ( ); @@ -3018,6 +3022,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F3C2CAC42C5C8BAF004D7998 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F3C2CAC62C5C8BD6004D7998 /* unifont-15.1.05.hex in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ From 5d51e3b4abc987a7e99930c3378ac4d4fe0ab949 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Aug 2024 08:39:13 -0700 Subject: [PATCH 112/253] testime: added support for multiple windows --- test/testime.c | 320 +++++++++++++++++++++++++++++-------------------- 1 file changed, 189 insertions(+), 131 deletions(-) diff --git a/test/testime.c b/test/testime.c index b9bf090b031f9..8727c720dd77f 100644 --- a/test/testime.c +++ b/test/testime.c @@ -42,21 +42,32 @@ #define CURSOR_BLINK_INTERVAL_MS 500 +typedef struct +{ + SDL_Window *window; + SDL_Renderer *renderer; + int rendererID; + SDL_FRect textRect; + SDL_FRect markedRect; + char text[MAX_TEXT_LENGTH]; + char markedText[MAX_TEXT_LENGTH]; + int cursor; + int cursor_length; + SDL_bool cursor_visible; + Uint64 last_cursor_change; + char **candidates; + int num_candidates; + int selected_candidate; + SDL_bool horizontal_candidates; +} WindowState; + static SDLTest_CommonState *state; -static SDL_FRect textRect, markedRect; -static SDL_Color lineColor = { 0, 0, 0, 255 }; -static SDL_Color backColor = { 255, 255, 255, 255 }; -static SDL_Color textColor = { 0, 0, 0, 255 }; -static char text[MAX_TEXT_LENGTH], markedText[MAX_TEXT_LENGTH]; -static int cursor = 0; -static int cursor_length = 0; -static SDL_bool cursor_visible; -static Uint64 last_cursor_change; +static WindowState *windowstate; +static const SDL_Color lineColor = { 0, 0, 0, 255 }; +static const SDL_Color backColor = { 255, 255, 255, 255 }; +static const SDL_Color textColor = { 0, 0, 0, 255 }; static SDL_BlendMode highlight_mode; -static char **candidates; -static int num_candidates; -static int selected_candidate; -static SDL_bool horizontal_candidates; + #ifdef HAVE_SDL_TTF static TTF_Font *font; #else @@ -455,81 +466,88 @@ static Uint32 utf8_decode(const char *p, size_t len) return codepoint; } -static void InitInput(void) +static WindowState *GetWindowStateForWindowID(SDL_WindowID windowID) { int i; - - /* Prepare a rect for text input */ - textRect.x = textRect.y = 100.0f; - textRect.w = DEFAULT_WINDOW_WIDTH - 2 * textRect.x; - textRect.h = 50.0f; - - text[0] = 0; - markedRect = textRect; - markedText[0] = 0; + SDL_Window *window = SDL_GetWindowFromID(windowID); for (i = 0; i < state->num_windows; ++i) { - SDL_StartTextInput(state->windows[i]); + if (windowstate[i].window == window) { + return &windowstate[i]; + } } + return NULL; } +static void InitInput(WindowState *ctx) +{ + /* Prepare a rect for text input */ + ctx->textRect.x = ctx->textRect.y = 100.0f; + ctx->textRect.w = DEFAULT_WINDOW_WIDTH - 2 * ctx->textRect.x; + ctx->textRect.h = 50.0f; + ctx->markedRect = ctx->textRect; -static void ClearCandidates(void) + SDL_StartTextInput(ctx->window); +} + + +static void ClearCandidates(WindowState *ctx) { int i; - for (i = 0; i < num_candidates; ++i) { - SDL_free(candidates[i]); + for (i = 0; i < ctx->num_candidates; ++i) { + SDL_free(ctx->candidates[i]); } - SDL_free(candidates); - candidates = NULL; - num_candidates = 0; + SDL_free(ctx->candidates); + ctx->candidates = NULL; + ctx->num_candidates = 0; } -static void SaveCandidates(SDL_Event *event) +static void SaveCandidates(WindowState *ctx, SDL_Event *event) { int i; - ClearCandidates(); + ClearCandidates(ctx); - num_candidates = event->edit_candidates.num_candidates; - if (num_candidates > 0) { - candidates = (char **)SDL_malloc(num_candidates * sizeof(*candidates)); - if (!candidates) { - num_candidates = 0; + ctx->num_candidates = event->edit_candidates.num_candidates; + if (ctx->num_candidates > 0) { + ctx->candidates = (char **)SDL_malloc(ctx->num_candidates * sizeof(*ctx->candidates)); + if (!ctx->candidates) { + ctx->num_candidates = 0; return; } - for (i = 0; i < num_candidates; ++i) { - candidates[i] = SDL_strdup(event->edit_candidates.candidates[i]); + for (i = 0; i < ctx->num_candidates; ++i) { + ctx->candidates[i] = SDL_strdup(event->edit_candidates.candidates[i]); } - selected_candidate = event->edit_candidates.selected_candidate; - horizontal_candidates = event->edit_candidates.horizontal; + ctx->selected_candidate = event->edit_candidates.selected_candidate; + ctx->horizontal_candidates = event->edit_candidates.horizontal; } } -static void DrawCandidates(int rendererID, SDL_FRect *cursorRect) +static void DrawCandidates(WindowState *ctx, SDL_FRect *cursorRect) { - SDL_Renderer *renderer = state->renderers[rendererID]; + SDL_Renderer *renderer = ctx->renderer; + int rendererID = ctx->rendererID; int i; int output_w = 0, output_h = 0; float w = 0.0f, h = 0.0f; SDL_FRect candidatesRect, dstRect, underlineRect; - if (num_candidates == 0) { + if (ctx->num_candidates == 0) { return; } /* Calculate the size of the candidate list */ - for (i = 0; i < num_candidates; ++i) { - if (!candidates[i]) { + for (i = 0; i < ctx->num_candidates; ++i) { + if (!ctx->candidates[i]) { continue; } #ifdef HAVE_SDL_TTF /* FIXME */ #else - if (horizontal_candidates) { - const char *utext = candidates[i]; + if (ctx->horizontal_candidates) { + const char *utext = ctx->candidates[i]; Uint32 codepoint; size_t len; float advance = 0.0f; @@ -544,7 +562,7 @@ static void DrawCandidates(int rendererID, SDL_FRect *cursorRect) w += advance; h = UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE; } else { - const char *utext = candidates[i]; + const char *utext = ctx->candidates[i]; Uint32 codepoint; size_t len; float advance = 0.0f; @@ -584,8 +602,8 @@ static void DrawCandidates(int rendererID, SDL_FRect *cursorRect) /* Draw the candidates */ dstRect.x = candidatesRect.x + 3.0f; dstRect.y = candidatesRect.y + 3.0f; - for (i = 0; i < num_candidates; ++i) { - if (!candidates[i]) { + for (i = 0; i < ctx->num_candidates; ++i) { + if (!ctx->candidates[i]) { continue; } @@ -595,8 +613,8 @@ static void DrawCandidates(int rendererID, SDL_FRect *cursorRect) dstRect.w = UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE; dstRect.h = UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE; - if (horizontal_candidates) { - const char *utext = candidates[i]; + if (ctx->horizontal_candidates) { + const char *utext = ctx->candidates[i]; Uint32 codepoint; size_t len; float start; @@ -611,7 +629,7 @@ static void DrawCandidates(int rendererID, SDL_FRect *cursorRect) utext += len; } - if (i == selected_candidate) { + if (i == ctx->selected_candidate) { underlineRect.x = start; underlineRect.y = dstRect.y + dstRect.h - 2; underlineRect.h = 2; @@ -621,7 +639,7 @@ static void DrawCandidates(int rendererID, SDL_FRect *cursorRect) SDL_RenderFillRect(renderer, &underlineRect); } } else { - const char *utext = candidates[i]; + const char *utext = ctx->candidates[i]; Uint32 codepoint; size_t len; float start; @@ -634,7 +652,7 @@ static void DrawCandidates(int rendererID, SDL_FRect *cursorRect) utext += len; } - if (i == selected_candidate) { + if (i == ctx->selected_candidate) { underlineRect.x = start; underlineRect.y = dstRect.y + dstRect.h - 2; underlineRect.h = 2; @@ -653,22 +671,28 @@ static void DrawCandidates(int rendererID, SDL_FRect *cursorRect) } } -static void UpdateTextInputArea(SDL_Window *window, const SDL_FRect *cursorRect) +static void UpdateTextInputArea(WindowState *ctx, const SDL_FRect *cursorRect) { SDL_Rect rect; - int cursor_offset = (int)(cursorRect->x - textRect.x); + int cursor_offset = (int)(cursorRect->x - ctx->textRect.x); - rect.x = (int)textRect.x; - rect.y = (int)textRect.y; - rect.w = (int)textRect.w; - rect.h = (int)textRect.h; - SDL_SetTextInputArea(window, &rect, cursor_offset); + rect.x = (int)ctx->textRect.x; + rect.y = (int)ctx->textRect.y; + rect.w = (int)ctx->textRect.w; + rect.h = (int)ctx->textRect.h; + SDL_SetTextInputArea(ctx->window, &rect, cursor_offset); } static void CleanupVideo(void) { - SDL_StopTextInput(state->windows[0]); - ClearCandidates(); + int i; + + for (i = 0; i < state->num_windows; ++i) { + WindowState *ctx = &windowstate[i]; + + SDL_StopTextInput(ctx->window); + ClearCandidates(ctx); + } #ifdef HAVE_SDL_TTF TTF_CloseFont(font); TTF_Quit(); @@ -677,27 +701,28 @@ static void CleanupVideo(void) #endif } -static void RedrawWindow(int rendererID) +static void RedrawWindow(WindowState *ctx) { - SDL_Renderer *renderer = state->renderers[rendererID]; + SDL_Renderer *renderer = ctx->renderer; + int rendererID = ctx->rendererID; SDL_FRect drawnTextRect, cursorRect, underlineRect; SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a); - SDL_RenderFillRect(renderer, &textRect); + SDL_RenderFillRect(renderer, &ctx->textRect); /* Initialize the drawn text rectangle for the cursor */ - drawnTextRect.x = textRect.x; - drawnTextRect.y = textRect.y + (textRect.h - UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE) / 2; + drawnTextRect.x = ctx->textRect.x; + drawnTextRect.y = ctx->textRect.y + (ctx->textRect.h - UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE) / 2; drawnTextRect.w = 0.0f; drawnTextRect.h = UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE; - if (*text) { + if (ctx->text[0]) { #ifdef HAVE_SDL_TTF - SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, textColor); + SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, ctx->text, textColor); SDL_Texture *texture; /* Vertically center text */ - drawnTextRect.y = textRect.y + (textRect.h - textSur->h) / 2; + drawnTextRect.y = ctx->textRect.y + (ctx->textRect.h - textSur->h) / 2; drawnTextRect.w = textSur->w; drawnTextRect.h = textSur->h; @@ -707,13 +732,13 @@ static void RedrawWindow(int rendererID) SDL_RenderTexture(renderer, texture, NULL, &drawnTextRect); SDL_DestroyTexture(texture); #else - char *utext = text; + char *utext = ctx->text; Uint32 codepoint; size_t len; SDL_FRect dstrect; - dstrect.x = textRect.x; - dstrect.y = textRect.y + (textRect.h - UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE) / 2; + dstrect.x = ctx->textRect.x; + dstrect.y = ctx->textRect.y + (ctx->textRect.h - UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE) / 2; dstrect.w = UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE; dstrect.h = UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE; drawnTextRect.y = dstrect.y; @@ -729,14 +754,14 @@ static void RedrawWindow(int rendererID) } /* The marked text rectangle is the text area that hasn't been filled by committed text */ - markedRect.x = textRect.x + drawnTextRect.w; - markedRect.w = textRect.w - drawnTextRect.w; - if (markedRect.w < 0) { + ctx->markedRect.x = ctx->textRect.x + drawnTextRect.w; + ctx->markedRect.w = ctx->textRect.w - drawnTextRect.w; + if (ctx->markedRect.w < 0) { /* Stop text input because we cannot hold any more characters */ - SDL_StopTextInput(state->windows[0]); + SDL_StopTextInput(ctx->window); return; } else { - SDL_StartTextInput(state->windows[0]); + SDL_StartTextInput(ctx->window); } /* Update the drawn text rectangle for composition text, after the committed text */ @@ -748,26 +773,26 @@ static void RedrawWindow(int rendererID) cursorRect.w = 2; cursorRect.h = drawnTextRect.h; - if (markedText[0]) { + if (ctx->markedText[0]) { #ifdef HAVE_SDL_TTF SDL_Surface *textSur; SDL_Texture *texture; - if (cursor) { - char *p = utf8_advance(markedText, cursor); + if (ctx->cursor) { + char *p = utf8_advance(ctx->markedText, ctx->cursor); char c = 0; if (!p) { - p = &markedText[SDL_strlen(markedText)]; + p = &ctx->markedText[SDL_strlen(ctx->markedText)]; } c = *p; *p = 0; - TTF_SizeUTF8(font, markedText, &drawnTextRect.w, NULL); + TTF_SizeUTF8(font, ctx->markedText, &drawnTextRect.w, NULL); cursorRect.x += drawnTextRect.w; *p = c; } - textSur = TTF_RenderUTF8_Blended(font, markedText, textColor); + textSur = TTF_RenderUTF8_Blended(font, ctx->markedText, textColor); /* Vertically center text */ - drawnTextRect.y = textRect.y + (textRect.h - textSur->h) / 2; + drawnTextRect.y = ctx->textRect.y + (ctx->textRect.h - textSur->h) / 2; drawnTextRect.w = textSur->w; drawnTextRect.h = textSur->h; @@ -777,19 +802,19 @@ static void RedrawWindow(int rendererID) SDL_RenderTexture(renderer, texture, NULL, &drawnTextRect); SDL_DestroyTexture(texture); - if (cursor_length > 0) { + if (ctx->cursor_length > 0) { /* FIXME: Need to measure text extents */ - cursorRect.w = cursor_length * UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE; + cursorRect.w = ctx->cursor_length * UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE; } #else int i = 0; - char *utext = markedText; + char *utext = ctx->markedText; Uint32 codepoint; size_t len; SDL_FRect dstrect; dstrect.x = drawnTextRect.x; - dstrect.y = textRect.y + (textRect.h - UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE) / 2; + dstrect.y = ctx->textRect.y + (ctx->textRect.h - UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE) / 2; dstrect.w = UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE; dstrect.h = UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE; drawnTextRect.y = dstrect.y; @@ -799,22 +824,22 @@ static void RedrawWindow(int rendererID) float advance = unifont_draw_glyph(codepoint, rendererID, &dstrect) * UNIFONT_DRAW_SCALE; dstrect.x += advance; drawnTextRect.w += advance; - if (i < cursor) { + if (i < ctx->cursor) { cursorRect.x += advance; } i++; utext += len; } - if (cursor_length > 0) { - cursorRect.w = cursor_length * UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE; + if (ctx->cursor_length > 0) { + cursorRect.w = ctx->cursor_length * UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE; } #endif cursorRect.y = drawnTextRect.y; cursorRect.h = drawnTextRect.h; - underlineRect = markedRect; + underlineRect = ctx->markedRect; underlineRect.y = drawnTextRect.y + drawnTextRect.h - 2; underlineRect.h = 2; underlineRect.w = drawnTextRect.w; @@ -825,26 +850,26 @@ static void RedrawWindow(int rendererID) /* Draw the cursor */ Uint64 now = SDL_GetTicks(); - if ((now - last_cursor_change) >= CURSOR_BLINK_INTERVAL_MS) { - cursor_visible = !cursor_visible; - last_cursor_change = now; + if ((now - ctx->last_cursor_change) >= CURSOR_BLINK_INTERVAL_MS) { + ctx->cursor_visible = !ctx->cursor_visible; + ctx->last_cursor_change = now; } - if (cursor_length > 0) { + if (ctx->cursor_length > 0) { /* We'll show a highlight */ SDL_SetRenderDrawBlendMode(renderer, highlight_mode); SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); SDL_RenderFillRect(renderer, &cursorRect); SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE); - } else if (cursor_visible) { + } else if (ctx->cursor_visible) { SDL_SetRenderDrawColor(renderer, lineColor.r, lineColor.g, lineColor.b, lineColor.a); SDL_RenderFillRect(renderer, &cursorRect); } /* Draw the candidates */ - DrawCandidates(rendererID, &cursorRect); + DrawCandidates(ctx, &cursorRect); /* Update the area used to draw composition UI */ - UpdateTextInputArea(state->windows[0], &cursorRect); + UpdateTextInputArea(ctx, &cursorRect); } static void Redraw(void) @@ -858,8 +883,7 @@ static void Redraw(void) SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0); SDL_RenderClear(renderer); - /* Sending in the window id to let the font renderers know which one we're working with. */ - RedrawWindow(i); + RedrawWindow(&windowstate[i]); SDL_RenderPresent(renderer); } @@ -920,6 +944,12 @@ int main(int argc, char *argv[]) return 2; } + windowstate = (WindowState *)SDL_calloc(state->num_windows, sizeof(*windowstate)); + if (!windowstate) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate window state: %s\n", SDL_GetError()); + return -1; + } + fontname = GetResourceFilename(fontname, DEFAULT_FONT); #ifdef HAVE_SDL_TTF @@ -939,10 +969,18 @@ int main(int argc, char *argv[]) SDL_Log("Using font: %s\n", fontname); - InitInput(); - /* Create the windows and initialize the renderers */ + /* Initialize window state */ for (i = 0; i < state->num_windows; ++i) { + WindowState *ctx = &windowstate[i]; + SDL_Window *window = state->windows[i]; SDL_Renderer *renderer = state->renderers[i]; + + ctx->window = window; + ctx->renderer = renderer; + ctx->rendererID = i; + + InitInput(ctx); + SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE); SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); SDL_RenderClear(renderer); @@ -961,33 +999,38 @@ int main(int argc, char *argv[]) while (SDL_PollEvent(&event)) { SDLTest_CommonEvent(state, &event, &done); switch (event.type) { - case SDL_EVENT_KEY_DOWN: + case SDL_EVENT_KEY_DOWN: { + WindowState *ctx = GetWindowStateForWindowID(event.key.windowID); + if (!ctx) { + break; + } + switch (event.key.key) { case SDLK_RETURN: - text[0] = 0x00; + ctx->text[0] = 0x00; break; case SDLK_BACKSPACE: /* Only delete text if not in editing mode. */ - if (!markedText[0]) { - size_t textlen = SDL_strlen(text); + if (!ctx->markedText[0]) { + size_t textlen = SDL_strlen(ctx->text); do { if (textlen == 0) { break; } - if (!(text[textlen - 1] & 0x80)) { + if (!(ctx->text[textlen - 1] & 0x80)) { /* One byte */ - text[textlen - 1] = 0x00; + ctx->text[textlen - 1] = 0x00; break; } - if ((text[textlen - 1] & 0xC0) == 0x80) { + if ((ctx->text[textlen - 1] & 0xC0) == 0x80) { /* Byte from the multibyte sequence */ - text[textlen - 1] = 0x00; + ctx->text[textlen - 1] = 0x00; textlen--; } - if ((text[textlen - 1] & 0xC0) == 0xC0) { + if ((ctx->text[textlen - 1] & 0xC0) == 0xC0) { /* First byte of multibyte sequence */ - text[textlen - 1] = 0x00; + ctx->text[textlen - 1] = 0x00; break; } } while (1); @@ -1007,44 +1050,59 @@ int main(int argc, char *argv[]) SDL_static_cast(Uint32, event.key.key), SDL_GetKeyName(event.key.key)); break; + } + case SDL_EVENT_TEXT_INPUT: { + WindowState *ctx = GetWindowStateForWindowID(event.text.windowID); + if (!ctx) { + break; + } - case SDL_EVENT_TEXT_INPUT: - if (event.text.text[0] == '\0' || event.text.text[0] == '\n' || markedRect.w < 0) { + if (event.text.text[0] == '\0' || event.text.text[0] == '\n' || ctx->markedRect.w < 0) { break; } SDL_Log("Keyboard: text input \"%s\"\n", event.text.text); - if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text)) { - SDL_strlcat(text, event.text.text, sizeof(text)); + if (SDL_strlen(ctx->text) + SDL_strlen(event.text.text) < sizeof(ctx->text)) { + SDL_strlcat(ctx->text, event.text.text, sizeof(ctx->text)); } - SDL_Log("text inputted: %s\n", text); + SDL_Log("text inputted: %s\n", ctx->text); /* After text inputted, we can clear up markedText because it */ /* is committed */ - markedText[0] = 0; + ctx->markedText[0] = 0; break; + } + case SDL_EVENT_TEXT_EDITING: { + WindowState *ctx = GetWindowStateForWindowID(event.edit.windowID); + if (!ctx) { + break; + } - case SDL_EVENT_TEXT_EDITING: SDL_Log("text editing \"%s\", selected range (%" SDL_PRIs32 ", %" SDL_PRIs32 ")\n", event.edit.text, event.edit.start, event.edit.length); - SDL_strlcpy(markedText, event.edit.text, sizeof(markedText)); - cursor = event.edit.start; - cursor_length = event.edit.length; + SDL_strlcpy(ctx->markedText, event.edit.text, sizeof(ctx->markedText)); + ctx->cursor = event.edit.start; + ctx->cursor_length = event.edit.length; break; + } + case SDL_EVENT_TEXT_EDITING_CANDIDATES: { + WindowState *ctx = GetWindowStateForWindowID(event.edit.windowID); + if (!ctx) { + break; + } - case SDL_EVENT_TEXT_EDITING_CANDIDATES: SDL_Log("text candidates:\n"); for (i = 0; i < event.edit_candidates.num_candidates; ++i) { SDL_Log("%c%s\n", i == event.edit_candidates.selected_candidate ? '>' : ' ', event.edit_candidates.candidates[i]); } - ClearCandidates(); - SaveCandidates(&event); + ClearCandidates(ctx); + SaveCandidates(ctx, &event); break; - + } default: break; } From 81f8e6aba6b3b73e44767a61f37e8f72b18ce3e4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Aug 2024 06:56:51 -0700 Subject: [PATCH 113/253] Added SDL_StartTextInputWithProperties() This allows you to customize the text input so you can have numeric text entry, hidden passwords, etc. Fixes https://github.com/libsdl-org/SDL/issues/7101 Fixes https://github.com/libsdl-org/SDL/issues/7965 Fixes https://github.com/libsdl-org/SDL/issues/9439 --- .../SDLTest/SDLTest.xcodeproj/project.pbxproj | 2 + .../main/java/org/libsdl/app/SDLActivity.java | 9 +- .../java/org/libsdl/app/SDLDummyEdit.java | 8 +- include/SDL3/SDL_hints.h | 2 + include/SDL3/SDL_keyboard.h | 82 ++++++++++ src/core/android/SDL_android.c | 5 +- src/core/android/SDL_android.h | 2 +- src/dynapi/SDL_dynapi.sym | 1 + src/dynapi/SDL_dynapi_overrides.h | 1 + src/dynapi/SDL_dynapi_procs.h | 1 + src/events/SDL_keyboard.c | 2 +- src/video/SDL_sysvideo.h | 10 +- src/video/SDL_video.c | 76 ++++++++- src/video/android/SDL_androidkeyboard.c | 104 +++++++++++- src/video/android/SDL_androidkeyboard.h | 2 +- src/video/cocoa/SDL_cocoakeyboard.h | 2 +- src/video/cocoa/SDL_cocoakeyboard.m | 2 +- src/video/gdk/SDL_gdktextinput.cpp | 39 ++++- src/video/gdk/SDL_gdktextinput.h | 4 +- src/video/n3ds/SDL_n3dsswkb.c | 2 +- src/video/n3ds/SDL_n3dsswkb.h | 2 +- src/video/psp/SDL_pspvideo.c | 33 +++- src/video/psp/SDL_pspvideo.h | 2 +- src/video/uikit/SDL_uikitviewcontroller.h | 2 +- src/video/uikit/SDL_uikitviewcontroller.m | 109 +++++++++++-- src/video/vita/SDL_vitavideo.c | 44 ++++- src/video/vita/SDL_vitavideo.h | 2 +- src/video/wayland/SDL_waylandkeyboard.c | 66 +++++++- src/video/wayland/SDL_waylandkeyboard.h | 2 +- src/video/windows/SDL_windowskeyboard.c | 2 +- src/video/windows/SDL_windowskeyboard.h | 2 +- src/video/winrt/SDL_winrtevents_c.h | 2 +- src/video/winrt/SDL_winrtkeyboard.cpp | 2 +- src/video/x11/SDL_x11keyboard.c | 29 +++- src/video/x11/SDL_x11keyboard.h | 4 +- test/testime.c | 154 ++++++++++++++++-- 36 files changed, 737 insertions(+), 76 deletions(-) diff --git a/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj b/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj index 0d28405ff1966..a3b389edca9c0 100644 --- a/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj +++ b/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj @@ -185,6 +185,7 @@ F3C17D3928E424B800E1A26D /* sample.wav in Resources */ = {isa = PBXBuildFile; fileRef = 00794E6209D20839003FC8A1 /* sample.wav */; }; F3C17D3B28E4252900E1A26D /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; }; F3C2CAC62C5C8BD6004D7998 /* unifont-15.1.05.hex in Resources */ = {isa = PBXBuildFile; fileRef = F3C2CAC52C5C8BD6004D7998 /* unifont-15.1.05.hex */; }; + F3C2CB072C5D3FB2004D7998 /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; }; F3CB56892A7895F800766177 /* SDL3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL3.framework */; }; F3CB568A2A7895F800766177 /* SDL3.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL3.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; F3CB568C2A7896BF00766177 /* SDL3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL3.framework */; }; @@ -3026,6 +3027,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F3C2CB072C5D3FB2004D7998 /* icon.bmp in Resources */, F3C2CAC62C5C8BD6004D7998 /* unifont-15.1.05.hex in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 6cfbc904f9598..134a3dfdcf604 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -1375,9 +1375,11 @@ static class ShowTextInputTask implements Runnable { */ static final int HEIGHT_PADDING = 15; + public int input_type; public int x, y, w, h; - public ShowTextInputTask(int x, int y, int w, int h) { + public ShowTextInputTask(int input_type, int x, int y, int w, int h) { + this.input_type = input_type; this.x = x; this.y = y; this.w = w; @@ -1405,6 +1407,7 @@ public void run() { } else { mTextEdit.setLayoutParams(params); } + mTextEdit.setInputType(input_type); mTextEdit.setVisibility(View.VISIBLE); mTextEdit.requestFocus(); @@ -1419,9 +1422,9 @@ public void run() { /** * This method is called by SDL using JNI. */ - public static boolean showTextInput(int x, int y, int w, int h) { + public static boolean showTextInput(int input_type, int x, int y, int w, int h) { // Transfer the task to the main thread as a Runnable - return mSingleton.commandHandler.post(new ShowTextInputTask(x, y, w, h)); + return mSingleton.commandHandler.post(new ShowTextInputTask(input_type, x, y, w, h)); } public static boolean isTextInputEvent(KeyEvent event) { diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLDummyEdit.java b/android-project/app/src/main/java/org/libsdl/app/SDLDummyEdit.java index dca28145ec19c..40e556ff41066 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLDummyEdit.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLDummyEdit.java @@ -12,6 +12,7 @@ public class SDLDummyEdit extends View implements View.OnKeyListener { InputConnection ic; + int input_type; public SDLDummyEdit(Context context) { super(context); @@ -20,6 +21,10 @@ public SDLDummyEdit(Context context) { setOnKeyListener(this); } + public void setInputType(int input_type) { + this.input_type = input_type; + } + @Override public boolean onCheckIsTextEditor() { return true; @@ -51,8 +56,7 @@ public boolean onKeyPreIme (int keyCode, KeyEvent event) { public InputConnection onCreateInputConnection(EditorInfo outAttrs) { ic = new SDLInputConnection(this, true); - outAttrs.inputType = InputType.TYPE_CLASS_TEXT | - InputType.TYPE_TEXT_FLAG_MULTI_LINE; + outAttrs.inputType = input_type; outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */; diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index eb14e7a2c6421..79aa0089e3788 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2620,6 +2620,8 @@ extern "C" { * A variable to control whether the return key on the soft keyboard should * hide the soft keyboard on Android and iOS. * + * This hint sets the default value of SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN. + * * The variable can be set to the following values: * * - "0": The return key will be handled as a key event. (default) diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index b5453a0a15408..67c4f5842e037 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -367,11 +367,93 @@ extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); * \since This function is available since SDL 3.0.0. * * \sa SDL_SetTextInputArea + * \sa SDL_StartTextInputWithProperties * \sa SDL_StopTextInput * \sa SDL_TextInputActive */ extern SDL_DECLSPEC int SDLCALL SDL_StartTextInput(SDL_Window *window); +/** + * Text input type. + * + * These are the valid values for SDL_PROP_TEXTINPUT_TYPE_NUMBER. Not every value is valid on every platform, but where a value isn't supported, a reasonable fallback will be used. + * + * \since This enum is available since SDL 3.0.0. + * + * \sa SDL_StartTextInputWithProperties + */ +typedef enum SDL_TextInputType +{ + SDL_TEXTINPUT_TYPE_TEXT, /**< The input is text */ + SDL_TEXTINPUT_TYPE_TEXT_NAME, /**< The input is a person's name */ + SDL_TEXTINPUT_TYPE_TEXT_EMAIL, /**< The input is an e-mail address */ + SDL_TEXTINPUT_TYPE_TEXT_USERNAME, /**< The input is a username */ + SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN, /**< The input is a secure password that is hidden */ + SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE, /**< The input is a secure password that is visible */ + SDL_TEXTINPUT_TYPE_NUMBER, /**< The input is a number */ + SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN, /**< The input is a secure PIN that is hidden */ + SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE /**< The input is a secure PIN that is visible */ +} SDL_TextInputType; + +/** + * Auto capitalization type. + * + * These are the valid values for SDL_PROP_TEXTINPUT_AUTOCAPITALIZATION_NUMBER. Not every value is valid on every platform, but where a value isn't supported, a reasonable fallback will be used. + * + * \since This enum is available since SDL 3.0.0. + * + * \sa SDL_StartTextInputWithProperties + */ +typedef enum SDL_Capitalization +{ + SDL_CAPITALIZE_NONE, /**< No auto-capitalization will be done */ + SDL_CAPITALIZE_SENTENCES, /**< The first letter of sentences will be capitalized */ + SDL_CAPITALIZE_WORDS, /**< The first letter of words will be capitalized */ + SDL_CAPITALIZE_LETTERS /**< All letters will be capitalized */ +} SDL_Capitalization; + +/** + * Start accepting Unicode text input events in a window, with properties describing the input. + * + * This function will enable text input (SDL_EVENT_TEXT_INPUT and + * SDL_EVENT_TEXT_EDITING events) in the specified window. Please use this + * function paired with SDL_StopTextInput(). + * + * Text input events are not received by default. + * + * On some platforms using this function shows the screen keyboard. + * + * These are the supported properties: + * + * - `SDL_PROP_TEXTINPUT_TYPE_NUMBER` - an SDL_TextInputType value that describes text being input, defaults to SDL_TEXTINPUT_TYPE_TEXT. + * - `SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER` - an SDL_Capitalization value that describes how text should be capitalized, defaults to SDL_CAPITALIZE_NONE. + * - `SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN` - true to enable auto completion and auto correction. + * - `SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN` - true if multiple lines of text are allowed. This defaults to true if SDL_HINT_RETURN_KEY_HIDES_IME is "0" or is not set, and defaults to false if SDL_HINT_RETURN_KEY_HIDES_IME is "1". + * + * On Android you can directly specify the input type: + * + * - `SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER` - the text input type to use, overriding other properties. This is documented at https://developer.android.com/reference/android/text/InputType + * + * \param window the window to enable text input. + * \param props the properties to use. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_SetTextInputArea + * \sa SDL_StartTextInput + * \sa SDL_StopTextInput + * \sa SDL_TextInputActive + */ +extern SDL_DECLSPEC int SDLCALL SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props); + +#define SDL_PROP_TEXTINPUT_TYPE_NUMBER "SDL.textinput.type" +#define SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER "SDL.textinput.capitalization" +#define SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN "SDL.textinput.autocorrect" +#define SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN "SDL.textinput.multiline" +#define SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER "SDL.textinput.android.inputtype" + /** * Check whether or not Unicode text input events are enabled for a window. * diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index c0c73bcf6ceb4..bf0f30b986114 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -645,7 +645,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cl midSetSystemCursor = (*env)->GetStaticMethodID(env, mActivityClass, "setSystemCursor", "(I)Z"); midSetWindowStyle = (*env)->GetStaticMethodID(env, mActivityClass, "setWindowStyle", "(Z)V"); midShouldMinimizeOnFocusLoss = (*env)->GetStaticMethodID(env, mActivityClass, "shouldMinimizeOnFocusLoss", "()Z"); - midShowTextInput = (*env)->GetStaticMethodID(env, mActivityClass, "showTextInput", "(IIII)Z"); + midShowTextInput = (*env)->GetStaticMethodID(env, mActivityClass, "showTextInput", "(IIIII)Z"); midSupportsRelativeMouse = (*env)->GetStaticMethodID(env, mActivityClass, "supportsRelativeMouse", "()Z"); midOpenFileDescriptor = (*env)->GetStaticMethodID(env, mActivityClass, "openFileDescriptor", "(Ljava/lang/String;Ljava/lang/String;)I"); midShowFileDialog = (*env)->GetStaticMethodID(env, mActivityClass, "showFileDialog", "([Ljava/lang/String;ZZI)Z"); @@ -2044,10 +2044,11 @@ int Android_JNI_SuspendScreenSaver(SDL_bool suspend) return Android_JNI_SendMessage(COMMAND_SET_KEEP_SCREEN_ON, (suspend == SDL_FALSE) ? 0 : 1); } -void Android_JNI_ShowScreenKeyboard(SDL_Rect *inputRect) +void Android_JNI_ShowScreenKeyboard(int input_type, SDL_Rect *inputRect) { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticBooleanMethod(env, mActivityClass, midShowTextInput, + input_type, inputRect->x, inputRect->y, inputRect->w, diff --git a/src/core/android/SDL_android.h b/src/core/android/SDL_android.h index ef0df18e30b19..6950ef2c76ebc 100644 --- a/src/core/android/SDL_android.h +++ b/src/core/android/SDL_android.h @@ -63,7 +63,7 @@ extern void Android_JNI_MinizeWindow(void); extern SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss(void); extern SDL_bool Android_JNI_GetAccelerometerValues(float values[3]); -extern void Android_JNI_ShowScreenKeyboard(SDL_Rect *inputRect); +extern void Android_JNI_ShowScreenKeyboard(int input_type, SDL_Rect *inputRect); extern void Android_JNI_HideScreenKeyboard(void); extern SDL_bool Android_JNI_IsScreenKeyboardShown(void); extern ANativeWindow *Android_JNI_GetNativeWindow(void); diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index bf7a2276b3153..38aad316a8e65 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -816,6 +816,7 @@ SDL3_0.0.0 { SDL_SignalCondition; SDL_SignalSemaphore; SDL_StartTextInput; + SDL_StartTextInputWithProperties; SDL_StepUTF8; SDL_StopHapticEffect; SDL_StopHapticEffects; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 96d40eaa36afc..004eee31cbb28 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -841,6 +841,7 @@ #define SDL_SignalCondition SDL_SignalCondition_REAL #define SDL_SignalSemaphore SDL_SignalSemaphore_REAL #define SDL_StartTextInput SDL_StartTextInput_REAL +#define SDL_StartTextInputWithProperties SDL_StartTextInputWithProperties_REAL #define SDL_StepUTF8 SDL_StepUTF8_REAL #define SDL_StopHapticEffect SDL_StopHapticEffect_REAL #define SDL_StopHapticEffects SDL_StopHapticEffects_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 749af3ce25ff2..6cdf7ff094b65 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -851,6 +851,7 @@ SDL_DYNAPI_PROC(int,SDL_ShowWindowSystemMenu,(SDL_Window *a, int b, int c),(a,b, SDL_DYNAPI_PROC(int,SDL_SignalCondition,(SDL_Condition *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SignalSemaphore,(SDL_Semaphore *a),(a),return) SDL_DYNAPI_PROC(int,SDL_StartTextInput,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_StartTextInputWithProperties,(SDL_Window *a, SDL_PropertiesID b),(a,b),return) SDL_DYNAPI_PROC(Uint32,SDL_StepUTF8,(const char **a, size_t *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_StopHapticEffect,(SDL_Haptic *a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_StopHapticEffects,(SDL_Haptic *a),(a),return) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 63c503d149c57..78abd861394b9 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -327,7 +327,7 @@ int SDL_SetKeyboardFocus(SDL_Window *window) if (SDL_TextInputActive(keyboard->focus)) { if (video && video->StartTextInput) { - video->StartTextInput(video, keyboard->focus); + video->StartTextInput(video, keyboard->focus, keyboard->focus->text_input_props); } } } diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 2be73c9b5614f..6554191225eab 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -106,6 +106,7 @@ struct SDL_Window int safe_inset_bottom; SDL_Rect safe_rect; + SDL_PropertiesID text_input_props; SDL_bool text_input_active; SDL_Rect text_input_rect; int text_input_cursor; @@ -331,14 +332,14 @@ struct SDL_VideoDevice int (*SuspendScreenSaver)(SDL_VideoDevice *_this); /* Text input */ - int (*StartTextInput)(SDL_VideoDevice *_this, SDL_Window *window); + int (*StartTextInput)(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); int (*StopTextInput)(SDL_VideoDevice *_this, SDL_Window *window); int (*UpdateTextInputArea)(SDL_VideoDevice *_this, SDL_Window *window); int (*ClearComposition)(SDL_VideoDevice *_this, SDL_Window *window); /* Screen keyboard */ SDL_bool (*HasScreenKeyboardSupport)(SDL_VideoDevice *_this); - void (*ShowScreenKeyboard)(SDL_VideoDevice *_this, SDL_Window *window); + void (*ShowScreenKeyboard)(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); void (*HideScreenKeyboard)(SDL_VideoDevice *_this, SDL_Window *window); SDL_bool (*IsScreenKeyboardShown)(SDL_VideoDevice *_this, SDL_Window *window); @@ -565,4 +566,9 @@ extern SDL_bool SDL_ShouldAllowTopmost(void); extern void SDL_ToggleDragAndDropSupport(void); +extern SDL_TextInputType SDL_GetTextInputType(SDL_PropertiesID props); +extern SDL_Capitalization SDL_GetTextInputCapitalization(SDL_PropertiesID props); +extern SDL_bool SDL_GetTextInputAutocorrect(SDL_PropertiesID props); +extern SDL_bool SDL_GetTextInputMultiline(SDL_PropertiesID props); + #endif /* SDL_sysvideo_h_ */ diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 484f84f13ef0f..fa6707f99e2da 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -4011,6 +4011,7 @@ void SDL_DestroyWindow(SDL_Window *window) SDL_HideWindow(window); } + SDL_DestroyProperties(window->text_input_props); SDL_DestroyProperties(window->props); /* Clear the modal status, but don't unset the parent, as it may be @@ -5129,23 +5130,80 @@ void SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask) } #endif -int SDL_StartTextInput(SDL_Window *window) +SDL_TextInputType SDL_GetTextInputType(SDL_PropertiesID props) { - CHECK_WINDOW_MAGIC(window, -1); + return (SDL_TextInputType)SDL_GetNumberProperty(props, SDL_PROP_TEXTINPUT_TYPE_NUMBER, SDL_TEXTINPUT_TYPE_TEXT); +} - /* Show the on-screen keyboard, if desired */ +SDL_Capitalization SDL_GetTextInputCapitalization(SDL_PropertiesID props) +{ + return (SDL_Capitalization)SDL_GetNumberProperty(props, SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER, SDL_CAPITALIZE_NONE); +} + +SDL_bool SDL_GetTextInputAutocorrect(SDL_PropertiesID props) +{ + return SDL_GetBooleanProperty(props, SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN, SDL_FALSE); +} + +SDL_bool SDL_GetTextInputMultiline(SDL_PropertiesID props) +{ + if (SDL_HasProperty(props, SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN)) { + return SDL_GetBooleanProperty(props, SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN, SDL_FALSE); + } + + if (SDL_GetHintBoolean(SDL_HINT_RETURN_KEY_HIDES_IME, SDL_FALSE)) { + return SDL_FALSE; + } else { + return SDL_TRUE; + } +} + +static SDL_bool AutoShowingScreenKeyboard(void) +{ const char *hint = SDL_GetHint(SDL_HINT_ENABLE_SCREEN_KEYBOARD); if (((!hint || SDL_strcasecmp(hint, "auto") == 0) && !SDL_HasKeyboard()) || SDL_GetStringBoolean(hint, SDL_FALSE)) { + return SDL_TRUE; + } else { + return SDL_FALSE; + } +} + +int SDL_StartTextInput(SDL_Window *window) +{ + return SDL_StartTextInputWithProperties(window, 0); +} + +int SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props) +{ + CHECK_WINDOW_MAGIC(window, -1); + + if (window->text_input_props) { + SDL_DestroyProperties(window->text_input_props); + window->text_input_props = 0; + } + + if (props) { + window->text_input_props = SDL_CreateProperties(); + if (!window->text_input_props) { + return -1; + } + if (SDL_CopyProperties(props, window->text_input_props) < 0) { + return -1; + } + } + + /* Show the on-screen keyboard, if desired */ + if (AutoShowingScreenKeyboard() && !SDL_ScreenKeyboardShown(window)) { if (_this->ShowScreenKeyboard) { - _this->ShowScreenKeyboard(_this, window); + _this->ShowScreenKeyboard(_this, window, props); } } if (!window->text_input_active) { /* Finally start the text input system */ if (_this->StartTextInput) { - if (_this->StartTextInput(_this, window) < 0) { + if (_this->StartTextInput(_this, window, props) < 0) { return -1; } } @@ -5174,9 +5232,7 @@ int SDL_StopTextInput(SDL_Window *window) } /* Hide the on-screen keyboard, if desired */ - const char *hint = SDL_GetHint(SDL_HINT_ENABLE_SCREEN_KEYBOARD); - if (((!hint || SDL_strcasecmp(hint, "auto") == 0) && !SDL_HasKeyboard()) || - SDL_GetStringBoolean(hint, SDL_FALSE)) { + if (AutoShowingScreenKeyboard() && SDL_ScreenKeyboardShown(window)) { if (_this->HideScreenKeyboard) { _this->HideScreenKeyboard(_this, window); } @@ -5239,7 +5295,9 @@ SDL_bool SDL_HasScreenKeyboardSupport(void) SDL_bool SDL_ScreenKeyboardShown(SDL_Window *window) { - if (window && _this && _this->IsScreenKeyboardShown) { + CHECK_WINDOW_MAGIC(window, SDL_FALSE); + + if (_this->IsScreenKeyboardShown) { return _this->IsScreenKeyboardShown(_this, window); } return SDL_FALSE; diff --git a/src/video/android/SDL_androidkeyboard.c b/src/video/android/SDL_androidkeyboard.c index 85a124725ce67..84da48166f044 100644 --- a/src/video/android/SDL_androidkeyboard.c +++ b/src/video/android/SDL_androidkeyboard.c @@ -30,6 +30,46 @@ #include "../../core/android/SDL_android.h" +#define TYPE_CLASS_TEXT 0x00000001 +#define TYPE_CLASS_NUMBER 0x00000002 +#define TYPE_CLASS_PHONE 0x00000003 +#define TYPE_CLASS_DATETIME 0x00000004 + +#define TYPE_DATETIME_VARIATION_NORMAL 0x00000000 +#define TYPE_DATETIME_VARIATION_DATE 0x00000010 +#define TYPE_DATETIME_VARIATION_TIME 0x00000020 + +#define TYPE_NUMBER_VARIATION_NORMAL 0x00000000 +#define TYPE_NUMBER_VARIATION_PASSWORD 0x00000010 +#define TYPE_NUMBER_FLAG_SIGNED 0x00001000 +#define TYPE_NUMBER_FLAG_DECIMAL 0x00002000 + +#define TYPE_TEXT_FLAG_CAP_CHARACTERS 0x00001000 +#define TYPE_TEXT_FLAG_CAP_WORDS 0x00002000 +#define TYPE_TEXT_FLAG_CAP_SENTENCES 0x00004000 +#define TYPE_TEXT_FLAG_AUTO_CORRECT 0x00008000 +#define TYPE_TEXT_FLAG_AUTO_COMPLETE 0x00010000 +#define TYPE_TEXT_FLAG_MULTI_LINE 0x00020000 +#define TYPE_TEXT_FLAG_IME_MULTI_LINE 0x00040000 +#define TYPE_TEXT_FLAG_NO_SUGGESTIONS 0x00080000 + +#define TYPE_TEXT_VARIATION_NORMAL 0x00000000 +#define TYPE_TEXT_VARIATION_URI 0x00000010 +#define TYPE_TEXT_VARIATION_EMAIL_ADDRESS 0x00000020 +#define TYPE_TEXT_VARIATION_EMAIL_SUBJECT 0x00000030 +#define TYPE_TEXT_VARIATION_SHORT_MESSAGE 0x00000040 +#define TYPE_TEXT_VARIATION_LONG_MESSAGE 0x00000050 +#define TYPE_TEXT_VARIATION_PERSON_NAME 0x00000060 +#define TYPE_TEXT_VARIATION_POSTAL_ADDRESS 0x00000070 +#define TYPE_TEXT_VARIATION_PASSWORD 0x00000080 +#define TYPE_TEXT_VARIATION_VISIBLE_PASSWORD 0x00000090 +#define TYPE_TEXT_VARIATION_WEB_EDIT_TEXT 0x000000a0 +#define TYPE_TEXT_VARIATION_FILTER 0x000000b0 +#define TYPE_TEXT_VARIATION_PHONETIC 0x000000c0 +#define TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS 0x000000d0 +#define TYPE_TEXT_VARIATION_WEB_PASSWORD 0x000000e0 + + static SDL_Scancode Android_Keycodes[] = { SDL_SCANCODE_UNKNOWN, /* AKEYCODE_UNKNOWN */ SDL_SCANCODE_SOFTLEFT, /* AKEYCODE_SOFT_LEFT */ @@ -343,9 +383,67 @@ SDL_bool Android_HasScreenKeyboardSupport(SDL_VideoDevice *_this) return SDL_TRUE; } -void Android_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) +void Android_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { - Android_JNI_ShowScreenKeyboard(&window->text_input_rect); + int input_type = 0; + if (SDL_HasProperty(props, SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER)) { + input_type = (int)SDL_GetNumberProperty(props, SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER, 0); + } else { + switch (SDL_GetTextInputType(props)) { + default: + case SDL_TEXTINPUT_TYPE_TEXT: + input_type = (TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_NORMAL); + break; + case SDL_TEXTINPUT_TYPE_TEXT_NAME: + input_type = (TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PERSON_NAME); + break; + case SDL_TEXTINPUT_TYPE_TEXT_EMAIL: + input_type = (TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_ADDRESS); + break; + case SDL_TEXTINPUT_TYPE_TEXT_USERNAME: + input_type = (TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_NORMAL); + break; + case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN: + input_type = (TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PASSWORD); + break; + case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE: + input_type = (TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); + break; + case SDL_TEXTINPUT_TYPE_NUMBER: + input_type = (TYPE_CLASS_NUMBER | TYPE_NUMBER_VARIATION_NORMAL); + break; + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN: + input_type = (TYPE_CLASS_NUMBER | TYPE_NUMBER_VARIATION_PASSWORD); + break; + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE: + input_type = (TYPE_CLASS_NUMBER | TYPE_NUMBER_VARIATION_NORMAL); + break; + } + + switch (SDL_GetTextInputCapitalization(props)) { + default: + case SDL_CAPITALIZE_NONE: + break; + case SDL_CAPITALIZE_LETTERS: + input_type |= TYPE_TEXT_FLAG_CAP_CHARACTERS; + break; + case SDL_CAPITALIZE_WORDS: + input_type |= TYPE_TEXT_FLAG_CAP_WORDS; + break; + case SDL_CAPITALIZE_SENTENCES: + input_type |= TYPE_TEXT_FLAG_CAP_SENTENCES; + break; + } + + if (SDL_GetTextInputAutocorrect(props)) { + input_type |= (TYPE_TEXT_FLAG_AUTO_CORRECT | TYPE_TEXT_FLAG_AUTO_COMPLETE); + } + + if (SDL_GetTextInputMultiline(props)) { + input_type |= TYPE_TEXT_FLAG_MULTI_LINE; + } + } + Android_JNI_ShowScreenKeyboard(input_type, &window->text_input_rect); SDL_screen_keyboard_shown = SDL_TRUE; } @@ -358,7 +456,7 @@ void Android_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) void Android_RestoreScreenKeyboardOnResume(SDL_VideoDevice *_this, SDL_Window *window) { if (SDL_screen_keyboard_shown) { - Android_ShowScreenKeyboard(_this, window); + Android_ShowScreenKeyboard(_this, window, window->text_input_props); } } diff --git a/src/video/android/SDL_androidkeyboard.h b/src/video/android/SDL_androidkeyboard.h index bcbd948e1caa9..c7b70090b8b7e 100644 --- a/src/video/android/SDL_androidkeyboard.h +++ b/src/video/android/SDL_androidkeyboard.h @@ -26,7 +26,7 @@ extern int Android_OnKeyDown(int keycode); extern int Android_OnKeyUp(int keycode); extern SDL_bool Android_HasScreenKeyboardSupport(SDL_VideoDevice *_this); -extern void Android_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); +extern void Android_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); extern void Android_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); extern void Android_RestoreScreenKeyboardOnResume(SDL_VideoDevice *_this, SDL_Window *window); extern SDL_bool Android_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window); diff --git a/src/video/cocoa/SDL_cocoakeyboard.h b/src/video/cocoa/SDL_cocoakeyboard.h index 85a409258a3a7..0103e1a8a336f 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.h +++ b/src/video/cocoa/SDL_cocoakeyboard.h @@ -27,7 +27,7 @@ extern void Cocoa_InitKeyboard(SDL_VideoDevice *_this); extern void Cocoa_HandleKeyEvent(SDL_VideoDevice *_this, NSEvent *event); extern void Cocoa_QuitKeyboard(SDL_VideoDevice *_this); -extern int Cocoa_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window); +extern int Cocoa_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); extern int Cocoa_StopTextInput(SDL_VideoDevice *_this, SDL_Window *window); extern int Cocoa_UpdateTextInputArea(SDL_VideoDevice *_this, SDL_Window *window); diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 685d6752df7e7..1bc0664da7ed8 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -381,7 +381,7 @@ void Cocoa_InitKeyboard(SDL_VideoDevice *_this) SDL_ToggleModState(SDL_KMOD_CAPS, (data.modifierFlags & NSEventModifierFlagCapsLock) ? SDL_TRUE : SDL_FALSE); } -int Cocoa_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window) +int Cocoa_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { @autoreleasepool { NSView *parentView; diff --git a/src/video/gdk/SDL_gdktextinput.cpp b/src/video/gdk/SDL_gdktextinput.cpp index 7af1b381a0409..0c6b1d30c10be 100644 --- a/src/video/gdk/SDL_gdktextinput.cpp +++ b/src/video/gdk/SDL_gdktextinput.cpp @@ -178,7 +178,7 @@ void GDK_EnsureHints(void) } } -int GDK_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window) +int GDK_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { /* * Currently a stub, since all input is handled by the virtual keyboard, @@ -226,7 +226,7 @@ SDL_bool GDK_HasScreenKeyboardSupport(SDL_VideoDevice *_this) return SDL_TRUE; } -void GDK_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) +void GDK_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { /* * There is XGameUiTextEntryOpen but it's only in online docs, @@ -253,6 +253,39 @@ void GDK_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) return; } + XGameUiTextEntryInputScope scope; + switch (SDL_GetTextInputType(props)) { + default: + case SDL_TEXTINPUT_TYPE_TEXT: + scope = (XGameUiTextEntryInputScope)g_TextInputScope; + break; + case SDL_TEXTINPUT_TYPE_TEXT_NAME: + scope = XGameUiTextEntryInputScope::Default; + break; + case SDL_TEXTINPUT_TYPE_TEXT_EMAIL: + scope = XGameUiTextEntryInputScope::EmailSmtpAddress; + break; + case SDL_TEXTINPUT_TYPE_TEXT_USERNAME: + scope = XGameUiTextEntryInputScope::Default; + break; + case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN: + scope = XGameUiTextEntryInputScope::Password; + break; + case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE: + scope = XGameUiTextEntryInputScope::Default; + break; + case SDL_TEXTINPUT_TYPE_NUMBER: + scope = XGameUiTextEntryInputScope::Number; + break; + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN: + // FIXME: Password or number scope? + scope = XGameUiTextEntryInputScope::Number; + break; + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE: + scope = XGameUiTextEntryInputScope::Number; + break; + } + g_TextBlock->queue = g_TextTaskQueue; g_TextBlock->context = _this; g_TextBlock->callback = GDK_InternalTextEntryCallback; @@ -261,7 +294,7 @@ void GDK_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) g_TitleText, g_DescriptionText, g_DefaultText, - (XGameUiTextEntryInputScope)g_TextInputScope, + scope, (uint32_t)g_MaxTextLength))) { SDL_free(g_TextBlock); g_TextBlock = NULL; diff --git a/src/video/gdk/SDL_gdktextinput.h b/src/video/gdk/SDL_gdktextinput.h index cbd043885cb3b..4b343da973bfd 100644 --- a/src/video/gdk/SDL_gdktextinput.h +++ b/src/video/gdk/SDL_gdktextinput.h @@ -32,13 +32,13 @@ extern "C" { void GDK_EnsureHints(void); -int GDK_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window); +int GDK_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); int GDK_StopTextInput(SDL_VideoDevice *_this, SDL_Window *window); int GDK_UpdateTextInputArea(SDL_VideoDevice *_this, SDL_Window *window); int GDK_ClearComposition(SDL_VideoDevice *_this, SDL_Window *window); SDL_bool GDK_HasScreenKeyboardSupport(SDL_VideoDevice *_this); -void GDK_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); +void GDK_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); void GDK_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); SDL_bool GDK_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window); diff --git a/src/video/n3ds/SDL_n3dsswkb.c b/src/video/n3ds/SDL_n3dsswkb.c index 51c38d8d2ccf4..d15d654895680 100644 --- a/src/video/n3ds/SDL_n3dsswkb.c +++ b/src/video/n3ds/SDL_n3dsswkb.c @@ -50,7 +50,7 @@ SDL_bool N3DS_HasScreenKeyboardSupport(SDL_VideoDevice *_this) return SDL_TRUE; } -int N3DS_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window) +int N3DS_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { char buffer[BUFFER_SIZE]; SwkbdButton button_pressed; diff --git a/src/video/n3ds/SDL_n3dsswkb.h b/src/video/n3ds/SDL_n3dsswkb.h index 0f505ebe89101..199e9e8c5579e 100644 --- a/src/video/n3ds/SDL_n3dsswkb.h +++ b/src/video/n3ds/SDL_n3dsswkb.h @@ -30,7 +30,7 @@ void N3DS_SwkbQuit(); SDL_bool N3DS_HasScreenKeyboardSupport(SDL_VideoDevice *_this); -int N3DS_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window); +int N3DS_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); int N3DS_StopTextInput(SDL_VideoDevice *_this, SDL_Window *window); #endif /* SDL_n3dskeyboard_h_ */ diff --git a/src/video/psp/SDL_pspvideo.c b/src/video/psp/SDL_pspvideo.c index bec60d0d14a7e..1897e2ea6bc76 100644 --- a/src/video/psp/SDL_pspvideo.c +++ b/src/video/psp/SDL_pspvideo.c @@ -249,7 +249,7 @@ SDL_bool PSP_HasScreenKeyboardSupport(SDL_VideoDevice *_this) return SDL_TRUE; } -void PSP_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) +void PSP_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { char list[0x20000] __attribute__((aligned(64))); // Needed for sceGuStart to work int i; @@ -266,7 +266,36 @@ void PSP_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) data.language = PSP_UTILITY_OSK_LANGUAGE_DEFAULT; data.lines = 1; data.unk_24 = 1; - data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; + switch (SDL_GetTextInputType(props)) { + default: + case SDL_TEXTINPUT_TYPE_TEXT: + data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; + break; + case SDL_TEXTINPUT_TYPE_TEXT_NAME: + data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; + break; + case SDL_TEXTINPUT_TYPE_TEXT_EMAIL: + data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; + break; + case SDL_TEXTINPUT_TYPE_TEXT_USERNAME: + data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; + break; + case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN: + data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; + break; + case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE: + data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; + break; + case SDL_TEXTINPUT_TYPE_NUMBER: + data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_LATIN_DIGIT; + break; + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN: + data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_LATIN_DIGIT; + break; + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE: + data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_LATIN_DIGIT; + break; + } data.desc = NULL; data.intext = NULL; data.outtextlength = input_text_length; diff --git a/src/video/psp/SDL_pspvideo.h b/src/video/psp/SDL_pspvideo.h index 50de4bca8a759..79351ffb998b9 100644 --- a/src/video/psp/SDL_pspvideo.h +++ b/src/video/psp/SDL_pspvideo.h @@ -74,7 +74,7 @@ int PSP_GL_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context); /* PSP on screen keyboard */ SDL_bool PSP_HasScreenKeyboardSupport(SDL_VideoDevice *_this); -void PSP_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); +void PSP_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); void PSP_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); SDL_bool PSP_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window); diff --git a/src/video/uikit/SDL_uikitviewcontroller.h b/src/video/uikit/SDL_uikitviewcontroller.h index cfd8767dba63c..6433e7c33c3c4 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.h +++ b/src/video/uikit/SDL_uikitviewcontroller.h @@ -88,7 +88,7 @@ #ifdef SDL_IPHONE_KEYBOARD SDL_bool UIKit_HasScreenKeyboardSupport(SDL_VideoDevice *_this); -void UIKit_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); +void UIKit_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); void UIKit_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); SDL_bool UIKit_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window); int UIKit_UpdateTextInputArea(SDL_VideoDevice *_this, SDL_Window *window); diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m index 20a3aae0c01cd..db85b25339a68 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.m +++ b/src/video/uikit/SDL_uikitviewcontroller.m @@ -278,15 +278,6 @@ - (void)initKeyboard textField.text = obligateForBackspace; committedText = textField.text; - /* set UITextInputTrait properties, mostly to defaults */ - textField.autocapitalizationType = UITextAutocapitalizationTypeNone; - textField.autocorrectionType = UITextAutocorrectionTypeNo; - textField.enablesReturnKeyAutomatically = NO; - textField.keyboardAppearance = UIKeyboardAppearanceDefault; - textField.keyboardType = UIKeyboardTypeDefault; - textField.returnKeyType = UIReturnKeyDefault; - textField.secureTextEntry = NO; - textField.hidden = YES; keyboardVisible = NO; @@ -393,6 +384,103 @@ - (void)deinitKeyboard object:nil]; } +- (void)setKeyboardProperties:(SDL_PropertiesID) props +{ + textField.secureTextEntry = NO; + + switch (SDL_GetTextInputType(props)) { + default: + case SDL_TEXTINPUT_TYPE_TEXT: + textField.keyboardType = UIKeyboardTypeDefault; + textField.textContentType = nil; + break; + case SDL_TEXTINPUT_TYPE_TEXT_NAME: + textField.keyboardType = UIKeyboardTypeDefault; + textField.textContentType = UITextContentTypeName; + break; + case SDL_TEXTINPUT_TYPE_TEXT_EMAIL: + textField.keyboardType = UIKeyboardTypeEmailAddress; + textField.textContentType = UITextContentTypeEmailAddress; + break; + case SDL_TEXTINPUT_TYPE_TEXT_USERNAME: + textField.keyboardType = UIKeyboardTypeDefault; + if (@available(iOS 11.0, *)) { + textField.textContentType = UITextContentTypeUsername; + } else { + textField.textContentType = nil; + } + break; + case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN: + textField.keyboardType = UIKeyboardTypeDefault; + if (@available(iOS 11.0, *)) { + textField.textContentType = UITextContentTypePassword; + } else { + textField.textContentType = nil; + } + textField.secureTextEntry = YES; + break; + case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE: + textField.keyboardType = UIKeyboardTypeDefault; + if (@available(iOS 11.0, *)) { + textField.textContentType = UITextContentTypePassword; + } else { + textField.textContentType = nil; + } + break; + case SDL_TEXTINPUT_TYPE_NUMBER: + textField.keyboardType = UIKeyboardTypeNumberPad; + textField.textContentType = nil; + break; + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN: + textField.keyboardType = UIKeyboardTypeNumberPad; + if (@available(iOS 12.0, *)) { + textField.textContentType = UITextContentTypeOneTimeCode; + } else { + textField.textContentType = nil; + } + textField.secureTextEntry = YES; + break; + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE: + textField.keyboardType = UIKeyboardTypeNumberPad; + if (@available(iOS 12.0, *)) { + textField.textContentType = UITextContentTypeOneTimeCode; + } else { + textField.textContentType = nil; + } + break; + } + + switch (SDL_GetTextInputCapitalization(props)) { + default: + case SDL_CAPITALIZE_NONE: + textField.autocapitalizationType = UITextAutocapitalizationTypeNone; + break; + case SDL_CAPITALIZE_LETTERS: + textField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters; + break; + case SDL_CAPITALIZE_WORDS: + textField.autocapitalizationType = UITextAutocapitalizationTypeWords; + break; + case SDL_CAPITALIZE_SENTENCES: + textField.autocapitalizationType = UITextAutocapitalizationTypeSentences; + break; + } + + if (SDL_GetTextInputAutocorrect(props)) { + textField.autocorrectionType = UITextAutocorrectionTypeYes; + textField.spellCheckingType = UITextSpellCheckingTypeYes; + } else { + textField.autocorrectionType = UITextAutocorrectionTypeNo; + textField.spellCheckingType = UITextSpellCheckingTypeNo; + } + + if (SDL_GetTextInputMultiline(props)) { + textField.enablesReturnKeyAutomatically = YES; + } else { + textField.enablesReturnKeyAutomatically = NO; + } +} + /* reveal onscreen virtual keyboard */ - (void)showKeyboard { @@ -596,10 +684,11 @@ SDL_bool UIKit_HasScreenKeyboardSupport(SDL_VideoDevice *_this) return SDL_TRUE; } -void UIKit_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) +void UIKit_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { @autoreleasepool { SDL_uikitviewcontroller *vc = GetWindowViewController(window); + [vc setKeyboardProperties:props]; [vc showKeyboard]; } } diff --git a/src/video/vita/SDL_vitavideo.c b/src/video/vita/SDL_vitavideo.c index a8bafc5ed05c5..c5ced23e3461b 100644 --- a/src/video/vita/SDL_vitavideo.c +++ b/src/video/vita/SDL_vitavideo.c @@ -411,7 +411,7 @@ void VITA_ImeEventHandler(void *arg, const SceImeEventData *e) } #endif -void VITA_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) +void VITA_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { SDL_VideoData *videodata = _this->internal; SceInt32 res; @@ -427,8 +427,46 @@ void VITA_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) param.supportedLanguages = SCE_IME_LANGUAGE_ENGLISH_US; param.languagesForced = SCE_FALSE; - param.type = SCE_IME_TYPE_DEFAULT; - param.option = SCE_IME_OPTION_NO_ASSISTANCE; + switch (SDL_GetTextInputType(props)) { + default: + case SDL_TEXTINPUT_TYPE_TEXT: + param.type = SCE_IME_TYPE_DEFAULT; + break; + case SDL_TEXTINPUT_TYPE_TEXT_NAME: + param.type = SCE_IME_TYPE_DEFAULT; + break; + case SDL_TEXTINPUT_TYPE_TEXT_EMAIL: + param.type = SCE_IME_TYPE_MAIL; + break; + case SDL_TEXTINPUT_TYPE_TEXT_USERNAME: + param.type = SCE_IME_TYPE_DEFAULT; + break; + case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN: + param.type = SCE_IME_TYPE_DEFAULT; + break; + case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE: + param.type = SCE_IME_TYPE_DEFAULT; + break; + case SDL_TEXTINPUT_TYPE_NUMBER: + param.type = SCE_IME_TYPE_NUMBER; + break; + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN: + param.type = SCE_IME_TYPE_NUMBER; + break; + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE: + param.type = SCE_IME_TYPE_NUMBER; + break; + } + param.option = 0; + if (SDL_GetTextInputCapitalization(props) != SDL_CAPITALIZE_SENTENCES) { + param.option |= SCE_IME_OPTION_NO_AUTO_CAPITALIZATION; + } + if (!SDL_GetTextInputAutocorrect(props)) { + param.option |= SCE_IME_OPTION_NO_ASSISTANCE; + } + if (SDL_GetTextInputMultiline(props)) { + param.option |= SCE_IME_OPTION_MULTILINE; + } param.inputTextBuffer = libime_out; param.maxTextLength = SCE_IME_MAX_TEXT_LENGTH; param.handler = VITA_ImeEventHandler; diff --git a/src/video/vita/SDL_vitavideo.h b/src/video/vita/SDL_vitavideo.h index 610d0c0dee11d..61aa6646faa18 100644 --- a/src/video/vita/SDL_vitavideo.h +++ b/src/video/vita/SDL_vitavideo.h @@ -97,7 +97,7 @@ int VITA_GLES_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context); /* VITA on screen keyboard */ SDL_bool VITA_HasScreenKeyboardSupport(SDL_VideoDevice *_this); -void VITA_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); +void VITA_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); void VITA_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); SDL_bool VITA_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window); diff --git a/src/video/wayland/SDL_waylandkeyboard.c b/src/video/wayland/SDL_waylandkeyboard.c index 854197e9c4398..88152c95fb74f 100644 --- a/src/video/wayland/SDL_waylandkeyboard.c +++ b/src/video/wayland/SDL_waylandkeyboard.c @@ -51,7 +51,7 @@ void Wayland_QuitKeyboard(SDL_VideoDevice *_this) #endif } -int Wayland_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window) +int Wayland_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { SDL_VideoData *internal = _this->internal; struct SDL_WaylandInput *input = internal->input; @@ -59,13 +59,71 @@ int Wayland_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window) if (internal->text_input_manager) { if (input && input->text_input) { const SDL_Rect *rect = &input->text_input->cursor_rect; + enum zwp_text_input_v3_content_hint hint = ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE; + enum zwp_text_input_v3_content_purpose purpose; + + switch (SDL_GetTextInputType(props)) { + default: + case SDL_TEXTINPUT_TYPE_TEXT: + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL; + break; + case SDL_TEXTINPUT_TYPE_TEXT_NAME: + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NAME; + break; + case SDL_TEXTINPUT_TYPE_TEXT_EMAIL: + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_EMAIL; + break; + case SDL_TEXTINPUT_TYPE_TEXT_USERNAME: + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_SENSITIVE_DATA; + break; + case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN: + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PASSWORD; + hint |= (ZWP_TEXT_INPUT_V3_CONTENT_HINT_HIDDEN_TEXT | ZWP_TEXT_INPUT_V3_CONTENT_HINT_SENSITIVE_DATA); + break; + case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE: + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PASSWORD; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_SENSITIVE_DATA; + break; + case SDL_TEXTINPUT_TYPE_NUMBER: + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NUMBER; + break; + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN: + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PIN; + hint |= (ZWP_TEXT_INPUT_V3_CONTENT_HINT_HIDDEN_TEXT | ZWP_TEXT_INPUT_V3_CONTENT_HINT_SENSITIVE_DATA); + break; + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE: + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PIN; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_SENSITIVE_DATA; + break; + } + + switch (SDL_GetTextInputCapitalization(props)) { + default: + case SDL_CAPITALIZE_NONE: + break; + case SDL_CAPITALIZE_LETTERS: + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_UPPERCASE; + break; + case SDL_CAPITALIZE_WORDS: + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_TITLECASE; + break; + case SDL_CAPITALIZE_SENTENCES: + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_AUTO_CAPITALIZATION; + break; + } + + if (SDL_GetTextInputAutocorrect(props)) { + hint |= (ZWP_TEXT_INPUT_V3_CONTENT_HINT_COMPLETION | ZWP_TEXT_INPUT_V3_CONTENT_HINT_SPELLCHECK); + } + if (SDL_GetTextInputMultiline(props)) { + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_MULTILINE; + } zwp_text_input_v3_enable(input->text_input->text_input); /* Now that it's enabled, set the input properties */ - zwp_text_input_v3_set_content_type(input->text_input->text_input, - ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE, - ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL); + zwp_text_input_v3_set_content_type(input->text_input->text_input, hint, purpose); if (!SDL_RectEmpty(rect)) { /* This gets reset on enable so we have to cache it */ zwp_text_input_v3_set_cursor_rectangle(input->text_input->text_input, diff --git a/src/video/wayland/SDL_waylandkeyboard.h b/src/video/wayland/SDL_waylandkeyboard.h index 8550aec2b44de..c85bfc84b7c47 100644 --- a/src/video/wayland/SDL_waylandkeyboard.h +++ b/src/video/wayland/SDL_waylandkeyboard.h @@ -32,7 +32,7 @@ typedef struct SDL_WaylandTextInput extern int Wayland_InitKeyboard(SDL_VideoDevice *_this); extern void Wayland_QuitKeyboard(SDL_VideoDevice *_this); -extern int Wayland_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window); +extern int Wayland_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); extern int Wayland_StopTextInput(SDL_VideoDevice *_this, SDL_Window *window); extern int Wayland_UpdateTextInputArea(SDL_VideoDevice *_this, SDL_Window *window); extern SDL_bool Wayland_HasScreenKeyboardSupport(SDL_VideoDevice *_this); diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index fe141c576bd59..304f15491a1f7 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -196,7 +196,7 @@ void WIN_ResetDeadKeys(void) } } -int WIN_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window) +int WIN_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { WIN_ResetDeadKeys(); diff --git a/src/video/windows/SDL_windowskeyboard.h b/src/video/windows/SDL_windowskeyboard.h index 15de35f208c46..efdff742d3036 100644 --- a/src/video/windows/SDL_windowskeyboard.h +++ b/src/video/windows/SDL_windowskeyboard.h @@ -29,7 +29,7 @@ extern void WIN_QuitKeyboard(SDL_VideoDevice *_this); extern void WIN_ResetDeadKeys(void); -extern int WIN_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window); +extern int WIN_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); extern int WIN_StopTextInput(SDL_VideoDevice *_this, SDL_Window *window); extern int WIN_UpdateTextInputArea(SDL_VideoDevice *_this, SDL_Window *window); extern int WIN_ClearComposition(SDL_VideoDevice *_this, SDL_Window *window); diff --git a/src/video/winrt/SDL_winrtevents_c.h b/src/video/winrt/SDL_winrtevents_c.h index e77e37d90e901..55a20f921d189 100644 --- a/src/video/winrt/SDL_winrtevents_c.h +++ b/src/video/winrt/SDL_winrtevents_c.h @@ -69,7 +69,7 @@ extern void WINRT_ProcessCharacterReceivedEvent(SDL_Window *window, Windows::UI: #if NTDDI_VERSION >= NTDDI_WIN10 extern void WINTRT_InitialiseInputPaneEvents(SDL_VideoDevice *_this); extern SDL_bool WINRT_HasScreenKeyboardSupport(SDL_VideoDevice *_this); -extern void WINRT_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); +extern void WINRT_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); extern void WINRT_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); extern SDL_bool WINRT_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window); #endif // NTDDI_VERSION >= ... diff --git a/src/video/winrt/SDL_winrtkeyboard.cpp b/src/video/winrt/SDL_winrtkeyboard.cpp index 02a68dc44b851..c2b5649da491d 100644 --- a/src/video/winrt/SDL_winrtkeyboard.cpp +++ b/src/video/winrt/SDL_winrtkeyboard.cpp @@ -148,7 +148,7 @@ SDL_bool WINRT_HasScreenKeyboardSupport(SDL_VideoDevice *_this) return SDL_TRUE; } -void WINRT_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) +void WINRT_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { using namespace Windows::UI::ViewManagement; InputPane ^ inputPane = InputPane::GetForCurrentView(); diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index 753abb3c83490..dcfcdf8f1d924 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/src/video/x11/SDL_x11keyboard.c @@ -421,7 +421,7 @@ static void X11_ResetXIM(SDL_VideoDevice *_this, SDL_Window *window) #endif } -int X11_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window) +int X11_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { X11_ResetXIM(_this, window); @@ -451,7 +451,7 @@ SDL_bool X11_HasScreenKeyboardSupport(SDL_VideoDevice *_this) return videodata->is_steam_deck; } -void X11_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) +void X11_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) { SDL_VideoData *videodata = _this->internal; @@ -459,10 +459,33 @@ void X11_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) /* For more documentation of the URL parameters, see: * https://partner.steamgames.com/doc/api/ISteamUtils#ShowFloatingGamepadTextInput */ + const int k_EFloatingGamepadTextInputModeModeSingleLine = 0; // Enter dismisses the keyboard + const int k_EFloatingGamepadTextInputModeModeMultipleLines = 1; // User needs to explicitly dismiss the keyboard + const int k_EFloatingGamepadTextInputModeModeEmail = 2; // Keyboard is displayed in a special mode that makes it easier to enter emails + const int k_EFloatingGamepadTextInputModeModeNumeric = 3; // Numeric keypad is shown char deeplink[128]; + int mode; + + switch (SDL_GetTextInputType(props)) { + case SDL_TEXTINPUT_TYPE_TEXT_EMAIL: + mode = k_EFloatingGamepadTextInputModeModeEmail; + break; + case SDL_TEXTINPUT_TYPE_NUMBER: + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN: + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE: + mode = k_EFloatingGamepadTextInputModeModeNumeric; + break; + default: + if (SDL_GetTextInputMultiline(props)) { + mode = k_EFloatingGamepadTextInputModeModeMultipleLines; + } else { + mode = k_EFloatingGamepadTextInputModeModeSingleLine; + } + break; + } (void)SDL_snprintf(deeplink, sizeof(deeplink), "steam://open/keyboard?XPosition=0&YPosition=0&Width=0&Height=0&Mode=%d", - SDL_GetHintBoolean(SDL_HINT_RETURN_KEY_HIDES_IME, SDL_FALSE) ? 0 : 1); + mode); SDL_OpenURL(deeplink); videodata->steam_keyboard_open = SDL_TRUE; } diff --git a/src/video/x11/SDL_x11keyboard.h b/src/video/x11/SDL_x11keyboard.h index 60e96af0bd570..364e1bc678a31 100644 --- a/src/video/x11/SDL_x11keyboard.h +++ b/src/video/x11/SDL_x11keyboard.h @@ -26,11 +26,11 @@ extern int X11_InitKeyboard(SDL_VideoDevice *_this); extern void X11_UpdateKeymap(SDL_VideoDevice *_this, SDL_bool send_event); extern void X11_QuitKeyboard(SDL_VideoDevice *_this); -extern int X11_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window); +extern int X11_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); extern int X11_StopTextInput(SDL_VideoDevice *_this, SDL_Window *window); extern int X11_UpdateTextInputArea(SDL_VideoDevice *_this, SDL_Window *window); extern SDL_bool X11_HasScreenKeyboardSupport(SDL_VideoDevice *_this); -extern void X11_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); +extern void X11_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props); extern void X11_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window); extern SDL_bool X11_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window); extern KeySym X11_KeyCodeToSym(SDL_VideoDevice *_this, KeyCode, unsigned char group, unsigned int mod_mask); diff --git a/test/testime.c b/test/testime.c index 8727c720dd77f..e5ae2e9141ff2 100644 --- a/test/testime.c +++ b/test/testime.c @@ -15,6 +15,7 @@ #include #include +#include #ifdef HAVE_SDL_TTF #include "SDL_ttf.h" #endif @@ -40,6 +41,11 @@ #endif #define MAX_TEXT_LENGTH 256 +#define WINDOW_WIDTH 640 +#define WINDOW_HEIGHT 480 + +#define MARGIN 32.0f +#define LINE_HEIGHT (FONT_CHARACTER_SIZE + 4.0f) #define CURSOR_BLINK_INTERVAL_MS 500 typedef struct @@ -47,6 +53,10 @@ typedef struct SDL_Window *window; SDL_Renderer *renderer; int rendererID; + SDL_bool settings_visible; + SDL_Texture *settings_icon; + SDL_FRect settings_rect; + SDL_PropertiesID text_settings; SDL_FRect textRect; SDL_FRect markedRect; char text[MAX_TEXT_LENGTH]; @@ -68,6 +78,33 @@ static const SDL_Color backColor = { 255, 255, 255, 255 }; static const SDL_Color textColor = { 0, 0, 0, 255 }; static SDL_BlendMode highlight_mode; +static const struct +{ + const char *label; + const char *setting; + int value; +} settings[] = { + { "Text", SDL_PROP_TEXTINPUT_TYPE_NUMBER, SDL_TEXTINPUT_TYPE_TEXT }, + { "Name", SDL_PROP_TEXTINPUT_TYPE_NUMBER, SDL_TEXTINPUT_TYPE_TEXT_NAME }, + { "E-mail", SDL_PROP_TEXTINPUT_TYPE_NUMBER, SDL_TEXTINPUT_TYPE_TEXT_EMAIL }, + { "Username", SDL_PROP_TEXTINPUT_TYPE_NUMBER, SDL_TEXTINPUT_TYPE_TEXT_USERNAME }, + { "Password (hidden)", SDL_PROP_TEXTINPUT_TYPE_NUMBER, SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN }, + { "Password (visible)", SDL_PROP_TEXTINPUT_TYPE_NUMBER, SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE }, + { "Number", SDL_PROP_TEXTINPUT_TYPE_NUMBER, SDL_TEXTINPUT_TYPE_NUMBER }, + { "Numeric PIN (hidden)", SDL_PROP_TEXTINPUT_TYPE_NUMBER, SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN }, + { "Numeric PIN (visible)", SDL_PROP_TEXTINPUT_TYPE_NUMBER, SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE }, + { "", NULL }, + { "No capitalization", SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER, SDL_CAPITALIZE_NONE }, + { "Capitalize sentences", SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER, SDL_CAPITALIZE_SENTENCES }, + { "Capitalize words", SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER, SDL_CAPITALIZE_WORDS }, + { "All caps", SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER, SDL_CAPITALIZE_LETTERS }, + { "", NULL }, + { "Auto-correct OFF", SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN, SDL_FALSE }, + { "Auto-correct ON", SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN, SDL_TRUE }, + { "Multiline OFF", SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN, SDL_FALSE }, + { "Multiline ON", SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN, SDL_TRUE } +}; + #ifdef HAVE_SDL_TTF static TTF_Font *font; #else @@ -487,7 +524,9 @@ static void InitInput(WindowState *ctx) ctx->textRect.h = 50.0f; ctx->markedRect = ctx->textRect; - SDL_StartTextInput(ctx->window); + ctx->text_settings = SDL_CreateProperties(); + + SDL_StartTextInputWithProperties(ctx->window, ctx->text_settings); } @@ -692,6 +731,7 @@ static void CleanupVideo(void) SDL_StopTextInput(ctx->window); ClearCandidates(ctx); + SDL_DestroyProperties(ctx->text_settings); } #ifdef HAVE_SDL_TTF TTF_CloseFont(font); @@ -701,11 +741,85 @@ static void CleanupVideo(void) #endif } +static void DrawSettingsButton(WindowState *ctx) +{ + SDL_Renderer *renderer = ctx->renderer; + + SDL_RenderTexture(renderer, ctx->settings_icon, NULL, &ctx->settings_rect); +} + +static void ToggleSettings(WindowState *ctx) +{ + if (ctx->settings_visible) { + ctx->settings_visible = SDL_FALSE; + SDL_StartTextInputWithProperties(ctx->window, ctx->text_settings); + } else { + SDL_StopTextInput(ctx->window); + ctx->settings_visible = SDL_TRUE; + } +} + +static void DrawSettings(WindowState *ctx) +{ + SDL_Renderer *renderer = ctx->renderer; + SDL_FRect checkbox; + int i; + + checkbox.x = MARGIN; + checkbox.y = MARGIN; + checkbox.w = (float)FONT_CHARACTER_SIZE; + checkbox.h = (float)FONT_CHARACTER_SIZE; + + for (i = 0; i < SDL_arraysize(settings); ++i) { + if (settings[i].setting) { + int value = (int)SDL_GetNumberProperty(ctx->text_settings, settings[i].setting, 0); + if (value == settings[i].value) { + SDL_SetRenderDrawColor(renderer, 255, 255, 0, 255); + SDL_RenderFillRect(renderer, &checkbox); + } + SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a); + SDL_RenderRect(renderer, &checkbox); + SDLTest_DrawString(renderer, checkbox.x + checkbox.w + 8.0f, checkbox.y, settings[i].label); + } + checkbox.y += LINE_HEIGHT; + } +} + +static void ClickSettings(WindowState *ctx, float x, float y) +{ + int setting = (int)SDL_floorf((y - MARGIN) / LINE_HEIGHT); + if (setting >= 0 && setting < SDL_arraysize(settings)) { + SDL_SetNumberProperty(ctx->text_settings, settings[setting].setting, settings[setting].value); + } +} + static void RedrawWindow(WindowState *ctx) { SDL_Renderer *renderer = ctx->renderer; int rendererID = ctx->rendererID; SDL_FRect drawnTextRect, cursorRect, underlineRect; + char text[MAX_TEXT_LENGTH]; + + DrawSettingsButton(ctx); + + if (ctx->settings_visible) { + DrawSettings(ctx); + return; + } + + /* Hide the text if it's a password */ + switch ((SDL_TextInputType)SDL_GetNumberProperty(ctx->text_settings, SDL_PROP_TEXTINPUT_TYPE_NUMBER, SDL_TEXTINPUT_TYPE_TEXT)) { + case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN: + case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN: { + size_t len = SDL_utf8strlen(ctx->text); + SDL_memset(text, '*', len); + text[len] = '\0'; + break; + } + default: + SDL_strlcpy(text, ctx->text, sizeof(text)); + break; + } SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a); SDL_RenderFillRect(renderer, &ctx->textRect); @@ -716,9 +830,9 @@ static void RedrawWindow(WindowState *ctx) drawnTextRect.w = 0.0f; drawnTextRect.h = UNIFONT_GLYPH_SIZE * UNIFONT_DRAW_SCALE; - if (ctx->text[0]) { + if (text[0]) { #ifdef HAVE_SDL_TTF - SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, ctx->text, textColor); + SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, textColor); SDL_Texture *texture; /* Vertically center text */ @@ -732,7 +846,7 @@ static void RedrawWindow(WindowState *ctx) SDL_RenderTexture(renderer, texture, NULL, &drawnTextRect); SDL_DestroyTexture(texture); #else - char *utext = ctx->text; + char *utext = text; Uint32 codepoint; size_t len; SDL_FRect dstrect; @@ -756,13 +870,6 @@ static void RedrawWindow(WindowState *ctx) /* The marked text rectangle is the text area that hasn't been filled by committed text */ ctx->markedRect.x = ctx->textRect.x + drawnTextRect.w; ctx->markedRect.w = ctx->textRect.w - drawnTextRect.w; - if (ctx->markedRect.w < 0) { - /* Stop text input because we cannot hold any more characters */ - SDL_StopTextInput(ctx->window); - return; - } else { - SDL_StartTextInput(ctx->window); - } /* Update the drawn text rectangle for composition text, after the committed text */ drawnTextRect.x += drawnTextRect.w; @@ -974,10 +1081,18 @@ int main(int argc, char *argv[]) WindowState *ctx = &windowstate[i]; SDL_Window *window = state->windows[i]; SDL_Renderer *renderer = state->renderers[i]; + int icon_w = 0, icon_h = 0; + + SDL_SetRenderLogicalPresentation(renderer, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_LOGICAL_PRESENTATION_LETTERBOX, SDL_SCALEMODE_LINEAR); ctx->window = window; ctx->renderer = renderer; ctx->rendererID = i; + ctx->settings_icon = LoadTexture(renderer, "icon.bmp", SDL_TRUE, &icon_w, &icon_h); + ctx->settings_rect.x = (float)WINDOW_WIDTH - icon_w - MARGIN; + ctx->settings_rect.y = MARGIN; + ctx->settings_rect.w = (float)icon_w; + ctx->settings_rect.h = (float)icon_h; InitInput(ctx); @@ -999,6 +1114,23 @@ int main(int argc, char *argv[]) while (SDL_PollEvent(&event)) { SDLTest_CommonEvent(state, &event, &done); switch (event.type) { + case SDL_EVENT_MOUSE_BUTTON_UP: { + SDL_FPoint point; + WindowState *ctx = GetWindowStateForWindowID(event.button.windowID); + if (!ctx) { + break; + } + + SDL_ConvertEventToRenderCoordinates(ctx->renderer, &event); + point.x = event.button.x; + point.y = event.button.y; + if (SDL_PointInRectFloat(&point, &ctx->settings_rect)) { + ToggleSettings(ctx); + } else if (ctx->settings_visible) { + ClickSettings(ctx, point.x, point.y); + } + break; + } case SDL_EVENT_KEY_DOWN: { WindowState *ctx = GetWindowStateForWindowID(event.key.windowID); if (!ctx) { From 50492e1d0330cac1a87260463ca3e9f7396dd971 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Aug 2024 14:30:45 -0700 Subject: [PATCH 114/253] Change the text input defaults to match the natural input experience --- include/SDL3/SDL_keyboard.h | 6 +++--- src/video/SDL_video.c | 15 +++++++++++++-- test/testime.c | 31 ++++++++++++++++++++++++++++++- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index 67c4f5842e037..14d1446e6092a 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -426,9 +426,9 @@ typedef enum SDL_Capitalization * These are the supported properties: * * - `SDL_PROP_TEXTINPUT_TYPE_NUMBER` - an SDL_TextInputType value that describes text being input, defaults to SDL_TEXTINPUT_TYPE_TEXT. - * - `SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER` - an SDL_Capitalization value that describes how text should be capitalized, defaults to SDL_CAPITALIZE_NONE. - * - `SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN` - true to enable auto completion and auto correction. - * - `SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN` - true if multiple lines of text are allowed. This defaults to true if SDL_HINT_RETURN_KEY_HIDES_IME is "0" or is not set, and defaults to false if SDL_HINT_RETURN_KEY_HIDES_IME is "1". + * - `SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER` - an SDL_Capitalization value that describes how text should be capitalized, defaults to SDL_CAPITALIZE_SENTENCES for normal text entry, SDL_CAPITALIZE_WORDS for SDL_TEXTINPUT_TYPE_TEXT_NAME, and SDL_CAPITALIZE_NONE for e-mail addresses, usernames, and passwords. + * - `SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN` - true to enable auto completion and auto correction, defaults to SDL_TRUE. + * - `SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN` - true if multiple lines of text are allowed. This defaults to SDL_TRUE if SDL_HINT_RETURN_KEY_HIDES_IME is "0" or is not set, and defaults to SDL_FALSE if SDL_HINT_RETURN_KEY_HIDES_IME is "1". * * On Android you can directly specify the input type: * diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index fa6707f99e2da..5dfe7dabd7038 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -5137,12 +5137,23 @@ SDL_TextInputType SDL_GetTextInputType(SDL_PropertiesID props) SDL_Capitalization SDL_GetTextInputCapitalization(SDL_PropertiesID props) { - return (SDL_Capitalization)SDL_GetNumberProperty(props, SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER, SDL_CAPITALIZE_NONE); + if (SDL_HasProperty(props, SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER)) { + return (SDL_Capitalization)SDL_GetNumberProperty(props, SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER, SDL_CAPITALIZE_NONE); + } + + switch (SDL_GetTextInputType(props)) { + case SDL_TEXTINPUT_TYPE_TEXT: + return SDL_CAPITALIZE_SENTENCES; + case SDL_TEXTINPUT_TYPE_TEXT_NAME: + return SDL_CAPITALIZE_WORDS; + default: + return SDL_CAPITALIZE_NONE; + } } SDL_bool SDL_GetTextInputAutocorrect(SDL_PropertiesID props) { - return SDL_GetBooleanProperty(props, SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN, SDL_FALSE); + return SDL_GetBooleanProperty(props, SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN, SDL_TRUE); } SDL_bool SDL_GetTextInputMultiline(SDL_PropertiesID props) diff --git a/test/testime.c b/test/testime.c index e5ae2e9141ff2..f6cc4f0368d18 100644 --- a/test/testime.c +++ b/test/testime.c @@ -759,6 +759,35 @@ static void ToggleSettings(WindowState *ctx) } } +static int GetDefaultSetting(SDL_PropertiesID props, const char *setting) +{ + if (SDL_strcmp(setting, SDL_PROP_TEXTINPUT_TYPE_NUMBER) == 0) { + return SDL_TEXTINPUT_TYPE_TEXT; + } + + if (SDL_strcmp(setting, SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER) == 0) { + switch (SDL_GetNumberProperty(props, SDL_PROP_TEXTINPUT_TYPE_NUMBER, SDL_TEXTINPUT_TYPE_TEXT)) { + case SDL_TEXTINPUT_TYPE_TEXT: + return SDL_CAPITALIZE_SENTENCES; + case SDL_TEXTINPUT_TYPE_TEXT_NAME: + return SDL_CAPITALIZE_WORDS; + default: + return SDL_CAPITALIZE_NONE; + } + } + + if (SDL_strcmp(setting, SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN) == 0) { + return SDL_TRUE; + } + + if (SDL_strcmp(setting, SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN) == 0) { + return SDL_TRUE; + } + + SDL_assert(!"Unknown setting"); + return 0; +} + static void DrawSettings(WindowState *ctx) { SDL_Renderer *renderer = ctx->renderer; @@ -772,7 +801,7 @@ static void DrawSettings(WindowState *ctx) for (i = 0; i < SDL_arraysize(settings); ++i) { if (settings[i].setting) { - int value = (int)SDL_GetNumberProperty(ctx->text_settings, settings[i].setting, 0); + int value = (int)SDL_GetNumberProperty(ctx->text_settings, settings[i].setting, GetDefaultSetting(ctx->text_settings, settings[i].setting)); if (value == settings[i].value) { SDL_SetRenderDrawColor(renderer, 255, 255, 0, 255); SDL_RenderFillRect(renderer, &checkbox); From e058aa6d65c75811d65a2452992d550609958a17 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Fri, 2 Aug 2024 21:50:11 +0000 Subject: [PATCH 115/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_keyboard.h | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index 14d1446e6092a..07bce7545b52a 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -376,7 +376,9 @@ extern SDL_DECLSPEC int SDLCALL SDL_StartTextInput(SDL_Window *window); /** * Text input type. * - * These are the valid values for SDL_PROP_TEXTINPUT_TYPE_NUMBER. Not every value is valid on every platform, but where a value isn't supported, a reasonable fallback will be used. + * These are the valid values for SDL_PROP_TEXTINPUT_TYPE_NUMBER. Not every + * value is valid on every platform, but where a value isn't supported, a + * reasonable fallback will be used. * * \since This enum is available since SDL 3.0.0. * @@ -398,7 +400,10 @@ typedef enum SDL_TextInputType /** * Auto capitalization type. * - * These are the valid values for SDL_PROP_TEXTINPUT_AUTOCAPITALIZATION_NUMBER. Not every value is valid on every platform, but where a value isn't supported, a reasonable fallback will be used. + * These are the valid values for + * SDL_PROP_TEXTINPUT_AUTOCAPITALIZATION_NUMBER. Not every value is valid on + * every platform, but where a value isn't supported, a reasonable fallback + * will be used. * * \since This enum is available since SDL 3.0.0. * @@ -413,7 +418,8 @@ typedef enum SDL_Capitalization } SDL_Capitalization; /** - * Start accepting Unicode text input events in a window, with properties describing the input. + * Start accepting Unicode text input events in a window, with properties + * describing the input. * * This function will enable text input (SDL_EVENT_TEXT_INPUT and * SDL_EVENT_TEXT_EDITING events) in the specified window. Please use this @@ -425,14 +431,25 @@ typedef enum SDL_Capitalization * * These are the supported properties: * - * - `SDL_PROP_TEXTINPUT_TYPE_NUMBER` - an SDL_TextInputType value that describes text being input, defaults to SDL_TEXTINPUT_TYPE_TEXT. - * - `SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER` - an SDL_Capitalization value that describes how text should be capitalized, defaults to SDL_CAPITALIZE_SENTENCES for normal text entry, SDL_CAPITALIZE_WORDS for SDL_TEXTINPUT_TYPE_TEXT_NAME, and SDL_CAPITALIZE_NONE for e-mail addresses, usernames, and passwords. - * - `SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN` - true to enable auto completion and auto correction, defaults to SDL_TRUE. - * - `SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN` - true if multiple lines of text are allowed. This defaults to SDL_TRUE if SDL_HINT_RETURN_KEY_HIDES_IME is "0" or is not set, and defaults to SDL_FALSE if SDL_HINT_RETURN_KEY_HIDES_IME is "1". + * - `SDL_PROP_TEXTINPUT_TYPE_NUMBER` - an SDL_TextInputType value that + * describes text being input, defaults to SDL_TEXTINPUT_TYPE_TEXT. + * - `SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER` - an SDL_Capitalization value + * that describes how text should be capitalized, defaults to + * SDL_CAPITALIZE_SENTENCES for normal text entry, SDL_CAPITALIZE_WORDS for + * SDL_TEXTINPUT_TYPE_TEXT_NAME, and SDL_CAPITALIZE_NONE for e-mail + * addresses, usernames, and passwords. + * - `SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN` - true to enable auto completion + * and auto correction, defaults to SDL_TRUE. + * - `SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN` - true if multiple lines of text + * are allowed. This defaults to SDL_TRUE if SDL_HINT_RETURN_KEY_HIDES_IME + * is "0" or is not set, and defaults to SDL_FALSE if + * SDL_HINT_RETURN_KEY_HIDES_IME is "1". * * On Android you can directly specify the input type: * - * - `SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER` - the text input type to use, overriding other properties. This is documented at https://developer.android.com/reference/android/text/InputType + * - `SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER` - the text input type to + * use, overriding other properties. This is documented at + * https://developer.android.com/reference/android/text/InputType * * \param window the window to enable text input. * \param props the properties to use. From 2c1d40a9ebc670b6c2b2d3127811e167749da836 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Aug 2024 18:43:24 -0700 Subject: [PATCH 116/253] Added an error message when SDL_GetWindowFromID() fails --- src/video/SDL_video.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 5dfe7dabd7038..47677944d7a4a 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2649,13 +2649,17 @@ SDL_Window *SDL_GetWindowFromID(SDL_WindowID id) SDL_Window *window; if (!_this) { + SDL_UninitializedVideo(); return NULL; } - for (window = _this->windows; window; window = window->next) { - if (window->id == id) { - return window; + if (id) { + for (window = _this->windows; window; window = window->next) { + if (window->id == id) { + return window; + } } } + SDL_SetError("Invalid window ID"); \ return NULL; } From cea71fbfccbc417c603366fd8256e9e2ded220d5 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Aug 2024 18:55:30 -0700 Subject: [PATCH 117/253] SDL_cocoakeyboard: Fix errant semicolons in sendPendingKey and clearPendingKey definitions - These are ignored by Clang but produce a warning: "semicolon before method body is ignored" --- build-scripts/pkg-support/android/__main__.py | 0 src/video/cocoa/SDL_cocoakeyboard.m | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 build-scripts/pkg-support/android/__main__.py diff --git a/build-scripts/pkg-support/android/__main__.py b/build-scripts/pkg-support/android/__main__.py old mode 100644 new mode 100755 diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 1bc0664da7ed8..977c23e93ca72 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -203,7 +203,7 @@ - (void)setPendingKey:(int)rawcode scancode:(SDL_Scancode)scancode timestamp:(Ui _pendingTimestamp = timestamp; } -- (void)sendPendingKey; +- (void)sendPendingKey { if (_pendingRawCode < 0) { return; @@ -213,7 +213,7 @@ - (void)sendPendingKey; [self clearPendingKey]; } -- (void)clearPendingKey; +- (void)clearPendingKey { _pendingRawCode = -1; } From 79f4de9f7e1dd5d6cba2ba11b88173bcdca351b3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Aug 2024 19:36:31 -0700 Subject: [PATCH 118/253] Use SDL_PROP_APP_METADATA_IDENTIFIER_STRING for the app ID --- src/core/unix/SDL_appid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/unix/SDL_appid.c b/src/core/unix/SDL_appid.c index 30eaf16999182..4a3a53b222b89 100644 --- a/src/core/unix/SDL_appid.c +++ b/src/core/unix/SDL_appid.c @@ -59,7 +59,7 @@ const char *SDL_GetExeName(void) const char *SDL_GetAppID(void) { - const char *id_str = SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_NAME_STRING); + const char *id_str = SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_IDENTIFIER_STRING); if (!id_str) { /* If the hint isn't set, try to use the application's executable name */ From f57c597c60559a94e7d2f2bf1a606cf480b4f127 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 2 Aug 2024 23:47:03 +0200 Subject: [PATCH 119/253] Added SDL_GetWindowFromEvent --- VisualC-GDK/SDL/SDL.vcxproj | 2 + VisualC-GDK/SDL/SDL.vcxproj.filters | 2 + VisualC-WinRT/SDL-UWP.vcxproj | 2 + VisualC/SDL/SDL.vcxproj | 2 + VisualC/SDL/SDL.vcxproj.filters | 6 + include/SDL3/SDL_events.h | 14 ++ src/dynapi/SDL_dynapi.sym | 1 + src/dynapi/SDL_dynapi_overrides.h | 1 + src/dynapi/SDL_dynapi_procs.h | 1 + src/events/SDL_categories.c | 228 ++++++++++++++++++++++++++++ src/events/SDL_categories_c.h | 66 ++++++++ test/testautomation_events.c | 73 ++++++--- 12 files changed, 377 insertions(+), 21 deletions(-) create mode 100644 src/events/SDL_categories.c create mode 100644 src/events/SDL_categories_c.h diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj index dd9a4600b0ae5..f8905e12daa20 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj +++ b/VisualC-GDK/SDL/SDL.vcxproj @@ -408,6 +408,7 @@ + @@ -631,6 +632,7 @@ NotUsing NotUsing + diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters index 4260bfcd900a9..f3cd8ca92b09f 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj.filters +++ b/VisualC-GDK/SDL/SDL.vcxproj.filters @@ -43,6 +43,7 @@ + @@ -326,6 +327,7 @@ + diff --git a/VisualC-WinRT/SDL-UWP.vcxproj b/VisualC-WinRT/SDL-UWP.vcxproj index a80d0924bab2a..b5a5a49f4cee9 100644 --- a/VisualC-WinRT/SDL-UWP.vcxproj +++ b/VisualC-WinRT/SDL-UWP.vcxproj @@ -114,6 +114,7 @@ + @@ -316,6 +317,7 @@ NotUsing + diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index 3a7f523d9f907..59e786fc237f7 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -332,6 +332,7 @@ + @@ -521,6 +522,7 @@ NotUsing NotUsing + diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters index 24579a58ebcb0..d58f179c076ba 100644 --- a/VisualC/SDL/SDL.vcxproj.filters +++ b/VisualC/SDL/SDL.vcxproj.filters @@ -495,6 +495,9 @@ dynapi + + events + events @@ -998,6 +1001,9 @@ dynapi + + events + events diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index 7dda524100614..2c12c8a5cecbd 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -1400,6 +1400,20 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EventEnabled(Uint32 type); */ extern SDL_DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); +/** + * Get window associated with an event. + * + * \param event an event containing a `windowID`. + * + * \returns the associated window on success or NULL if there is none. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_PollEvent + * \sa SDL_WaitEvent + * \sa SDL_WaitEventTimeout + */ +extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromEvent(const SDL_Event *event); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 38aad316a8e65..b81e437b0a2d4 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -471,6 +471,7 @@ SDL3_0.0.0 { SDL_GetWindowBordersSize; SDL_GetWindowDisplayScale; SDL_GetWindowFlags; + SDL_GetWindowFromEvent; SDL_GetWindowFromID; SDL_GetWindowFullscreenMode; SDL_GetWindowICCProfile; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 004eee31cbb28..e096d67202cc9 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -496,6 +496,7 @@ #define SDL_GetWindowBordersSize SDL_GetWindowBordersSize_REAL #define SDL_GetWindowDisplayScale SDL_GetWindowDisplayScale_REAL #define SDL_GetWindowFlags SDL_GetWindowFlags_REAL +#define SDL_GetWindowFromEvent SDL_GetWindowFromEvent_REAL #define SDL_GetWindowFromID SDL_GetWindowFromID_REAL #define SDL_GetWindowFullscreenMode SDL_GetWindowFullscreenMode_REAL #define SDL_GetWindowICCProfile SDL_GetWindowICCProfile_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 6cdf7ff094b65..7c232e31707cd 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -516,6 +516,7 @@ SDL_DYNAPI_PROC(int,SDL_GetWindowAspectRatio,(SDL_Window *a, float *b, float *c) SDL_DYNAPI_PROC(int,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(float,SDL_GetWindowDisplayScale,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_WindowFlags,SDL_GetWindowFlags,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowFromEvent,(const SDL_Event *a),(a),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowFromID,(SDL_WindowID a),(a),return) SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetWindowFullscreenMode,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_GetWindowICCProfile,(SDL_Window *a, size_t *b),(a,b),return) diff --git a/src/events/SDL_categories.c b/src/events/SDL_categories.c new file mode 100644 index 0000000000000..cd57c632f988f --- /dev/null +++ b/src/events/SDL_categories.c @@ -0,0 +1,228 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_internal.h" + +/* SDL event categories */ + +#include "SDL_events_c.h" +#include "SDL_categories_c.h" + +SDL_EventCategory SDL_GetEventCategory(Uint32 type) +{ + if (type >= SDL_EVENT_USER && type <= SDL_EVENT_LAST) { + return SDL_EVENTCATEGORY_USER; + } + else if (type >= SDL_EVENT_DISPLAY_FIRST && type <= SDL_EVENT_DISPLAY_LAST) { + return SDL_EVENTCATEGORY_DISPLAY; + } + else if (type >= SDL_EVENT_WINDOW_FIRST && type <= SDL_EVENT_WINDOW_LAST) { + return SDL_EVENTCATEGORY_WINDOW; + } + switch (type) { + default: + return SDL_SetError("Unknown event type"); + + case SDL_EVENT_KEYMAP_CHANGED: + case SDL_EVENT_TERMINATING: + case SDL_EVENT_LOW_MEMORY: + case SDL_EVENT_WILL_ENTER_BACKGROUND: + case SDL_EVENT_DID_ENTER_BACKGROUND: + case SDL_EVENT_WILL_ENTER_FOREGROUND: + case SDL_EVENT_DID_ENTER_FOREGROUND: + case SDL_EVENT_LOCALE_CHANGED: + case SDL_EVENT_SYSTEM_THEME_CHANGED: + case SDL_EVENT_RENDER_TARGETS_RESET: + case SDL_EVENT_RENDER_DEVICE_RESET: + return SDL_EVENTCATEGORY_SYSTEM; + + case SDL_EVENT_QUIT: + return SDL_EVENTCATEGORY_QUIT; + + case SDL_EVENT_KEY_DOWN: + case SDL_EVENT_KEY_UP: + return SDL_EVENTCATEGORY_KEY; + + case SDL_EVENT_TEXT_EDITING: + return SDL_EVENTCATEGORY_EDIT; + + case SDL_EVENT_TEXT_INPUT: + return SDL_EVENTCATEGORY_TEXT; + + case SDL_EVENT_KEYBOARD_ADDED: + case SDL_EVENT_KEYBOARD_REMOVED: + return SDL_EVENTCATEGORY_KDEVICE; + + case SDL_EVENT_TEXT_EDITING_CANDIDATES: + return SDL_EVENTCATEGORY_EDIT_CANDIDATES; + + case SDL_EVENT_MOUSE_MOTION: + return SDL_EVENTCATEGORY_MOTION; + + case SDL_EVENT_MOUSE_BUTTON_DOWN: + case SDL_EVENT_MOUSE_BUTTON_UP: + return SDL_EVENTCATEGORY_BUTTON; + + case SDL_EVENT_MOUSE_WHEEL: + return SDL_EVENTCATEGORY_WHEEL; + + case SDL_EVENT_MOUSE_ADDED: + case SDL_EVENT_MOUSE_REMOVED: + return SDL_EVENTCATEGORY_MDEVICE; + + case SDL_EVENT_JOYSTICK_AXIS_MOTION: + return SDL_EVENTCATEGORY_JAXIS; + + case SDL_EVENT_JOYSTICK_BALL_MOTION: + return SDL_EVENTCATEGORY_JBALL; + + case SDL_EVENT_JOYSTICK_HAT_MOTION: + return SDL_EVENTCATEGORY_JHAT; + + case SDL_EVENT_JOYSTICK_BUTTON_DOWN: + case SDL_EVENT_JOYSTICK_BUTTON_UP: + return SDL_EVENTCATEGORY_JBUTTON; + + case SDL_EVENT_JOYSTICK_ADDED: + case SDL_EVENT_JOYSTICK_REMOVED: + case SDL_EVENT_JOYSTICK_UPDATE_COMPLETE: + return SDL_EVENTCATEGORY_JDEVICE; + + case SDL_EVENT_JOYSTICK_BATTERY_UPDATED: + return SDL_EVENTCATEGORY_JBATTERY; + + case SDL_EVENT_GAMEPAD_AXIS_MOTION: + return SDL_EVENTCATEGORY_GAXIS; + + case SDL_EVENT_GAMEPAD_BUTTON_DOWN: + case SDL_EVENT_GAMEPAD_BUTTON_UP: + return SDL_EVENTCATEGORY_GBUTTON; + + case SDL_EVENT_GAMEPAD_ADDED: + case SDL_EVENT_GAMEPAD_REMOVED: + case SDL_EVENT_GAMEPAD_REMAPPED: + case SDL_EVENT_GAMEPAD_UPDATE_COMPLETE: + case SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED: + return SDL_EVENTCATEGORY_GDEVICE; + + case SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN: + case SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION: + case SDL_EVENT_GAMEPAD_TOUCHPAD_UP: + return SDL_EVENTCATEGORY_GTOUCHPAD; + + case SDL_EVENT_GAMEPAD_SENSOR_UPDATE: + return SDL_EVENTCATEGORY_GSENSOR; + + case SDL_EVENT_FINGER_DOWN: + case SDL_EVENT_FINGER_UP: + case SDL_EVENT_FINGER_MOTION: + return SDL_EVENTCATEGORY_TFINGER; + + case SDL_EVENT_CLIPBOARD_UPDATE: + return SDL_EVENTCATEGORY_CLIPBOARD; + + case SDL_EVENT_DROP_FILE: + case SDL_EVENT_DROP_TEXT: + case SDL_EVENT_DROP_BEGIN: + case SDL_EVENT_DROP_COMPLETE: + case SDL_EVENT_DROP_POSITION: + return SDL_EVENTCATEGORY_DROP; + + case SDL_EVENT_AUDIO_DEVICE_ADDED: + case SDL_EVENT_AUDIO_DEVICE_REMOVED: + case SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED: + return SDL_EVENTCATEGORY_ADEVICE; + + case SDL_EVENT_SENSOR_UPDATE: + return SDL_EVENTCATEGORY_SENSOR; + + case SDL_EVENT_PEN_DOWN: + case SDL_EVENT_PEN_UP: + return SDL_EVENTCATEGORY_PTIP; + + case SDL_EVENT_PEN_MOTION: + return SDL_EVENTCATEGORY_PMOTION; + + case SDL_EVENT_PEN_BUTTON_DOWN: + case SDL_EVENT_PEN_BUTTON_UP: + return SDL_EVENTCATEGORY_PBUTTON; + + case SDL_EVENT_CAMERA_DEVICE_ADDED: + case SDL_EVENT_CAMERA_DEVICE_REMOVED: + case SDL_EVENT_CAMERA_DEVICE_APPROVED: + case SDL_EVENT_CAMERA_DEVICE_DENIED: + return SDL_EVENTCATEGORY_CDEVICE; + } +} + +SDL_Window *SDL_GetWindowFromEvent(const SDL_Event *event) +{ + SDL_WindowID windowID; + + switch (SDL_GetEventCategory(event->type)) { + case SDL_EVENTCATEGORY_USER: + windowID = event->user.windowID; + break; + case SDL_EVENTCATEGORY_WINDOW: + windowID = event->window.windowID; + break; + case SDL_EVENTCATEGORY_KEY: + windowID = event->key.windowID; + break; + case SDL_EVENTCATEGORY_EDIT: + windowID = event->edit.windowID; + break; + case SDL_EVENTCATEGORY_TEXT: + windowID = event->text.windowID; + break; + case SDL_EVENTCATEGORY_EDIT_CANDIDATES: + windowID = event->edit_candidates.windowID; + break; + case SDL_EVENTCATEGORY_MOTION: + windowID = event->motion.windowID; + break; + case SDL_EVENTCATEGORY_BUTTON: + windowID = event->button.windowID; + break; + case SDL_EVENTCATEGORY_WHEEL: + windowID = event->wheel.windowID; + break; + case SDL_EVENTCATEGORY_TFINGER: + windowID = event->tfinger.windowID; + break; + case SDL_EVENTCATEGORY_PTIP: + windowID = event->ptip.windowID; + break; + case SDL_EVENTCATEGORY_PMOTION: + windowID = event->pmotion.windowID; + break; + case SDL_EVENTCATEGORY_PBUTTON: + windowID = event->pbutton.windowID; + break; + case SDL_EVENTCATEGORY_DROP: + windowID = event->drop.windowID; + break; + default: + /* < 0 -> invalid event type (error is set by SDL_GetEventCategory) */ + /* else -> event has no associated window (not an error) */ + return NULL; + } + return SDL_GetWindowFromID(windowID); +} diff --git a/src/events/SDL_categories_c.h b/src/events/SDL_categories_c.h new file mode 100644 index 0000000000000..b184311fbf26e --- /dev/null +++ b/src/events/SDL_categories_c.h @@ -0,0 +1,66 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_internal.h" + +#ifndef SDL_categories_c_h_ +#define SDL_categories_c_h_ + +typedef enum SDL_EventCategory +{ + SDL_EVENTCATEGORY_SYSTEM, + SDL_EVENTCATEGORY_DISPLAY, + SDL_EVENTCATEGORY_WINDOW, + SDL_EVENTCATEGORY_KDEVICE, + SDL_EVENTCATEGORY_KEY, + SDL_EVENTCATEGORY_EDIT, + SDL_EVENTCATEGORY_EDIT_CANDIDATES, + SDL_EVENTCATEGORY_TEXT, + SDL_EVENTCATEGORY_MDEVICE, + SDL_EVENTCATEGORY_MOTION, + SDL_EVENTCATEGORY_BUTTON, + SDL_EVENTCATEGORY_WHEEL, + SDL_EVENTCATEGORY_JDEVICE, + SDL_EVENTCATEGORY_JAXIS, + SDL_EVENTCATEGORY_JBALL, + SDL_EVENTCATEGORY_JHAT, + SDL_EVENTCATEGORY_JBUTTON, + SDL_EVENTCATEGORY_JBATTERY, + SDL_EVENTCATEGORY_GDEVICE, + SDL_EVENTCATEGORY_GAXIS, + SDL_EVENTCATEGORY_GBUTTON, + SDL_EVENTCATEGORY_GTOUCHPAD, + SDL_EVENTCATEGORY_GSENSOR, + SDL_EVENTCATEGORY_ADEVICE, + SDL_EVENTCATEGORY_CDEVICE, + SDL_EVENTCATEGORY_SENSOR, + SDL_EVENTCATEGORY_QUIT, + SDL_EVENTCATEGORY_USER, + SDL_EVENTCATEGORY_TFINGER, + SDL_EVENTCATEGORY_PTIP, + SDL_EVENTCATEGORY_PMOTION, + SDL_EVENTCATEGORY_PBUTTON, + SDL_EVENTCATEGORY_DROP, + SDL_EVENTCATEGORY_CLIPBOARD, +} SDL_EventCategory; + +extern SDL_EventCategory SDL_GetEventCategory(Uint32 type); + +#endif /* SDL_categories_c_h_ */ diff --git a/test/testautomation_events.c b/test/testautomation_events.c index 14418f76ccff2..b7fae05d5c73f 100644 --- a/test/testautomation_events.c +++ b/test/testautomation_events.c @@ -22,6 +22,8 @@ static int g_eventFilterCalled = 0; static int g_userdataValue1 = 1; static int g_userdataValue2 = 2; +#define MAX_ITERATIONS 100 + /* Event filter that sets some flags and optionally checks userdata */ static int SDLCALL events_sampleNullEventFilter(void *userdata, SDL_Event *event) { @@ -45,31 +47,57 @@ static int SDLCALL events_sampleNullEventFilter(void *userdata, SDL_Event *event */ static int events_pushPumpAndPollUserevent(void *arg) { - SDL_Event event1; - SDL_Event event2; + SDL_Event event_in; + SDL_Event event_out; int result; + int i; + Sint32 ref_code = SDLTest_RandomSint32(); + SDL_Window *event_window; + + /* Flush all events */ + SDL_FlushEvents(SDL_EVENT_FIRST, SDL_EVENT_LAST); + SDLTest_AssertCheck(!SDL_HasEvents(SDL_EVENT_USER, SDL_EVENT_USER), "Check SDL_HasEvents returns false"); /* Create user event */ - event1.type = SDL_EVENT_USER; - event1.common.timestamp = 0; - event1.user.code = SDLTest_RandomSint32(); - event1.user.data1 = (void *)&g_userdataValue1; - event1.user.data2 = (void *)&g_userdataValue2; + event_in.type = SDL_EVENT_USER; + event_in.user.windowID = 0; + event_in.common.timestamp = 0; + event_in.user.code = ref_code; + event_in.user.data1 = (void *)&g_userdataValue1; + event_in.user.data2 = (void *)&g_userdataValue2; /* Push a user event onto the queue and force queue update */ - SDL_PushEvent(&event1); + SDL_PushEvent(&event_in); SDLTest_AssertPass("Call to SDL_PushEvent()"); SDL_PumpEvents(); SDLTest_AssertPass("Call to SDL_PumpEvents()"); - /* Poll for user event */ - result = SDL_PollEvent(&event2); - SDLTest_AssertPass("Call to SDL_PollEvent()"); - SDLTest_AssertCheck(result == 1, "Check result from SDL_PollEvent, expected: 1, got: %d", result); + SDLTest_AssertCheck(SDL_HasEvents(SDL_EVENT_USER, SDL_EVENT_USER), "Check SDL_HasEvents returns true"); - /* Need to finish getting all events and sentinel, otherwise other tests that rely on event are in bad state */ - while (SDL_PollEvent(&event2)) { + /* Poll until we get a user event. */ + for (i = 0; i < MAX_ITERATIONS; i++) { + result = SDL_PollEvent(&event_out); + SDLTest_AssertPass("Call to SDL_PollEvent()"); + SDLTest_AssertCheck(result == 1, "Check result from SDL_PollEvent, expected: 1, got: %d", result); + if (!result) { + break; + } + if (event_out.type == SDL_EVENT_USER) { + break; + } } + SDLTest_AssertCheck(i < MAX_ITERATIONS, "Check the user event is seen in less then %d polls, got %d poll", MAX_ITERATIONS, i + 1); + + SDLTest_AssertCheck(SDL_EVENT_USER == event_out.type, "Check event type is SDL_EVENT_USER, expected: 0x%x, got: 0x%" SDL_PRIx32, SDL_EVENT_USER, event_out.type); + SDLTest_AssertCheck(ref_code == event_out.user.code, "Check SDL_Event.user.code, expected: 0x%" SDL_PRIx32 ", got: 0x%" SDL_PRIx32 , ref_code, event_out.user.code); + SDLTest_AssertCheck(0 == event_out.user.windowID, "Check SDL_Event.user.windowID, expected: NULL , got: %" SDL_PRIu32, event_out.user.windowID); + SDLTest_AssertCheck((void *)&g_userdataValue1 == event_out.user.data1, "Check SDL_Event.user.data1, expected: %p, got: %p", (void *)&g_userdataValue1, event_out.user.data1); + SDLTest_AssertCheck((void *)&g_userdataValue2 == event_out.user.data2, "Check SDL_Event.user.data2, expected: %p, got: %p", (void *)&g_userdataValue2, event_out.user.data2); + event_window = SDL_GetWindowFromEvent(&event_out); + SDLTest_AssertCheck(NULL == SDL_GetWindowFromEvent(&event_out), "Check SDL_GetWindowFromEvent returns the window id from a user event, expected: NULL, got: %p", event_window); + + /* Need to finish getting all events and sentinel, otherwise other tests that rely on event are in bad state */ + SDL_FlushEvents(SDL_EVENT_FIRST, SDL_EVENT_LAST); return TEST_COMPLETED; } @@ -178,21 +206,24 @@ static int events_addDelEventWatchWithUserdata(void *arg) /* ================= Test References ================== */ /* Events test cases */ -static const SDLTest_TestCaseReference eventsTest1 = { - (SDLTest_TestCaseFp)events_pushPumpAndPollUserevent, "events_pushPumpAndPollUserevent", "Pushes, pumps and polls a user event", TEST_ENABLED +static const SDLTest_TestCaseReference eventsTest_pushPumpAndPollUserevent = { + events_pushPumpAndPollUserevent, "events_pushPumpAndPollUserevent", "Pushes, pumps and polls a user event", TEST_ENABLED }; -static const SDLTest_TestCaseReference eventsTest2 = { - (SDLTest_TestCaseFp)events_addDelEventWatch, "events_addDelEventWatch", "Adds and deletes an event watch function with NULL userdata", TEST_ENABLED +static const SDLTest_TestCaseReference eventsTest_addDelEventWatch = { + events_addDelEventWatch, "events_addDelEventWatch", "Adds and deletes an event watch function with NULL userdata", TEST_ENABLED }; -static const SDLTest_TestCaseReference eventsTest3 = { - (SDLTest_TestCaseFp)events_addDelEventWatchWithUserdata, "events_addDelEventWatchWithUserdata", "Adds and deletes an event watch function with userdata", TEST_ENABLED +static const SDLTest_TestCaseReference eventsTest_addDelEventWatchWithUserdata = { + events_addDelEventWatchWithUserdata, "events_addDelEventWatchWithUserdata", "Adds and deletes an event watch function with userdata", TEST_ENABLED }; /* Sequence of Events test cases */ static const SDLTest_TestCaseReference *eventsTests[] = { - &eventsTest1, &eventsTest2, &eventsTest3, NULL + &eventsTest_pushPumpAndPollUserevent, + &eventsTest_addDelEventWatch, + &eventsTest_addDelEventWatchWithUserdata, + NULL }; /* Events test suite (global) */ From b5c0921196bb085f90ce100696f7e99be37ff2db Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sat, 3 Aug 2024 02:37:43 +0000 Subject: [PATCH 120/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_events.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index 2c12c8a5cecbd..4c113f9a3efce 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -1404,7 +1404,6 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); * Get window associated with an event. * * \param event an event containing a `windowID`. - * * \returns the associated window on success or NULL if there is none. * * \since This function is available since SDL 3.0.0. From 8d748d64e88b7b38acb55dffde5934fcbf9b3549 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Aug 2024 20:27:33 -0700 Subject: [PATCH 121/253] Fixed compiler warning building for macOS --- src/video/cocoa/SDL_cocoaevents.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index 52790a92d4de5..02b0edc5e87da 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -195,7 +195,7 @@ - (void)dealloc } } -- (void)windowWillClose:(NSNotification *)notification; +- (void)windowWillClose:(NSNotification *)notification { NSWindow *win = (NSWindow *)[notification object]; From f7c8d66ccb9b92e69af2dc5056de96044379a46d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Aug 2024 20:36:35 -0700 Subject: [PATCH 122/253] Use the convenience function SDL_GetWindowFromEvent() --- src/test/SDL_test_common.c | 46 +++++++++++++++++++------------------- test/checkkeys.c | 4 ++-- test/testwm.c | 4 ++-- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 5372bc8506f2e..05289d35eca6e 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1620,7 +1620,7 @@ static void SDLTest_PrintEvent(const SDL_Event *event) case SDL_EVENT_WINDOW_SAFE_AREA_CHANGED: { SDL_Rect rect; - SDL_GetWindowSafeArea(SDL_GetWindowFromID(event->window.windowID), &rect); + SDL_GetWindowSafeArea(SDL_GetWindowFromEvent(event), &rect); SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " changed safe area to: %d,%d %dx%d\n", event->window.windowID, rect.x, rect.y, rect.w, rect.h); break; @@ -1661,7 +1661,7 @@ static void SDLTest_PrintEvent(const SDL_Event *event) SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " display changed to %" SDL_PRIs32, event->window.windowID, event->window.data1); break; case SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED: - SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " display scale changed to %d%%", event->window.windowID, (int)(SDL_GetWindowDisplayScale(SDL_GetWindowFromID(event->window.windowID)) * 100.0f)); + SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " display scale changed to %d%%", event->window.windowID, (int)(SDL_GetWindowDisplayScale(SDL_GetWindowFromEvent(event)) * 100.0f)); break; case SDL_EVENT_WINDOW_OCCLUDED: SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " occluded", event->window.windowID); @@ -2089,7 +2089,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event switch (event->type) { case SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED: if (state->auto_scale_content) { - SDL_Window *window = SDL_GetWindowFromID(event->window.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { float scale = SDL_GetDisplayContentScale(SDL_GetDisplayForWindow(window)); int w = state->window_w; @@ -2103,7 +2103,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event break; case SDL_EVENT_WINDOW_FOCUS_LOST: if (state->flash_on_focus_loss) { - SDL_Window *window = SDL_GetWindowFromID(event->window.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { SDL_FlashWindow(window, SDL_FLASH_UNTIL_FOCUSED); } @@ -2111,7 +2111,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event break; case SDL_EVENT_WINDOW_CLOSE_REQUESTED: { - SDL_Window *window = SDL_GetWindowFromID(event->window.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { SDL_HideWindow(window); } @@ -2127,7 +2127,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event /* Add hotkeys here */ case SDLK_PRINTSCREEN: { - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { for (i = 0; i < state->num_windows; ++i) { if (window == state->windows[i]) { @@ -2139,7 +2139,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_EQUALS: if (withControl) { /* Ctrl-+ double the size of the window */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { int w, h; SDL_GetWindowSize(window, &w, &h); @@ -2150,7 +2150,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_MINUS: if (withControl) { /* Ctrl-- half the size of the window */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { int w, h; SDL_GetWindowSize(window, &w, &h); @@ -2164,7 +2164,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_RIGHT: if (withAlt) { /* Alt-Up/Down/Left/Right switches between displays */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { int num_displays; const SDL_DisplayID *displays = SDL_GetDisplays(&num_displays); @@ -2195,7 +2195,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event } if (withShift) { /* Shift-Up/Down/Left/Right shift the window by 100px */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { const int delta = 100; int x, y; @@ -2222,7 +2222,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_O: if (withControl) { /* Ctrl-O (or Ctrl-Shift-O) changes window opacity. */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { float opacity = SDL_GetWindowOpacity(window); if (withShift) { @@ -2253,7 +2253,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event } else if (withControl) { if (withShift) { /* Ctrl-Shift-C copy screenshot! */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { for (i = 0; i < state->num_windows; ++i) { if (window == state->windows[i]) { @@ -2299,7 +2299,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_F: if (withControl) { /* Ctrl-F flash the window */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { SDL_FlashWindow(window, SDL_FLASH_BRIEFLY); } @@ -2308,7 +2308,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_G: if (withControl) { /* Ctrl-G toggle mouse grab */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { SDL_SetWindowMouseGrab(window, !SDL_GetWindowMouseGrab(window)); } @@ -2317,7 +2317,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_K: if (withControl) { /* Ctrl-K toggle keyboard grab */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { SDL_SetWindowKeyboardGrab(window, !SDL_GetWindowKeyboardGrab(window)); } @@ -2326,7 +2326,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_M: if (withControl) { /* Ctrl-M maximize */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { SDL_WindowFlags flags = SDL_GetWindowFlags(window); if (flags & SDL_WINDOW_MAXIMIZED) { @@ -2354,7 +2354,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_T: if (withControl) { /* Ctrl-T toggle topmost mode */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { SDL_WindowFlags flags = SDL_GetWindowFlags(window); if (flags & SDL_WINDOW_ALWAYS_ON_TOP) { @@ -2368,7 +2368,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_Z: if (withControl) { /* Ctrl-Z minimize */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { SDL_MinimizeWindow(window); } @@ -2377,7 +2377,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_RETURN: if (withControl) { /* Ctrl-Enter toggle fullscreen */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { SDL_WindowFlags flags = SDL_GetWindowFlags(window); if (!(flags & SDL_WINDOW_FULLSCREEN) || @@ -2390,7 +2390,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event } } else if (withAlt) { /* Alt-Enter toggle fullscreen desktop */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { SDL_WindowFlags flags = SDL_GetWindowFlags(window); if (!(flags & SDL_WINDOW_FULLSCREEN) || @@ -2407,7 +2407,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_B: if (withControl) { /* Ctrl-B toggle window border */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { const SDL_WindowFlags flags = SDL_GetWindowFlags(window); const SDL_bool b = (flags & SDL_WINDOW_BORDERLESS) ? SDL_TRUE : SDL_FALSE; @@ -2418,7 +2418,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_A: if (withControl) { /* Ctrl-A toggle aspect ratio */ - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); if (window) { float min_aspect = 0.0f, max_aspect = 0.0f; @@ -2436,7 +2436,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event break; case SDLK_0: if (withControl) { - SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(event); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Test Message", "You're awesome!", window); } break; diff --git a/test/checkkeys.c b/test/checkkeys.c index 3596605b648e5..66c2e7ed604ae 100644 --- a/test/checkkeys.c +++ b/test/checkkeys.c @@ -408,7 +408,7 @@ static void loop(void) break; case SDL_EVENT_FINGER_DOWN: { - SDL_Window *window = SDL_GetWindowFromID(event.tfinger.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(&event); if (SDL_TextInputActive(window)) { SDL_Log("Stopping text input for window %" SDL_PRIu32 "\n", event.tfinger.windowID); SDL_StopTextInput(window); @@ -420,7 +420,7 @@ static void loop(void) } case SDL_EVENT_MOUSE_BUTTON_DOWN: if (event.button.button == SDL_BUTTON_RIGHT) { - SDL_Window *window = SDL_GetWindowFromID(event.button.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(&event); if (SDL_TextInputActive(window)) { SDL_Log("Stopping text input for window %" SDL_PRIu32 "\n", event.button.windowID); SDL_StopTextInput(window); diff --git a/test/testwm.c b/test/testwm.c index dfd642a48ea94..b3fddb28389af 100644 --- a/test/testwm.c +++ b/test/testwm.c @@ -167,7 +167,7 @@ static void loop(void) SDLTest_CommonEvent(state, &event, &done); if (event.type == SDL_EVENT_WINDOW_RESIZED) { - SDL_Window *window = SDL_GetWindowFromID(event.window.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(&event); if (window) { SDL_Log("Window %" SDL_PRIu32 " resized to %" SDL_PRIs32 "x%" SDL_PRIs32 "\n", event.window.windowID, @@ -176,7 +176,7 @@ static void loop(void) } } if (event.type == SDL_EVENT_WINDOW_MOVED) { - SDL_Window *window = SDL_GetWindowFromID(event.window.windowID); + SDL_Window *window = SDL_GetWindowFromEvent(&event); if (window) { SDL_Log("Window %" SDL_PRIu32 " moved to %" SDL_PRIs32 ",%" SDL_PRIs32 " (display %s)\n", event.window.windowID, From 978e5fc4f83867394d30973f7a74a2e420e59b01 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Aug 2024 20:38:50 -0700 Subject: [PATCH 123/253] Updated Xcode project for SDL_GetWindowFromEvent() --- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index cb0d184592006..e93e7d67e5e4f 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -441,6 +441,8 @@ F3B38CD7296E2E52005DA6D3 /* SDL_init.h in Headers */ = {isa = PBXBuildFile; fileRef = F3B38CCC296E2E52005DA6D3 /* SDL_init.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3B38CDB296E2E52005DA6D3 /* SDL_oldnames.h in Headers */ = {isa = PBXBuildFile; fileRef = F3B38CCD296E2E52005DA6D3 /* SDL_oldnames.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3B38CDF296E2E52005DA6D3 /* SDL_intrin.h in Headers */ = {isa = PBXBuildFile; fileRef = F3B38CCE296E2E52005DA6D3 /* SDL_intrin.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F3C2CB222C5DDDB2004D7998 /* SDL_categories_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F3C2CB202C5DDDB2004D7998 /* SDL_categories_c.h */; }; + F3C2CB232C5DDDB2004D7998 /* SDL_categories.c in Sources */ = {isa = PBXBuildFile; fileRef = F3C2CB212C5DDDB2004D7998 /* SDL_categories.c */; }; F3D60A8328C16A1900788A3A /* SDL_hidapi_wii.c in Sources */ = {isa = PBXBuildFile; fileRef = F3D60A8228C16A1800788A3A /* SDL_hidapi_wii.c */; }; F3DDCC562AFD42B600B0842B /* SDL_clipboard_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F3DDCC4D2AFD42B500B0842B /* SDL_clipboard_c.h */; }; F3DDCC5B2AFD42B600B0842B /* SDL_video_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F3DDCC522AFD42B600B0842B /* SDL_video_c.h */; }; @@ -988,6 +990,8 @@ F3B38CCC296E2E52005DA6D3 /* SDL_init.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_init.h; path = SDL3/SDL_init.h; sourceTree = ""; }; F3B38CCD296E2E52005DA6D3 /* SDL_oldnames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_oldnames.h; path = SDL3/SDL_oldnames.h; sourceTree = ""; }; F3B38CCE296E2E52005DA6D3 /* SDL_intrin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_intrin.h; path = SDL3/SDL_intrin.h; sourceTree = ""; }; + F3C2CB202C5DDDB2004D7998 /* SDL_categories_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_categories_c.h; sourceTree = ""; }; + F3C2CB212C5DDDB2004D7998 /* SDL_categories.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_categories.c; sourceTree = ""; }; F3D60A8228C16A1800788A3A /* SDL_hidapi_wii.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_wii.c; sourceTree = ""; }; F3DDCC4D2AFD42B500B0842B /* SDL_clipboard_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboard_c.h; sourceTree = ""; }; F3DDCC522AFD42B600B0842B /* SDL_video_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_video_c.h; sourceTree = ""; }; @@ -2179,6 +2183,8 @@ A7D8A93623E2514000DCD162 /* scancodes_linux.h */, A7D8A92C23E2514000DCD162 /* scancodes_windows.h */, A7D8A94123E2514000DCD162 /* scancodes_xfree86.h */, + F3C2CB202C5DDDB2004D7998 /* SDL_categories_c.h */, + F3C2CB212C5DDDB2004D7998 /* SDL_categories.c */, A7D8A93923E2514000DCD162 /* SDL_clipboardevents_c.h */, A7D8A93A23E2514000DCD162 /* SDL_clipboardevents.c */, A7D8A93123E2514000DCD162 /* SDL_displayevents_c.h */, @@ -2354,6 +2360,7 @@ A7D8B8A223E2514400DCD162 /* SDL_diskaudio.h in Headers */, A7D8BB3F23E2514500DCD162 /* SDL_displayevents_c.h in Headers */, A7D8BA1923E2514400DCD162 /* SDL_draw.h in Headers */, + F3C2CB222C5DDDB2004D7998 /* SDL_categories_c.h in Headers */, E479118E2BA9555500CE3B7F /* SDL_sysstorage.h in Headers */, A7D8BA0723E2514400DCD162 /* SDL_drawline.h in Headers */, A7D8B9EF23E2514400DCD162 /* SDL_drawpoint.h in Headers */, @@ -2839,6 +2846,7 @@ A7D8AE9A23E2514100DCD162 /* SDL_cocoaopengles.m in Sources */, A7D8B96823E2514400DCD162 /* SDL_qsort.c in Sources */, F3FA5A222B59ACE000FEAD97 /* yuv_rgb_sse.c in Sources */, + F3C2CB232C5DDDB2004D7998 /* SDL_categories.c in Sources */, A7D8B55123E2514300DCD162 /* SDL_hidapi_switch.c in Sources */, A7D8B96223E2514400DCD162 /* SDL_strtokr.c in Sources */, A7D8BB7523E2514500DCD162 /* SDL_clipboardevents.c in Sources */, From 2c0fcf27e8ee696d27630cea3bd82e538650149b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Aug 2024 21:33:42 -0700 Subject: [PATCH 124/253] Don't use alloca() in a loop, we might overflow the stack. --- src/video/windows/SDL_windowswindow.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index c0f3692f192d0..c15e40ca08a75 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -2091,9 +2091,8 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, fetc.cfFormat, format_mime, (unsigned long)bsize, drop); UINT count = DragQueryFile(drop, 0xFFFFFFFF, NULL, 0); for (UINT i = 0; i < count; ++i) { - SDL_bool isstack; UINT size = DragQueryFile(drop, i, NULL, 0) + 1; - LPTSTR buffer = SDL_small_alloc(TCHAR, size, &isstack); + LPTSTR buffer = (LPTSTR)SDL_malloc(size * sizeof(TCHAR)); if (buffer) { if (DragQueryFile(drop, i, buffer, size)) { char *file = WIN_StringToUTF8(buffer); @@ -2103,7 +2102,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, SDL_SendDropFile(target->window, NULL, file); SDL_free(file); } - SDL_small_free(buffer, isstack); + SDL_free(buffer); } } GlobalUnlock(med.hGlobal); From 2f24e9c2f261a0365f57913afca5783904307496 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sat, 3 Aug 2024 13:30:08 +0000 Subject: [PATCH 125/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_audio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index bd3ee14aaae09..f25959c3b09fc 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -821,7 +821,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid); * stream's format at any time. * * \param devid an audio device to bind a stream to. - * \param streams an array of audio streams to unbind. + * \param streams an array of audio streams to bind. * \param num_streams number streams listed in the `streams` array. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. From e3cf20e1cc5645646f7216733e97b4c7660d2df8 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Sat, 3 Aug 2024 15:34:38 +0200 Subject: [PATCH 126/253] Remove `createSDLMainRunnable()` in favour of `main()` to fix multiple issues when providing custom main/runnable code (#10434) This allows managed applications (eg. Java, C#) to override main() to their liking. --- .../main/java/org/libsdl/app/SDLActivity.java | 34 +++++++++-------- src/core/android/SDL_android.c | 38 +++++++++++++------ 2 files changed, 46 insertions(+), 26 deletions(-) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 134a3dfdcf604..b7d4bde0eee8c 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -247,12 +247,19 @@ protected static SDLGenericMotionListener_API12 getMotionListener() { } /** - * This method creates a Runnable which invokes SDL_main. The default implementation - * uses the getMainSharedObject() and getMainFunction() methods to invoke native - * code from the specified shared library. + * The application entry point, called on a dedicated thread (SDLThread). + * The default implementation uses the getMainSharedObject() and getMainFunction() methods + * to invoke native code from the specified shared library. + * It can be overridden by derived classes. */ - protected Runnable createSDLMainRunnable() { - return new SDLMain(); + protected void main() { + String library = SDLActivity.mSingleton.getMainSharedObject(); + String function = SDLActivity.mSingleton.getMainFunction(); + String[] arguments = SDLActivity.mSingleton.getArguments(); + + Log.v("SDL", "Running main function " + function + " from library " + library); + SDLActivity.nativeRunMain(library, function, arguments); + Log.v("SDL", "Finished main function"); } /** @@ -838,7 +845,7 @@ public static void handleNativeState() { // Start up the C app thread and enable sensor input for the first time // FIXME: Why aren't we enabling sensor input at start? - mSDLThread = new Thread(SDLActivity.mSingleton.createSDLMainRunnable(), "SDLThread"); + mSDLThread = new Thread(new SDLMain(), "SDLThread"); mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, true); mSDLThread.start(); @@ -1032,6 +1039,8 @@ protected boolean sendCommand(int command, Object data) { // C functions we call public static native String nativeGetVersion(); public static native int nativeSetupJNI(); + public static native void nativeInitMainThread(); + public static native void nativeCleanupMainThread(); public static native int nativeRunMain(String library, String function, Object arguments); public static native void nativeLowMemory(); public static native void nativeSendQuit(); @@ -2102,10 +2111,7 @@ static class SDLFileDialogState { class SDLMain implements Runnable { @Override public void run() { - // Runs SDL_main() - String library = SDLActivity.mSingleton.getMainSharedObject(); - String function = SDLActivity.mSingleton.getMainFunction(); - String[] arguments = SDLActivity.mSingleton.getArguments(); + // Runs SDLActivity.main() try { android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_DISPLAY); @@ -2113,11 +2119,9 @@ public void run() { Log.v("SDL", "modify thread properties failed " + e.toString()); } - Log.v("SDL", "Running main function " + function + " from library " + library); - - SDLActivity.nativeRunMain(library, function, arguments); - - Log.v("SDL", "Finished main function"); + SDLActivity.nativeInitMainThread(); + SDLActivity.mSingleton.main(); + SDLActivity.nativeCleanupMainThread(); if (SDLActivity.mSingleton != null && !SDLActivity.mSingleton.isFinishing()) { // Let's finish the Activity diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index bf0f30b986114..7cb4f9a303a18 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -64,6 +64,12 @@ JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetVersion)( JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)( JNIEnv *env, jclass cls); +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeInitSDLThread)( + JNIEnv *env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeCleanupSDLThread)( + JNIEnv *env, jclass cls); + JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)( JNIEnv *env, jclass cls, jstring library, jstring function, jobject array); @@ -188,6 +194,8 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeFileDialog)( static JNINativeMethod SDLActivity_tab[] = { { "nativeGetVersion", "()Ljava/lang/String;", SDL_JAVA_INTERFACE(nativeGetVersion) }, { "nativeSetupJNI", "()I", SDL_JAVA_INTERFACE(nativeSetupJNI) }, + { "nativeInitSDLThread", "()V", SDL_JAVA_INTERFACE(nativeInitSDLThread) }, + { "nativeCleanupSDLThread", "()V", SDL_JAVA_INTERFACE(nativeCleanupSDLThread) }, { "nativeRunMain", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)I", SDL_JAVA_INTERFACE(nativeRunMain) }, { "onNativeDropFile", "(Ljava/lang/String;)V", SDL_JAVA_INTERFACE(onNativeDropFile) }, { "nativeSetScreenResolution", "(IIIIFF)V", SDL_JAVA_INTERFACE(nativeSetScreenResolution) }, @@ -764,14 +772,10 @@ JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(nativeAllowRecreateActivity)( return SDL_AtomicGet(&bAllowRecreateActivity); } -/* Start up the SDL app */ -JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv *env, jclass cls, jstring library, jstring function, jobject array) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeInitSDLThread)( + JNIEnv *env, jclass jcls) { - int status = -1; - const char *library_file; - void *library_handle; - - __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeRunMain() %d time", run_count); + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeInitSDLThread() %d time", run_count); if (run_count == 1) { SDL_AddHintCallback(SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY, SDL_AllowRecreateActivityChanged, NULL); } @@ -779,6 +783,22 @@ JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv *env, jclass cls, /* Save JNIEnv of SDLThread */ Android_JNI_SetEnv(env); +} + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeCleanupSDLThread)( + JNIEnv *env, jclass jcls) +{ + /* This is a Java thread, it doesn't need to be Detached from the JVM. + * Set to mThreadKey value to NULL not to call pthread_create destructor 'Android_JNI_ThreadDestroyed' */ + Android_JNI_SetEnv(NULL); +} + +/* Start up the SDL app */ +JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv *env, jclass cls, jstring library, jstring function, jobject array) +{ + int status = -1; + const char *library_file; + void *library_handle; library_file = (*env)->GetStringUTFChars(env, library, NULL); library_handle = dlopen(library_file, RTLD_GLOBAL); @@ -853,10 +873,6 @@ JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv *env, jclass cls, } (*env)->ReleaseStringUTFChars(env, library, library_file); - /* This is a Java thread, it doesn't need to be Detached from the JVM. - * Set to mThreadKey value to NULL not to call pthread_create destructor 'Android_JNI_ThreadDestroyed' */ - Android_JNI_SetEnv(NULL); - /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */ /* exit(status); */ From cd5f0d2ccef967582fd105eb15f2d24e04d6d468 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 2 Aug 2024 18:32:13 -0700 Subject: [PATCH 127/253] Added SDL_RectToFRect() --- include/SDL3/SDL_rect.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/SDL3/SDL_rect.h b/include/SDL3/SDL_rect.h index 9735bc2a47806..a61c5d5f5e553 100644 --- a/include/SDL3/SDL_rect.h +++ b/include/SDL3/SDL_rect.h @@ -112,6 +112,24 @@ typedef struct SDL_FRect } SDL_FRect; +/** + * Convert an SDL_Rect to SDL_FRect + * + * \param rect a pointer to an SDL_Rect. + * \param frect a pointer filled in with the floating point representation of `rect`. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + */ +SDL_FORCE_INLINE void SDL_RectToFRect(const SDL_Rect *rect, SDL_FRect *frect) +{ + frect->x = (float)rect->x; + frect->y = (float)rect->y; + frect->w = (float)rect->w; + frect->h = (float)rect->h; +} + /** * Determine whether a point resides inside a rectangle. * From cb440ec4a40d0375478a3d0623f705ee38d80f95 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sat, 3 Aug 2024 13:40:37 +0000 Subject: [PATCH 128/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_rect.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_rect.h b/include/SDL3/SDL_rect.h index a61c5d5f5e553..0583300989784 100644 --- a/include/SDL3/SDL_rect.h +++ b/include/SDL3/SDL_rect.h @@ -116,7 +116,8 @@ typedef struct SDL_FRect * Convert an SDL_Rect to SDL_FRect * * \param rect a pointer to an SDL_Rect. - * \param frect a pointer filled in with the floating point representation of `rect`. + * \param frect a pointer filled in with the floating point representation of + * `rect`. * * \threadsafety It is safe to call this function from any thread. * From ab916a959e096a3af9502b50a622eda0e8f83253 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Wed, 27 Mar 2024 18:33:50 +0000 Subject: [PATCH 129/253] video: Only prefer Wayland if fifo-v1 and commit-timing-v1 are available Wayland has a myriad of unresolved problems regarding surface suspension blocking forever in QueuePresent/SwapBuffers when occludedand the FIFO (vsync) implementation being fundamentally broken leading to reduced GPU-bound performance and 'barcoding' frametimes due to swapchain starvation. There are two protocols used to solve these two problems together -- fifo-v1 and commit-timing-v1, which implement the commit queue on the compositor side, and a timestamp that frames are intended to be displayed for/discarded respectfully. To avoid severe performance regressions for developers targeting SDL3, only pick Wayland as the default backend when these two protocols are supported -- otherwise fallback to X11/XWayland. We do this by having two VideoBootStraps, one which is tests the preferred case, "wayland_preferred" (ie. if fifo-v1 + commit-timing-v1 are available init time), and the fallback, which is just "wayland", the same name as before, which does no such tests. Thus, forcing with SDL_VIDEO_DRIVER=wayland will go onto the fallback option, and pick Wayland always, as usual, so there is no behaviour change. In the case that X11/XWayland is not available (ie. no DISPLAY), we will still fallback to using Wayland without these protocols available. Signed-off-by: Joshua Ashton --- src/video/SDL_sysvideo.h | 3 +- src/video/SDL_video.c | 5 +- src/video/wayland/SDL_waylandvideo.c | 82 +++++++++++++++++++++++++++- 3 files changed, 85 insertions(+), 5 deletions(-) diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 6554191225eab..9e03a86687ed5 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -503,7 +503,8 @@ extern VideoBootStrap RPI_bootstrap; extern VideoBootStrap KMSDRM_bootstrap; extern VideoBootStrap DUMMY_bootstrap; extern VideoBootStrap DUMMY_evdev_bootstrap; -extern VideoBootStrap Wayland_bootstrap; +extern VideoBootStrap Wayland_preferred_bootstrap; +extern VideoBootStrap Wayland_fallback_bootstrap; extern VideoBootStrap VIVANTE_bootstrap; extern VideoBootStrap Emscripten_bootstrap; extern VideoBootStrap OFFSCREEN_bootstrap; diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 47677944d7a4a..353e110403819 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -71,11 +71,14 @@ static VideoBootStrap *bootstrap[] = { &COCOA_bootstrap, #endif #ifdef SDL_VIDEO_DRIVER_WAYLAND - &Wayland_bootstrap, + &Wayland_preferred_bootstrap, #endif #ifdef SDL_VIDEO_DRIVER_X11 &X11_bootstrap, #endif +#ifdef SDL_VIDEO_DRIVER_WAYLAND + &Wayland_fallback_bootstrap, +#endif #ifdef SDL_VIDEO_DRIVER_VIVANTE &VIVANTE_bootstrap, #endif diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index db0d40a7a7be6..7a5f2cb8747bc 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -68,6 +68,7 @@ #include #endif +#define WAYLANDVID_PREFERRED_DRIVER_NAME "wayland_preferred" #define WAYLANDVID_DRIVER_NAME "wayland" /* Clamp certain core protocol versions on older versions of libwayland. */ @@ -372,7 +373,54 @@ static void Wayland_DeleteDevice(SDL_VideoDevice *device) SDL_WAYLAND_UnloadSymbols(); } -static SDL_VideoDevice *Wayland_CreateDevice(void) +typedef struct +{ + SDL_bool has_fifo_v1; + SDL_bool has_commit_timing_v1; +} SDL_WaylandPreferredData; + +static void wayland_preferred_check_handle_global(void *data, struct wl_registry *registry, uint32_t id, + const char *interface, uint32_t version) +{ + SDL_WaylandPreferredData *d = data; + + if (SDL_strcmp(interface, "wp_fifo_manager_v1") == 0) { + d->has_fifo_v1 = SDL_TRUE; + } else if (SDL_strcmp(interface, "wp_commit_timing_manager_v1") == 0) { + d->has_commit_timing_v1 = SDL_TRUE; + } +} + +static void wayland_preferred_check_remove_global(void *data, struct wl_registry *registry, uint32_t id) +{ + /* No need to do anything here. */ +} + +static const struct wl_registry_listener preferred_registry_listener = { + wayland_preferred_check_handle_global, + wayland_preferred_check_remove_global +}; + +static SDL_bool Wayland_IsPreferred(struct wl_display *display) +{ + struct wl_registry *registry = wl_display_get_registry(display); + SDL_WaylandPreferredData preferred_data = { 0 }; + + if (!registry) { + SDL_SetError("Failed to get the Wayland registry"); + return SDL_FALSE; + } + + wl_registry_add_listener(registry, &preferred_registry_listener, &preferred_data); + + WAYLAND_wl_display_roundtrip(display); + + wl_registry_destroy(registry); + + return preferred_data.has_fifo_v1 && preferred_data.has_commit_timing_v1; +} + +static SDL_VideoDevice *Wayland_CreateDevice(SDL_bool fallback) { SDL_VideoDevice *device; SDL_VideoData *data; @@ -401,6 +449,18 @@ static SDL_VideoDevice *Wayland_CreateDevice(void) } } + /* + * If we are checking for preferred Wayland, then let's query for + * fifo-v1 and commit-timing-v1's existance so we don't regress + * GPU-bound performance and frame-pacing by default due to + * swapchain starvation. + */ + if (!fallback && !Wayland_IsPreferred(display)) { + WAYLAND_wl_display_disconnect(display); + SDL_WAYLAND_UnloadSymbols(); + return NULL; + } + data = SDL_calloc(1, sizeof(*data)); if (!data) { WAYLAND_wl_display_disconnect(display); @@ -534,9 +594,25 @@ static SDL_VideoDevice *Wayland_CreateDevice(void) return device; } -VideoBootStrap Wayland_bootstrap = { +static SDL_VideoDevice *Wayland_Preferred_CreateDevice(void) +{ + return Wayland_CreateDevice(SDL_FALSE); +} + +static SDL_VideoDevice *Wayland_Fallback_CreateDevice(void) +{ + return Wayland_CreateDevice(SDL_TRUE); +} + +VideoBootStrap Wayland_preferred_bootstrap = { + WAYLANDVID_PREFERRED_DRIVER_NAME, "SDL Wayland video driver", + Wayland_Preferred_CreateDevice, + Wayland_ShowMessageBox +}; + +VideoBootStrap Wayland_fallback_bootstrap = { WAYLANDVID_DRIVER_NAME, "SDL Wayland video driver", - Wayland_CreateDevice, + Wayland_Fallback_CreateDevice, Wayland_ShowMessageBox }; From ca2c9f680be42c4dfa8c0a0db6ed2f51a567182f Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sat, 30 Mar 2024 12:01:27 -0400 Subject: [PATCH 130/253] video: Support multiple video driver entries having the same name string Allow multiple bootstrap entries for a single video driver with the same name, which internally allows preferential and fallback init conditions while hiding the implementation details from applications (e.g. applications will just see "wayland", regardless of whether it's using the preferred or fallback driver list entry). If a driver is requested, all instances of it in the list will be tried before reporting failure, and client applications programmatically enumerating the video drivers will be presented with a deduplicated list of entries. --- src/video/SDL_sysvideo.h | 2 +- src/video/SDL_video.c | 38 ++++++++++++++++++++++++---- src/video/wayland/SDL_waylandvideo.c | 15 +++++------ 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 9e03a86687ed5..6aeee58fd64ce 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -504,7 +504,7 @@ extern VideoBootStrap KMSDRM_bootstrap; extern VideoBootStrap DUMMY_bootstrap; extern VideoBootStrap DUMMY_evdev_bootstrap; extern VideoBootStrap Wayland_preferred_bootstrap; -extern VideoBootStrap Wayland_fallback_bootstrap; +extern VideoBootStrap Wayland_bootstrap; extern VideoBootStrap VIVANTE_bootstrap; extern VideoBootStrap Emscripten_bootstrap; extern VideoBootStrap OFFSCREEN_bootstrap; diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 353e110403819..578d06a5af1fd 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -70,14 +70,14 @@ static VideoBootStrap *bootstrap[] = { #ifdef SDL_VIDEO_DRIVER_COCOA &COCOA_bootstrap, #endif +#ifdef SDL_VIDEO_DRIVER_X11 #ifdef SDL_VIDEO_DRIVER_WAYLAND &Wayland_preferred_bootstrap, #endif -#ifdef SDL_VIDEO_DRIVER_X11 &X11_bootstrap, #endif #ifdef SDL_VIDEO_DRIVER_WAYLAND - &Wayland_fallback_bootstrap, + &Wayland_bootstrap, #endif #ifdef SDL_VIDEO_DRIVER_VIVANTE &VIVANTE_bootstrap, @@ -514,15 +514,41 @@ static int SDL_UninitializedVideo(void) return SDL_SetError("Video subsystem has not been initialized"); } +/* Deduplicated list of video bootstrap drivers. */ +static const VideoBootStrap *deduped_bootstrap[SDL_arraysize(bootstrap) - 1]; + int SDL_GetNumVideoDrivers(void) { - return SDL_arraysize(bootstrap) - 1; + static int num_drivers = -1; + + if (num_drivers >= 0) { + return num_drivers; + } + + num_drivers = 0; + + /* Build a list of unique video drivers. */ + for (int i = 0; bootstrap[i] != NULL; ++i) { + SDL_bool duplicate = SDL_FALSE; + for (int j = 0; j < i; ++j) { + if (SDL_strcmp(bootstrap[i]->name, bootstrap[j]->name) == 0) { + duplicate = SDL_TRUE; + break; + } + } + + if (!duplicate) { + deduped_bootstrap[num_drivers++] = bootstrap[i]; + } + } + + return num_drivers; } const char *SDL_GetVideoDriver(int index) { if (index >= 0 && index < SDL_GetNumVideoDrivers()) { - return bootstrap[index]->name; + return deduped_bootstrap[index]->name; } return NULL; } @@ -580,7 +606,9 @@ int SDL_VideoInit(const char *driver_name) if ((driver_attempt_len == SDL_strlen(bootstrap[i]->name)) && (SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) { video = bootstrap[i]->create(); - break; + if (video) { + break; + } } } diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 7a5f2cb8747bc..3aa9b8705e18d 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -68,7 +68,6 @@ #include #endif -#define WAYLANDVID_PREFERRED_DRIVER_NAME "wayland_preferred" #define WAYLANDVID_DRIVER_NAME "wayland" /* Clamp certain core protocol versions on older versions of libwayland. */ @@ -420,7 +419,7 @@ static SDL_bool Wayland_IsPreferred(struct wl_display *display) return preferred_data.has_fifo_v1 && preferred_data.has_commit_timing_v1; } -static SDL_VideoDevice *Wayland_CreateDevice(SDL_bool fallback) +static SDL_VideoDevice *Wayland_CreateDevice(SDL_bool require_preferred_protocols) { SDL_VideoDevice *device; SDL_VideoData *data; @@ -451,11 +450,11 @@ static SDL_VideoDevice *Wayland_CreateDevice(SDL_bool fallback) /* * If we are checking for preferred Wayland, then let's query for - * fifo-v1 and commit-timing-v1's existance so we don't regress + * fifo-v1 and commit-timing-v1's existence, so we don't regress * GPU-bound performance and frame-pacing by default due to * swapchain starvation. */ - if (!fallback && !Wayland_IsPreferred(display)) { + if (require_preferred_protocols && !Wayland_IsPreferred(display)) { WAYLAND_wl_display_disconnect(display); SDL_WAYLAND_UnloadSymbols(); return NULL; @@ -596,21 +595,21 @@ static SDL_VideoDevice *Wayland_CreateDevice(SDL_bool fallback) static SDL_VideoDevice *Wayland_Preferred_CreateDevice(void) { - return Wayland_CreateDevice(SDL_FALSE); + return Wayland_CreateDevice(SDL_TRUE); } static SDL_VideoDevice *Wayland_Fallback_CreateDevice(void) { - return Wayland_CreateDevice(SDL_TRUE); + return Wayland_CreateDevice(SDL_FALSE); } VideoBootStrap Wayland_preferred_bootstrap = { - WAYLANDVID_PREFERRED_DRIVER_NAME, "SDL Wayland video driver", + WAYLANDVID_DRIVER_NAME, "SDL Wayland video driver", Wayland_Preferred_CreateDevice, Wayland_ShowMessageBox }; -VideoBootStrap Wayland_fallback_bootstrap = { +VideoBootStrap Wayland_bootstrap = { WAYLANDVID_DRIVER_NAME, "SDL Wayland video driver", Wayland_Fallback_CreateDevice, Wayland_ShowMessageBox From 490f7af92b958c52a920fbc313c5568d3c7550d7 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 18:20:26 -0700 Subject: [PATCH 131/253] Removed test that triggers an asan overflow warning Fixes https://github.com/libsdl-org/SDL/issues/8884 --- test/testautomation_sdltest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/testautomation_sdltest.c b/test/testautomation_sdltest.c index 1f29c07308b92..a9b04c6c17268 100644 --- a/test/testautomation_sdltest.c +++ b/test/testautomation_sdltest.c @@ -1059,12 +1059,14 @@ static int sdltest_randomIntegerInRange(void *arg) SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(max,min)"); SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result); +#if 0 /* This test correctly triggers an asan warning: runtime error: signed integer overflow: 2147483647 + 4239 cannot be represented in type 'int' */ /* Range with min at integer limit */ min = long_min; max = long_max + (Sint32)SDLTest_RandomSint16(); result = SDLTest_RandomIntegerInRange(min, max); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(SINT32_MIN,...)"); SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result); +#endif /* Range with max at integer limit */ min = long_min - (Sint32)SDLTest_RandomSint16(); From 31b3f5ea79cf47ec838aa46071445355b3b5f4d0 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 3 Aug 2024 21:00:46 +0200 Subject: [PATCH 132/253] ci: add GDK --- .github/actions/setup-gdk-desktop/action.yml | 82 +++++ .github/workflows/create-test-plan.py | 20 +- .github/workflows/generic.yml | 5 + .gitignore | 1 + build-scripts/setup-gdk-desktop.py | 303 +++++++++++++++++++ 5 files changed, 407 insertions(+), 4 deletions(-) create mode 100644 .github/actions/setup-gdk-desktop/action.yml create mode 100644 build-scripts/setup-gdk-desktop.py diff --git a/.github/actions/setup-gdk-desktop/action.yml b/.github/actions/setup-gdk-desktop/action.yml new file mode 100644 index 0000000000000..10427ace3c9e5 --- /dev/null +++ b/.github/actions/setup-gdk-desktop/action.yml @@ -0,0 +1,82 @@ +name: 'Setup GDK (Game Development Kit) for Windows Desktop' +description: 'Download GDK and install into MSBuild' +inputs: + # Keep edition and ref in sync! + edition: + description: 'GDK edition' + default: '240601' # YYMMUU (Year Month Update) + ref: + description: 'Git reference' + default: 'June_2024_Update_1' + folder: + description: 'Folder where to create Directory.Build.props' + required: true + default: '${{ github.workspace }}' +runs: + using: 'composite' + steps: + - uses: actions/setup-python@main + with: + python-version: 3.x + - name: 'Calculate variables' + id: calc + shell: pwsh + run: | + $vs_folder=@(vswhere -latest -property installationPath) + echo "vs-folder=${vs_folder}" >> $Env:GITHUB_OUTPUT + + echo "gdk-path=${{ runner.temp }}\GDK-${{ inputs.edition }}" >> $Env:GITHUB_OUTPUT + + echo "cache-key=gdk-${{ inputs.ref }}-${{ inputs.edition }}" >> $Env:GITHUB_OUTPUT + - name: 'Restore cached GDK' + id: cache-restore + uses: actions/cache/restore@v4 + with: + path: '${{ steps.calc.outputs.gdk-path }}' + key: ${{ steps.calc.outputs.cache-key }} + - name: 'Download GDK' + if: ${{ !steps.cache-restore.outputs.cache-hit }} + shell: pwsh + run: | + python build-scripts/setup-gdk-desktop.py ` + --download ` + --temp-folder "${{ runner.temp }}" ` + --gdk-path="${{ steps.calc.outputs.gdk-path }}" ` + --ref-edition "${{ inputs.ref }},${{ inputs.edition }}" ` + --vs-folder="${{ steps.calc.outputs.vs-folder }}" ` + --no-user-props + - name: 'Extract GDK' + if: ${{ !steps.cache-restore.outputs.cache-hit }} + shell: pwsh + run: | + python build-scripts/setup-gdk-desktop.py ` + --extract ` + --ref-edition "${{ inputs.ref }},${{ inputs.edition }}" ` + --temp-folder "${{ runner.temp }}" ` + --gdk-path="${{ steps.calc.outputs.gdk-path }}" ` + --vs-folder="${{ steps.calc.outputs.vs-folder }}" ` + --no-user-props + - name: 'Cache GDK' + if: ${{ !steps.cache-restore.outputs.cache-hit }} + uses: actions/cache/save@v4 + with: + path: '${{ steps.calc.outputs.gdk-path }}' + key: ${{ steps.calc.outputs.cache-key }} + - name: 'Copy MSBuild files into GDK' + shell: pwsh + run: | + python build-scripts/setup-gdk-desktop.py ` + --ref-edition "${{ inputs.ref }},${{ inputs.edition }}" ` + --gdk-path="${{ steps.calc.outputs.gdk-path }}" ` + --vs-folder="${{ steps.calc.outputs.vs-folder }}" ` + --copy-msbuild ` + --no-user-props + - name: 'Write user props' + shell: pwsh + run: | + python build-scripts/setup-gdk-desktop.py ` + --ref-edition "${{ inputs.ref }},${{ inputs.edition }}" ` + --temp-folder "${{ runner.temp }}" ` + --vs-folder="${{ steps.calc.outputs.vs-folder }}" ` + --gdk-path="${{ steps.calc.outputs.gdk-path }}" ` + "--props-folder=${{ inputs.folder }}" diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py index c51df834971e8..c6d4f0aa8cd72 100755 --- a/.github/workflows/create-test-plan.py +++ b/.github/workflows/create-test-plan.py @@ -95,6 +95,7 @@ class JobSpec: msvc_arch: Optional[MsvcArch] = None clang_cl: bool = False uwp: bool = False + gdk: bool = False vita_gles: Optional[VitaGLES] = None @@ -111,13 +112,14 @@ class JobSpec: "msvc-arm32": JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ), "msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ), "msvc-uwp-x64": JobSpec(name="UWP (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-UWP", msvc_arch=MsvcArch.X64, msvc_project="VisualC-WinRT/SDL-UWP.sln", uwp=True, ), + "msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ), "ubuntu-20.04": JobSpec(name="Ubuntu 20.04", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04", ), "ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", ), "ubuntu-intel-icx": JobSpec(name="Ubuntu 20.04 (Intel oneAPI)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-oneapi", intel=IntelCompiler.Icx, ), "ubuntu-intel-icc": JobSpec(name="Ubuntu 20.04 (Intel Compiler)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-icc", intel=IntelCompiler.Icc, ), "macos-framework-x64": JobSpec(name="MacOS (Framework) (x86_64)", os=JobOs.Macos12, platform=SdlPlatform.MacOS, artifact="SDL-macos-framework", apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ), "macos-framework-arm64": JobSpec(name="MacOS (Framework) (arm64)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact=None, apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ), - "amcos-gnu-arm64": JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-gnu", apple_framework=False, apple_archs={AppleArch.Aarch64, }, ), + "macos-gnu-arm64": JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-gnu", apple_framework=False, apple_archs={AppleArch.Aarch64, }, ), "android-cmake": JobSpec(name="Android (CMake)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, ), "android-cmake-lean": JobSpec(name="Android (CMake, lean)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-lean-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, lean=True, ), "android-mk": JobSpec(name="Android (Android.mk)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_mk=True, ), @@ -191,6 +193,7 @@ class JobDetails: setup_libusb_arch: str = "" xcode_sdk: str = "" cpactions: bool = False + setup_gdk_folder: str = "" cpactions_os: str = "" cpactions_version: str = "" cpactions_arch: str = "" @@ -254,6 +257,7 @@ def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]: "cpactions-setup-cmd": self.cpactions_setup_cmd, "cpactions-install-cmd": self.cpactions_install_cmd, "setup-vita-gles-type": self.setup_vita_gles_type, + "setup-gdk-folder": self.setup_gdk_folder, } return {k: v for k, v in data.items() if v != ""} @@ -314,7 +318,7 @@ def spec_to_job(spec: JobSpec) -> JobDetails: )) match spec.platform: case SdlPlatform.Msvc: - job.setup_ninja = True + job.setup_ninja = not spec.gdk job.clang_tidy = False # complains about \threadsafety: "unknown command tag name [clang-diagnostic-documentation-unknown-command]" job.msvc_project = spec.msvc_project if spec.msvc_project else "" job.test_pkg_config = False @@ -344,11 +348,14 @@ def spec_to_job(spec: JobSpec) -> JobDetails: if spec.msvc_project: match spec.msvc_arch: case MsvcArch.X86: - job.msvc_project_flags.append("-p:Platform=Win32") + msvc_platform = "Win32" case MsvcArch.X64: - job.msvc_project_flags.append("-p:Platform=x64") + msvc_platform = "x64" case _: raise ValueError(f"Unsupported vcxproj architecture (arch={spec.msvc_arch})") + if spec.gdk: + msvc_platform = f"Gaming.Desktop.{msvc_platform}" + job.msvc_project_flags.append(f"-p:Platform={msvc_platform}") match spec.msvc_arch: case MsvcArch.X86: job.msvc_vcvars = "x64_x86" @@ -367,6 +374,8 @@ def spec_to_job(spec: JobSpec) -> JobDetails: "-DCMAKE_SYSTEM_VERSION=10.0", )) job.msvc_project_flags.append("-p:WindowsTargetPlatformVersion=10.0.17763.0") + elif spec.gdk: + job.setup_gdk_folder = "VisualC-GDK" else: match spec.msvc_arch: case MsvcArch.X86: @@ -611,6 +620,9 @@ def tf(b): if fpic is not None: job.cmake_arguments.append(f"-DCMAKE_POSITION_INDEPENDENT_CODE={tf(fpic)}") + if job.no_cmake: + job.cmake_arguments = [] + return job diff --git a/.github/workflows/generic.yml b/.github/workflows/generic.yml index 9a05ff16d2fd1..2798ec7cda98b 100644 --- a/.github/workflows/generic.yml +++ b/.github/workflows/generic.yml @@ -68,6 +68,11 @@ jobs: if: ${{ matrix.platform.platform == 'msvc' }} with: arch: ${{ matrix.platform.msvc-vcvars }} + - name: 'Set up Windows GDK Desktop' + uses: ./.github/actions/setup-gdk-desktop + if: ${{ matrix.platform.setup-gdk-folder != '' }} + with: + folder: '${{ matrix.platform.setup-gdk-folder }}' - name: 'Set up LoongArch64 toolchain' uses: ./.github/actions/setup-loongarch64-toolchain id: setup-loongarch64-toolchain diff --git a/.gitignore b/.gitignore index ef5cc7137ac03..5326a62c39891 100644 --- a/.gitignore +++ b/.gitignore @@ -83,6 +83,7 @@ VisualC/tests/testyuv/testyuv.bmp VisualC-GDK/**/Layout src/render/direct3d12/D3D12_*_One.h src/render/direct3d12/D3D12_*_Series.h +Directory.Build.props # for Android android-project/local.properties diff --git a/build-scripts/setup-gdk-desktop.py b/build-scripts/setup-gdk-desktop.py new file mode 100644 index 0000000000000..d2309a0e3119e --- /dev/null +++ b/build-scripts/setup-gdk-desktop.py @@ -0,0 +1,303 @@ +#!/usr/bin/env python + +import argparse +import functools +import logging +import os +from pathlib import Path +import re +import shutil +import subprocess +import tempfile +import textwrap +import urllib.request +import zipfile + +# Update both variables when updating the GDK +GIT_REF = "June_2024_Update_1" +GDK_EDITION = "240601" # YYMMUU + +logger = logging.getLogger(__name__) + +class GdDesktopConfigurator: + def __init__(self, gdk_path, arch, vs_folder, vs_version=None, vs_toolset=None, temp_folder=None, git_ref=None, gdk_edition=None): + self.git_ref = git_ref or GIT_REF + self.gdk_edition = gdk_edition or GDK_EDITION + self.gdk_path = gdk_path + self.temp_folder = temp_folder or Path(tempfile.gettempdir()) + self.dl_archive_path = Path(self.temp_folder) / f"{ self.git_ref }.zip" + self.gdk_extract_path = Path(self.temp_folder) / f"GDK-{ self.git_ref }" + self.arch = arch + self.vs_folder = vs_folder + self._vs_version = vs_version + self._vs_toolset = vs_toolset + + def download_archive(self) -> None: + gdk_url = f"https://github.com/microsoft/GDK/archive/refs/tags/{ GIT_REF }.zip" + logger.info("Downloading %s to %s", gdk_url, self.dl_archive_path) + urllib.request.urlretrieve(gdk_url, self.dl_archive_path) + assert self.dl_archive_path.is_file() + + def extract_zip_archive(self) -> None: + extract_path = self.gdk_extract_path.parent + assert self.dl_archive_path.is_file() + logger.info("Extracting %s to %s", self.dl_archive_path, extract_path) + with zipfile.ZipFile(self.dl_archive_path) as zf: + zf.extractall(extract_path) + assert self.gdk_extract_path.is_dir(), f"{self.gdk_extract_path} must exist" + + def extract_development_kit(self) -> None: + extract_dks_cmd = self.gdk_extract_path / "SetupScripts/ExtractXboxOneDKs.cmd" + assert extract_dks_cmd.is_file() + logger.info("Extracting GDK Development Kit: running %s", extract_dks_cmd) + cmd = ["cmd.exe", "/C", str(extract_dks_cmd), str(self.gdk_extract_path), str(self.gdk_path)] + logger.debug("Running %r", cmd) + subprocess.check_call(cmd) + + def detect_vs_version(self) -> str: + vs_regex = re.compile("VS([0-9]{4})") + supported_vs_versions = [] + for p in self.gaming_grdk_build_path.iterdir(): + if not p.is_dir(): + continue + if m := vs_regex.match(p.name): + supported_vs_versions.append(m.group(1)) + logger.info(f"Supported Visual Studio versions: {supported_vs_versions}") + vs_versions = set(self.vs_folder.parts).intersection(set(supported_vs_versions)) + if not vs_versions: + raise RuntimeError("Visual Studio version is incompatible") + if len(vs_versions) > 1: + raise RuntimeError(f"Too many compatible VS versions found ({vs_versions})") + vs_version = vs_versions.pop() + logger.info(f"Used Visual Studio version: {vs_version}") + return vs_version + + def detect_vs_toolset(self) -> str: + toolset_paths = [] + for ts_path in self.gdk_toolset_parent_path.iterdir(): + if not ts_path.is_dir(): + continue + ms_props = ts_path / "Microsoft.Cpp.props" + if not ms_props.is_file(): + continue + toolset_paths.append(ts_path.name) + logger.info("Detected Visual Studio toolsets: %s", toolset_paths) + assert toolset_paths, "Have we detected at least one toolset?" + + def toolset_number(toolset: str) -> int: + if m:= re.match("[^0-9]*([0-9]+).*", toolset): + return int(m.group(1)) + return -9 + + return max(toolset_paths, key=toolset_number) + + @property + def vs_version(self) -> str: + if self._vs_version is None: + self._vs_version = self.detect_vs_version() + return self._vs_version + + @property + def vs_toolset(self) -> str: + if self._vs_toolset is None: + self._vs_toolset = self.detect_vs_toolset() + return self._vs_toolset + + @staticmethod + def copy_files_and_merge_into(srcdir: Path, dstdir: Path) -> None: + logger.info(f"Copy {srcdir} to {dstdir}") + for root, _, files in os.walk(srcdir): + dest_root = dstdir / Path(root).relative_to(srcdir) + if not dest_root.is_dir(): + dest_root.mkdir() + for file in files: + srcfile = Path(root) / file + dstfile = dest_root / file + shutil.copy(srcfile, dstfile) + + def copy_msbuild(self) -> None: + vc_toolset_parent_path = self.vs_folder / "MSBuild/Microsoft/VC" + if 1: + logger.info(f"Detected compatible Visual Studio version: {self.vs_version}") + srcdir = vc_toolset_parent_path + dstdir = self.gdk_toolset_parent_path + assert srcdir.is_dir(), "Source directory must exist" + assert dstdir.is_dir(), "Destination directory must exist" + + self.copy_files_and_merge_into(srcdir=srcdir, dstdir=dstdir) + + @property + def game_dk_path(self) -> Path: + return self.gdk_path / "Microsoft GDK" + + @property + def game_dk_latest_path(self) -> Path: + return self.game_dk_path / self.gdk_edition + + @property + def windows_sdk_path(self) -> Path: + return self.gdk_path / "Windows Kits/10" + + @property + def gaming_grdk_build_path(self) -> Path: + return self.game_dk_latest_path / "GRDK" + + @property + def gdk_toolset_parent_path(self) -> Path: + return self.gaming_grdk_build_path / f"VS{self.vs_version}/flatDeployment/MSBuild/Microsoft/VC" + + @property + def env(self) -> dict[str, str]: + game_dk = self.game_dk_path + game_dk_latest = self.game_dk_latest_path + windows_sdk_dir = self.windows_sdk_path + gaming_grdk_build = self.gaming_grdk_build_path + + return { + "GRDKEDITION": f"{self.gdk_edition}", + "GameDK": f"{game_dk}\\", + "GameDKLatest": f"{ game_dk_latest }\\", + "WindowsSdkDir": f"{ windows_sdk_dir }\\", + "GamingGRDKBuild": f"{ gaming_grdk_build }\\", + "VSInstallDir": f"{ self.vs_folder }\\", + } + + def create_user_props(self, path: Path) -> None: + vc_targets_path = self.gaming_grdk_build_path / f"VS{ self.vs_version }/flatDeployment/MSBuild/Microsoft/VC/{ self.vs_toolset }" + vc_targets_path16 = self.gaming_grdk_build_path / f"VS2019/flatDeployment/MSBuild/Microsoft/VC/{ self.vs_toolset }" + vc_targets_path17 = self.gaming_grdk_build_path / f"VS2022/flatDeployment/MSBuild/Microsoft/VC/{ self.vs_toolset }" + additional_include_directories = ";".join(str(p) for p in self.gdk_include_paths) + additional_library_directories = ";".join(str(p) for p in self.gdk_library_paths) + durango_xdk_install_path = self.gdk_path / "Microsoft GDK" + with path.open("w") as f: + f.write(textwrap.dedent(f"""\ + + + + { vc_targets_path }\\ + { vc_targets_path16 }\\ + { vc_targets_path17 }\\ + { self.gaming_grdk_build_path }\\ + Gaming.Desktop.x64 + Debug + { self.gdk_edition } + { durango_xdk_install_path } + + $(DurangoXdkInstallPath)\\{self.gdk_edition}\\GRDK\\VS2019\\flatDeployment\\MSBuild\\Microsoft\\VC\\{self.vs_toolset}\\Platforms\\$(Platform)\\ + $(DurangoXdkInstallPath)\\{self.gdk_edition}\\GRDK\\VS2019\\flatDeployment\\MSBuild\\Microsoft\\VC\\{self.vs_toolset}\\Platforms\\$(Platform)\\ + $(DurangoXdkInstallPath)\\{self.gdk_edition}\\GRDK\\VS2022\\flatDeployment\\MSBuild\\Microsoft\\VC\\{self.vs_toolset}\\Platforms\\$(Platform)\\ + $(DurangoXdkInstallPath)\\{self.gdk_edition}\\GRDK\\VS2022\\flatDeployment\\MSBuild\\Microsoft\\VC\\{self.vs_toolset}\\Platforms\\$(Platform)\\ + + true + true + true + + + + { additional_include_directories };%(AdditionalIncludeDirectories) + + + { additional_library_directories };%(AdditionalLibraryDirectories) + + + + """)) + + @property + def gdk_include_paths(self) -> list[Path]: + return [ + self.gaming_grdk_build_path / "gamekit/include", + ] + + @property + def gdk_library_paths(self) -> list[Path]: + return [ + self.gaming_grdk_build_path / f"gamekit/lib/{self.arch}", + ] + + @property + def gdk_binary_path(self) -> list[Path]: + return [ + self.gaming_grdk_build_path / "bin", + self.game_dk_path / "bin", + ] + + @property + def build_env(self) -> dict[str, str]: + gdk_include = ";".join(str(p) for p in self.gdk_include_paths) + gdk_lib = ";".join(str(p) for p in self.gdk_library_paths) + gdk_path = ";".join(str(p) for p in self.gdk_binary_path) + return { + "GDK_INCLUDE": gdk_include, + "GDK_LIB": gdk_lib, + "GDK_PATH": gdk_path, + } + + def print_env(self) -> None: + for k, v in self.env.items(): + print(f"set \"{k}={v}\"") + print() + for k, v in self.build_env.items(): + print(f"set \"{k}={v}\"") + print() + print(f"set \"PATH=%GDK_PATH%;%PATH%\"") + print(f"set \"LIB=%GDK_LIB%;%LIB%\"") + print(f"set \"INCLUDE=%GDK_INCLUDE%;%INCLUDE%\"") + + +def main(): + logging.basicConfig(level=logging.INFO) + parser = argparse.ArgumentParser(allow_abbrev=False) + parser.add_argument("--arch", choices=["amd64"], default="amd64", help="Architecture") + parser.add_argument("--download", action="store_true", help="Download GDK") + parser.add_argument("--extract", action="store_true", help="Extract downloaded GDK") + parser.add_argument("--copy-msbuild", action="store_true", help="Copy MSBuild files") + parser.add_argument("--temp-folder", help="Temporary folder where to download and extract GDK") + parser.add_argument("--gdk-path", required=True, type=Path, help="Folder where to store the GDK") + parser.add_argument("--ref-edition", type=str, help="Git ref and GDK edition separated by comma") + parser.add_argument("--vs-folder", required=True, type=Path, help="Installation folder of Visual Studio") + parser.add_argument("--vs-version", required=False, type=int, help="Visual Studio version") + parser.add_argument("--vs-toolset", required=False, help="Visual Studio toolset (e.g. v150)") + parser.add_argument("--props-folder", required=False, type=Path, default=Path(), help="Visual Studio toolset (e.g. v150)") + parser.add_argument("--no-user-props", required=False, dest="user_props", action="store_false", help="Don't ") + args = parser.parse_args() + + logging.basicConfig(level=logging.INFO) + + git_ref = None + gdk_edition = None + if args.ref_edition is not None: + git_ref, gdk_edition = args.ref_edition.split(",", 1) + try: + int(gdk_edition) + except ValueError: + parser.error("Edition should be an integer (YYMMUU) (Y=year M=month U=update)") + + configurator = GdDesktopConfigurator( + arch=args.arch, + git_ref=git_ref, + gdk_edition=gdk_edition, + vs_folder=args.vs_folder, + vs_version=args.vs_version, + vs_toolset=args.vs_toolset, + gdk_path=args.gdk_path, + temp_folder=args.temp_folder, + ) + + if args.download: + configurator.download_archive() + + if args.extract: + configurator.extract_zip_archive() + + configurator.extract_development_kit() + + if args.copy_msbuild: + configurator.copy_msbuild() + + if args.user_props: + configurator.print_env() + configurator.create_user_props(args.props_folder / "Directory.Build.props") + +if __name__ == "__main__": + raise SystemExit(main()) From 6f6f4fbfd3e438da6bca8b6c9d2bfdecb677aedd Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 4 Aug 2024 08:06:43 -0700 Subject: [PATCH 133/253] Updated X11 event debugging --- src/video/x11/SDL_x11events.c | 128 +++++++++++++++++----------------- 1 file changed, 65 insertions(+), 63 deletions(-) diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index e4650c32c89f4..cb46a4e377c6f 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -44,7 +44,9 @@ #include -/*#define DEBUG_XEVENTS*/ +#if 0 +#define DEBUG_XEVENTS +#endif #ifndef _NET_WM_MOVERESIZE_SIZE_TOPLEFT #define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0 @@ -335,7 +337,7 @@ void X11_ReconcileKeyboardState(SDL_VideoDevice *_this) static void X11_DispatchFocusIn(SDL_VideoDevice *_this, SDL_WindowData *data) { #ifdef DEBUG_XEVENTS - printf("window %p: Dispatching FocusIn\n", data); + SDL_Log("window 0x%lx: Dispatching FocusIn\n", data->xwindow); #endif SDL_SetKeyboardFocus(data->window); X11_ReconcileKeyboardState(_this); @@ -355,7 +357,7 @@ static void X11_DispatchFocusIn(SDL_VideoDevice *_this, SDL_WindowData *data) static void X11_DispatchFocusOut(SDL_VideoDevice *_this, SDL_WindowData *data) { #ifdef DEBUG_XEVENTS - printf("window %p: Dispatching FocusOut\n", data); + SDL_Log("window 0x%lx: Dispatching FocusOut\n", data->xwindow); #endif /* If another window has already processed a focus in, then don't try to * remove focus here. Doing so will incorrectly remove focus from that @@ -517,7 +519,7 @@ static void X11_UpdateUserTime(SDL_WindowData *data, const unsigned long latest) XA_CARDINAL, 32, PropModeReplace, (const unsigned char *)&latest, 1); #ifdef DEBUG_XEVENTS - printf("window %p: updating _NET_WM_USER_TIME to %lu\n", data, latest); + SDL_Log("window 0x%lx: updating _NET_WM_USER_TIME to %lu\n", data->xwindow, latest); #endif data->user_time = latest; } @@ -547,7 +549,7 @@ static void X11_HandleClipboardEvent(SDL_VideoDevice *_this, const XEvent *xeven #ifdef DEBUG_XEVENTS char *atom_name; atom_name = X11_XGetAtomName(display, req->target); - printf("window CLIPBOARD: SelectionRequest (requestor = %ld, target = %ld, mime_type = %s)\n", + SDL_Log("window CLIPBOARD: SelectionRequest (requestor = 0x%lx, target = 0x%lx, mime_type = %s)\n", req->requestor, req->target, atom_name); if (atom_name) { X11_XFree(atom_name); @@ -616,7 +618,7 @@ static void X11_HandleClipboardEvent(SDL_VideoDevice *_this, const XEvent *xeven case SelectionNotify: { #ifdef DEBUG_XEVENTS - printf("window CLIPBOARD: SelectionNotify (requestor = %ld, target = %ld)\n", + SDL_Log("window CLIPBOARD: SelectionNotify (requestor = 0x%lx, target = 0x%lx)\n", xevent->xselection.requestor, xevent->xselection.target); #endif videodata->selection_waiting = SDL_FALSE; @@ -629,7 +631,7 @@ static void X11_HandleClipboardEvent(SDL_VideoDevice *_this, const XEvent *xeven SDLX11_ClipboardData *clipboard = NULL; #ifdef DEBUG_XEVENTS - printf("window CLIPBOARD: SelectionClear (requestor = %ld, target = %ld)\n", + SDL_Log("window CLIPBOARD: SelectionClear (requestor = 0x%lx, target = 0x%lx)\n", xevent->xselection.requestor, xevent->xselection.target); #endif @@ -751,7 +753,7 @@ void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_ SDL_bool handled_by_ime = SDL_FALSE; #ifdef DEBUG_XEVENTS - printf("window %p: %s (X11 keycode = 0x%X)\n", data, (xevent->type == KeyPress ? "KeyPress" : "KeyRelease"), xevent->xkey.keycode); + SDL_Log("window 0x%lx %s (X11 keycode = 0x%X)\n", xevent->xany.window, (xevent->type == KeyPress ? "KeyPress" : "KeyRelease"), xevent->xkey.keycode); #endif #ifdef DEBUG_SCANCODES if (videodata->key_layout[keycode] == SDL_SCANCODE_UNKNOWN && keycode) { @@ -777,8 +779,8 @@ void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_ /* filter events catches XIM events and sends them to the correct handler */ if (X11_XFilterEvent(xevent, None)) { -#if 0 - printf("Filtered event type = %d display = %d window = %d\n", +#ifdef DEBUG_XEVENTS + SDL_Log("Filtered event type = %d display = %p window = 0x%lx\n", xevent->type, xevent->xany.display, xevent->xany.window); #endif /* Make sure dead key press/release events are sent */ @@ -845,7 +847,7 @@ void X11_HandleButtonPress(SDL_VideoDevice *_this, SDL_WindowData *windowdata, S Display *display = videodata->display; int xticks = 0, yticks = 0; #ifdef DEBUG_XEVENTS - printf("window %p: ButtonPress (X11 button = %d)\n", window, button); + SDL_Log("window 0x%lx: ButtonPress (X11 button = %d)\n", windowdata->xwindow, button); #endif if (X11_IsWheelEvent(display, button, &xticks, &yticks)) { SDL_SendMouseWheel(0, window, mouseID, (float)-xticks, (float)yticks, SDL_MOUSEWHEEL_NORMAL); @@ -883,7 +885,7 @@ void X11_HandleButtonRelease(SDL_VideoDevice *_this, SDL_WindowData *windowdata, /* The X server sends a Release event for each Press for wheels. Ignore them. */ int xticks = 0, yticks = 0; #ifdef DEBUG_XEVENTS - printf("window %p: ButtonRelease (X11 button = %d)\n", data, xevent->xbutton.button); + SDL_Log("window 0x%lx: ButtonRelease (X11 button = %d)\n", windowdata->xwindow, button); #endif if (!X11_IsWheelEvent(display, button, &xticks, &yticks)) { if (button > 7) { @@ -916,7 +918,7 @@ void X11_GetBorderValues(SDL_WindowData *data) X11_XFree(property); #ifdef DEBUG_XEVENTS - printf("New _NET_FRAME_EXTENTS: left=%d right=%d, top=%d, bottom=%d\n", data->border_left, data->border_right, data->border_top, data->border_bottom); + SDL_Log("New _NET_FRAME_EXTENTS: left=%d right=%d, top=%d, bottom=%d\n", data->border_left, data->border_right, data->border_top, data->border_bottom); #endif } } else { @@ -939,8 +941,8 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) /* Key press/release events are filtered in X11_HandleKeyEvent() */ if (xevent->type != KeyPress && xevent->type != KeyRelease) { if (X11_XFilterEvent(xevent, None)) { -#if 0 - printf("Filtered event type = %d display = %d window = %d\n", +#ifdef DEBUG_XEVENTS + SDL_Log("Filtered event type = %d display = %p window = 0x%lx\n", xevent->type, xevent->xany.display, xevent->xany.window); #endif return; @@ -967,8 +969,8 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) } #endif -#if 0 - printf("type = %d display = %d window = %d\n", +#ifdef DEBUG_XEVENTS + SDL_Log("X11 event type = %d display = %p window = 0x%lx\n", xevent->type, xevent->xany.display, xevent->xany.window); #endif @@ -981,7 +983,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0); #ifdef DEBUG_XEVENTS - printf("window CLIPBOARD: XFixesSelectionNotify (selection = %s)\n", + SDL_Log("window CLIPBOARD: XFixesSelectionNotify (selection = %s)\n", X11_XGetAtomName(display, ev->selection)); #endif @@ -1011,7 +1013,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) /* The window for KeymapNotify, etc events is 0 */ if (xevent->type == KeymapNotify) { #ifdef DEBUG_XEVENTS - printf("window %p: KeymapNotify!\n", data); + SDL_Log("window 0x%lx: KeymapNotify!\n", xevent->xany.window); #endif if (SDL_GetKeyboardFocus() != NULL) { #ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBLOOKUPKEYSYM @@ -1032,7 +1034,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) const int request = xevent->xmapping.request; #ifdef DEBUG_XEVENTS - printf("window %p: MappingNotify!\n", data); + SDL_Log("window 0x%lx: MappingNotify!\n", xevent->xany.window); #endif if ((request == MappingKeyboard) || (request == MappingModifier)) { X11_XRefreshKeyboardMapping(&xevent->xmapping); @@ -1077,15 +1079,15 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) { SDL_Mouse *mouse = SDL_GetMouse(); #ifdef DEBUG_XEVENTS - printf("window %p: EnterNotify! (%d,%d,%d)\n", data, + SDL_Log("window 0x%lx: EnterNotify! (%d,%d,%d)\n", xevent->xany.window, xevent->xcrossing.x, xevent->xcrossing.y, xevent->xcrossing.mode); if (xevent->xcrossing.mode == NotifyGrab) { - printf("Mode: NotifyGrab\n"); + SDL_Log("Mode: NotifyGrab\n"); } if (xevent->xcrossing.mode == NotifyUngrab) { - printf("Mode: NotifyUngrab\n"); + SDL_Log("Mode: NotifyUngrab\n"); } #endif SDL_SetMouseFocus(data->window); @@ -1116,15 +1118,15 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) case LeaveNotify: { #ifdef DEBUG_XEVENTS - printf("window %p: LeaveNotify! (%d,%d,%d)\n", data, + SDL_Log("window 0x%lx: LeaveNotify! (%d,%d,%d)\n", xevent->xany.window, xevent->xcrossing.x, xevent->xcrossing.y, xevent->xcrossing.mode); if (xevent->xcrossing.mode == NotifyGrab) { - printf("Mode: NotifyGrab\n"); + SDL_Log("Mode: NotifyGrab\n"); } if (xevent->xcrossing.mode == NotifyUngrab) { - printf("Mode: NotifyUngrab\n"); + SDL_Log("Mode: NotifyUngrab\n"); } #endif if (!SDL_GetMouse()->relative_mode) { @@ -1151,19 +1153,19 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) if (xevent->xfocus.mode == NotifyGrab || xevent->xfocus.mode == NotifyUngrab) { /* Someone is handling a global hotkey, ignore it */ #ifdef DEBUG_XEVENTS - printf("window %p: FocusIn (NotifyGrab/NotifyUngrab, ignoring)\n", data); + SDL_Log("window 0x%lx: FocusIn (NotifyGrab/NotifyUngrab, ignoring)\n", xevent->xany.window); #endif break; } if (xevent->xfocus.detail == NotifyInferior || xevent->xfocus.detail == NotifyPointer) { #ifdef DEBUG_XEVENTS - printf("window %p: FocusIn (NotifyInferior/NotifyPointer, ignoring)\n", data); + SDL_Log("window 0x%lx: FocusIn (NotifyInferior/NotifyPointer, ignoring)\n", xevent->xany.window); #endif break; } #ifdef DEBUG_XEVENTS - printf("window %p: FocusIn!\n", data); + SDL_Log("window 0x%lx: FocusIn!\n", xevent->xany.window); #endif if (!videodata->last_mode_change_deadline) /* no recent mode changes */ { data->pending_focus = PENDING_FOCUS_NONE; @@ -1182,7 +1184,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) if (xevent->xfocus.mode == NotifyGrab || xevent->xfocus.mode == NotifyUngrab) { /* Someone is handling a global hotkey, ignore it */ #ifdef DEBUG_XEVENTS - printf("window %p: FocusOut (NotifyGrab/NotifyUngrab, ignoring)\n", data); + SDL_Log("window 0x%lx: FocusOut (NotifyGrab/NotifyUngrab, ignoring)\n", xevent->xany.window); #endif break; } @@ -1191,12 +1193,12 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) care about the position of the pointer when the keyboard focus changed. */ #ifdef DEBUG_XEVENTS - printf("window %p: FocusOut (NotifyInferior/NotifyPointer, ignoring)\n", data); + SDL_Log("window 0x%lx: FocusOut (NotifyInferior/NotifyPointer, ignoring)\n", xevent->xany.window); #endif break; } #ifdef DEBUG_XEVENTS - printf("window %p: FocusOut!\n", data); + SDL_Log("window 0x%lx: FocusOut!\n", xevent->xany.window); #endif if (!videodata->last_mode_change_deadline) /* no recent mode changes */ { data->pending_focus = PENDING_FOCUS_NONE; @@ -1222,7 +1224,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) XEvent ev; #ifdef DEBUG_XEVENTS - printf("window %p: UnmapNotify!\n", data); + SDL_Log("window 0x%lx: UnmapNotify!\n", xevent->xany.window); #endif if (X11_XCheckIfEvent(display, &ev, &isReparentNotify, (XPointer)&xevent->xunmap)) { @@ -1243,7 +1245,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) case MapNotify: { #ifdef DEBUG_XEVENTS - printf("window %p: MapNotify!\n", data); + SDL_Log("window 0x%lx: MapNotify!\n", xevent->xany.window); #endif X11_DispatchMapNotify(data); @@ -1259,7 +1261,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) case ConfigureNotify: { #ifdef DEBUG_XEVENTS - printf("window %p: ConfigureNotify! (position: %d,%d, size: %dx%d)\n", data, + SDL_Log("window 0x%lx: ConfigureNotify! (position: %d,%d, size: %dx%d)\n", xevent->xany.window, xevent->xconfigure.x, xevent->xconfigure.y, xevent->xconfigure.width, xevent->xconfigure.height); #endif @@ -1328,9 +1330,9 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) data->xdnd_source = xevent->xclient.data.l[0]; xdnd_version = (xevent->xclient.data.l[1] >> 24); #ifdef DEBUG_XEVENTS - printf("XID of source window : %ld\n", data->xdnd_source); - printf("Protocol version to use : %d\n", xdnd_version); - printf("More then 3 data types : %d\n", (int)use_list); + SDL_Log("XID of source window : 0x%lx\n", data->xdnd_source); + SDL_Log("Protocol version to use : %d\n", xdnd_version); + SDL_Log("More then 3 data types : %d\n", (int)use_list); #endif if (use_list) { @@ -1351,7 +1353,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) if (xdnd_version >= 2) { act = xevent->xclient.data.l[4]; } - printf("Action requested by user is : %s\n", X11_XGetAtomName(display, act)); + SDL_Log("Action requested by user is : %s\n", X11_XGetAtomName(display, act)); #endif { /* Drag and Drop position */ @@ -1408,7 +1410,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) Window root = DefaultRootWindow(display); #ifdef DEBUG_XEVENTS - printf("window %p: _NET_WM_PING\n", data); + SDL_Log("window 0x%lx: _NET_WM_PING\n", xevent->xany.window); #endif xevent->xclient.window = root; X11_XSendEvent(display, root, False, SubstructureRedirectMask | SubstructureNotifyMask, xevent); @@ -1420,7 +1422,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) (xevent->xclient.data.l[0] == videodata->WM_DELETE_WINDOW)) { #ifdef DEBUG_XEVENTS - printf("window %p: WM_DELETE_WINDOW\n", data); + SDL_Log("window 0x%lx: WM_DELETE_WINDOW\n", xevent->xany.window); #endif SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0); break; @@ -1431,7 +1433,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) case Expose: { #ifdef DEBUG_XEVENTS - printf("window %p: Expose (count = %d)\n", data, xevent->xexpose.count); + SDL_Log("window 0x%lx: Expose (count = %d)\n", xevent->xany.window, xevent->xexpose.count); #endif SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_EXPOSED, 0, 0); } break; @@ -1464,7 +1466,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) SDL_Mouse *mouse = SDL_GetMouse(); if (!mouse->relative_mode || mouse->relative_mode_warp) { #ifdef DEBUG_MOTION - printf("window %p: X11 motion: %d,%d\n", data, xevent->xmotion.x, xevent->xmotion.y); + SDL_Log("window 0x%lx: X11 motion: %d,%d\n", xevent->xany.window, xevent->xmotion.x, xevent->xmotion.y); #endif X11_ProcessHitTest(_this, data, (float)xevent->xmotion.x, (float)xevent->xmotion.y, SDL_FALSE); @@ -1503,7 +1505,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) char *name = X11_XGetAtomName(display, xevent->xproperty.atom); if (name) { - printf("window %p: PropertyNotify: %s %s time=%lu\n", data, name, (xevent->xproperty.state == PropertyDelete) ? "deleted" : "changed", xevent->xproperty.time); + SDL_Log("window 0x%lx: PropertyNotify: %s %s time=%lu\n", xevent->xany.window, name, (xevent->xproperty.state == PropertyDelete) ? "deleted" : "changed", xevent->xproperty.time); X11_XFree(name); } @@ -1512,55 +1514,55 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) if (real_type == XA_INTEGER) { int *values = (int *)propdata; - printf("{"); + SDL_Log("{"); for (i = 0; i < items_read; i++) { - printf(" %d", values[i]); + SDL_Log(" %d", values[i]); } - printf(" }\n"); + SDL_Log(" }\n"); } else if (real_type == XA_CARDINAL) { if (real_format == 32) { Uint32 *values = (Uint32 *)propdata; - printf("{"); + SDL_Log("{"); for (i = 0; i < items_read; i++) { - printf(" %d", values[i]); + SDL_Log(" %d", values[i]); } - printf(" }\n"); + SDL_Log(" }\n"); } else if (real_format == 16) { Uint16 *values = (Uint16 *)propdata; - printf("{"); + SDL_Log("{"); for (i = 0; i < items_read; i++) { - printf(" %d", values[i]); + SDL_Log(" %d", values[i]); } - printf(" }\n"); + SDL_Log(" }\n"); } else if (real_format == 8) { Uint8 *values = (Uint8 *)propdata; - printf("{"); + SDL_Log("{"); for (i = 0; i < items_read; i++) { - printf(" %d", values[i]); + SDL_Log(" %d", values[i]); } - printf(" }\n"); + SDL_Log(" }\n"); } } else if (real_type == XA_STRING || real_type == videodata->UTF8_STRING) { - printf("{ \"%s\" }\n", propdata); + SDL_Log("{ \"%s\" }\n", propdata); } else if (real_type == XA_ATOM) { Atom *atoms = (Atom *)propdata; - printf("{"); + SDL_Log("{"); for (i = 0; i < items_read; i++) { char *atomname = X11_XGetAtomName(display, atoms[i]); if (atomname) { - printf(" %s", atomname); + SDL_Log(" %s", atomname); X11_XFree(atomname); } } - printf(" }\n"); + SDL_Log(" }\n"); } else { char *atomname = X11_XGetAtomName(display, real_type); - printf("Unknown type: %ld (%s)\n", real_type, atomname ? atomname : "UNKNOWN"); + SDL_Log("Unknown type: 0x%lx (%s)\n", real_type, atomname ? atomname : "UNKNOWN"); if (atomname) { X11_XFree(atomname); } @@ -1743,7 +1745,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) { Atom target = xevent->xselection.target; #ifdef DEBUG_XEVENTS - printf("window %p: SelectionNotify (requestor = %ld, target = %ld)\n", data, + SDL_Log("window 0x%lx: SelectionNotify (requestor = 0x%lx, target = 0x%lx)\n", xevent->xany.window, xevent->xselection.requestor, xevent->xselection.target); #endif if (target == data->xdnd_req) { @@ -1791,7 +1793,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) default: { #ifdef DEBUG_XEVENTS - printf("window %p: Unhandled event %d\n", data, xevent->type); + SDL_Log("window 0x%lx: Unhandled event %d\n", xevent->xany.window, xevent->type); #endif } break; } From ef6521aee762bd61e5a5d881eb1e972deeb9c5cd Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 4 Aug 2024 08:20:54 -0700 Subject: [PATCH 134/253] testnative: print events with --info event --- include/SDL3/SDL_test_common.h | 11 +++++++++-- src/test/SDL_test_common.c | 18 +++++++++++++++++- test/testnative.c | 8 ++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/include/SDL3/SDL_test_common.h b/include/SDL3/SDL_test_common.h index 76ea5e45c0090..a162a3de5573d 100644 --- a/include/SDL3/SDL_test_common.h +++ b/include/SDL3/SDL_test_common.h @@ -208,9 +208,16 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state); SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv); /** - * Common event handler for test windows if you use a standard SDL_main. + * Print the details of an event. + * + * This is automatically called by SDLTest_CommonEvent() as needed. * - * This will free data from the event, like the string in a drop event! + * \param event The event to print. + */ +void SDLTest_PrintEvent(const SDL_Event *event); + +/** + * Common event handler for test windows if you use a standard SDL_main. * * \param state The common state used to create test window. * \param event The event to handle. diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 05289d35eca6e..5f84b36495854 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -615,6 +615,22 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index) state->hide_cursor = SDL_TRUE; return 1; } + } else { + if (SDL_strcasecmp(argv[index], "--info") == 0) { + ++index; + if (!argv[index]) { + return -1; + } + if (SDL_strcasecmp(argv[index], "all") == 0) { + state->verbose |= VERBOSE_EVENT; + return 2; + } + if (SDL_strcasecmp(argv[index], "event") == 0) { + state->verbose |= VERBOSE_EVENT; + return 2; + } + return -1; + } } if (state->flags & SDL_INIT_AUDIO) { @@ -1555,7 +1571,7 @@ static const char *GamepadButtonName(const SDL_GamepadButton button) } } -static void SDLTest_PrintEvent(const SDL_Event *event) +void SDLTest_PrintEvent(const SDL_Event *event) { switch (event->type) { case SDL_EVENT_SYSTEM_THEME_CHANGED: diff --git a/test/testnative.c b/test/testnative.c index aee65b3eeec77..449bff3748d17 100644 --- a/test/testnative.c +++ b/test/testnative.c @@ -206,6 +206,14 @@ int main(int argc, char *argv[]) while (!done) { /* Check for events */ while (SDL_PollEvent(&event)) { + if (state->verbose & VERBOSE_EVENT) { + if (((event.type != SDL_EVENT_MOUSE_MOTION) && + (event.type != SDL_EVENT_FINGER_MOTION)) || + (state->verbose & VERBOSE_MOTION)) { + SDLTest_PrintEvent(&event); + } + } + switch (event.type) { case SDL_EVENT_WINDOW_EXPOSED: SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); From c7093858569969d07c641765c4f17c4c12b2d208 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 4 Aug 2024 08:22:35 -0700 Subject: [PATCH 135/253] Enable events for external X11 windows Fixes https://github.com/libsdl-org/SDL/issues/3825 Fixes https://github.com/libsdl-org/SDL/issues/5142 Fixes https://github.com/libsdl-org/SDL/issues/9503 --- src/video/x11/SDL_x11window.c | 68 ++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 3fe3cd588141c..d0cd1b558d789 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -421,6 +421,42 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, Window w) return 0; } +static void SetupWindowInput(SDL_VideoDevice *_this, SDL_Window *window) +{ + long fevent = 0; + SDL_WindowData *data = window->internal; + Window xwindow = data->xwindow; + +#ifdef X_HAVE_UTF8_STRING + if (SDL_X11_HAVE_UTF8 && data->ic) { + X11_XGetICValues(data->ic, XNFilterEvents, &fevent, NULL); + } +#endif + + X11_Xinput2SelectTouch(_this, window); + + { + unsigned int x11_keyboard_events = KeyPressMask | KeyReleaseMask; + unsigned int x11_pointer_events = ButtonPressMask | ButtonReleaseMask | PointerMotionMask; + + X11_Xinput2SelectMouseAndKeyboard(_this, window); + + /* If XInput2 can handle pointer and keyboard events, we don't track them here */ + if (data->xinput2_keyboard_enabled) { + x11_keyboard_events = 0; + } + if (data->xinput2_mouse_enabled) { + x11_pointer_events = 0; + } + + X11_XSelectInput(data->videodata->display, xwindow, + (FocusChangeMask | EnterWindowMask | LeaveWindowMask | ExposureMask | + x11_keyboard_events | x11_pointer_events | + PropertyChangeMask | StructureNotifyMask | + KeymapStateMask | fevent)); + } +} + static void SetWindowBordered(Display *display, int screen, Window window, SDL_bool border) { /* @@ -461,6 +497,8 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI if (SetupWindowData(_this, window, w) < 0) { return -1; } + + SetupWindowInput(_this, window); return 0; } @@ -486,7 +524,6 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI const char *wintype_name = NULL; long compositor = 1; Atom _NET_WM_PID; - long fevent = 0; const char *hint = NULL; int win_x, win_y; SDL_bool undefined_position = SDL_FALSE; @@ -783,12 +820,6 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI } #endif -#ifdef X_HAVE_UTF8_STRING - if (SDL_X11_HAVE_UTF8 && windowdata->ic) { - X11_XGetICValues(windowdata->ic, XNFilterEvents, &fevent, NULL); - } -#endif - #ifdef SDL_VIDEO_DRIVER_X11_XSHAPE /* Tooltips do not receive input */ if (window->flags & SDL_WINDOW_TOOLTIP) { @@ -798,28 +829,7 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI } #endif - X11_Xinput2SelectTouch(_this, window); - - { - unsigned int x11_keyboard_events = KeyPressMask | KeyReleaseMask; - unsigned int x11_pointer_events = ButtonPressMask | ButtonReleaseMask | PointerMotionMask; - - X11_Xinput2SelectMouseAndKeyboard(_this, window); - - /* If XInput2 can handle pointer and keyboard events, we don't track them here */ - if (windowdata->xinput2_keyboard_enabled) { - x11_keyboard_events = 0; - } - if (windowdata->xinput2_mouse_enabled) { - x11_pointer_events = 0; - } - - X11_XSelectInput(display, w, - (FocusChangeMask | EnterWindowMask | LeaveWindowMask | ExposureMask | - x11_keyboard_events | x11_pointer_events | - PropertyChangeMask | StructureNotifyMask | - KeymapStateMask | fevent)); - } + SetupWindowInput(_this, window); /* For _ICC_PROFILE. */ X11_XSelectInput(display, RootWindow(display, screen), PropertyChangeMask); From 66cb2153cc8c59d0629d1d2ef7da4ed3e03099a3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 4 Aug 2024 09:56:57 -0700 Subject: [PATCH 136/253] Handle Colemak swapping of CapsLock and Backspace Fixes https://github.com/libsdl-org/SDL/issues/7853 --- src/video/windows/SDL_windowskeyboard.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index 304f15491a1f7..3ff2afdb38fff 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -108,6 +108,18 @@ void WIN_UpdateKeymap(SDL_bool send_event) if (scancode == SDL_SCANCODE_UNKNOWN || scancode == SDL_SCANCODE_DELETE || (SDL_GetDefaultKeyFromScancode(scancode, SDL_KMOD_NONE) & SDLK_SCANCODE_MASK)) { + + /* The Colemak mapping swaps Backspace and CapsLock */ + if (mods[m] == SDL_KMOD_NONE && + (scancode == SDL_SCANCODE_CAPSLOCK || + scancode == SDL_SCANCODE_BACKSPACE)) { + vk = LOBYTE(MapVirtualKey(i, MAPVK_VSC_TO_VK)); + if (vk == VK_CAPITAL) { + SDL_SetKeymapEntry(keymap, scancode, mods[m], SDLK_CAPSLOCK); + } else if (vk == VK_BACK) { + SDL_SetKeymapEntry(keymap, scancode, mods[m], SDLK_BACKSPACE); + } + } continue; } From 6da4278d37f008553cf299dd1dafdb397b774c8e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 4 Aug 2024 10:37:51 -0700 Subject: [PATCH 137/253] Clarify how to check for EOF in SDL_ReadIO() documentation. Fixes https://github.com/libsdl-org/SDL/issues/8564 --- include/SDL3/SDL_iostream.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/SDL3/SDL_iostream.h b/include/SDL3/SDL_iostream.h index 430cd3e40bc55..0194f272bfe3e 100644 --- a/include/SDL3/SDL_iostream.h +++ b/include/SDL3/SDL_iostream.h @@ -481,9 +481,7 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context); * * This function reads up `size` bytes from the data source to the area * pointed at by `ptr`. This function may read less bytes than requested. It - * will return zero when the data stream is completely read, or on error. To - * determine if there was an error or all data was read, call - * SDL_GetIOStatus(). + * will return zero when the data stream is completely read, and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF, or on error, and SDL_GetIOStatus() will return SDL_IO_STATUS_ERROR. * * \param context a pointer to an SDL_IOStream structure. * \param ptr a pointer to a buffer to read data into. From 454c85ad5114f23a61d40e5db3bad60393fc152c Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sun, 4 Aug 2024 17:39:54 +0000 Subject: [PATCH 138/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_iostream.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_iostream.h b/include/SDL3/SDL_iostream.h index 0194f272bfe3e..fce0e1245c8aa 100644 --- a/include/SDL3/SDL_iostream.h +++ b/include/SDL3/SDL_iostream.h @@ -481,7 +481,9 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context); * * This function reads up `size` bytes from the data source to the area * pointed at by `ptr`. This function may read less bytes than requested. It - * will return zero when the data stream is completely read, and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF, or on error, and SDL_GetIOStatus() will return SDL_IO_STATUS_ERROR. + * will return zero when the data stream is completely read, and + * SDL_GetIOStatus() will return SDL_IO_STATUS_EOF, or on error, and + * SDL_GetIOStatus() will return SDL_IO_STATUS_ERROR. * * \param context a pointer to an SDL_IOStream structure. * \param ptr a pointer to a buffer to read data into. From bc1c3f826f9acb705344280936852d17b81f980c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 4 Aug 2024 10:47:41 -0700 Subject: [PATCH 139/253] Added SDL_HINT_LOGGING documentation to the logging category page. Fixes https://github.com/libsdl-org/SDL/issues/10335 --- include/SDL3/SDL_log.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_log.h b/include/SDL3/SDL_log.h index 171cce8449856..b74876492f411 100644 --- a/include/SDL3/SDL_log.h +++ b/include/SDL3/SDL_log.h @@ -29,9 +29,23 @@ * it will only be sent out if it has that minimum priority or higher. * * SDL's own logs are sent below the default priority threshold, so they are - * quiet by default. If you're debugging SDL you might want: + * quiet by default. * - * SDL_SetLogPriorities(SDL_LOG_PRIORITY_WARN); + * You can change the log verbosity programmatically using SDL_SetLogPriority() or with SDL_SetHint(SDL_HINT_LOGGING, ...), or with the "SDL_LOGGING" environment variable. This variable is a comma separated set of category=level tokens that define the default logging levels for SDL applications. + * + * The category can be a numeric category, one of "app", "error", "assert", + * "system", "audio", "video", "render", "input", "test", or `*` for any + * unspecified category. + * + * The level can be a numeric level, one of "verbose", "debug", "info", + * "warn", "error", "critical", or "quiet" to disable that category. + * + * You can omit the category if you want to set the logging level for all + * categories. + * + * If this hint isn't set, the default log levels are equivalent to: + * + * `app=info,assert=warn,test=verbose,*=error` * * Here's where the messages go on different platforms: * From a699ff2419d17b72b263fc880a318de73bb10a14 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sun, 4 Aug 2024 17:49:28 +0000 Subject: [PATCH 140/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_log.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_log.h b/include/SDL3/SDL_log.h index b74876492f411..eba3fac8d3166 100644 --- a/include/SDL3/SDL_log.h +++ b/include/SDL3/SDL_log.h @@ -31,7 +31,11 @@ * SDL's own logs are sent below the default priority threshold, so they are * quiet by default. * - * You can change the log verbosity programmatically using SDL_SetLogPriority() or with SDL_SetHint(SDL_HINT_LOGGING, ...), or with the "SDL_LOGGING" environment variable. This variable is a comma separated set of category=level tokens that define the default logging levels for SDL applications. + * You can change the log verbosity programmatically using + * SDL_SetLogPriority() or with SDL_SetHint(SDL_HINT_LOGGING, ...), or with + * the "SDL_LOGGING" environment variable. This variable is a comma separated + * set of category=level tokens that define the default logging levels for SDL + * applications. * * The category can be a numeric category, one of "app", "error", "assert", * "system", "audio", "video", "render", "input", "test", or `*` for any From 4b3a80bb73fd953126e4daaf4b63acc8ebd76de3 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sun, 4 Aug 2024 21:23:25 +0200 Subject: [PATCH 141/253] msbuild: add TreatWarningAsError property, and enable it on ci --- .github/workflows/create-test-plan.py | 1 + VisualC-GDK/SDL/SDL.vcxproj | 5 +++++ VisualC-GDK/SDL_test/SDL_test.vcxproj | 5 +++++ VisualC-GDK/tests/testcontroller/testcontroller.vcxproj | 5 +++++ VisualC-GDK/tests/testgdk/testgdk.vcxproj | 5 +++++ VisualC-GDK/tests/testsprite/testsprite.vcxproj | 5 +++++ VisualC-WinRT/SDL-UWP.vcxproj | 5 +++++ VisualC-WinRT/testdraw/testdraw.vcxproj | 5 +++++ VisualC/SDL/SDL.vcxproj | 5 +++++ VisualC/SDL_test/SDL_test.vcxproj | 5 +++++ VisualC/tests/checkkeys/checkkeys.vcxproj | 5 +++++ VisualC/tests/loopwave/loopwave.vcxproj | 5 +++++ VisualC/tests/testatomic/testatomic.vcxproj | 5 +++++ VisualC/tests/testautomation/testautomation.vcxproj | 5 +++++ VisualC/tests/testcontroller/testcontroller.vcxproj | 5 +++++ VisualC/tests/testdraw/testdraw.vcxproj | 5 +++++ VisualC/tests/testfile/testfile.vcxproj | 5 +++++ VisualC/tests/testgl/testgl.vcxproj | 5 +++++ VisualC/tests/testgles2/testgles2.vcxproj | 5 +++++ VisualC/tests/testoverlay/testoverlay.vcxproj | 5 +++++ VisualC/tests/testpen/testpen.vcxproj | 5 +++++ VisualC/tests/testplatform/testplatform.vcxproj | 5 +++++ VisualC/tests/testpower/testpower.vcxproj | 5 +++++ VisualC/tests/testrendertarget/testrendertarget.vcxproj | 5 +++++ VisualC/tests/testrumble/testrumble.vcxproj | 5 +++++ VisualC/tests/testscale/testscale.vcxproj | 5 +++++ VisualC/tests/testsensor/testsensor.vcxproj | 5 +++++ VisualC/tests/testshape/testshape.vcxproj | 5 +++++ VisualC/tests/testsprite/testsprite.vcxproj | 5 +++++ VisualC/tests/testsurround/testsurround.vcxproj | 5 +++++ VisualC/tests/testvulkan/testvulkan.vcxproj | 5 +++++ VisualC/tests/testwm/testwm.vcxproj | 5 +++++ VisualC/tests/testyuv/testyuv.vcxproj | 5 +++++ 33 files changed, 161 insertions(+) diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py index c6d4f0aa8cd72..a1850134f2a09 100755 --- a/.github/workflows/create-test-plan.py +++ b/.github/workflows/create-test-plan.py @@ -321,6 +321,7 @@ def spec_to_job(spec: JobSpec) -> JobDetails: job.setup_ninja = not spec.gdk job.clang_tidy = False # complains about \threadsafety: "unknown command tag name [clang-diagnostic-documentation-unknown-command]" job.msvc_project = spec.msvc_project if spec.msvc_project else "" + job.msvc_project_flags.append("-p:TreatWarningsAsError=true") job.test_pkg_config = False job.cmake_arguments.extend(( "-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=ProgramDatabase", diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj index f8905e12daa20..77fc0785a83a7 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj +++ b/VisualC-GDK/SDL/SDL.vcxproj @@ -306,6 +306,11 @@ Building shader blobs (Xbox One) + + + $(TreatWarningsAsError) + + diff --git a/VisualC-GDK/SDL_test/SDL_test.vcxproj b/VisualC-GDK/SDL_test/SDL_test.vcxproj index 2c7ada3ca0148..7505baf8602c6 100644 --- a/VisualC-GDK/SDL_test/SDL_test.vcxproj +++ b/VisualC-GDK/SDL_test/SDL_test.vcxproj @@ -184,6 +184,11 @@ true + + + $(TreatWarningsAsError) + + diff --git a/VisualC-GDK/tests/testcontroller/testcontroller.vcxproj b/VisualC-GDK/tests/testcontroller/testcontroller.vcxproj index 51f1d92cdb548..d7ad95cf244c7 100644 --- a/VisualC-GDK/tests/testcontroller/testcontroller.vcxproj +++ b/VisualC-GDK/tests/testcontroller/testcontroller.vcxproj @@ -260,6 +260,11 @@ xgameruntime.lib;%(AdditionalDependencies) + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC-GDK/tests/testgdk/testgdk.vcxproj b/VisualC-GDK/tests/testgdk/testgdk.vcxproj index 27b9662d677b2..41293cadae55e 100644 --- a/VisualC-GDK/tests/testgdk/testgdk.vcxproj +++ b/VisualC-GDK/tests/testgdk/testgdk.vcxproj @@ -284,6 +284,11 @@ + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC-GDK/tests/testsprite/testsprite.vcxproj b/VisualC-GDK/tests/testsprite/testsprite.vcxproj index a3af667e76335..3885aec28aa3f 100644 --- a/VisualC-GDK/tests/testsprite/testsprite.vcxproj +++ b/VisualC-GDK/tests/testsprite/testsprite.vcxproj @@ -284,6 +284,11 @@ + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC-WinRT/SDL-UWP.vcxproj b/VisualC-WinRT/SDL-UWP.vcxproj index b5a5a49f4cee9..7a5c81952e71e 100644 --- a/VisualC-WinRT/SDL-UWP.vcxproj +++ b/VisualC-WinRT/SDL-UWP.vcxproj @@ -916,6 +916,11 @@ /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) + + + $(TreatWarningsAsError) + + diff --git a/VisualC-WinRT/testdraw/testdraw.vcxproj b/VisualC-WinRT/testdraw/testdraw.vcxproj index eea5a6ccd31eb..86d985dba8b18 100644 --- a/VisualC-WinRT/testdraw/testdraw.vcxproj +++ b/VisualC-WinRT/testdraw/testdraw.vcxproj @@ -264,6 +264,11 @@ NotUsing + + + $(TreatWarningsAsError) + + diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index 59e786fc237f7..4cb8de774c47f 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -230,6 +230,11 @@ true + + + $(TreatWarningsAsError) + + diff --git a/VisualC/SDL_test/SDL_test.vcxproj b/VisualC/SDL_test/SDL_test.vcxproj index 90b52243ca199..541f7cb0cf6f6 100644 --- a/VisualC/SDL_test/SDL_test.vcxproj +++ b/VisualC/SDL_test/SDL_test.vcxproj @@ -152,6 +152,11 @@ true + + + $(TreatWarningsAsError) + + diff --git a/VisualC/tests/checkkeys/checkkeys.vcxproj b/VisualC/tests/checkkeys/checkkeys.vcxproj index 7d35d4bcefbc4..cc263df07d9bd 100644 --- a/VisualC/tests/checkkeys/checkkeys.vcxproj +++ b/VisualC/tests/checkkeys/checkkeys.vcxproj @@ -183,6 +183,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/loopwave/loopwave.vcxproj b/VisualC/tests/loopwave/loopwave.vcxproj index 13d37fdfb2c3f..a5912a9a8c5a0 100644 --- a/VisualC/tests/loopwave/loopwave.vcxproj +++ b/VisualC/tests/loopwave/loopwave.vcxproj @@ -183,6 +183,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testatomic/testatomic.vcxproj b/VisualC/tests/testatomic/testatomic.vcxproj index c9ab811a8d545..5a1efef2dacf4 100644 --- a/VisualC/tests/testatomic/testatomic.vcxproj +++ b/VisualC/tests/testatomic/testatomic.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testautomation/testautomation.vcxproj b/VisualC/tests/testautomation/testautomation.vcxproj index 666c7155bfedf..af345542d0083 100644 --- a/VisualC/tests/testautomation/testautomation.vcxproj +++ b/VisualC/tests/testautomation/testautomation.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testcontroller/testcontroller.vcxproj b/VisualC/tests/testcontroller/testcontroller.vcxproj index 8c0854b145efc..94c8629a1a266 100644 --- a/VisualC/tests/testcontroller/testcontroller.vcxproj +++ b/VisualC/tests/testcontroller/testcontroller.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testdraw/testdraw.vcxproj b/VisualC/tests/testdraw/testdraw.vcxproj index e3e232a7d429d..5ca57bf082bc0 100644 --- a/VisualC/tests/testdraw/testdraw.vcxproj +++ b/VisualC/tests/testdraw/testdraw.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testfile/testfile.vcxproj b/VisualC/tests/testfile/testfile.vcxproj index 6d9c371b1a57e..a38880d5e3a0e 100644 --- a/VisualC/tests/testfile/testfile.vcxproj +++ b/VisualC/tests/testfile/testfile.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testgl/testgl.vcxproj b/VisualC/tests/testgl/testgl.vcxproj index 1e32a90494e6d..b8bc234ec1faf 100644 --- a/VisualC/tests/testgl/testgl.vcxproj +++ b/VisualC/tests/testgl/testgl.vcxproj @@ -181,6 +181,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testgles2/testgles2.vcxproj b/VisualC/tests/testgles2/testgles2.vcxproj index 743af4b8c90bc..13d0df290306a 100644 --- a/VisualC/tests/testgles2/testgles2.vcxproj +++ b/VisualC/tests/testgles2/testgles2.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testoverlay/testoverlay.vcxproj b/VisualC/tests/testoverlay/testoverlay.vcxproj index 5272c28d22cea..80c8b03040026 100644 --- a/VisualC/tests/testoverlay/testoverlay.vcxproj +++ b/VisualC/tests/testoverlay/testoverlay.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testpen/testpen.vcxproj b/VisualC/tests/testpen/testpen.vcxproj index 79f2526273fa8..fdef64f234051 100644 --- a/VisualC/tests/testpen/testpen.vcxproj +++ b/VisualC/tests/testpen/testpen.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testplatform/testplatform.vcxproj b/VisualC/tests/testplatform/testplatform.vcxproj index 5ef911d1db7f5..788429ec5bf65 100644 --- a/VisualC/tests/testplatform/testplatform.vcxproj +++ b/VisualC/tests/testplatform/testplatform.vcxproj @@ -205,6 +205,11 @@ .\Release/testplatform.bsc + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testpower/testpower.vcxproj b/VisualC/tests/testpower/testpower.vcxproj index abf6b8c6b3e0c..98ca2b53a2c67 100644 --- a/VisualC/tests/testpower/testpower.vcxproj +++ b/VisualC/tests/testpower/testpower.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testrendertarget/testrendertarget.vcxproj b/VisualC/tests/testrendertarget/testrendertarget.vcxproj index 8582f01dd7f6f..eaf719bb291aa 100644 --- a/VisualC/tests/testrendertarget/testrendertarget.vcxproj +++ b/VisualC/tests/testrendertarget/testrendertarget.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testrumble/testrumble.vcxproj b/VisualC/tests/testrumble/testrumble.vcxproj index c50bd4523ea76..c0cb1090b64ff 100644 --- a/VisualC/tests/testrumble/testrumble.vcxproj +++ b/VisualC/tests/testrumble/testrumble.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testscale/testscale.vcxproj b/VisualC/tests/testscale/testscale.vcxproj index 957f8b5575c11..3843e57ae34aa 100644 --- a/VisualC/tests/testscale/testscale.vcxproj +++ b/VisualC/tests/testscale/testscale.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testsensor/testsensor.vcxproj b/VisualC/tests/testsensor/testsensor.vcxproj index bc8495e578588..3f034ad396dc6 100644 --- a/VisualC/tests/testsensor/testsensor.vcxproj +++ b/VisualC/tests/testsensor/testsensor.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testshape/testshape.vcxproj b/VisualC/tests/testshape/testshape.vcxproj index 0dc50470e5c48..33521f68443c5 100644 --- a/VisualC/tests/testshape/testshape.vcxproj +++ b/VisualC/tests/testshape/testshape.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testsprite/testsprite.vcxproj b/VisualC/tests/testsprite/testsprite.vcxproj index d9011921f933d..f53408ff57239 100644 --- a/VisualC/tests/testsprite/testsprite.vcxproj +++ b/VisualC/tests/testsprite/testsprite.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testsurround/testsurround.vcxproj b/VisualC/tests/testsurround/testsurround.vcxproj index 950f22e9f5c48..657dd1f3d7468 100644 --- a/VisualC/tests/testsurround/testsurround.vcxproj +++ b/VisualC/tests/testsurround/testsurround.vcxproj @@ -183,6 +183,11 @@ Console + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testvulkan/testvulkan.vcxproj b/VisualC/tests/testvulkan/testvulkan.vcxproj index 158a4253f8c62..800aa50ff4747 100644 --- a/VisualC/tests/testvulkan/testvulkan.vcxproj +++ b/VisualC/tests/testvulkan/testvulkan.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {da956fd3-e143-46f2-9fe5-c77bebc56b1a} diff --git a/VisualC/tests/testwm/testwm.vcxproj b/VisualC/tests/testwm/testwm.vcxproj index b88dd5356fe0c..b16df24343c5b 100644 --- a/VisualC/tests/testwm/testwm.vcxproj +++ b/VisualC/tests/testwm/testwm.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} diff --git a/VisualC/tests/testyuv/testyuv.vcxproj b/VisualC/tests/testyuv/testyuv.vcxproj index 14e5e778006e6..e0eefbd742f39 100644 --- a/VisualC/tests/testyuv/testyuv.vcxproj +++ b/VisualC/tests/testyuv/testyuv.vcxproj @@ -177,6 +177,11 @@ Windows + + + $(TreatWarningsAsError) + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} From 4bea89e945c6028abe8bdbda83d065c39e0a45aa Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Sun, 4 Aug 2024 15:31:15 -0400 Subject: [PATCH 142/253] Xbox buildfixes --- src/video/windows/SDL_windowsvideo.c | 4 ++++ src/video/windows/SDL_windowsvideo.h | 2 ++ src/video/windows/SDL_windowswindow.c | 3 +-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c index 118717b9a0355..ee768c1e1698b 100644 --- a/src/video/windows/SDL_windowsvideo.c +++ b/src/video/windows/SDL_windowsvideo.c @@ -473,12 +473,14 @@ int WIN_VideoInit(SDL_VideoDevice *_this) if (SUCCEEDED(hr)) { data->coinitialized = SDL_TRUE; +#if !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) hr = OleInitialize(NULL); if (SUCCEEDED(hr)) { data->oleinitialized = SDL_TRUE; } else { SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "OleInitialize() failed: 0x%.8x, using fallback drag-n-drop functionality\n", (unsigned int)hr); } +#endif /* !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) */ } else { SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "CoInitialize() failed: 0x%.8x, using fallback drag-n-drop functionality\n", (unsigned int)hr); } @@ -543,10 +545,12 @@ void WIN_VideoQuit(SDL_VideoDevice *_this) WIN_SetRawMouseEnabled(_this, SDL_FALSE); WIN_SetRawKeyboardEnabled(_this, SDL_FALSE); +#if !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) if (data->oleinitialized) { OleUninitialize(); data->oleinitialized = SDL_FALSE; } +#endif /* !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) */ if (data->coinitialized) { WIN_CoUninitialize(); data->coinitialized = SDL_FALSE; diff --git a/src/video/windows/SDL_windowsvideo.h b/src/video/windows/SDL_windowsvideo.h index fa3aba980df74..2265ac01922f4 100644 --- a/src/video/windows/SDL_windowsvideo.h +++ b/src/video/windows/SDL_windowsvideo.h @@ -380,7 +380,9 @@ struct SDL_VideoData int render; SDL_bool coinitialized; +#if !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) SDL_bool oleinitialized; +#endif /* !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) */ DWORD clipboard_count; diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index c15e40ca08a75..019fdd68c7561 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -589,11 +589,10 @@ static void CleanupWindowData(SDL_VideoDevice *_this, SDL_Window *window) if (data) { SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, WIN_MouseRelativeModeCenterChanged, data); +#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) if (data->drop_target) { WIN_AcceptDragAndDrop(window, SDL_FALSE); } - -#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) if (data->ICMFileName) { SDL_free(data->ICMFileName); } From 90757fba5d6916c171d95b445c54fb2b0eab8317 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sun, 4 Aug 2024 22:16:22 +0200 Subject: [PATCH 143/253] Remove bscmake reference Although BSCMAKE is still installed with Visual Studio, it is no longer used by the IDE. Since Visual Studio 2008, browse and symbol information is stored automatically in a SQL Server .sdf file in the solution folder. --- VisualC/tests/testplatform/testplatform.vcxproj | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/VisualC/tests/testplatform/testplatform.vcxproj b/VisualC/tests/testplatform/testplatform.vcxproj index 788429ec5bf65..7752f733f78d3 100644 --- a/VisualC/tests/testplatform/testplatform.vcxproj +++ b/VisualC/tests/testplatform/testplatform.vcxproj @@ -107,10 +107,6 @@ true Windows - - true - .\Debug/testplatform.bsc - @@ -140,10 +136,6 @@ true Windows - - true - .\Debug/testplatform.bsc - @@ -170,10 +162,6 @@ Windows - - true - .\Release/testplatform.bsc - @@ -200,10 +188,6 @@ Windows - - true - .\Release/testplatform.bsc - From 7dfb9acb71da02f422eaf9310ac5f150fbbe6e51 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Mon, 5 Aug 2024 00:07:15 +0200 Subject: [PATCH 144/253] VisualC: add testdialog project --- VisualC/SDL.sln | 11 ++ VisualC/tests/testdialog/testdialog.vcxproj | 205 ++++++++++++++++++++ 2 files changed, 216 insertions(+) create mode 100644 VisualC/tests/testdialog/testdialog.vcxproj diff --git a/VisualC/SDL.sln b/VisualC/SDL.sln index 67484805ddbe6..f0492dfb18d94 100644 --- a/VisualC/SDL.sln +++ b/VisualC/SDL.sln @@ -12,6 +12,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testatomic", "tests\testato EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testautomation", "tests\testautomation\testautomation.vcxproj", "{9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testdialog", "tests\testdialog\testdialog.vcxproj", "{97A3A89b-E023-48CD-905F-CDBDE8D951DE}" +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testdraw", "tests\testdraw\testdraw.vcxproj", "{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testfile", "tests\testfile\testfile.vcxproj", "{CAE4F1D0-314F-4B10-805B-0EFD670133A0}" @@ -100,6 +102,14 @@ Global {9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA}.Release|Win32.Build.0 = Release|Win32 {9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA}.Release|x64.ActiveCfg = Release|x64 {9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA}.Release|x64.Build.0 = Release|x64 + {97A3A89b-E023-48CD-905F-CDBDE8D951DE}.Debug|Win32.ActiveCfg = Debug|Win32 + {97A3A89b-E023-48CD-905F-CDBDE8D951DE}.Debug|Win32.Build.0 = Debug|Win32 + {97A3A89b-E023-48CD-905F-CDBDE8D951DE}.Debug|x64.ActiveCfg = Debug|x64 + {97A3A89b-E023-48CD-905F-CDBDE8D951DE}.Debug|x64.Build.0 = Debug|x64 + {97A3A89b-E023-48CD-905F-CDBDE8D951DE}.Release|Win32.ActiveCfg = Release|Win32 + {97A3A89b-E023-48CD-905F-CDBDE8D951DE}.Release|Win32.Build.0 = Release|Win32 + {97A3A89b-E023-48CD-905F-CDBDE8D951DE}.Release|x64.ActiveCfg = Release|x64 + {97A3A89b-E023-48CD-905F-CDBDE8D951DE}.Release|x64.Build.0 = Release|x64 {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|Win32.ActiveCfg = Debug|Win32 {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|Win32.Build.0 = Debug|Win32 {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|x64.ActiveCfg = Debug|x64 @@ -269,6 +279,7 @@ Global {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} {66B32F7E-5716-48D0-B5B9-D832FD052DD5} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} {9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} + {97A3A89b-E023-48CD-905F-CDBDE8D951DE} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} {CAE4F1D0-314F-4B10-805B-0EFD670133A0} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} {8B5CFB38-CCBA-40A8-AD7A-89C57B070884} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} diff --git a/VisualC/tests/testdialog/testdialog.vcxproj b/VisualC/tests/testdialog/testdialog.vcxproj new file mode 100644 index 0000000000000..ed773c472c23b --- /dev/null +++ b/VisualC/tests/testdialog/testdialog.vcxproj @@ -0,0 +1,205 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {97A3A89B-E023-48CD-905F-CDBDE8D951DE} + testdialog + 10.0 + + + + Application + $(DefaultPlatformToolset) + + + Application + $(DefaultPlatformToolset) + + + Application + $(DefaultPlatformToolset) + + + Application + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/testdialog.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + X64 + .\Debug/testdialog.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/testdialog.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + .\Release/testdialog.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + + + + + $(TreatWarningsAsError) + + + + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} + false + false + true + + + {da956fd3-e143-46f2-9fe5-c77bebc56b1a} + false + false + true + + + + + + + + + \ No newline at end of file From b1af91e7885343fd47c6b72c3c086663aa05cdd2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 4 Aug 2024 19:44:13 -0700 Subject: [PATCH 145/253] Clarified timer documentation Fixes https://github.com/libsdl-org/SDL/issues/10079 --- include/SDL3/SDL_timer.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/SDL3/SDL_timer.h b/include/SDL3/SDL_timer.h index cd3cc3a11dcd5..30b4e0be6e080 100644 --- a/include/SDL3/SDL_timer.h +++ b/include/SDL3/SDL_timer.h @@ -137,7 +137,7 @@ typedef Uint32 SDL_TimerID; * The callback function is passed the current timer interval and returns the * next timer interval, in milliseconds. If the returned value is the same as * the one passed in, the periodic alarm continues, otherwise a new alarm is - * scheduled. If the callback returns 0, the periodic alarm is cancelled. + * scheduled. If the callback returns 0, the periodic alarm is canceled and will be removed. * * \param userdata an arbitrary pointer provided by the app through * SDL_AddTimer, for its own use. @@ -164,7 +164,7 @@ typedef Uint32 (SDLCALL *SDL_TimerCallback)(void *userdata, SDL_TimerID timerID, * The callback function is passed the current timer interval and the user * supplied parameter from the SDL_AddTimer() call and should return the next * timer interval. If the value returned from the callback is 0, the timer is - * canceled. + * canceled and will be removed. * * The callback is run on a separate thread, and for short timeouts can * potentially be called before this function returns. @@ -200,7 +200,7 @@ extern SDL_DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_TimerC * The callback function is passed the current timer interval and returns the * next timer interval, in nanoseconds. If the returned value is the same as * the one passed in, the periodic alarm continues, otherwise a new alarm is - * scheduled. If the callback returns 0, the periodic alarm is cancelled. + * scheduled. If the callback returns 0, the periodic alarm is canceled and will be removed. * * \param userdata an arbitrary pointer provided by the app through * SDL_AddTimer, for its own use. @@ -227,7 +227,7 @@ typedef Uint64 (SDLCALL *SDL_NSTimerCallback)(void *userdata, SDL_TimerID timerI * The callback function is passed the current timer interval and the user * supplied parameter from the SDL_AddTimerNS() call and should return the * next timer interval. If the value returned from the callback is 0, the - * timer is canceled. + * timer is canceled and will be removed. * * The callback is run on a separate thread, and for short timeouts can * potentially be called before this function returns. From 795499a529f27469e9c97de596a1606dfc900eec Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 4 Aug 2024 19:45:18 -0700 Subject: [PATCH 146/253] Removing a timer that isn't running is a success. --- src/timer/SDL_timer.c | 6 +----- test/testautomation_timer.c | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/timer/SDL_timer.c b/src/timer/SDL_timer.c index 20050952b949d..a4420bb9a90ca 100644 --- a/src/timer/SDL_timer.c +++ b/src/timer/SDL_timer.c @@ -381,11 +381,7 @@ int SDL_RemoveTimer(SDL_TimerID id) } SDL_free(entry); } - if (canceled) { - return 0; - } else { - return SDL_SetError("Timer not found"); - } + return 0; } #else diff --git a/test/testautomation_timer.c b/test/testautomation_timer.c index 23d971218e374..98dce1e6797e3 100644 --- a/test/testautomation_timer.c +++ b/test/testautomation_timer.c @@ -142,7 +142,7 @@ static int timer_addRemoveTimer(void *arg) /* Try to remove timer again (should be a NOOP) */ result = SDL_RemoveTimer(id); SDLTest_AssertPass("Call to SDL_RemoveTimer()"); - SDLTest_AssertCheck(result < 0, "Check result value, expected: <0, got: %i", result); + SDLTest_AssertCheck(result == 0, "Check result value, expected: 0, got: %i", result); /* Reset state */ param = SDLTest_RandomIntegerInRange(-1024, 1024); @@ -162,7 +162,7 @@ static int timer_addRemoveTimer(void *arg) /* Remove timer again and check that callback was called */ result = SDL_RemoveTimer(id); SDLTest_AssertPass("Call to SDL_RemoveTimer()"); - SDLTest_AssertCheck(result < 0, "Check result value, expected: <0, got: %i", result); + SDLTest_AssertCheck(result == 0, "Check result value, expected: 0, got: %i", result); SDLTest_AssertCheck(g_timerCallbackCalled == 1, "Check callback WAS called, expected: 1, got: %i", g_timerCallbackCalled); return TEST_COMPLETED; From 6212497ea393f42da2c05faa1504549ff5cd14ce Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Mon, 5 Aug 2024 03:00:45 +0000 Subject: [PATCH 147/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_timer.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_timer.h b/include/SDL3/SDL_timer.h index 30b4e0be6e080..1c7ccff487c75 100644 --- a/include/SDL3/SDL_timer.h +++ b/include/SDL3/SDL_timer.h @@ -137,7 +137,8 @@ typedef Uint32 SDL_TimerID; * The callback function is passed the current timer interval and returns the * next timer interval, in milliseconds. If the returned value is the same as * the one passed in, the periodic alarm continues, otherwise a new alarm is - * scheduled. If the callback returns 0, the periodic alarm is canceled and will be removed. + * scheduled. If the callback returns 0, the periodic alarm is canceled and + * will be removed. * * \param userdata an arbitrary pointer provided by the app through * SDL_AddTimer, for its own use. @@ -200,7 +201,8 @@ extern SDL_DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_TimerC * The callback function is passed the current timer interval and returns the * next timer interval, in nanoseconds. If the returned value is the same as * the one passed in, the periodic alarm continues, otherwise a new alarm is - * scheduled. If the callback returns 0, the periodic alarm is canceled and will be removed. + * scheduled. If the callback returns 0, the periodic alarm is canceled and + * will be removed. * * \param userdata an arbitrary pointer provided by the app through * SDL_AddTimer, for its own use. From f59d66f4b1f99ae61a3e776933eda7ccdbc1ab0a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 4 Aug 2024 19:21:06 -0700 Subject: [PATCH 148/253] Implemented left-justification in SDL_PrintString() Fixes https://github.com/libsdl-org/SDL/issues/10310 --- src/stdlib/SDL_string.c | 26 +++++++++++++++++--------- test/testautomation_stdlib.c | 12 ++++++++++++ 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index cd6cd1868c04c..b477979a5db60 100644 --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -1796,7 +1796,7 @@ typedef enum typedef struct { - SDL_bool left_justify; /* for now: ignored. */ + SDL_bool left_justify; SDL_bool force_sign; SDL_bool force_type; /* for now: used only by float printer, ignored otherwise. */ SDL_bool pad_zeroes; @@ -1808,6 +1808,9 @@ typedef struct static size_t SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string) { + const char fill = (info && info->pad_zeroes) ? '0' : ' '; + size_t width = 0; + size_t filllen = 0; size_t length = 0; size_t slen, sz; @@ -1817,24 +1820,29 @@ static size_t SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, c sz = SDL_strlen(string); if (info && info->width > 0 && (size_t)info->width > sz) { - const char fill = info->pad_zeroes ? '0' : ' '; - size_t width = info->width - sz; - size_t filllen; - + width = info->width - sz; if (info->precision >= 0 && (size_t)info->precision < sz) { width += sz - (size_t)info->precision; } filllen = SDL_min(width, maxlen); - SDL_memset(text, fill, filllen); - text += filllen; - maxlen -= filllen; - length += width; + if (!info->left_justify) { + SDL_memset(text, fill, filllen); + text += filllen; + maxlen -= filllen; + length += width; + filllen = 0; + } } SDL_strlcpy(text, string, maxlen); length += sz; + if (filllen > 0) { + SDL_memset(text + sz, fill, filllen); + length += width; + } + if (info) { if (info->precision >= 0 && (size_t)info->precision < sz) { slen = (size_t)info->precision; diff --git a/test/testautomation_stdlib.c b/test/testautomation_stdlib.c index d7072f03c6c0d..44a0907264019 100644 --- a/test/testautomation_stdlib.c +++ b/test/testautomation_stdlib.c @@ -150,6 +150,18 @@ static int stdlib_snprintf(void *arg) SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", (int)SDL_strlen(text), result); + result = SDL_snprintf(text, sizeof(text), "%10sA", "foo"); + expected = " fooA"; + SDLTest_AssertPass("Call to SDL_snprintf(\"%%10sA\", \"foo\")"); + SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); + SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", (int)SDL_strlen(text), result); + + result = SDL_snprintf(text, sizeof(text), "%-10sA", "foo"); + expected = "foo A"; + SDLTest_AssertPass("Call to SDL_snprintf(\"%%-10sA\", \"foo\")"); + SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); + SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", (int)SDL_strlen(text), result); + result = SDL_snprintf(text, sizeof(text), "%S", L"foo"); expected = "foo"; SDLTest_AssertPass("Call to SDL_snprintf(\"%%S\", \"foo\")"); From 571a4b4b324b92ef0ab121d90bd1b84128659151 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 4 Aug 2024 20:24:19 -0700 Subject: [PATCH 149/253] Updated macOS build requirements Building the latest SDL requires at least Xcode 12.2 and the macOS 11.0 SDK. --- docs/README-macos.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README-macos.md b/docs/README-macos.md index e8d21d61e52d1..3e4708de3c0e9 100644 --- a/docs/README-macos.md +++ b/docs/README-macos.md @@ -30,7 +30,7 @@ cmake --build . sudo cmake --install . ``` -Please note that building SDL requires at least Xcode 6 and the 10.9 SDK. +Please note that building SDL requires at least Xcode 12.2 and the 11.0 SDK. PowerPC support for macOS has been officially dropped as of SDL 2.0.2. 32-bit Intel and macOS 10.8 runtime support has been officially dropped as of SDL 2.24.0. From 881e2bc344f43bf04927fb2045f46f3d3f611d36 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 4 Aug 2024 20:34:10 -0700 Subject: [PATCH 150/253] Fixed build --- src/timer/SDL_timer.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/timer/SDL_timer.c b/src/timer/SDL_timer.c index a4420bb9a90ca..a936367f9b40a 100644 --- a/src/timer/SDL_timer.c +++ b/src/timer/SDL_timer.c @@ -353,7 +353,6 @@ int SDL_RemoveTimer(SDL_TimerID id) { SDL_TimerData *data = &SDL_timer_data; SDL_TimerMap *prev, *entry; - SDL_bool canceled = SDL_FALSE; if (!id) { return SDL_InvalidParamError("id"); @@ -377,7 +376,6 @@ int SDL_RemoveTimer(SDL_TimerID id) if (entry) { if (!SDL_AtomicGet(&entry->timer->canceled)) { SDL_AtomicSet(&entry->timer->canceled, 1); - canceled = SDL_TRUE; } SDL_free(entry); } From e631fdfbd2ed2f832586ef5c047023aa9ab14a95 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Mon, 5 Aug 2024 02:28:42 +0200 Subject: [PATCH 151/253] gdk: show dialog when xgameruntime.dll is not installed --- src/main/gdk/SDL_sysmain_runapp.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/gdk/SDL_sysmain_runapp.cpp b/src/main/gdk/SDL_sysmain_runapp.cpp index 35de9e192dec1..911293ec25813 100644 --- a/src/main/gdk/SDL_sysmain_runapp.cpp +++ b/src/main/gdk/SDL_sysmain_runapp.cpp @@ -126,7 +126,11 @@ int SDL_RunApp(int, char**, SDL_main_func mainFunction, void *reserved) XGameRuntimeUninitialize(); } else { #ifdef SDL_PLATFORM_WINGDK - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "[GDK] Could not initialize - aborting", NULL); + if (hr == E_GAMERUNTIME_DLL_NOT_FOUND) { + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "[GDK] Gaming Runtime library not found (xgameruntime.dll)", NULL); + } else { + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "[GDK] Could not initialize - aborting", NULL); + } #else SDL_assert_always(0 && "[GDK] Could not initialize - aborting"); #endif From 4f343f96b4624dac7632fca58438c1664c06a10d Mon Sep 17 00:00:00 2001 From: hwsmm <9151706+hwsmm@users.noreply.github.com> Date: Mon, 5 Aug 2024 20:23:36 +0900 Subject: [PATCH 152/253] Fix name discrepancy in Android JNI --- src/core/android/SDL_android.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 7cb4f9a303a18..1c10815cdd735 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -64,10 +64,10 @@ JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetVersion)( JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)( JNIEnv *env, jclass cls); -JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeInitSDLThread)( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeInitMainThread)( JNIEnv *env, jclass cls); -JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeCleanupSDLThread)( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeCleanupMainThread)( JNIEnv *env, jclass cls); JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)( @@ -194,8 +194,8 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeFileDialog)( static JNINativeMethod SDLActivity_tab[] = { { "nativeGetVersion", "()Ljava/lang/String;", SDL_JAVA_INTERFACE(nativeGetVersion) }, { "nativeSetupJNI", "()I", SDL_JAVA_INTERFACE(nativeSetupJNI) }, - { "nativeInitSDLThread", "()V", SDL_JAVA_INTERFACE(nativeInitSDLThread) }, - { "nativeCleanupSDLThread", "()V", SDL_JAVA_INTERFACE(nativeCleanupSDLThread) }, + { "nativeInitMainThread", "()V", SDL_JAVA_INTERFACE(nativeInitMainThread) }, + { "nativeCleanupMainThread", "()V", SDL_JAVA_INTERFACE(nativeCleanupMainThread) }, { "nativeRunMain", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)I", SDL_JAVA_INTERFACE(nativeRunMain) }, { "onNativeDropFile", "(Ljava/lang/String;)V", SDL_JAVA_INTERFACE(onNativeDropFile) }, { "nativeSetScreenResolution", "(IIIIFF)V", SDL_JAVA_INTERFACE(nativeSetScreenResolution) }, @@ -772,7 +772,7 @@ JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(nativeAllowRecreateActivity)( return SDL_AtomicGet(&bAllowRecreateActivity); } -JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeInitSDLThread)( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeInitMainThread)( JNIEnv *env, jclass jcls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeInitSDLThread() %d time", run_count); @@ -785,7 +785,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeInitSDLThread)( Android_JNI_SetEnv(env); } -JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeCleanupSDLThread)( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeCleanupMainThread)( JNIEnv *env, jclass jcls) { /* This is a Java thread, it doesn't need to be Detached from the JVM. From 0a6bab3ac79016f126d0a01cb55122073ff8a6af Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 07:56:29 -0700 Subject: [PATCH 153/253] Added SDL_CreateRenderer to the "see also" for SDL_RenderPresent() --- include/SDL3/SDL_render.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index 69bf515c5833e..c02b71e9b6ea4 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -2057,15 +2057,16 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_RenderReadPixels(SDL_Renderer *ren * * \since This function is available since SDL 3.0.0. * + * \sa SDL_CreateRenderer * \sa SDL_RenderClear + * \sa SDL_RenderFillRect + * \sa SDL_RenderFillRects * \sa SDL_RenderLine * \sa SDL_RenderLines * \sa SDL_RenderPoint * \sa SDL_RenderPoints * \sa SDL_RenderRect * \sa SDL_RenderRects - * \sa SDL_RenderFillRect - * \sa SDL_RenderFillRects * \sa SDL_SetRenderDrawBlendMode * \sa SDL_SetRenderDrawColor */ From 5aa1a48ac3d40327599b1a36e87190a1805b17e3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 08:24:36 -0700 Subject: [PATCH 154/253] Added SDL_HINT_AUDIO_FREQUENCY, SDL_HINT_AUDIO_CHANNELS, and SDL_HINT_AUDIO_FORMAT --- include/SDL3/SDL_hints.h | 46 ++++++++++++++++++++++++++++++++++++++++ src/audio/SDL_audio.c | 15 +++++++------ 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 79aa0089e3788..447beb1f184cb 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -215,6 +215,17 @@ extern "C" { */ #define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY" +/** + * A variable controlling the default audio channel count. + * + * If the application doesn't specify the audio channel count when opening the device, this hint can be used to specify a default channel count that will be used. This defaults to "1" for recording and "2" for playback devices. + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_CHANNELS "SDL_AUDIO_CHANNELS" + /** * Specify an application icon name for an audio device. * @@ -327,6 +338,41 @@ extern "C" { */ #define SDL_HINT_AUDIO_DRIVER "SDL_AUDIO_DRIVER" +/** + * A variable controlling the default audio format. + * + * If the application doesn't specify the audio format when opening the device, this hint can be used to specify a default format that will be used. + * + * The variable can be set to the following values: + * - "U8": Unsigned 8-bit audio + * - "S8": Signed 8-bit audio + * - "S16LE": Signed 16-bit little-endian audio + * - "S16BE": Signed 16-bit big-endian audio + * - "S16": Signed 16-bit native-endian audio (default) + * - "S32LE": Signed 32-bit little-endian audio + * - "S32BE": Signed 32-bit big-endian audio + * - "S32": Signed 32-bit native-endian audio + * - "F32LE": Floating point little-endian audio + * - "F32BE": Floating point big-endian audio + * - "F32": Floating point native-endian audio + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_FORMAT "SDL_AUDIO_FORMAT" + +/** + * A variable controlling the default audio frequency. + * + * If the application doesn't specify the audio frequency when opening the device, this hint can be used to specify a default frequency that will be used. This defaults to "44100". + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_FREQUENCY "SDL_AUDIO_FREQUENCY" + /** * A variable that causes SDL to not ignore audio "monitors". * diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 505a8a22570b2..b27df57058439 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -1577,9 +1577,9 @@ static void PrepareAudioFormat(SDL_bool recording, SDL_AudioSpec *spec) if (spec->freq == 0) { spec->freq = recording ? DEFAULT_AUDIO_RECORDING_FREQUENCY : DEFAULT_AUDIO_PLAYBACK_FREQUENCY; - const char *env = SDL_getenv("SDL_AUDIO_FREQUENCY"); // !!! FIXME: should be a hint? - if (env) { - const int val = SDL_atoi(env); + const char *hint = SDL_GetHint(SDL_HINT_AUDIO_FREQUENCY); + if (hint) { + const int val = SDL_atoi(hint); if (val > 0) { spec->freq = val; } @@ -1588,9 +1588,10 @@ static void PrepareAudioFormat(SDL_bool recording, SDL_AudioSpec *spec) if (spec->channels == 0) { spec->channels = recording ? DEFAULT_AUDIO_RECORDING_CHANNELS : DEFAULT_AUDIO_PLAYBACK_CHANNELS;; - const char *env = SDL_getenv("SDL_AUDIO_CHANNELS"); - if (env) { - const int val = SDL_atoi(env); + + const char *hint = SDL_GetHint(SDL_HINT_AUDIO_CHANNELS); + if (hint) { + const int val = SDL_atoi(hint); if (val > 0) { spec->channels = val; } @@ -1598,7 +1599,7 @@ static void PrepareAudioFormat(SDL_bool recording, SDL_AudioSpec *spec) } if (spec->format == 0) { - const SDL_AudioFormat val = ParseAudioFormatString(SDL_getenv("SDL_AUDIO_FORMAT")); + const SDL_AudioFormat val = ParseAudioFormatString(SDL_GetHint(SDL_HINT_AUDIO_FORMAT)); spec->format = (val != 0) ? val : (recording ? DEFAULT_AUDIO_RECORDING_FORMAT : DEFAULT_AUDIO_PLAYBACK_FORMAT); } } From 71574ac98576acfdb4893c23fa4ea940c95ad37d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 09:01:26 -0700 Subject: [PATCH 155/253] Added SDL_HINT_AUDIO_DUMMY_TIMESCALE --- docs/README-migration.md | 33 ++++++++++++++++++-------------- include/SDL3/SDL_hints.h | 11 +++++++++++ src/audio/dummy/SDL_dummyaudio.c | 14 ++++++++------ 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 1e69aa85ed2f1..0672ead80ed2b 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -755,6 +755,23 @@ SDL_AddHintCallback() now returns a standard int result instead of void, returni Calling SDL_GetHint() with the name of the hint being changed from within a hint callback will now return the new value rather than the old value. The old value is still passed as a parameter to the hint callback. +The environment variables SDL_VIDEODRIVER and SDL_AUDIODRIVER have been renamed to SDL_VIDEO_DRIVER and SDL_AUDIO_DRIVER. + +The environment variables SDL_VIDEO_X11_WMCLASS and SDL_VIDEO_WAYLAND_WMCLASS have been removed and replaced by either using the appindentifier param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_IDENTIFIER_STRING with SDL_SetAppMetadataProperty() + +The following hints have been renamed: +* SDL_HINT_VIDEODRIVER => SDL_VIDEO_DRIVER +* SDL_HINT_AUDIODRIVER => SDL_HINT_AUDIO_DRIVER +* SDL_HINT_ALLOW_TOPMOST => SDL_HINT_WINDOW_ALLOW_TOPMOST +* SDL_HINT_DIRECTINPUT_ENABLED => SDL_HINT_JOYSTICK_DIRECTINPUT +* SDL_HINT_GDK_TEXTINPUT_DEFAULT => SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT +* SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE => SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE +* SDL_HINT_LINUX_DIGITAL_HATS => SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS +* SDL_HINT_LINUX_HAT_DEADZONES => SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES +* SDL_HINT_LINUX_JOYSTICK_CLASSIC => SDL_HINT_JOYSTICK_LINUX_CLASSIC +* SDL_HINT_LINUX_JOYSTICK_DEADZONES => SDL_HINT_JOYSTICK_LINUX_DEADZONES +* SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP => SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE + The following hints have been removed: * SDL_HINT_ACCELEROMETER_AS_JOYSTICK * SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO - the audio will be paused when the application is paused, and SDL_HINT_ANDROID_BLOCK_ON_PAUSE can be used to control that @@ -784,20 +801,8 @@ The following hints have been removed: * SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING * SDL_HINT_AUDIO_DEVICE_APP_NAME - replaced by either using the appname param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_NAME_STRING with SDL_SetAppMetadataProperty() -* Renamed hints SDL_HINT_VIDEODRIVER and SDL_HINT_AUDIODRIVER to SDL_HINT_VIDEO_DRIVER and SDL_HINT_AUDIO_DRIVER -* Renamed environment variables SDL_VIDEODRIVER and SDL_AUDIODRIVER to SDL_VIDEO_DRIVER and SDL_AUDIO_DRIVER -* The environment variables SDL_VIDEO_X11_WMCLASS and SDL_VIDEO_WAYLAND_WMCLASS have been removed and replaced by either using the appindentifier param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_IDENTIFIER_STRING with SDL_SetAppMetadataProperty() - -The following hints have been renamed: -* SDL_HINT_ALLOW_TOPMOST => SDL_HINT_WINDOW_ALLOW_TOPMOST -* SDL_HINT_DIRECTINPUT_ENABLED => SDL_HINT_JOYSTICK_DIRECTINPUT -* SDL_HINT_GDK_TEXTINPUT_DEFAULT => SDL_HINT_GDK_TEXTINPUT_DEFAULT_TEXT -* SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE => SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE -* SDL_HINT_LINUX_DIGITAL_HATS => SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS -* SDL_HINT_LINUX_HAT_DEADZONES => SDL_HINT_JOYSTICK_LINUX_HAT_DEADZONES -* SDL_HINT_LINUX_JOYSTICK_CLASSIC => SDL_HINT_JOYSTICK_LINUX_CLASSIC -* SDL_HINT_LINUX_JOYSTICK_DEADZONES => SDL_HINT_JOYSTICK_LINUX_DEADZONES -* SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP => SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE +The following environment variables have been removed: +* SDL_DUMMYAUDIODELAY - replaced with the hint SDL_HINT_AUDIO_DUMMY_TIMESCALE which allows scaling the audio time rather than specifying an absolute delay. The following functions have been removed: * SDL_ClearHints() - replaced with SDL_ResetHints() diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 447beb1f184cb..8982ffc0f8921 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -338,6 +338,17 @@ extern "C" { */ #define SDL_HINT_AUDIO_DRIVER "SDL_AUDIO_DRIVER" +/** + * A variable controlling the audio rate when using the dummy audio driver. + * + * The dummy audio driver normally simulates real-time for the audio rate that was specified, but you can use this variable to adjust this rate higher or lower down to 0. The default value is "1.0". + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_DUMMY_TIMESCALE "SDL_AUDIO_DUMMY_TIMESCALE" + /** * A variable controlling the default audio format. * diff --git a/src/audio/dummy/SDL_dummyaudio.c b/src/audio/dummy/SDL_dummyaudio.c index 26cfd06f2d51f..a1b85237982e4 100644 --- a/src/audio/dummy/SDL_dummyaudio.c +++ b/src/audio/dummy/SDL_dummyaudio.c @@ -25,9 +25,6 @@ #include "../SDL_sysaudio.h" #include "SDL_dummyaudio.h" -// !!! FIXME: this should be an SDL hint, not an environment variable. -#define DUMMYENVR_IODELAY "SDL_DUMMYAUDIODELAY" - static int DUMMYAUDIO_WaitDevice(SDL_AudioDevice *device) { SDL_Delay(device->hidden->io_delay); @@ -36,8 +33,6 @@ static int DUMMYAUDIO_WaitDevice(SDL_AudioDevice *device) static int DUMMYAUDIO_OpenDevice(SDL_AudioDevice *device) { - const char *envr = SDL_getenv(DUMMYENVR_IODELAY); - device->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, sizeof(*device->hidden)); if (!device->hidden) { return -1; @@ -50,8 +45,15 @@ static int DUMMYAUDIO_OpenDevice(SDL_AudioDevice *device) } } - device->hidden->io_delay = (Uint32) (envr ? SDL_atoi(envr) : ((device->sample_frames * 1000) / device->spec.freq)); + device->hidden->io_delay = ((device->sample_frames * 1000) / device->spec.freq); + const char *hint = SDL_GetHint(SDL_HINT_AUDIO_DUMMY_TIMESCALE); + if (hint) { + double scale = SDL_atof(hint); + if (scale >= 0.0) { + device->hidden->io_delay = (Uint32)SDL_round(device->hidden->io_delay * scale); + } + } return 0; // we're good; don't change reported device format. } From f05cd850485845a69dcaa9f78cfc3f3ee1f2bd6f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 08:04:46 -0700 Subject: [PATCH 156/253] Added SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE --- include/SDL3/SDL_hints.h | 11 +++++++++++ src/audio/alsa/SDL_alsa_audio.c | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 8982ffc0f8921..3da8a25ddafea 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -197,6 +197,17 @@ extern "C" { */ #define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION" +/** + * Specify the default ALSA audio device name. + * + * This variable is a specific audio device to open when the "default" audio device is used. By default if 4 channel audio is requested, the "plug:surround40" device will be opened and if 6 channel audio is requested the "plug:surround51" device will be opened. + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE "SDL_AUDIO_ALSA_DEFAULT_DEVICE" + /** * A variable controlling the audio category on iOS and macOS. * diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index e2827f418d4b1..7513c92043c5a 100644 --- a/src/audio/alsa/SDL_alsa_audio.c +++ b/src/audio/alsa/SDL_alsa_audio.c @@ -228,7 +228,7 @@ static const char *get_audio_device(void *handle, const int channels) ALSA_Device *dev = (ALSA_Device *)handle; if (SDL_strcmp(dev->name, "default") == 0) { - const char *device = SDL_getenv("AUDIODEV"); // Is there a standard variable name? + const char *device = SDL_GetHint(SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE); if (device) { return device; } else if (channels == 6) { From ff0e42c51cf827c55d3740490d55e33a4f5b2dc5 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 08:07:28 -0700 Subject: [PATCH 157/253] Removed the SDL_AUDIO_ALSA_DEBUG environment variable The debug info is available if you set SDL_HINT_LOGGING to "audio=debug" --- docs/README-migration.md | 1 + src/audio/alsa/SDL_alsa_audio.c | 15 +++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 0672ead80ed2b..83667d2e0be88 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -802,6 +802,7 @@ The following hints have been removed: * SDL_HINT_AUDIO_DEVICE_APP_NAME - replaced by either using the appname param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_NAME_STRING with SDL_SetAppMetadataProperty() The following environment variables have been removed: +* SDL_AUDIO_ALSA_DEBUG - replaced by setting the hint SDL_HINT_LOGGING to "audio=debug" * SDL_DUMMYAUDIODELAY - replaced with the hint SDL_HINT_AUDIO_DUMMY_TIMESCALE which allows scaling the audio time rather than specifying an absolute delay. The following functions have been removed: diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index 7513c92043c5a..55a1ea706eede 100644 --- a/src/audio/alsa/SDL_alsa_audio.c +++ b/src/audio/alsa/SDL_alsa_audio.c @@ -426,16 +426,11 @@ static int ALSA_set_buffer_size(SDL_AudioDevice *device, snd_pcm_hw_params_t *pa device->sample_frames = persize; // This is useful for debugging - if (SDL_getenv("SDL_AUDIO_ALSA_DEBUG")) { - snd_pcm_uframes_t bufsize; - - ALSA_snd_pcm_hw_params_get_buffer_size(hwparams, &bufsize); - - SDL_LogError(SDL_LOG_CATEGORY_AUDIO, - "ALSA: period size = %ld, periods = %u, buffer size = %lu", - persize, periods, bufsize); - } - + snd_pcm_uframes_t bufsize; + ALSA_snd_pcm_hw_params_get_buffer_size(hwparams, &bufsize); + SDL_LogDebug(SDL_LOG_CATEGORY_AUDIO, + "ALSA: period size = %ld, periods = %u, buffer size = %lu", + persize, periods, bufsize); return 0; } From f3fcc41a4ee2b78812dbfc2b46f7b077b0c35449 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 08:40:12 -0700 Subject: [PATCH 158/253] Removed the AUDIODEV environment variable from the sndio audio driver The sndio documentation says that the AUDIODEVICE environment variable is used when the device is opened with SIO_DEVANY. --- src/audio/sndio/SDL_sndioaudio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/audio/sndio/SDL_sndioaudio.c b/src/audio/sndio/SDL_sndioaudio.c index 9e94e87abd9dd..e8f59a64e2e4c 100644 --- a/src/audio/sndio/SDL_sndioaudio.c +++ b/src/audio/sndio/SDL_sndioaudio.c @@ -231,11 +231,8 @@ static int SNDIO_OpenDevice(SDL_AudioDevice *device) return -1; } - // !!! FIXME: we really should standardize this on a specific SDL hint. - const char *audiodev = SDL_getenv("AUDIODEV"); - // Recording devices must be non-blocking for SNDIO_FlushRecording - device->hidden->dev = SNDIO_sio_open(audiodev ? audiodev : SIO_DEVANY, + device->hidden->dev = SNDIO_sio_open(SIO_DEVANY, device->recording ? SIO_REC : SIO_PLAY, device->recording); if (!device->hidden->dev) { return SDL_SetError("sio_open() failed"); From a4dc130d7edea27d9ed3905be0139284da4a8281 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 08:41:58 -0700 Subject: [PATCH 159/253] Removed the SDL_PATH_DSP environment variable from the NetBSD and OSS audio driver The AUDIODEV environment variable is no longer used by other audio drivers, and can be used exclusively to specify the DSP audio device. --- docs/README-migration.md | 3 +++ src/audio/SDL_audiodev.c | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 83667d2e0be88..6eca317d8ed2e 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -801,6 +801,9 @@ The following hints have been removed: * SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING * SDL_HINT_AUDIO_DEVICE_APP_NAME - replaced by either using the appname param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_NAME_STRING with SDL_SetAppMetadataProperty() +The following environment variables have been renamed: +* SDL_PATH_DSP => AUDIODEV + The following environment variables have been removed: * SDL_AUDIO_ALSA_DEBUG - replaced by setting the hint SDL_HINT_LOGGING to "audio=debug" * SDL_DUMMYAUDIODELAY - replaced with the hint SDL_HINT_AUDIO_DUMMY_TIMESCALE which allows scaling the audio time rather than specifying an absolute delay. diff --git a/src/audio/SDL_audiodev.c b/src/audio/SDL_audiodev.c index 12a8385cf6346..d30f71c215ee2 100644 --- a/src/audio/SDL_audiodev.c +++ b/src/audio/SDL_audiodev.c @@ -87,10 +87,7 @@ static void SDL_EnumUnixAudioDevices_Internal(const SDL_bool recording, const SD } // Figure out what our audio device is - audiodev = SDL_getenv("SDL_PATH_DSP"); - if (!audiodev) { - audiodev = SDL_getenv("AUDIODEV"); - } + audiodev = SDL_getenv("AUDIODEV"); if (!audiodev) { if (classic) { audiodev = SDL_PATH_DEV_AUDIO; From 897610d317239389dbfb85c8ef92cdf624e5fbd8 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 09:10:09 -0700 Subject: [PATCH 160/253] Updated migration documentation for the AUDIODEV environment variable --- docs/README-migration.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/README-migration.md b/docs/README-migration.md index 6eca317d8ed2e..4e43d01a19728 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -759,6 +759,8 @@ The environment variables SDL_VIDEODRIVER and SDL_AUDIODRIVER have been renamed The environment variables SDL_VIDEO_X11_WMCLASS and SDL_VIDEO_WAYLAND_WMCLASS have been removed and replaced by either using the appindentifier param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_IDENTIFIER_STRING with SDL_SetAppMetadataProperty() +The environment variable AUDIODEV is used exclusively to specify the audio device for the OSS and NetBSD audio drivers. Its use in the ALSA driver has been replaced with the hint SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE and in the sndio driver with the environment variable AUDIODEVICE. + The following hints have been renamed: * SDL_HINT_VIDEODRIVER => SDL_VIDEO_DRIVER * SDL_HINT_AUDIODRIVER => SDL_HINT_AUDIO_DRIVER From e1ee0e748d2cd4c09658f114ea410bb246d5e5a7 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 08:49:24 -0700 Subject: [PATCH 161/253] Added SDL_HINT_WAVE_CHUNK_LIMIT --- include/SDL3/SDL_hints.h | 13 ++++++++++++- src/audio/SDL_wave.c | 8 ++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 3da8a25ddafea..423fe485a2834 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3340,6 +3340,17 @@ extern "C" { */ #define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK" +/** + * A variable controlling the maximum number of chunks in a WAVE file. + * + * This sets an upper bound on the number of chunks in a WAVE file to avoid wasting time on malformed or corrupt WAVE files. This defaults to "10000". + * + * This hint should be set before calling SDL_LoadWAV() or SDL_LoadWAV_IO() + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_WAVE_CHUNK_LIMIT "SDL_WAVE_CHUNK_LIMIT" + /** * A variable controlling how the size of the RIFF chunk affects the loading * of a WAVE file. @@ -3351,7 +3362,7 @@ extern "C" { * Note that files that have trailing data unrelated to the WAVE file or * corrupt files may slow down the loading process without a reliable * boundary. By default, SDL stops after 10000 chunks to prevent wasting time. - * Use the environment variable SDL_WAVE_CHUNK_LIMIT to adjust this value. + * Use SDL_HINT_WAVE_CHUNK_LIMIT to adjust this value. * * The variable can be set to the following values: * diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c index f10f24d68d6db..fd2f67af194fb 100644 --- a/src/audio/SDL_wave.c +++ b/src/audio/SDL_wave.c @@ -1774,7 +1774,7 @@ static int WaveLoad(SDL_IOStream *src, WaveFile *file, SDL_AudioSpec *spec, Uint int result; Uint32 chunkcount = 0; Uint32 chunkcountlimit = 10000; - const char *envchunkcountlimit; + const char *hint; Sint64 RIFFstart, RIFFend, lastchunkpos; SDL_bool RIFFlengthknown = SDL_FALSE; WaveFormat *format = &file->format; @@ -1787,10 +1787,10 @@ static int WaveLoad(SDL_IOStream *src, WaveFile *file, SDL_AudioSpec *spec, Uint SDL_zero(fmtchunk); SDL_zero(datachunk); - envchunkcountlimit = SDL_getenv("SDL_WAVE_CHUNK_LIMIT"); - if (envchunkcountlimit) { + hint = SDL_GetHint(SDL_HINT_WAVE_CHUNK_LIMIT); + if (hint) { unsigned int count; - if (SDL_sscanf(envchunkcountlimit, "%u", &count) == 1) { + if (SDL_sscanf(hint, "%u", &count) == 1) { chunkcountlimit = count <= SDL_MAX_UINT32 ? count : SDL_MAX_UINT32; } } From c9b2bfa7c105f29d45c3017c5da834f7e6bc8faf Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 09:22:44 -0700 Subject: [PATCH 162/253] Added SDL_HINT_AUDIO_DISK_INPUT_FILE, SDL_HINT_AUDIO_DISK_OUTPUT_FILE, and SDL_HINT_AUDIO_DISK_TIMESCALE --- docs/README-migration.md | 3 +++ include/SDL3/SDL_hints.h | 33 +++++++++++++++++++++++++++++++++ src/audio/disk/SDL_diskaudio.c | 20 +++++++++----------- 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 4e43d01a19728..1de129e0dd7f7 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -808,6 +808,9 @@ The following environment variables have been renamed: The following environment variables have been removed: * SDL_AUDIO_ALSA_DEBUG - replaced by setting the hint SDL_HINT_LOGGING to "audio=debug" +* SDL_DISKAUDIODELAY - replaced with the hint SDL_HINT_AUDIO_DISK_TIMESCALE which allows scaling the audio time rather than specifying an absolute delay. +* SDL_DISKAUDIOFILE - replaced with the hint SDL_HINT_AUDIO_DISK_OUTPUT_FILE +* SDL_DISKAUDIOFILEIN - replaced with the hint SDL_HINT_AUDIO_DISK_INPUT_FILE * SDL_DUMMYAUDIODELAY - replaced with the hint SDL_HINT_AUDIO_DUMMY_TIMESCALE which allows scaling the audio time rather than specifying an absolute delay. The following functions have been removed: diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 423fe485a2834..c33bdf29e2c76 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -335,6 +335,39 @@ extern "C" { */ #define SDL_HINT_AUDIO_DEVICE_STREAM_ROLE "SDL_AUDIO_DEVICE_STREAM_ROLE" +/** + * Specify the input file when recording audio using the disk audio driver. + * + * This defaults to "sdlaudio-in.raw" + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_DISK_INPUT_FILE "SDL_AUDIO_DISK_INPUT_FILE" + +/** + * Specify the output file when playing audio using the disk audio driver. + * + * This defaults to "sdlaudio.raw" + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_DISK_OUTPUT_FILE "SDL_AUDIO_DISK_OUTPUT_FILE" + +/** + * A variable controlling the audio rate when using the disk audio driver. + * + * The disk audio driver normally simulates real-time for the audio rate that was specified, but you can use this variable to adjust this rate higher or lower down to 0. The default value is "1.0". + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_DISK_TIMESCALE "SDL_AUDIO_DISK_TIMESCALE" + /** * A variable that specifies an audio backend to use. * diff --git a/src/audio/disk/SDL_diskaudio.c b/src/audio/disk/SDL_diskaudio.c index 6dc5e40d6f521..1e8a485a99845 100644 --- a/src/audio/disk/SDL_diskaudio.c +++ b/src/audio/disk/SDL_diskaudio.c @@ -27,13 +27,8 @@ #include "../SDL_sysaudio.h" #include "SDL_diskaudio.h" -// !!! FIXME: these should be SDL hints, not environment variables. -// environment variables and defaults. -#define DISKENVR_OUTFILE "SDL_DISKAUDIOFILE" #define DISKDEFAULT_OUTFILE "sdlaudio.raw" -#define DISKENVR_INFILE "SDL_DISKAUDIOFILEIN" #define DISKDEFAULT_INFILE "sdlaudio-in.raw" -#define DISKENVR_IODELAY "SDL_DISKAUDIODELAY" static int DISKAUDIO_WaitDevice(SDL_AudioDevice *device) { @@ -98,7 +93,7 @@ static void DISKAUDIO_CloseDevice(SDL_AudioDevice *device) static const char *get_filename(const SDL_bool recording) { - const char *devname = SDL_getenv(recording ? DISKENVR_INFILE : DISKENVR_OUTFILE); + const char *devname = SDL_GetHint(recording ? SDL_HINT_AUDIO_DISK_INPUT_FILE : SDL_HINT_AUDIO_DISK_OUTPUT_FILE); if (!devname) { devname = recording ? DISKDEFAULT_INFILE : DISKDEFAULT_OUTFILE; } @@ -109,17 +104,20 @@ static int DISKAUDIO_OpenDevice(SDL_AudioDevice *device) { SDL_bool recording = device->recording; const char *fname = get_filename(recording); - const char *envr = SDL_getenv(DISKENVR_IODELAY); device->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, sizeof(*device->hidden)); if (!device->hidden) { return -1; } - if (envr) { - device->hidden->io_delay = SDL_atoi(envr); - } else { - device->hidden->io_delay = ((device->sample_frames * 1000) / device->spec.freq); + device->hidden->io_delay = ((device->sample_frames * 1000) / device->spec.freq); + + const char *hint = SDL_GetHint(SDL_HINT_AUDIO_DISK_TIMESCALE); + if (hint) { + double scale = SDL_atof(hint); + if (scale >= 0.0) { + device->hidden->io_delay = (Uint32)SDL_round(device->hidden->io_delay * scale); + } } // Open the "audio device" From 05f870f20d6145547a30140f0e15329d0376d626 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 09:33:32 -0700 Subject: [PATCH 163/253] Added SDL_HINT_OPENGL_LIBRARY and SDL_HINT_VULKAN_LIBRARY --- include/SDL3/SDL_hints.h | 18 ++++++++++++++++++ src/video/android/SDL_androidvulkan.c | 2 +- src/video/cocoa/SDL_cocoaopengl.m | 2 +- src/video/cocoa/SDL_cocoavulkan.m | 2 +- src/video/kmsdrm/SDL_kmsdrmvulkan.c | 2 +- src/video/offscreen/SDL_offscreenvulkan.c | 2 +- src/video/uikit/SDL_uikitvulkan.m | 2 +- src/video/vivante/SDL_vivantevulkan.c | 2 +- src/video/wayland/SDL_waylandvulkan.c | 2 +- src/video/windows/SDL_windowsopengl.c | 2 +- src/video/windows/SDL_windowsvulkan.c | 2 +- src/video/x11/SDL_x11opengl.c | 2 +- src/video/x11/SDL_x11vulkan.c | 2 +- 13 files changed, 30 insertions(+), 12 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index c33bdf29e2c76..00b88ecd8eb72 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2436,6 +2436,15 @@ extern "C" { */ #define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS" +/** + * Specify the OpenGL library to load. + * + * This hint should be set before creating an OpenGL window or creating an OpenGL context. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_OPENGL_LIBRARY "SDL_OPENGL_LIBRARY" + /** * A variable controlling what driver to use for OpenGL ES contexts. * @@ -3341,6 +3350,15 @@ extern "C" { */ #define SDL_HINT_VITA_TOUCH_MOUSE_DEVICE "SDL_VITA_TOUCH_MOUSE_DEVICE" +/** + * Specify the Vulkan library to load. + * + * This hint should be set before creating a Vulkan window or calling SDL_Vulkan_LoadLibrary(). + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VULKAN_LIBRARY "SDL_VULKAN_LIBRARY" + /** * A variable controlling how the fact chunk affects the loading of a WAVE * file. diff --git a/src/video/android/SDL_androidvulkan.c b/src/video/android/SDL_androidvulkan.c index da5acfb66c21d..b4be7232a7a2e 100644 --- a/src/video/android/SDL_androidvulkan.c +++ b/src/video/android/SDL_androidvulkan.c @@ -49,7 +49,7 @@ int Android_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path) /* Load the Vulkan loader library */ if (!path) { - path = SDL_getenv("SDL_VULKAN_LIBRARY"); + path = SDL_GetHint(SDL_HINT_VULKAN_LIBRARY); } if (!path) { path = "libvulkan.so"; diff --git a/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m index 4cf14c75b03b3..319e31e239285 100644 --- a/src/video/cocoa/SDL_cocoaopengl.m +++ b/src/video/cocoa/SDL_cocoaopengl.m @@ -229,7 +229,7 @@ int Cocoa_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path) { /* Load the OpenGL library */ if (path == NULL) { - path = SDL_getenv("SDL_OPENGL_LIBRARY"); + path = SDL_GetHint(SDL_HINT_OPENGL_LIBRARY); } if (path == NULL) { path = DEFAULT_OPENGL; diff --git a/src/video/cocoa/SDL_cocoavulkan.m b/src/video/cocoa/SDL_cocoavulkan.m index 62929fd2ea9f2..0c956411ac09a 100644 --- a/src/video/cocoa/SDL_cocoavulkan.m +++ b/src/video/cocoa/SDL_cocoavulkan.m @@ -61,7 +61,7 @@ int Cocoa_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path) /* Load the Vulkan loader library */ if (!path) { - path = SDL_getenv("SDL_VULKAN_LIBRARY"); + path = SDL_GetHint(SDL_HINT_VULKAN_LIBRARY); } if (!path) { diff --git a/src/video/kmsdrm/SDL_kmsdrmvulkan.c b/src/video/kmsdrm/SDL_kmsdrmvulkan.c index eb68199258d17..7ca9e92d7a270 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvulkan.c +++ b/src/video/kmsdrm/SDL_kmsdrmvulkan.c @@ -56,7 +56,7 @@ int KMSDRM_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path) /* Load the Vulkan library */ if (!path) { - path = SDL_getenv("SDL_VULKAN_LIBRARY"); + path = SDL_GetHint(SDL_HINT_VULKAN_LIBRARY); } if (!path) { path = DEFAULT_VULKAN; diff --git a/src/video/offscreen/SDL_offscreenvulkan.c b/src/video/offscreen/SDL_offscreenvulkan.c index ec33186d20f55..1727d997f2314 100644 --- a/src/video/offscreen/SDL_offscreenvulkan.c +++ b/src/video/offscreen/SDL_offscreenvulkan.c @@ -74,7 +74,7 @@ int OFFSCREEN_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path) /* Load the Vulkan loader library */ if (!path) { - path = SDL_getenv("SDL_VULKAN_LIBRARY"); + path = SDL_GetHint(SDL_HINT_VULKAN_LIBRARY); } #if defined(SDL_PLATFORM_APPLE) diff --git a/src/video/uikit/SDL_uikitvulkan.m b/src/video/uikit/SDL_uikitvulkan.m index cab1c75873b7c..9d045535a68ef 100644 --- a/src/video/uikit/SDL_uikitvulkan.m +++ b/src/video/uikit/SDL_uikitvulkan.m @@ -59,7 +59,7 @@ int UIKit_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path) /* Load the Vulkan loader library */ if (!path) { - path = SDL_getenv("SDL_VULKAN_LIBRARY"); + path = SDL_GetHint(SDL_HINT_VULKAN_LIBRARY); } if (!path) { diff --git a/src/video/vivante/SDL_vivantevulkan.c b/src/video/vivante/SDL_vivantevulkan.c index d1a7ef7cc0a0c..8325efff13788 100644 --- a/src/video/vivante/SDL_vivantevulkan.c +++ b/src/video/vivante/SDL_vivantevulkan.c @@ -47,7 +47,7 @@ int VIVANTE_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path) /* Load the Vulkan loader library */ if (!path) { - path = SDL_getenv("SDL_VULKAN_LIBRARY"); + path = SDL_GetHint(SDL_HINT_VULKAN_LIBRARY); } if (!path) { /* If no path set, try Vivante fb vulkan driver explicitly */ diff --git a/src/video/wayland/SDL_waylandvulkan.c b/src/video/wayland/SDL_waylandvulkan.c index 0a0d3c5c865db..97cb61426f435 100644 --- a/src/video/wayland/SDL_waylandvulkan.c +++ b/src/video/wayland/SDL_waylandvulkan.c @@ -54,7 +54,7 @@ int Wayland_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path) /* Load the Vulkan loader library */ if (!path) { - path = SDL_getenv("SDL_VULKAN_LIBRARY"); + path = SDL_GetHint(SDL_HINT_VULKAN_LIBRARY); } if (!path) { path = DEFAULT_VULKAN; diff --git a/src/video/windows/SDL_windowsopengl.c b/src/video/windows/SDL_windowsopengl.c index 7e17e8f83ef95..0f18eb28e3689 100644 --- a/src/video/windows/SDL_windowsopengl.c +++ b/src/video/windows/SDL_windowsopengl.c @@ -110,7 +110,7 @@ int WIN_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path) void *handle; if (path == NULL) { - path = SDL_getenv("SDL_OPENGL_LIBRARY"); + path = SDL_GetHint(SDL_HINT_OPENGL_LIBRARY); } if (path == NULL) { path = DEFAULT_OPENGL; diff --git a/src/video/windows/SDL_windowsvulkan.c b/src/video/windows/SDL_windowsvulkan.c index abd2d034ac208..f8f0cb7622761 100644 --- a/src/video/windows/SDL_windowsvulkan.c +++ b/src/video/windows/SDL_windowsvulkan.c @@ -49,7 +49,7 @@ int WIN_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path) /* Load the Vulkan loader library */ if (!path) { - path = SDL_getenv("SDL_VULKAN_LIBRARY"); + path = SDL_GetHint(SDL_HINT_VULKAN_LIBRARY); } if (!path) { path = "vulkan-1.dll"; diff --git a/src/video/x11/SDL_x11opengl.c b/src/video/x11/SDL_x11opengl.c index d94205130365b..b393ec260e347 100644 --- a/src/video/x11/SDL_x11opengl.c +++ b/src/video/x11/SDL_x11opengl.c @@ -172,7 +172,7 @@ int X11_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path) /* Load the OpenGL library */ if (path == NULL) { - path = SDL_getenv("SDL_OPENGL_LIBRARY"); + path = SDL_GetHint(SDL_HINT_OPENGL_LIBRARY); } if (path == NULL) { path = DEFAULT_OPENGL; diff --git a/src/video/x11/SDL_x11vulkan.c b/src/video/x11/SDL_x11vulkan.c index 93641b39a7cc8..cabd85e97cc70 100644 --- a/src/video/x11/SDL_x11vulkan.c +++ b/src/video/x11/SDL_x11vulkan.c @@ -58,7 +58,7 @@ int X11_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path) /* Load the Vulkan loader library */ if (!path) { - path = SDL_getenv("SDL_VULKAN_LIBRARY"); + path = SDL_GetHint(SDL_HINT_VULKAN_LIBRARY); } if (!path) { path = DEFAULT_VULKAN; From 8cde570ad964e434782f53e2466cd4d582ccd573 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 09:42:51 -0700 Subject: [PATCH 164/253] Added SDL_HINT_VIDEO_X11_VISUALID --- include/SDL3/SDL_hints.h | 9 +++++++++ src/video/x11/SDL_x11modes.c | 4 ++-- src/video/x11/SDL_x11window.c | 5 +++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 00b88ecd8eb72..4abace78b3359 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3311,6 +3311,15 @@ extern "C" { */ #define SDL_HINT_VIDEO_X11_SCALING_FACTOR "SDL_VIDEO_X11_SCALING_FACTOR" +/** + * A variable forcing the visual ID used for X11 display modes. + * + * This hint should be set before initializing the video subsystem. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VIDEO_X11_VISUALID "SDL_VIDEO_X11_VISUALID" + /** * A variable forcing the visual ID chosen for new X11 windows. * diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c index d830123bf1099..61854feff708a 100644 --- a/src/video/x11/SDL_x11modes.c +++ b/src/video/x11/SDL_x11modes.c @@ -265,11 +265,11 @@ static float GetGlobalContentScale(SDL_VideoDevice *_this) static int get_visualinfo(Display *display, int screen, XVisualInfo *vinfo) { - const char *visual_id = SDL_getenv("SDL_VIDEO_X11_VISUALID"); + const char *visual_id = SDL_GetHint(SDL_HINT_VIDEO_X11_VISUALID); int depth; /* Look for an exact visual, if requested */ - if (visual_id) { + if (visual_id && *visual_id) { XVisualInfo *vi, template; int nvis; diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index d0cd1b558d789..7d1d2fab677e7 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -531,8 +531,9 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI #if defined(SDL_VIDEO_OPENGL_GLX) || defined(SDL_VIDEO_OPENGL_EGL) const int transparent = (window->flags & SDL_WINDOW_TRANSPARENT) ? SDL_TRUE : SDL_FALSE; const char *forced_visual_id = SDL_GetHint(SDL_HINT_VIDEO_X11_WINDOW_VISUALID); + const char *display_visual_id = SDL_GetHint(SDL_HINT_VIDEO_X11_VISUALID); - if (forced_visual_id && forced_visual_id[0] != '\0') { + if (forced_visual_id && *forced_visual_id) { XVisualInfo *vi, template; int nvis; @@ -547,7 +548,7 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI return -1; } } else if ((window->flags & SDL_WINDOW_OPENGL) && - !SDL_getenv("SDL_VIDEO_X11_VISUALID")) { + (!display_visual_id || !*display_visual_id)) { XVisualInfo *vinfo = NULL; #ifdef SDL_VIDEO_OPENGL_EGL From 175f28f59f0fe1e5e2f6dee2039b0bb20b52021a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 09:47:57 -0700 Subject: [PATCH 165/253] Added SDL_HINT_VIDEO_X11_NODIRECTCOLOR --- include/SDL3/SDL_hints.h | 14 ++++++++++++++ src/video/x11/SDL_x11video.c | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 4abace78b3359..9f5123c12ac3b 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3300,6 +3300,20 @@ extern "C" { */ #define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING" +/** + * A variable controlling whether SDL uses DirectColor visuals. + * + * The variable can be set to the following values: + * + * - "0": Disable DirectColor visuals. + * - "1": Enable DirectColor visuals. (default) + * + * This hint should be set before initializing the video subsystem. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VIDEO_X11_NODIRECTCOLOR "SDL_VIDEO_X11_NODIRECTCOLOR" + /** * A variable forcing the content scaling factor for X11 displays. * diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index 5024450a9d3a9..e255f3ce4d7fe 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -491,7 +491,10 @@ void X11_VideoQuit(SDL_VideoDevice *_this) SDL_bool X11_UseDirectColorVisuals(void) { - return (SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") == NULL); + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_NODIRECTCOLOR, SDL_FALSE)) { + return SDL_FALSE; + } + return SDL_TRUE; } #endif /* SDL_VIDEO_DRIVER_X11 */ From 997df06320add8302354fa9500cdbecb197be903 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 09:54:06 -0700 Subject: [PATCH 166/253] Added SDL_HINT_X11_XCB_LIBRARY --- include/SDL3/SDL_hints.h | 11 +++++++++++ src/video/x11/SDL_x11vulkan.c | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 9f5123c12ac3b..7e00e1f9fb986 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3862,6 +3862,17 @@ extern "C" { */ #define SDL_HINT_X11_WINDOW_TYPE "SDL_X11_WINDOW_TYPE" +/** + * Specify the XCB library to load for the X11 driver. + * + * This defaults to "libX11-xcb.so" + * + * This hint should be set before initializing the video subsystem. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_X11_XCB_LIBRARY "SDL_X11_XCB_LIBRARY" + /** * A variable controlling whether XInput should be used for controller * handling. diff --git a/src/video/x11/SDL_x11vulkan.c b/src/video/x11/SDL_x11vulkan.c index cabd85e97cc70..67b526bcb30b1 100644 --- a/src/video/x11/SDL_x11vulkan.c +++ b/src/video/x11/SDL_x11vulkan.c @@ -107,8 +107,8 @@ int X11_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path) SDL_SetError("Installed Vulkan doesn't implement either the " VK_KHR_XCB_SURFACE_EXTENSION_NAME "extension or the " VK_KHR_XLIB_SURFACE_EXTENSION_NAME " extension"); goto fail; } else { - const char *libX11XCBLibraryName = SDL_getenv("SDL_X11_XCB_LIBRARY"); - if (!libX11XCBLibraryName) { + const char *libX11XCBLibraryName = SDL_GetHint(SDL_HINT_X11_XCB_LIBRARY); + if (!libX11XCBLibraryName || !*libX11XCBLibraryName) { libX11XCBLibraryName = "libX11-xcb.so"; } videoData->vulkan_xlib_xcb_library = SDL_LoadObject(libX11XCBLibraryName); From 3669d1e76a1ae87863320513fb79e88ce28ba34b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 10:06:01 -0700 Subject: [PATCH 167/253] Added SDL_HINT_VULKAN_DISPLAY --- include/SDL3/SDL_hints.h | 11 +++++++++++ src/video/SDL_vulkan_utils.c | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 7e00e1f9fb986..84682c8b8e475 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3373,6 +3373,17 @@ extern "C" { */ #define SDL_HINT_VITA_TOUCH_MOUSE_DEVICE "SDL_VITA_TOUCH_MOUSE_DEVICE" +/** + * A variable overriding the display index used in SDL_Vulkan_CreateSurface() + * + * The display index starts at 0, which is the default. + * + * This hint should be set before calling SDL_Vulkan_CreateSurface() + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VULKAN_DISPLAY "SDL_VULKAN_DISPLAY" + /** * Specify the Vulkan library to load. * diff --git a/src/video/SDL_vulkan_utils.c b/src/video/SDL_vulkan_utils.c index bb42b4933b87a..c5223cdb0a10b 100644 --- a/src/video/SDL_vulkan_utils.c +++ b/src/video/SDL_vulkan_utils.c @@ -209,7 +209,7 @@ int SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_, SDL_SetError(VK_KHR_DISPLAY_EXTENSION_NAME " extension is not enabled in the Vulkan instance."); goto error; } - chosenDisplayId = SDL_getenv("SDL_VULKAN_DISPLAY"); + chosenDisplayId = SDL_GetHint(SDL_HINT_VULKAN_DISPLAY); if (chosenDisplayId) { displayId = SDL_atoi(chosenDisplayId); } From a97dadf7793c6b720861020b0545b8deca73369b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 10:52:58 -0700 Subject: [PATCH 168/253] Added hints to replace environment variables on the PlayStation Vita --- docs/README-migration.md | 6 +++ include/SDL3/SDL_hints.h | 80 +++++++++++++++++++++++++++++++ src/video/vita/SDL_vitagl_pvr.c | 8 ++-- src/video/vita/SDL_vitagles_pvr.c | 7 ++- src/video/vita/SDL_vitatouch.c | 10 ++-- src/video/vita/SDL_vitavideo.c | 13 ++--- 6 files changed, 105 insertions(+), 19 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 1de129e0dd7f7..b0f432b14920c 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -812,6 +812,12 @@ The following environment variables have been removed: * SDL_DISKAUDIOFILE - replaced with the hint SDL_HINT_AUDIO_DISK_OUTPUT_FILE * SDL_DISKAUDIOFILEIN - replaced with the hint SDL_HINT_AUDIO_DISK_INPUT_FILE * SDL_DUMMYAUDIODELAY - replaced with the hint SDL_HINT_AUDIO_DUMMY_TIMESCALE which allows scaling the audio time rather than specifying an absolute delay. +* VITA_DISABLE_TOUCH_BACK - replaced with the hint SDL_HINT_VITA_ENABLE_BACK_TOUCH +* VITA_DISABLE_TOUCH_FRONT - replaced with the hint SDL_HINT_VITA_ENABLE_FRONT_TOUCH +* VITA_MODULE_PATH - replaced with the hint SDL_HINT_VITA_MODULE_PATH +* VITA_PVR_OGL - replaced with the hint SDL_HINT_VITA_PVR_OPENGL +* VITA_PVR_SKIP_INIT - replaced with the hint SDL_HINT_VITA_PVR_INIT +* VITA_RESOLUTION - replaced with the hint SDL_HINT_VITA_RESOLUTION The following functions have been removed: * SDL_ClearHints() - replaced with SDL_ResetHints() diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 84682c8b8e475..4da310ce76d03 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3357,6 +3357,86 @@ extern "C" { */ #define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" +/** + * A variable controlling whether touch should be enabled on the back panel of the PlayStation Vita. + * + * The variable can be set to the following values: + * + * - "0": Disable touch on the back panel. + * - "1": Enable touch on the back panel. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VITA_ENABLE_BACK_TOUCH "SDL_VITA_ENABLE_BACK_TOUCH" + +/** + * A variable controlling whether touch should be enabled on the front panel of the PlayStation Vita. + * + * The variable can be set to the following values: + * + * - "0": Disable touch on the front panel. + * - "1": Enable touch on the front panel. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VITA_ENABLE_FRONT_TOUCH "SDL_VITA_ENABLE_FRONT_TOUCH" + +/** + * A variable controlling the module path on the PlayStation Vita. + * + * This hint defaults to "app0:module" + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VITA_MODULE_PATH "SDL_VITA_MODULE_PATH" + +/** + * A variable controlling whether to perform PVR initialization on the PlayStation Vita. + * + * - "0": Skip PVR initialization. + * - "1": Perform the normal PVR initialization. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VITA_PVR_INIT "SDL_VITA_PVR_INIT" + +/** + * A variable overriding the resolution reported on the PlayStation Vita. + * + * The variable can be set to the following values: + * + * - "544": 544p (default) + * - "720": 725p for PSTV + * - "1080": 1088i for PSTV + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VITA_RESOLUTION "SDL_VITA_RESOLUTION" + +/** + * A variable controlling whether OpenGL should be used instead of OpenGL ES on the PlayStation Vita. + * + * The variable can be set to the following values: + * + * - "0": Use OpenGL ES. (default) + * - "1": Use OpenGL. + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VITA_PVR_OPENGL "SDL_VITA_PVR_OPENGL" + /** * A variable controlling which touchpad should generate synthetic mouse * events. diff --git a/src/video/vita/SDL_vitagl_pvr.c b/src/video/vita/SDL_vitagl_pvr.c index a8c6b03fab187..886a0a0f3c815 100644 --- a/src/video/vita/SDL_vitagl_pvr.c +++ b/src/video/vita/SDL_vitagl_pvr.c @@ -46,13 +46,13 @@ static void getFBSize(int *width, int *height) int VITA_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path) { PVRSRV_PSP2_APPHINT hint; - const char *override = SDL_getenv("VITA_MODULE_PATH"); - const char *skip_init = SDL_getenv("VITA_PVR_SKIP_INIT"); char *default_path = "app0:module"; char target_path[MAX_PATH]; - if (!skip_init) { // we don't care about actual value - if (override) { + if (SDL_GetHintBoolean(SDL_HINT_VITA_PVR_INIT, SDL_TRUE)) { + const char *override = SDL_GetHint(SDL_HINT_VITA_MODULE_PATH); + + if (override && *override) { default_path = override; } diff --git a/src/video/vita/SDL_vitagles_pvr.c b/src/video/vita/SDL_vitagles_pvr.c index 0e7d407458984..acc9ba8f3d24b 100644 --- a/src/video/vita/SDL_vitagles_pvr.c +++ b/src/video/vita/SDL_vitagles_pvr.c @@ -35,14 +35,13 @@ int VITA_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path) { PVRSRV_PSP2_APPHINT hint; - const char *override = SDL_getenv("VITA_MODULE_PATH"); - const char *skip_init = SDL_getenv("VITA_PVR_SKIP_INIT"); const char *default_path = "app0:module"; char target_path[MAX_PATH]; - if (!skip_init) { // we don't care about actual value + if (SDL_GetHintBoolean(SDL_HINT_VITA_PVR_INIT, SDL_TRUE)) { + const char *override = SDL_GetHint(SDL_HINT_VITA_MODULE_PATH); - if (override) { + if (override && *override) { default_path = override; } diff --git a/src/video/vita/SDL_vitatouch.c b/src/video/vita/SDL_vitatouch.c index 0520b8b99ea12..aab16cc5dc4de 100644 --- a/src/video/vita/SDL_vitatouch.c +++ b/src/video/vita/SDL_vitatouch.c @@ -41,13 +41,13 @@ struct float range; } force_info[SCE_TOUCH_PORT_MAX_NUM]; -const char *disableFrontPoll = NULL; -const char *disableBackPoll = NULL; +static SDL_bool disableFrontPoll; +static SDL_bool disableBackPoll; void VITA_InitTouch(void) { - disableFrontPoll = SDL_getenv("VITA_DISABLE_TOUCH_FRONT"); - disableBackPoll = SDL_getenv("VITA_DISABLE_TOUCH_BACK"); + disableFrontPoll = !SDL_GetHintBoolean(SDL_HINT_VITA_ENABLE_FRONT_TOUCH, SDL_TRUE); + disableBackPoll = !SDL_GetHintBoolean(SDL_HINT_VITA_ENABLE_BACK_TOUCH, SDL_TRUE); sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START); sceTouchSetSamplingState(SCE_TOUCH_PORT_BACK, SCE_TOUCH_SAMPLING_STATE_START); @@ -92,7 +92,7 @@ void VITA_PollTouch(void) SDL_memcpy(touch_old, touch, sizeof(touch_old)); for (port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) { - /** Skip polling of Touch Device if environment variable is set **/ + /** Skip polling of Touch Device if hint is set **/ if (((port == 0) && disableFrontPoll) || ((port == 1) && disableBackPoll)) { continue; } diff --git a/src/video/vita/SDL_vitavideo.c b/src/video/vita/SDL_vitavideo.c index c5ced23e3461b..3c6654c9b12d6 100644 --- a/src/video/vita/SDL_vitavideo.c +++ b/src/video/vita/SDL_vitavideo.c @@ -125,7 +125,7 @@ static SDL_VideoDevice *VITA_Create(void) #if defined(SDL_VIDEO_VITA_PIB) || defined(SDL_VIDEO_VITA_PVR) #ifdef SDL_VIDEO_VITA_PVR_OGL - if (SDL_getenv("VITA_PVR_OGL") != NULL) { + if (SDL_GetHintBoolean(SDL_HINT_VITA_PVR_OPENGL, SDL_FALSE)) { device->GL_LoadLibrary = VITA_GL_LoadLibrary; device->GL_CreateContext = VITA_GL_CreateContext; device->GL_GetProcAddress = VITA_GL_GetProcAddress; @@ -170,19 +170,19 @@ int VITA_VideoInit(SDL_VideoDevice *_this) { SDL_DisplayMode mode; #ifdef SDL_VIDEO_VITA_PVR - const char *res = SDL_getenv("VITA_RESOLUTION"); + const char *res = SDL_GetHint(SDL_HINT_VITA_RESOLUTION); #endif SDL_zero(mode); #ifdef SDL_VIDEO_VITA_PVR if (res) { /* 1088i for PSTV (Or Sharpscale) */ - if (!SDL_strncmp(res, "1080", 4)) { + if (SDL_strncmp(res, "1080", 4) == 0) { mode.w = 1920; mode.h = 1088; } /* 725p for PSTV (Or Sharpscale) */ - else if (!SDL_strncmp(res, "720", 3)) { + else if (SDL_strncmp(res, "720", 3) == 0) { mode.w = 1280; mode.h = 725; } @@ -261,7 +261,8 @@ int VITA_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properties win.windowSize = PSP2_WINDOW_960X544; } if (window->flags & SDL_WINDOW_OPENGL) { - if (SDL_getenv("VITA_PVR_OGL") != NULL) { + SDL_bool use_opengl = SDL_GetHintBoolean(SDL_HINT_VITA_PVR_OPENGL, SDL_FALSE); + if (use_opengl) { /* Set version to 2.1 and PROFILE to ES */ temp_major = _this->gl_config.major_version; temp_minor = _this->gl_config.minor_version; @@ -275,7 +276,7 @@ int VITA_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properties if (wdata->egl_surface == EGL_NO_SURFACE) { return SDL_SetError("Could not create GLES window surface"); } - if (SDL_getenv("VITA_PVR_OGL") != NULL) { + if (use_opengl) { /* Revert */ _this->gl_config.major_version = temp_major; _this->gl_config.minor_version = temp_minor; From 95adcc522f886343a41e2edb493138f12b1753a9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 10:56:16 -0700 Subject: [PATCH 169/253] Allow SDL hints to override OpenGL extension availability --- src/render/opengl/SDL_render_gl.c | 2 +- src/video/SDL_egl.c | 4 ++-- src/video/SDL_video.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index af1a2af7f0562..2d34dddd7db95 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1729,7 +1729,7 @@ static int GL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Pro data->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); } - hint = SDL_getenv("GL_ARB_texture_non_power_of_two"); + hint = SDL_GetHint("GL_ARB_texture_non_power_of_two"); if (!hint || *hint != '0') { SDL_bool isGL2 = SDL_FALSE; const char *verstr = (const char *)data->glGetString(GL_VERSION); diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c index 59d2402582a0c..cc6569ccb379a 100644 --- a/src/video/SDL_egl.c +++ b/src/video/SDL_egl.c @@ -189,14 +189,14 @@ SDL_bool SDL_EGL_HasExtension(SDL_VideoDevice *_this, SDL_EGL_ExtensionType type return SDL_FALSE; } - /* Extensions can be masked with an environment variable. + /* Extensions can be masked with a hint or environment variable. * Unlike the OpenGL override, this will use the set bits of an integer * to disable the extension. * Bit Action * 0 If set, the display extension is masked and not present to SDL. * 1 If set, the client extension is masked and not present to SDL. */ - ext_override = SDL_getenv(ext); + ext_override = SDL_GetHint(ext); if (ext_override) { int disable_ext = SDL_atoi(ext_override); if (disable_ext & 0x01 && type == SDL_EGL_DISPLAY_EXTENSION) { diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 578d06a5af1fd..bd8768471a57d 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -4323,8 +4323,8 @@ SDL_bool SDL_GL_ExtensionSupported(const char *extension) if (where || *extension == '\0') { return SDL_FALSE; } - /* See if there's an environment variable override */ - start = SDL_getenv(extension); + /* See if there's a hint or environment variable override */ + start = SDL_GetHint(extension); if (start && *start == '0') { return SDL_FALSE; } From f370e1a6458575c1d8c450e7f61ecc3043022e82 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 11:02:29 -0700 Subject: [PATCH 170/253] Removed the SDL_ALTIVEC_BLIT_FEATURES environment variable. This code has long since been tested, and none of the developers have an Altivec CPU. --- src/video/SDL_blit_N.c | 43 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c index 6a5501d4ea8a6..b94f43f832cf4 100644 --- a/src/video/SDL_blit_N.c +++ b/src/video/SDL_blit_N.c @@ -36,14 +36,11 @@ /* Functions to blit from N-bit surfaces to other surfaces */ -enum blit_features -{ - BLIT_FEATURE_NONE = 0, - BLIT_FEATURE_HAS_MMX = 1, - BLIT_FEATURE_HAS_ALTIVEC = 2, - BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH = 4, - BLIT_FEATURE_HAS_ARM_SIMD = 8 -}; +#define BLIT_FEATURE_NONE 0x00 +#define BLIT_FEATURE_HAS_MMX 0x01 +#define BLIT_FEATURE_HAS_ALTIVEC 0x02 +#define BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH 0x04 +#define BLIT_FEATURE_HAS_ARM_SIMD 0x08 #ifdef SDL_ALTIVEC_BLITTERS #ifdef SDL_PLATFORM_MACOS @@ -873,26 +870,18 @@ static void ConvertAltivec32to32_prefetch(SDL_BlitInfo *info) vec_dss(DST_CHAN_DEST); } -static enum blit_features GetBlitFeatures(void) +static Uint32 GetBlitFeatures(void) { - static enum blit_features features = -1; - if (features == (enum blit_features) - 1) { - /* Provide an override for testing .. */ - const char *override = SDL_getenv("SDL_ALTIVEC_BLIT_FEATURES"); - if (override) { - unsigned int features_as_uint = 0; - SDL_sscanf(override, "%u", &features_as_uint); - features = (enum blit_features)features_as_uint; - } else { - features = (0 - /* Feature 1 is has-MMX */ - | ((SDL_HasMMX()) ? BLIT_FEATURE_HAS_MMX : 0) - /* Feature 2 is has-AltiVec */ - | ((SDL_HasAltiVec()) ? BLIT_FEATURE_HAS_ALTIVEC : 0) - /* Feature 4 is dont-use-prefetch */ - /* !!!! FIXME: Check for G5 or later, not the cache size! Always prefetch on a G4. */ - | ((GetL3CacheSize() == 0) ? BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH : 0)); - } + static Uint32 features = ~0u; + if (features == ~0u) { + features = (0 + /* Feature 1 is has-MMX */ + | ((SDL_HasMMX()) ? BLIT_FEATURE_HAS_MMX : 0) + /* Feature 2 is has-AltiVec */ + | ((SDL_HasAltiVec()) ? BLIT_FEATURE_HAS_ALTIVEC : 0) + /* Feature 4 is dont-use-prefetch */ + /* !!!! FIXME: Check for G5 or later, not the cache size! Always prefetch on a G4. */ + | ((GetL3CacheSize() == 0) ? BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH : 0)); } return features; } From d9f9e9e7648f286fe177e8a2e47bb205924a0991 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 11:13:33 -0700 Subject: [PATCH 171/253] Added SDL_HINT_VIDEO_DUMMY_SAVE_FRAMES and SDL_HINT_VIDEO_OFFSCREEN_SAVE_FRAMES --- include/SDL3/SDL_hints.h | 26 +++++++++++++++++++ src/video/dummy/SDL_nullframebuffer.c | 2 +- .../offscreen/SDL_offscreenframebuffer.c | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 4da310ce76d03..dedc8a9b58bba 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3037,6 +3037,18 @@ extern "C" { */ #define SDL_HINT_VIDEO_DRIVER "SDL_VIDEO_DRIVER" +/** + * A variable controlling whether the dummy video driver saves output frames. + * + * - "0": Video frames are not saved to disk. (default) + * - "1": Video frames are saved to files in the format "SDL_windowX-Y.bmp", where X is the window ID, and Y is the frame number. + * + * This hint can be set anytime. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VIDEO_DUMMY_SAVE_FRAMES "SDL_VIDEO_DUMMY_SAVE_FRAMES" + /** * If eglGetPlatformDisplay fails, fall back to calling eglGetDisplay. * @@ -3101,6 +3113,20 @@ extern "C" { */ #define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS" +/** + * A variable controlling whether the offscreen video driver saves output frames. + * + * This only saves frames that are generated using software rendering, not accelerated OpenGL rendering. + * + * - "0": Video frames are not saved to disk. (default) + * - "1": Video frames are saved to files in the format "SDL_windowX-Y.bmp", where X is the window ID, and Y is the frame number. + * + * This hint can be set anytime. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VIDEO_OFFSCREEN_SAVE_FRAMES "SDL_VIDEO_OFFSCREEN_SAVE_FRAMES" + /** * A variable controlling whether all window operations will block until * complete. diff --git a/src/video/dummy/SDL_nullframebuffer.c b/src/video/dummy/SDL_nullframebuffer.c index f1311cfbe4a95..b1c19ac48a245 100644 --- a/src/video/dummy/SDL_nullframebuffer.c +++ b/src/video/dummy/SDL_nullframebuffer.c @@ -61,7 +61,7 @@ int SDL_DUMMY_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window } /* Send the data to the display */ - if (SDL_getenv("SDL_VIDEO_DUMMY_SAVE_FRAMES")) { + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DUMMY_SAVE_FRAMES, SDL_FALSE)) { char file[128]; (void)SDL_snprintf(file, sizeof(file), "SDL_window%" SDL_PRIu32 "-%8.8d.bmp", SDL_GetWindowID(window), ++frame_number); diff --git a/src/video/offscreen/SDL_offscreenframebuffer.c b/src/video/offscreen/SDL_offscreenframebuffer.c index 82bb536d8ae51..e64a2452512e2 100644 --- a/src/video/offscreen/SDL_offscreenframebuffer.c +++ b/src/video/offscreen/SDL_offscreenframebuffer.c @@ -62,7 +62,7 @@ int SDL_OFFSCREEN_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *wi } /* Send the data to the display */ - if (SDL_getenv("SDL_VIDEO_OFFSCREEN_SAVE_FRAMES")) { + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_OFFSCREEN_SAVE_FRAMES, SDL_FALSE)) { char file[128]; (void)SDL_snprintf(file, sizeof(file), "SDL_window%" SDL_PRIu32 "-%8.8d.bmp", SDL_GetWindowID(window), ++frame_number); From 8a5b9559dc4a16122d585dafeb2b78cf283652ac Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 11:16:16 -0700 Subject: [PATCH 172/253] Removed the SDL_VIDEO_NGAGE_SAVE_FRAMES environment variable Display updating is now implemented, presumably we don't need to be able to dump frames for debugging. --- src/video/ngage/SDL_ngageframebuffer.cpp | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/video/ngage/SDL_ngageframebuffer.cpp b/src/video/ngage/SDL_ngageframebuffer.cpp index 181b914ae797c..3675c54078100 100644 --- a/src/video/ngage/SDL_ngageframebuffer.cpp +++ b/src/video/ngage/SDL_ngageframebuffer.cpp @@ -145,24 +145,7 @@ int SDL_NGAGE_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window int SDL_NGAGE_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects) { - static int frame_number; - SDL_Surface *surface; - - surface = (SDL_Surface *)SDL_GetWindowData(window, NGAGE_SURFACE); - if (!surface) { - return SDL_SetError("Couldn't find ngage surface for window"); - } - - /* Send the data to the display */ - if (SDL_getenv("SDL_VIDEO_NGAGE_SAVE_FRAMES")) { - char file[128]; - SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp", - (int)SDL_GetWindowID(window), ++frame_number); - SDL_SaveBMP(surface, file); - } - DirectUpdate(_this, numrects, (SDL_Rect *)rects); - return 0; } From 0da346f12989cd2410034da7eaecfd003ff673a3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 11:42:06 -0700 Subject: [PATCH 173/253] Added SDL_HINT_HIDAPI_LIBUSB, SDL_HINT_HIDAPI_LIBUSB_WHITELIST, and SDL_HINT_HIDAPI_UDEV --- docs/README-migration.md | 2 ++ include/SDL3/SDL_hints.h | 46 ++++++++++++++++++++++++ src/hidapi/SDL_hidapi.c | 18 +++++----- src/joystick/hidapi/SDL_hidapijoystick.c | 4 +-- 4 files changed, 59 insertions(+), 11 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index b0f432b14920c..526f7c844ddfd 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -812,6 +812,8 @@ The following environment variables have been removed: * SDL_DISKAUDIOFILE - replaced with the hint SDL_HINT_AUDIO_DISK_OUTPUT_FILE * SDL_DISKAUDIOFILEIN - replaced with the hint SDL_HINT_AUDIO_DISK_INPUT_FILE * SDL_DUMMYAUDIODELAY - replaced with the hint SDL_HINT_AUDIO_DUMMY_TIMESCALE which allows scaling the audio time rather than specifying an absolute delay. +* SDL_HIDAPI_DISABLE_LIBUSB - replaced with the hint SDL_HINT_HIDAPI_LIBUSB +* SDL_HIDAPI_JOYSTICK_DISABLE_UDEV - replaced with the hint SDL_HINT_HIDAPI_UDEV * VITA_DISABLE_TOUCH_BACK - replaced with the hint SDL_HINT_VITA_ENABLE_BACK_TOUCH * VITA_DISABLE_TOUCH_FRONT - replaced with the hint SDL_HINT_VITA_ENABLE_FRONT_TOUCH * VITA_MODULE_PATH - replaced with the hint SDL_HINT_VITA_MODULE_PATH diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index dedc8a9b58bba..0bffad638f689 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -930,6 +930,52 @@ extern "C" { */ #define SDL_HINT_GDK_TEXTINPUT_TITLE "SDL_GDK_TEXTINPUT_TITLE" +/** + * A variable to control whether HIDAPI uses libusb for device access. + * + * By default libusb will only be used for a few devices that require direct USB access, and this can be controlled with SDL_HINT_HIDAPI_LIBUSB_WHITELIST. + * + * The variable can be set to the following values: + * + * - "0": HIDAPI will not use libusb for device access. + * - "1": HIDAPI will use libusb for device access if available. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_HIDAPI_LIBUSB "SDL_HIDAPI_LIBUSB" + +/** + * A variable to control whether HIDAPI uses libusb only for whitelisted devices. + * + * By default libusb will only be used for a few devices that require direct USB access. + * + * The variable can be set to the following values: + * + * - "0": HIDAPI will use libusb for all device access. + * - "1": HIDAPI will use libusb only for whitelisted devices. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_HIDAPI_LIBUSB_WHITELIST "SDL_HIDAPI_LIBUSB_WHITELIST" + +/** + * A variable to control whether HIDAPI uses udev for device detection. + * + * The variable can be set to the following values: + * + * - "0": HIDAPI will poll for device changes. + * - "1": HIDAPI will use udev for device detection. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_HIDAPI_UDEV "SDL_HIDAPI_UDEV" + /** * A variable to control whether SDL_hid_enumerate() enumerates all HID * devices or only controllers. diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c index 930db26df2097..ee4abeec7510b 100644 --- a/src/hidapi/SDL_hidapi.c +++ b/src/hidapi/SDL_hidapi.c @@ -909,13 +909,13 @@ static SDL_bool IsInWhitelist(Uint16 vendor, Uint16 product) #if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) /* We have another way to get HID devices, so use the whitelist to get devices where libusb is preferred */ -#define SDL_HIDAPI_LIBUSB_WHITELIST_DEFAULT SDL_TRUE +#define SDL_HINT_HIDAPI_LIBUSB_WHITELIST_DEFAULT SDL_TRUE #else /* libusb is the only way to get HID devices, so don't use the whitelist, get them all */ -#define SDL_HIDAPI_LIBUSB_WHITELIST_DEFAULT SDL_FALSE +#define SDL_HINT_HIDAPI_LIBUSB_WHITELIST_DEFAULT SDL_FALSE #endif /* HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND */ -static SDL_bool use_libusb_whitelist = SDL_HIDAPI_LIBUSB_WHITELIST_DEFAULT; +static SDL_bool use_libusb_whitelist = SDL_HINT_HIDAPI_LIBUSB_WHITELIST_DEFAULT; /* Shared HIDAPI Implementation */ @@ -1140,9 +1140,9 @@ int SDL_hid_init(void) SDL_AddHintCallback(SDL_HINT_HIDAPI_IGNORE_DEVICES, IgnoredDevicesChanged, NULL); #ifdef SDL_USE_LIBUDEV - if (SDL_getenv("SDL_HIDAPI_JOYSTICK_DISABLE_UDEV") != NULL) { + if (!SDL_GetHintBoolean(SDL_HINT_HIDAPI_UDEV, SDL_TRUE)) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, - "udev disabled by SDL_HIDAPI_JOYSTICK_DISABLE_UDEV"); + "udev disabled by SDL_HINT_HIDAPI_UDEV"); linux_enumeration_method = ENUMERATION_FALLBACK; } else if (SDL_DetectSandbox() != SDL_SANDBOX_NONE) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, @@ -1155,12 +1155,12 @@ int SDL_hid_init(void) } #endif - use_libusb_whitelist = SDL_GetHintBoolean("SDL_HIDAPI_LIBUSB_WHITELIST", - SDL_HIDAPI_LIBUSB_WHITELIST_DEFAULT); + use_libusb_whitelist = SDL_GetHintBoolean(SDL_HINT_HIDAPI_LIBUSB_WHITELIST, + SDL_HINT_HIDAPI_LIBUSB_WHITELIST_DEFAULT); #ifdef HAVE_LIBUSB - if (SDL_getenv("SDL_HIDAPI_DISABLE_LIBUSB") != NULL) { + if (!SDL_GetHintBoolean(SDL_HINT_HIDAPI_LIBUSB, SDL_TRUE)) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, - "libusb disabled by SDL_HIDAPI_DISABLE_LIBUSB"); + "libusb disabled with SDL_HINT_HIDAPI_LIBUSB"); libusb_ctx.libhandle = NULL; } else { ++attempts; diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 17ec232e7e0f0..dbf59ddcb9bc2 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -579,9 +579,9 @@ static int HIDAPI_JoystickInit(void) #ifdef SDL_USE_LIBUDEV if (linux_enumeration_method == ENUMERATION_UNSET) { - if (SDL_getenv("SDL_HIDAPI_JOYSTICK_DISABLE_UDEV") != NULL) { + if (!SDL_GetHintBoolean(SDL_HINT_HIDAPI_UDEV, SDL_TRUE)) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, - "udev disabled by SDL_HIDAPI_JOYSTICK_DISABLE_UDEV"); + "udev disabled by SDL_HINT_HIDAPI_UDEV"); linux_enumeration_method = ENUMERATION_FALLBACK; } else if (SDL_DetectSandbox() != SDL_SANDBOX_NONE) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, From 6f399c3beb9e5c72e1e460cf30b6da44221cbe48 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 11:50:23 -0700 Subject: [PATCH 174/253] Note that SDL_HAPTIC_GAIN_MAX should remain an environment variable. --- docs/README-migration.md | 1 + src/haptic/SDL_haptic.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 526f7c844ddfd..676ad1332ed97 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -812,6 +812,7 @@ The following environment variables have been removed: * SDL_DISKAUDIOFILE - replaced with the hint SDL_HINT_AUDIO_DISK_OUTPUT_FILE * SDL_DISKAUDIOFILEIN - replaced with the hint SDL_HINT_AUDIO_DISK_INPUT_FILE * SDL_DUMMYAUDIODELAY - replaced with the hint SDL_HINT_AUDIO_DUMMY_TIMESCALE which allows scaling the audio time rather than specifying an absolute delay. +* SDL_HAPTIC_GAIN_MAX * SDL_HIDAPI_DISABLE_LIBUSB - replaced with the hint SDL_HINT_HIDAPI_LIBUSB * SDL_HIDAPI_JOYSTICK_DISABLE_UDEV - replaced with the hint SDL_HINT_HIDAPI_UDEV * VITA_DISABLE_TOUCH_BACK - replaced with the hint SDL_HINT_VITA_ENABLE_BACK_TOUCH diff --git a/src/haptic/SDL_haptic.c b/src/haptic/SDL_haptic.c index bb009ec565c31..be296261709ff 100644 --- a/src/haptic/SDL_haptic.c +++ b/src/haptic/SDL_haptic.c @@ -539,7 +539,7 @@ int SDL_SetHapticGain(SDL_Haptic *haptic, int gain) return SDL_SetError("Haptic: Gain must be between 0 and 100."); } - /* We use the envvar to get the maximum gain. */ + /* The user can use an environment variable to override the max gain. */ env = SDL_getenv("SDL_HAPTIC_GAIN_MAX"); if (env) { max_gain = SDL_atoi(env); From afde1cc9c238f90dd0ad945f2b1035b7fbef0393 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 12:02:50 -0700 Subject: [PATCH 175/253] Added SDL_HINT_EVDEV_DEVICES --- include/SDL3/SDL_hints.h | 15 +++++++++++++++ src/core/linux/SDL_evdev.c | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 0bffad638f689..ab94f7eab64e3 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -685,6 +685,21 @@ extern "C" { */ #define SDL_HINT_ENABLE_SCREEN_KEYBOARD "SDL_ENABLE_SCREEN_KEYBOARD" +/** + * A variable containing a list of evdev devices to use if udev is not available. + * + * The list of devices is in the form: + * + * deviceclass:path[,deviceclass:path[,...]] + * + * where device class is an integer representing the SDL_UDEV_deviceclass and path is the full path to the event device. + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_EVDEV_DEVICES "SDL_EVDEV_DEVICES" + /** * A variable controlling verbosity of the logging of SDL events pushed onto * the internal queue. diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c index 43b3b3b77d06a..96c59802bc20c 100644 --- a/src/core/linux/SDL_evdev.c +++ b/src/core/linux/SDL_evdev.c @@ -198,7 +198,7 @@ int SDL_EVDEV_Init(void) where device class is an integer representing the SDL_UDEV_deviceclass and path is the full path to the event device. */ - const char *devices = SDL_getenv("SDL_EVDEV_DEVICES"); + const char *devices = SDL_GetHint(SDL_HINT_EVDEV_DEVICES); if (devices) { /* Assume this is the old use of the env var and it is not in ROM. */ From 746b8eb14b03c2b2768ee3aafa8ff32731aeb679 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 12:23:56 -0700 Subject: [PATCH 176/253] Added SDL_HINT_MUTE_CONSOLE_KEYBOARD --- docs/README-migration.md | 2 ++ include/SDL3/SDL_hints.h | 16 ++++++++++++++++ src/core/freebsd/SDL_evdev_kbd_freebsd.c | 4 ++-- src/core/linux/SDL_evdev_kbd.c | 3 +-- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 676ad1332ed97..3b87da24c3de2 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -815,6 +815,8 @@ The following environment variables have been removed: * SDL_HAPTIC_GAIN_MAX * SDL_HIDAPI_DISABLE_LIBUSB - replaced with the hint SDL_HINT_HIDAPI_LIBUSB * SDL_HIDAPI_JOYSTICK_DISABLE_UDEV - replaced with the hint SDL_HINT_HIDAPI_UDEV +* SDL_INPUT_FREEBSD_KEEP_KBD - replaced with the hint SDL_HINT_MUTE_CONSOLE_KEYBOARD +* SDL_INPUT_LINUX_KEEP_KBD - replaced with the hint SDL_HINT_MUTE_CONSOLE_KEYBOARD * VITA_DISABLE_TOUCH_BACK - replaced with the hint SDL_HINT_VITA_ENABLE_BACK_TOUCH * VITA_DISABLE_TOUCH_FRONT - replaced with the hint SDL_HINT_VITA_ENABLE_FRONT_TOUCH * VITA_MODULE_PATH - replaced with the hint SDL_HINT_VITA_MODULE_PATH diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index ab94f7eab64e3..6203f327137cd 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2482,6 +2482,22 @@ extern "C" { */ #define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS" +/** + * A variable controlling whether the keyboard should be muted on the console. + * + * Normally the keyboard is muted while SDL applications are running so that keyboard input doesn't show up as key strokes on the console. This hint allows you to turn that off for debugging purposes. + * + * The variable can be set to the following values: + * + * - "0": Allow keystrokes to go through to the console. + * - "1": Mute keyboard input so it doesn't show up on the console. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_MUTE_CONSOLE_KEYBOARD "SDL_MUTE_CONSOLE_KEYBOARD" + /** * Tell SDL not to catch the SIGINT or SIGTERM signals on POSIX platforms. * diff --git a/src/core/freebsd/SDL_evdev_kbd_freebsd.c b/src/core/freebsd/SDL_evdev_kbd_freebsd.c index 10ee85dcabcd5..a980c8d18ef7b 100644 --- a/src/core/freebsd/SDL_evdev_kbd_freebsd.c +++ b/src/core/freebsd/SDL_evdev_kbd_freebsd.c @@ -264,8 +264,8 @@ SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void) SDL_free(kbd->key_map); kbd->key_map = &keymap_default_us_acc; } - /* Allow inhibiting keyboard mute with env. variable for debugging etc. */ - if (SDL_getenv("SDL_INPUT_FREEBSD_KEEP_KBD") == NULL) { + + if (SDL_GetHintBoolean(SDL_HINT_MUTE_CONSOLE_KEYBOARD, SDL_TRUE)) { /* Take keyboard from console and open the actual keyboard device. * Ensures that the keystrokes do not leak through to the console. */ diff --git a/src/core/linux/SDL_evdev_kbd.c b/src/core/linux/SDL_evdev_kbd.c index bf483298346cc..8af1cf35eee53 100644 --- a/src/core/linux/SDL_evdev_kbd.c +++ b/src/core/linux/SDL_evdev_kbd.c @@ -473,8 +473,7 @@ void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, SDL_bool muted) } if (muted) { - /* Allow inhibiting keyboard mute with env. variable for debugging etc. */ - if (SDL_getenv("SDL_INPUT_LINUX_KEEP_KBD") == NULL) { + if (SDL_GetHintBoolean(SDL_HINT_MUTE_CONSOLE_KEYBOARD, SDL_TRUE)) { /* Mute the keyboard so keystrokes only generate evdev events * and do not leak through to the console */ From dfd96ff50ff0bbe1d98ebc82dddfbe073e028f73 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 12:58:06 -0700 Subject: [PATCH 177/253] Updated SDL_HINT_VIDEODRIVER documentation --- docs/README-migration.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 3b87da24c3de2..5c099f0545f02 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -762,7 +762,7 @@ The environment variables SDL_VIDEO_X11_WMCLASS and SDL_VIDEO_WAYLAND_WMCLASS ha The environment variable AUDIODEV is used exclusively to specify the audio device for the OSS and NetBSD audio drivers. Its use in the ALSA driver has been replaced with the hint SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE and in the sndio driver with the environment variable AUDIODEVICE. The following hints have been renamed: -* SDL_HINT_VIDEODRIVER => SDL_VIDEO_DRIVER +* SDL_HINT_VIDEODRIVER => SDL_HINT_VIDEO_DRIVER * SDL_HINT_AUDIODRIVER => SDL_HINT_AUDIO_DRIVER * SDL_HINT_ALLOW_TOPMOST => SDL_HINT_WINDOW_ALLOW_TOPMOST * SDL_HINT_DIRECTINPUT_ENABLED => SDL_HINT_JOYSTICK_DIRECTINPUT @@ -804,7 +804,9 @@ The following hints have been removed: * SDL_HINT_AUDIO_DEVICE_APP_NAME - replaced by either using the appname param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_NAME_STRING with SDL_SetAppMetadataProperty() The following environment variables have been renamed: +* SDL_AUDIODRIVER => SDL_AUDIO_DRIVER * SDL_PATH_DSP => AUDIODEV +* SDL_VIDEODRIVER => SDL_VIDEO_DRIVER The following environment variables have been removed: * SDL_AUDIO_ALSA_DEBUG - replaced by setting the hint SDL_HINT_LOGGING to "audio=debug" @@ -2005,7 +2007,7 @@ The following symbols have been renamed: Several video backends have had their names lower-cased ("kmsdrm", "rpi", "android", "psp", "ps2", "vita"). SDL already does a case-insensitive compare for SDL_HINT_VIDEO_DRIVER tests, but if your app is calling SDL_GetVideoDriver() or SDL_GetCurrentVideoDriver() and doing case-sensitive compares on those strings, please update your code. -SDL_VideoInit() and SDL_VideoQuit() have been removed. Instead you can call SDL_InitSubSystem() and SDL_QuitSubSystem() with SDL_INIT_VIDEO, which will properly refcount the subsystems. You can choose a specific video driver using SDL_VIDEO_DRIVER hint. +SDL_VideoInit() and SDL_VideoQuit() have been removed. Instead you can call SDL_InitSubSystem() and SDL_QuitSubSystem() with SDL_INIT_VIDEO, which will properly refcount the subsystems. You can choose a specific video driver using SDL_HINT_VIDEO_DRIVER. Rather than iterating over displays using display index, there is a new function SDL_GetDisplays() to get the current list of displays, and functions which used to take a display index now take SDL_DisplayID, with an invalid ID being 0. ```c From e3682995f5c8f2b19e34ad9a6c58956619324cc3 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Mon, 5 Aug 2024 15:54:41 +0000 Subject: [PATCH 178/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_hints.h | 100 +++++++++++++++++++++++++-------------- 1 file changed, 64 insertions(+), 36 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 6203f327137cd..3f3d44b55e9ce 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -200,7 +200,10 @@ extern "C" { /** * Specify the default ALSA audio device name. * - * This variable is a specific audio device to open when the "default" audio device is used. By default if 4 channel audio is requested, the "plug:surround40" device will be opened and if 6 channel audio is requested the "plug:surround51" device will be opened. + * This variable is a specific audio device to open when the "default" audio + * device is used. By default if 4 channel audio is requested, the + * "plug:surround40" device will be opened and if 6 channel audio is requested + * the "plug:surround51" device will be opened. * * This hint should be set before an audio device is opened. * @@ -229,7 +232,9 @@ extern "C" { /** * A variable controlling the default audio channel count. * - * If the application doesn't specify the audio channel count when opening the device, this hint can be used to specify a default channel count that will be used. This defaults to "1" for recording and "2" for playback devices. + * If the application doesn't specify the audio channel count when opening the + * device, this hint can be used to specify a default channel count that will + * be used. This defaults to "1" for recording and "2" for playback devices. * * This hint should be set before an audio device is opened. * @@ -360,7 +365,9 @@ extern "C" { /** * A variable controlling the audio rate when using the disk audio driver. * - * The disk audio driver normally simulates real-time for the audio rate that was specified, but you can use this variable to adjust this rate higher or lower down to 0. The default value is "1.0". + * The disk audio driver normally simulates real-time for the audio rate that + * was specified, but you can use this variable to adjust this rate higher or + * lower down to 0. The default value is "1.0". * * This hint should be set before an audio device is opened. * @@ -385,7 +392,9 @@ extern "C" { /** * A variable controlling the audio rate when using the dummy audio driver. * - * The dummy audio driver normally simulates real-time for the audio rate that was specified, but you can use this variable to adjust this rate higher or lower down to 0. The default value is "1.0". + * The dummy audio driver normally simulates real-time for the audio rate that + * was specified, but you can use this variable to adjust this rate higher or + * lower down to 0. The default value is "1.0". * * This hint should be set before an audio device is opened. * @@ -396,20 +405,18 @@ extern "C" { /** * A variable controlling the default audio format. * - * If the application doesn't specify the audio format when opening the device, this hint can be used to specify a default format that will be used. + * If the application doesn't specify the audio format when opening the + * device, this hint can be used to specify a default format that will be + * used. * - * The variable can be set to the following values: - * - "U8": Unsigned 8-bit audio - * - "S8": Signed 8-bit audio - * - "S16LE": Signed 16-bit little-endian audio - * - "S16BE": Signed 16-bit big-endian audio - * - "S16": Signed 16-bit native-endian audio (default) - * - "S32LE": Signed 32-bit little-endian audio - * - "S32BE": Signed 32-bit big-endian audio - * - "S32": Signed 32-bit native-endian audio - * - "F32LE": Floating point little-endian audio - * - "F32BE": Floating point big-endian audio - * - "F32": Floating point native-endian audio + * The variable can be set to the following values: - "U8": Unsigned 8-bit + * audio - "S8": Signed 8-bit audio - "S16LE": Signed 16-bit little-endian + * audio - "S16BE": Signed 16-bit big-endian audio - "S16": Signed 16-bit + * native-endian audio (default) - "S32LE": Signed 32-bit little-endian audio + * - "S32BE": Signed 32-bit big-endian audio - "S32": Signed 32-bit + * native-endian audio - "F32LE": Floating point little-endian audio - + * "F32BE": Floating point big-endian audio - "F32": Floating point + * native-endian audio * * This hint should be set before an audio device is opened. * @@ -420,7 +427,9 @@ extern "C" { /** * A variable controlling the default audio frequency. * - * If the application doesn't specify the audio frequency when opening the device, this hint can be used to specify a default frequency that will be used. This defaults to "44100". + * If the application doesn't specify the audio frequency when opening the + * device, this hint can be used to specify a default frequency that will be + * used. This defaults to "44100". * * This hint should be set before an audio device is opened. * @@ -686,13 +695,15 @@ extern "C" { #define SDL_HINT_ENABLE_SCREEN_KEYBOARD "SDL_ENABLE_SCREEN_KEYBOARD" /** - * A variable containing a list of evdev devices to use if udev is not available. + * A variable containing a list of evdev devices to use if udev is not + * available. * * The list of devices is in the form: * - * deviceclass:path[,deviceclass:path[,...]] + * deviceclass:path[,deviceclass:path[,...]] * - * where device class is an integer representing the SDL_UDEV_deviceclass and path is the full path to the event device. + * where device class is an integer representing the SDL_UDEV_deviceclass and + * path is the full path to the event device. * * This hint should be set before SDL is initialized. * @@ -948,7 +959,9 @@ extern "C" { /** * A variable to control whether HIDAPI uses libusb for device access. * - * By default libusb will only be used for a few devices that require direct USB access, and this can be controlled with SDL_HINT_HIDAPI_LIBUSB_WHITELIST. + * By default libusb will only be used for a few devices that require direct + * USB access, and this can be controlled with + * SDL_HINT_HIDAPI_LIBUSB_WHITELIST. * * The variable can be set to the following values: * @@ -962,9 +975,11 @@ extern "C" { #define SDL_HINT_HIDAPI_LIBUSB "SDL_HIDAPI_LIBUSB" /** - * A variable to control whether HIDAPI uses libusb only for whitelisted devices. + * A variable to control whether HIDAPI uses libusb only for whitelisted + * devices. * - * By default libusb will only be used for a few devices that require direct USB access. + * By default libusb will only be used for a few devices that require direct + * USB access. * * The variable can be set to the following values: * @@ -2485,7 +2500,9 @@ extern "C" { /** * A variable controlling whether the keyboard should be muted on the console. * - * Normally the keyboard is muted while SDL applications are running so that keyboard input doesn't show up as key strokes on the console. This hint allows you to turn that off for debugging purposes. + * Normally the keyboard is muted while SDL applications are running so that + * keyboard input doesn't show up as key strokes on the console. This hint + * allows you to turn that off for debugging purposes. * * The variable can be set to the following values: * @@ -2516,7 +2533,8 @@ extern "C" { /** * Specify the OpenGL library to load. * - * This hint should be set before creating an OpenGL window or creating an OpenGL context. + * This hint should be set before creating an OpenGL window or creating an + * OpenGL context. * * \since This hint is available since SDL 3.0.0. */ @@ -3118,7 +3136,8 @@ extern "C" { * A variable controlling whether the dummy video driver saves output frames. * * - "0": Video frames are not saved to disk. (default) - * - "1": Video frames are saved to files in the format "SDL_windowX-Y.bmp", where X is the window ID, and Y is the frame number. + * - "1": Video frames are saved to files in the format "SDL_windowX-Y.bmp", + * where X is the window ID, and Y is the frame number. * * This hint can be set anytime. * @@ -3191,12 +3210,15 @@ extern "C" { #define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS" /** - * A variable controlling whether the offscreen video driver saves output frames. + * A variable controlling whether the offscreen video driver saves output + * frames. * - * This only saves frames that are generated using software rendering, not accelerated OpenGL rendering. + * This only saves frames that are generated using software rendering, not + * accelerated OpenGL rendering. * * - "0": Video frames are not saved to disk. (default) - * - "1": Video frames are saved to files in the format "SDL_windowX-Y.bmp", where X is the window ID, and Y is the frame number. + * - "1": Video frames are saved to files in the format "SDL_windowX-Y.bmp", + * where X is the window ID, and Y is the frame number. * * This hint can be set anytime. * @@ -3461,7 +3483,8 @@ extern "C" { #define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" /** - * A variable controlling whether touch should be enabled on the back panel of the PlayStation Vita. + * A variable controlling whether touch should be enabled on the back panel of + * the PlayStation Vita. * * The variable can be set to the following values: * @@ -3475,7 +3498,8 @@ extern "C" { #define SDL_HINT_VITA_ENABLE_BACK_TOUCH "SDL_VITA_ENABLE_BACK_TOUCH" /** - * A variable controlling whether touch should be enabled on the front panel of the PlayStation Vita. + * A variable controlling whether touch should be enabled on the front panel + * of the PlayStation Vita. * * The variable can be set to the following values: * @@ -3500,7 +3524,8 @@ extern "C" { #define SDL_HINT_VITA_MODULE_PATH "SDL_VITA_MODULE_PATH" /** - * A variable controlling whether to perform PVR initialization on the PlayStation Vita. + * A variable controlling whether to perform PVR initialization on the + * PlayStation Vita. * * - "0": Skip PVR initialization. * - "1": Perform the normal PVR initialization. (default) @@ -3527,7 +3552,8 @@ extern "C" { #define SDL_HINT_VITA_RESOLUTION "SDL_VITA_RESOLUTION" /** - * A variable controlling whether OpenGL should be used instead of OpenGL ES on the PlayStation Vita. + * A variable controlling whether OpenGL should be used instead of OpenGL ES + * on the PlayStation Vita. * * The variable can be set to the following values: * @@ -3570,7 +3596,8 @@ extern "C" { /** * Specify the Vulkan library to load. * - * This hint should be set before creating a Vulkan window or calling SDL_Vulkan_LoadLibrary(). + * This hint should be set before creating a Vulkan window or calling + * SDL_Vulkan_LoadLibrary(). * * \since This hint is available since SDL 3.0.0. */ @@ -3611,7 +3638,8 @@ extern "C" { /** * A variable controlling the maximum number of chunks in a WAVE file. * - * This sets an upper bound on the number of chunks in a WAVE file to avoid wasting time on malformed or corrupt WAVE files. This defaults to "10000". + * This sets an upper bound on the number of chunks in a WAVE file to avoid + * wasting time on malformed or corrupt WAVE files. This defaults to "10000". * * This hint should be set before calling SDL_LoadWAV() or SDL_LoadWAV_IO() * From 074dd8c35f0b3769b033b86b2a16628d0811b01d Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 5 Aug 2024 12:02:28 -0400 Subject: [PATCH 179/253] hints: Change hints to be backed by Properties, add documentation. (#9892) This makes the subsystem thread-safe, more performant, and cleans up the code a little. Also removed SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS, since setting this hint programmatically initializes properties, which creates a lock, so we can't check hints while creating locks. The slim reader-writer locks have been the default for ages and are solid, so we'll just use those when available. --- docs/README-migration.md | 3 + include/SDL3/SDL_hints.h | 87 ++++---- src/SDL.c | 3 +- src/SDL_hints.c | 340 ++++++++++++++++-------------- src/SDL_hints_c.h | 3 +- src/dynapi/SDL_dynapi_procs.h | 6 +- src/thread/windows/SDL_sysmutex.c | 34 ++- 7 files changed, 259 insertions(+), 217 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 5c099f0545f02..916f61f0a0c7e 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -755,6 +755,8 @@ SDL_AddHintCallback() now returns a standard int result instead of void, returni Calling SDL_GetHint() with the name of the hint being changed from within a hint callback will now return the new value rather than the old value. The old value is still passed as a parameter to the hint callback. +SDL_SetHint, SDL_SetHintWithPriority, and SDL_ResetHint now return int (-1 on error, 0 on success) instead of SDL_bool (SDL_FALSE on error, SDL_TRUE on success). + The environment variables SDL_VIDEODRIVER and SDL_AUDIODRIVER have been renamed to SDL_VIDEO_DRIVER and SDL_AUDIO_DRIVER. The environment variables SDL_VIDEO_X11_WMCLASS and SDL_VIDEO_WAYLAND_WMCLASS have been removed and replaced by either using the appindentifier param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_IDENTIFIER_STRING with SDL_SetAppMetadataProperty() @@ -799,6 +801,7 @@ The following hints have been removed: * SDL_HINT_VIDEO_X11_XINERAMA - Xinerama no longer supported by the X11 backend * SDL_HINT_VIDEO_X11_XVIDMODE - Xvidmode no longer supported by the X11 backend * SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING - SDL now properly handles the 0x406D1388 Exception if no debugger intercepts it, preventing its propagation. +* SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS - Slim Reader/Writer Locks are always used if available * SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 - replaced with SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4, defaulting to SDL_TRUE * SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING * SDL_HINT_AUDIO_DEVICE_APP_NAME - replaced by either using the appname param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_NAME_STRING with SDL_SetAppMetadataProperty() diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 3f3d44b55e9ce..3e9de6051973d 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3837,27 +3837,6 @@ extern "C" { */ #define SDL_HINT_WINDOWS_RAW_KEYBOARD "SDL_WINDOWS_RAW_KEYBOARD" -/** - * A variable controlling whether SDL uses Critical Sections for mutexes on - * Windows. - * - * On Windows 7 and newer, Slim Reader/Writer Locks are available. They offer - * better performance, allocate no kernel resources and use less memory. SDL - * will fall back to Critical Sections on older OS versions or if forced to by - * this hint. - * - * The variable can be set to the following values: - * - * - "0": Use SRW Locks when available, otherwise fall back to Critical - * Sections. (default) - * - "1": Force the use of Critical Sections in all cases. - * - * This hint should be set before SDL is initialized. - * - * \since This hint is available since SDL 3.0.0. - */ -#define SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS "SDL_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS" - /** * A variable controlling whether SDL uses Kernel Semaphores on Windows. * @@ -4133,7 +4112,10 @@ typedef enum SDL_HintPriority * \param name the hint to set. * \param value the value of the hint variable. * \param priority the SDL_HintPriority level for the hint. - * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. * @@ -4141,9 +4123,9 @@ typedef enum SDL_HintPriority * \sa SDL_ResetHint * \sa SDL_SetHint */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, - const char *value, - SDL_HintPriority priority); +extern SDL_DECLSPEC int SDLCALL SDL_SetHintWithPriority(const char *name, + const char *value, + SDL_HintPriority priority); /** * Set a hint with normal priority. @@ -4154,7 +4136,10 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, * * \param name the hint to set. * \param value the value of the hint variable. - * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. * @@ -4162,8 +4147,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, * \sa SDL_ResetHint * \sa SDL_SetHintWithPriority */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, - const char *value); +extern SDL_DECLSPEC int SDLCALL SDL_SetHint(const char *name, const char *value); /** * Reset a hint to the default value. @@ -4173,14 +4157,17 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, * change. * * \param name the hint to set. - * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetHint * \sa SDL_ResetHints */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResetHint(const char *name); +extern SDL_DECLSPEC int SDLCALL SDL_ResetHint(const char *name); /** * Reset all hints to the default values. @@ -4189,6 +4176,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResetHint(const char *name); * variable, or NULL if the environment isn't set. Callbacks will be called * normally with this change. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_ResetHint @@ -4201,6 +4190,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_ResetHints(void); * \param name the hint to query. * \returns the string value of a hint or NULL if the hint isn't set. * + * \threadsafety It is safe to call this function from any thread, however + * the return value only remains valid until the hint is + * changed; if another thread might do so, the app should + * supply locks and/or make a copy of the string. Note that + * using a hint callback instead is always thread-safe, as SDL + * holds a lock on the thread subsystem during the callback. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetHint @@ -4216,6 +4212,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); * \returns the boolean value of a hint or the provided default value if the * hint does not exist. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetHint @@ -4224,37 +4222,48 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value); /** - * Type definition of the hint callback function. + * A callback used to send notifications of hint value changes. + * + * This is called an initial time during SDL_AddHintCallback with the hint's + * current value, and then again each time the hint's value changes. * * \param userdata what was passed as `userdata` to SDL_AddHintCallback(). * \param name what was passed as `name` to SDL_AddHintCallback(). * \param oldValue the previous hint value. * \param newValue the new value hint is to be set to. * + * \threadsafety This callback is fired from whatever thread is setting a + * new hint value. SDL holds a lock on the hint subsystem when + * calling this callback. + * * \since This datatype is available since SDL 3.0.0. + * + * \sa SDL_AddHintCallback */ typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); /** * Add a function to watch a particular hint. * + * The callback function is called _during_ this function, to provide it an + * initial value, and again each time the hint's value changes. + * * \param name the hint to watch. - * \param callback an SDL_HintCallback function that will be called when the + * \param callback An SDL_HintCallback function that will be called when the * hint value changes. * \param userdata a pointer to pass to the callback function. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \threadsafety It is **NOT** safe to call this function from two threads at - * once. + * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. * * \sa SDL_DelHintCallback */ extern SDL_DECLSPEC int SDLCALL SDL_AddHintCallback(const char *name, - SDL_HintCallback callback, - void *userdata); + SDL_HintCallback callback, + void *userdata); /** * Remove a function watching a particular hint. @@ -4264,13 +4273,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddHintCallback(const char *name, * hint value changes. * \param userdata a pointer being passed to the callback function. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_AddHintCallback */ extern SDL_DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name, - SDL_HintCallback callback, - void *userdata); + SDL_HintCallback callback, + void *userdata); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/src/SDL.c b/src/SDL.c index 798d68fccff9a..d037f3b485db7 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -255,10 +255,12 @@ void SDL_InitMainThread(void) SDL_InitLog(); SDL_InitProperties(); SDL_GetGlobalProperties(); + SDL_InitHints(); } static void SDL_QuitMainThread(void) { + SDL_QuitHints(); SDL_QuitProperties(); SDL_QuitLog(); SDL_QuitFilesystem(); @@ -623,7 +625,6 @@ void SDL_Quit(void) #endif SDL_SetObjectsInvalid(); - SDL_ClearHints(); SDL_AssertionsQuit(); SDL_QuitPixelFormatDetails(); diff --git a/src/SDL_hints.c b/src/SDL_hints.c index 1abbeb930c135..48b3e6ac795e6 100644 --- a/src/SDL_hints.c +++ b/src/SDL_hints.c @@ -22,9 +22,6 @@ #include "SDL_hints_c.h" -/* Assuming there aren't many hints set and they aren't being queried in - critical performance paths, we'll just use linked lists here. - */ typedef struct SDL_HintWatch { SDL_HintCallback callback; @@ -34,42 +31,71 @@ typedef struct SDL_HintWatch typedef struct SDL_Hint { - char *name; char *value; SDL_HintPriority priority; SDL_HintWatch *callbacks; - struct SDL_Hint *next; } SDL_Hint; -static SDL_Hint *SDL_hints; +static SDL_PropertiesID SDL_hint_props = 0; -SDL_bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority) +static SDL_PropertiesID GetHintProperties(SDL_bool create) { - const char *env; - SDL_Hint *hint; - SDL_HintWatch *entry; + if (!SDL_hint_props && create) { + SDL_hint_props = SDL_CreateProperties(); + } + return SDL_hint_props; +} - if (!name) { - return SDL_FALSE; +void SDL_InitHints(void) +{ + // Just make sure the hint properties are created on the main thread + (void)GetHintProperties(SDL_TRUE); +} + +static void SDLCALL CleanupHintProperty(void *userdata, void *value) +{ + SDL_Hint *hint = (SDL_Hint *) value; + SDL_free(hint->value); + + SDL_HintWatch *entry = hint->callbacks; + while (entry) { + SDL_HintWatch *freeable = entry; + entry = entry->next; + SDL_free(freeable); } + SDL_free(hint); +} - env = SDL_getenv(name); - if (env && priority < SDL_HINT_OVERRIDE) { - return SDL_FALSE; +int SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority) +{ + if (!name || !*name) { + return SDL_InvalidParamError("name"); } - for (hint = SDL_hints; hint; hint = hint->next) { - if (SDL_strcmp(name, hint->name) == 0) { - if (priority < hint->priority) { - return SDL_FALSE; - } - if (hint->value != value && - (!value || !hint->value || SDL_strcmp(hint->value, value) != 0)) { + const char *env = SDL_getenv(name); + if (env && (priority < SDL_HINT_OVERRIDE)) { + return SDL_SetError("An environment variable is taking priority"); + } + + const SDL_PropertiesID hints = GetHintProperties(SDL_TRUE); + if (!hints) { + return -1; + } + + int retval = -1; + + SDL_LockProperties(hints); + + SDL_Hint *hint = SDL_GetPointerProperty(hints, name, NULL); + if (hint) { + if (priority >= hint->priority) { + if (hint->value != value && (!value || !hint->value || SDL_strcmp(hint->value, value) != 0)) { char *old_value = hint->value; hint->value = value ? SDL_strdup(value) : NULL; - for (entry = hint->callbacks; entry;) { - /* Save the next entry in case this one is deleted */ + SDL_HintWatch *entry = hint->callbacks; + while (entry) { + // Save the next entry in case this one is deleted SDL_HintWatch *next = entry->next; entry->callback(entry->userdata, name, old_value, value); entry = next; @@ -77,104 +103,118 @@ SDL_bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPr SDL_free(old_value); } hint->priority = priority; - return SDL_TRUE; + retval = 0; + } + } else { // Couldn't find the hint? Add a new one. + hint = (SDL_Hint *)SDL_malloc(sizeof(*hint)); + if (hint) { + hint->value = value ? SDL_strdup(value) : NULL; + hint->priority = priority; + hint->callbacks = NULL; + retval = (SDL_SetPointerPropertyWithCleanup(hints, name, hint, CleanupHintProperty, NULL) != -1); } } - /* Couldn't find the hint, add a new one */ - hint = (SDL_Hint *)SDL_malloc(sizeof(*hint)); - if (!hint) { - return SDL_FALSE; - } - hint->name = SDL_strdup(name); - hint->value = value ? SDL_strdup(value) : NULL; - hint->priority = priority; - hint->callbacks = NULL; - hint->next = SDL_hints; - SDL_hints = hint; - return SDL_TRUE; + SDL_UnlockProperties(hints); + + return retval; } -SDL_bool SDL_ResetHint(const char *name) +int SDL_ResetHint(const char *name) { - const char *env; - SDL_Hint *hint; - SDL_HintWatch *entry; - - if (!name) { - return SDL_FALSE; + if (!name || !*name) { + return SDL_InvalidParamError("name"); } - env = SDL_getenv(name); - for (hint = SDL_hints; hint; hint = hint->next) { - if (SDL_strcmp(name, hint->name) == 0) { - if ((!env && hint->value) || - (env && !hint->value) || - (env && SDL_strcmp(env, hint->value) != 0)) { - for (entry = hint->callbacks; entry;) { - /* Save the next entry in case this one is deleted */ - SDL_HintWatch *next = entry->next; - entry->callback(entry->userdata, name, hint->value, env); - entry = next; - } - } - SDL_free(hint->value); - hint->value = NULL; - hint->priority = SDL_HINT_DEFAULT; - return SDL_TRUE; - } + const char *env = SDL_getenv(name); + + const SDL_PropertiesID hints = GetHintProperties(SDL_FALSE); + if (!hints) { + return -1; } - return SDL_FALSE; -} -void SDL_ResetHints(void) -{ - const char *env; - SDL_Hint *hint; - SDL_HintWatch *entry; - - for (hint = SDL_hints; hint; hint = hint->next) { - env = SDL_getenv(hint->name); - if ((!env && hint->value) || - (env && !hint->value) || - (env && SDL_strcmp(env, hint->value) != 0)) { - for (entry = hint->callbacks; entry;) { - /* Save the next entry in case this one is deleted */ + int retval = -1; + + SDL_LockProperties(hints); + + SDL_Hint *hint = SDL_GetPointerProperty(hints, name, NULL); + if (hint) { + if ((!env && hint->value) || (env && !hint->value) || (env && SDL_strcmp(env, hint->value) != 0)) { + for (SDL_HintWatch *entry = hint->callbacks; entry;) { + // Save the next entry in case this one is deleted SDL_HintWatch *next = entry->next; - entry->callback(entry->userdata, hint->name, hint->value, env); + entry->callback(entry->userdata, name, hint->value, env); entry = next; } } SDL_free(hint->value); hint->value = NULL; hint->priority = SDL_HINT_DEFAULT; + retval = 0; + } + + SDL_UnlockProperties(hints); + + return retval; +} + +static void SDLCALL ResetHintsCallback(void *userdata, SDL_PropertiesID hints, const char *name) +{ + SDL_Hint *hint = SDL_GetPointerProperty(hints, name, NULL); + if (!hint) { + return; // uh...okay. + } + + const char *env = SDL_getenv(name); + if ((!env && hint->value) || (env && !hint->value) || (env && SDL_strcmp(env, hint->value) != 0)) { + SDL_HintWatch *entry = hint->callbacks; + while (entry) { + // Save the next entry in case this one is deleted + SDL_HintWatch *next = entry->next; + entry->callback(entry->userdata, name, hint->value, env); + entry = next; + } } + SDL_free(hint->value); + hint->value = NULL; + hint->priority = SDL_HINT_DEFAULT; } -SDL_bool SDL_SetHint(const char *name, const char *value) +void SDL_ResetHints(void) +{ + SDL_EnumerateProperties(GetHintProperties(SDL_FALSE), ResetHintsCallback, NULL); +} + +int SDL_SetHint(const char *name, const char *value) { return SDL_SetHintWithPriority(name, value, SDL_HINT_NORMAL); } const char *SDL_GetHint(const char *name) { - const char *env; - SDL_Hint *hint; - if (!name) { return NULL; } - env = SDL_getenv(name); - for (hint = SDL_hints; hint; hint = hint->next) { - if (SDL_strcmp(name, hint->name) == 0) { - if (!env || hint->priority == SDL_HINT_OVERRIDE) { - return SDL_GetPersistentString(hint->value); - } - break; + const SDL_PropertiesID hints = GetHintProperties(SDL_FALSE); + if (!hints) { + return NULL; + } + + const char *retval = SDL_getenv(name); + + SDL_LockProperties(hints); + + SDL_Hint *hint = SDL_GetPointerProperty(hints, name, NULL); + if (hint) { + if (!retval || hint->priority == SDL_HINT_OVERRIDE) { + retval = SDL_GetPersistentString(hint->value); } } - return env; + + SDL_UnlockProperties(hints); + + return retval; } int SDL_GetStringInteger(const char *value, int default_value) @@ -213,102 +253,92 @@ SDL_bool SDL_GetHintBoolean(const char *name, SDL_bool default_value) int SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata) { - SDL_Hint *hint; - SDL_HintWatch *entry; - const char *value; - if (!name || !*name) { return SDL_InvalidParamError("name"); - } - if (!callback) { + } else if (!callback) { return SDL_InvalidParamError("callback"); } - SDL_DelHintCallback(name, callback, userdata); + const SDL_PropertiesID hints = GetHintProperties(SDL_TRUE); + if (!hints) { + return -1; + } - entry = (SDL_HintWatch *)SDL_malloc(sizeof(*entry)); + SDL_HintWatch *entry = (SDL_HintWatch *)SDL_malloc(sizeof(*entry)); if (!entry) { return -1; } entry->callback = callback; entry->userdata = userdata; - for (hint = SDL_hints; hint; hint = hint->next) { - if (SDL_strcmp(name, hint->name) == 0) { - break; - } - } - if (!hint) { - /* Need to add a hint entry for this watcher */ + int retval = -1; + + SDL_LockProperties(hints); + + SDL_DelHintCallback(name, callback, userdata); + + SDL_Hint *hint = SDL_GetPointerProperty(hints, name, NULL); + if (hint) { + retval = 0; + } else { // Need to add a hint entry for this watcher hint = (SDL_Hint *)SDL_malloc(sizeof(*hint)); if (!hint) { SDL_free(entry); - return -1; - } - hint->name = SDL_strdup(name); - if (!hint->name) { - SDL_free(entry); - SDL_free(hint); - return -1; + } else { + hint->value = NULL; + hint->priority = SDL_HINT_DEFAULT; + hint->callbacks = NULL; + retval = SDL_SetPointerPropertyWithCleanup(hints, name, hint, CleanupHintProperty, NULL); } - hint->value = NULL; - hint->priority = SDL_HINT_DEFAULT; - hint->callbacks = NULL; - hint->next = SDL_hints; - SDL_hints = hint; } - /* Add it to the callbacks for this hint */ + // Add it to the callbacks for this hint entry->next = hint->callbacks; hint->callbacks = entry; - /* Now call it with the current value */ - value = SDL_GetHint(name); + // Now call it with the current value + const char *value = SDL_GetHint(name); callback(userdata, name, value, value); - return 0; + + SDL_UnlockProperties(hints); + + return retval; } void SDL_DelHintCallback(const char *name, SDL_HintCallback callback, void *userdata) { - SDL_Hint *hint; - SDL_HintWatch *entry, *prev; - - for (hint = SDL_hints; hint; hint = hint->next) { - if (SDL_strcmp(name, hint->name) == 0) { - prev = NULL; - for (entry = hint->callbacks; entry; entry = entry->next) { - if (callback == entry->callback && userdata == entry->userdata) { - if (prev) { - prev->next = entry->next; - } else { - hint->callbacks = entry->next; - } - SDL_free(entry); - break; + if (!name || !*name) { + return; + } + + const SDL_PropertiesID hints = GetHintProperties(SDL_FALSE); + if (!hints) { + return; + } + + SDL_LockProperties(hints); + SDL_Hint *hint = SDL_GetPointerProperty(hints, name, NULL); + if (hint) { + SDL_HintWatch *prev = NULL; + for (SDL_HintWatch *entry = hint->callbacks; entry; entry = entry->next) { + if ((callback == entry->callback) && (userdata == entry->userdata)) { + if (prev) { + prev->next = entry->next; + } else { + hint->callbacks = entry->next; } - prev = entry; + SDL_free(entry); + break; } - return; + prev = entry; } } + SDL_UnlockProperties(hints); } -void SDL_ClearHints(void) +void SDL_QuitHints(void) { - SDL_Hint *hint; - SDL_HintWatch *entry; - - while (SDL_hints) { - hint = SDL_hints; - SDL_hints = hint->next; - - SDL_free(hint->name); - SDL_free(hint->value); - for (entry = hint->callbacks; entry;) { - SDL_HintWatch *freeable = entry; - entry = entry->next; - SDL_free(freeable); - } - SDL_free(hint); - } + SDL_DestroyProperties(SDL_hint_props); + SDL_hint_props = 0; } + diff --git a/src/SDL_hints_c.h b/src/SDL_hints_c.h index 486280ec6b2d8..bd33ad8ac8b90 100644 --- a/src/SDL_hints_c.h +++ b/src/SDL_hints_c.h @@ -25,8 +25,9 @@ #ifndef SDL_hints_c_h_ #define SDL_hints_c_h_ +extern void SDL_InitHints(void); extern SDL_bool SDL_GetStringBoolean(const char *value, SDL_bool default_value); extern int SDL_GetStringInteger(const char *value, int default_value); -extern void SDL_ClearHints(void); +extern void SDL_QuitHints(void); #endif /* SDL_hints_c_h_ */ diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 7c232e31707cd..faf99fa0f58e1 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -711,7 +711,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_RenderViewportSet,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(SDL_AssertState,SDL_ReportAssertion,(SDL_AssertData *a, const char *b, const char *c, int d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_RequestAndroidPermission,(const char *a, SDL_RequestAndroidPermissionCallback b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_ResetAssertionReport,(void),(),) -SDL_DYNAPI_PROC(SDL_bool,SDL_ResetHint,(const char *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_ResetHint,(const char *a),(a),return) SDL_DYNAPI_PROC(void,SDL_ResetHints,(void),(),) SDL_DYNAPI_PROC(void,SDL_ResetKeyboard,(void),(),) SDL_DYNAPI_PROC(void,SDL_ResetLogPriorities,(void),(),) @@ -762,8 +762,8 @@ SDL_DYNAPI_PROC(int,SDL_SetGamepadPlayerIndex,(SDL_Gamepad *a, int b),(a,b),retu SDL_DYNAPI_PROC(int,SDL_SetGamepadSensorEnabled,(SDL_Gamepad *a, SDL_SensorType b, SDL_bool c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_SetHapticAutocenter,(SDL_Haptic *a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetHapticGain,(SDL_Haptic *a, int b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetHint,(const char *a, const char *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetHintWithPriority,(const char *a, const char *b, SDL_HintPriority c),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_SetHint,(const char *a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(int,SDL_SetHintWithPriority,(const char *a, const char *b, SDL_HintPriority c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_SetJoystickEventsEnabled,(SDL_bool a),(a),) SDL_DYNAPI_PROC(int,SDL_SetJoystickLED,(SDL_Joystick *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_SetJoystickPlayerIndex,(SDL_Joystick *a, int b),(a,b),return) diff --git a/src/thread/windows/SDL_sysmutex.c b/src/thread/windows/SDL_sysmutex.c index 6ad755d7fa2de..115d38f45c0de 100644 --- a/src/thread/windows/SDL_sysmutex.c +++ b/src/thread/windows/SDL_sysmutex.c @@ -194,29 +194,25 @@ static const SDL_mutex_impl_t SDL_mutex_impl_cs = { SDL_Mutex *SDL_CreateMutex(void) { if (!SDL_mutex_impl_active.Create) { - // Default to fallback implementation - const SDL_mutex_impl_t *impl = &SDL_mutex_impl_cs; - - if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS, SDL_FALSE)) { #ifdef SDL_PLATFORM_WINRT - // Link statically on this platform - impl = &SDL_mutex_impl_srw; + const SDL_mutex_impl_t *impl = &SDL_mutex_impl_srw; #else - // Try faster implementation for Windows 7 and newer - HMODULE kernel32 = GetModuleHandle(TEXT("kernel32.dll")); - if (kernel32) { - // Requires Vista: - pInitializeSRWLock = (pfnInitializeSRWLock)GetProcAddress(kernel32, "InitializeSRWLock"); - pReleaseSRWLockExclusive = (pfnReleaseSRWLockExclusive)GetProcAddress(kernel32, "ReleaseSRWLockExclusive"); - pAcquireSRWLockExclusive = (pfnAcquireSRWLockExclusive)GetProcAddress(kernel32, "AcquireSRWLockExclusive"); - // Requires 7: - pTryAcquireSRWLockExclusive = (pfnTryAcquireSRWLockExclusive)GetProcAddress(kernel32, "TryAcquireSRWLockExclusive"); - if (pInitializeSRWLock && pReleaseSRWLockExclusive && pAcquireSRWLockExclusive && pTryAcquireSRWLockExclusive) { - impl = &SDL_mutex_impl_srw; - } + const SDL_mutex_impl_t *impl = &SDL_mutex_impl_cs; + + // Try faster implementation for Windows 7 and newer + HMODULE kernel32 = GetModuleHandle(TEXT("kernel32.dll")); + if (kernel32) { + // Requires Vista: + pInitializeSRWLock = (pfnInitializeSRWLock)GetProcAddress(kernel32, "InitializeSRWLock"); + pReleaseSRWLockExclusive = (pfnReleaseSRWLockExclusive)GetProcAddress(kernel32, "ReleaseSRWLockExclusive"); + pAcquireSRWLockExclusive = (pfnAcquireSRWLockExclusive)GetProcAddress(kernel32, "AcquireSRWLockExclusive"); + // Requires 7: + pTryAcquireSRWLockExclusive = (pfnTryAcquireSRWLockExclusive)GetProcAddress(kernel32, "TryAcquireSRWLockExclusive"); + if (pInitializeSRWLock && pReleaseSRWLockExclusive && pAcquireSRWLockExclusive && pTryAcquireSRWLockExclusive) { + impl = &SDL_mutex_impl_srw; } -#endif } +#endif // SDL_PLATFORM_WINRT // Copy instead of using pointer to save one level of indirection SDL_copyp(&SDL_mutex_impl_active, impl); From 6161c437c776b77d81c90a29d0106070db83cd5b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 1 Apr 2024 20:07:51 -0700 Subject: [PATCH 180/253] Added SDL_SetLogPriorityPrefix() SDL_Log() no longer prints a log prefix by default for SDL_LOG_PRIORITY_INFO and below. The log prefixes can be customized with SDL_SetLogPriorityPrefix(). --- docs/README-migration.md | 2 ++ include/SDL3/SDL_log.h | 17 ++++++++++ src/SDL_log.c | 56 ++++++++++++++++++++++++------- src/dynapi/SDL_dynapi.sym | 1 + src/dynapi/SDL_dynapi_overrides.h | 1 + src/dynapi/SDL_dynapi_procs.h | 1 + src/video/cocoa/SDL_cocoavideo.m | 4 +-- src/video/uikit/SDL_uikitvideo.m | 4 +-- 8 files changed, 69 insertions(+), 17 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 916f61f0a0c7e..529dae78a1c25 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -1058,6 +1058,8 @@ SDL_LoadFunction() now returns `SDL_FunctionPointer` instead of `void *`, and sh ## SDL_log.h +SDL_Log() no longer prints a log prefix by default for SDL_LOG_PRIORITY_INFO and below. The log prefixes can be customized with SDL_SetLogPriorityPrefix(). + The following macros have been removed: * SDL_MAX_LOG_MESSAGE - there's no message length limit anymore. If you need an artificial limit, this used to be 4096 in SDL versions before 2.0.24. diff --git a/include/SDL3/SDL_log.h b/include/SDL3/SDL_log.h index eba3fac8d3166..2723b18f25b70 100644 --- a/include/SDL3/SDL_log.h +++ b/include/SDL3/SDL_log.h @@ -181,6 +181,23 @@ extern SDL_DECLSPEC SDL_LogPriority SDLCALL SDL_GetLogPriority(int category); */ extern SDL_DECLSPEC void SDLCALL SDL_ResetLogPriorities(void); +/** + * Set the text prepended to log messages of a given priority. + * + * By default SDL_LOG_PRIORITY_INFO and below have no prefix, and SDL_LOG_PRIORITY_WARN and higher have a prefix showing their priority, e.g. "WARNING: ". + * + * \param priority the SDL_LogPriority to modify. + * \param prefix the prefix to use for that log priority, or NULL to use no prefix. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_SetLogPriorities + * \sa SDL_SetLogPriority + */ +extern SDL_DECLSPEC int SDLCALL SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix); + /** * Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO. * diff --git a/src/SDL_log.c b/src/SDL_log.c index b3d6028a017e3..267ade6e6b6a6 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -66,7 +66,7 @@ static SDL_Mutex *log_function_mutex = NULL; #endif /* If this list changes, update the documentation for SDL_HINT_LOGGING */ -static const char *SDL_priority_prefixes[] = { +static const char * const SDL_priority_names[] = { NULL, "VERBOSE", "DEBUG", @@ -75,10 +75,22 @@ static const char *SDL_priority_prefixes[] = { "ERROR", "CRITICAL" }; +SDL_COMPILE_TIME_ASSERT(priority_names, SDL_arraysize(SDL_priority_names) == SDL_NUM_LOG_PRIORITIES); + +/* If this list changes, update the documentation for SDL_HINT_LOGGING */ +static const char *SDL_priority_prefixes[] = { + NULL, + "", + "", + "", + "WARNING: ", + "ERROR: ", + "CRITICAL: " +}; SDL_COMPILE_TIME_ASSERT(priority_prefixes, SDL_arraysize(SDL_priority_prefixes) == SDL_NUM_LOG_PRIORITIES); /* If this list changes, update the documentation for SDL_HINT_LOGGING */ -static const char *SDL_category_prefixes[] = { +static const char * const SDL_category_names[] = { "APP", "ERROR", "ASSERT", @@ -89,7 +101,7 @@ static const char *SDL_category_prefixes[] = { "INPUT", "TEST" }; -SDL_COMPILE_TIME_ASSERT(category_prefixes, SDL_arraysize(SDL_category_prefixes) == SDL_LOG_CATEGORY_RESERVED1); +SDL_COMPILE_TIME_ASSERT(category_names, SDL_arraysize(SDL_category_names) == SDL_LOG_CATEGORY_RESERVED1); #ifdef HAVE_GCC_DIAGNOSTIC_PRAGMA #pragma GCC diagnostic pop @@ -172,8 +184,8 @@ static SDL_bool SDL_ParseLogCategory(const char *string, size_t length, int *cat return SDL_TRUE; } - for (i = 0; i < SDL_arraysize(SDL_category_prefixes); ++i) { - if (SDL_strncasecmp(string, SDL_category_prefixes[i], length) == 0) { + for (i = 0; i < SDL_arraysize(SDL_category_names); ++i) { + if (SDL_strncasecmp(string, SDL_category_names[i], length) == 0) { *category = i; return SDL_TRUE; } @@ -205,7 +217,7 @@ static SDL_bool SDL_ParseLogPriority(const char *string, size_t length, SDL_LogP } for (i = SDL_LOG_PRIORITY_VERBOSE; i < SDL_NUM_LOG_PRIORITIES; ++i) { - if (SDL_strncasecmp(string, SDL_priority_prefixes[i], length) == 0) { + if (SDL_strncasecmp(string, SDL_priority_names[i], length) == 0) { *priority = (SDL_LogPriority)i; return SDL_TRUE; } @@ -303,6 +315,24 @@ void SDL_ResetLogPriorities(void) SDL_forced_priority = SDL_FALSE; } +int SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix) +{ + if (priority < SDL_LOG_PRIORITY_VERBOSE || priority >= SDL_NUM_LOG_PRIORITIES) { + return SDL_InvalidParamError("priority"); + } + + if (!prefix) { + prefix = ""; + } else { + prefix = SDL_GetPersistentString(prefix); + if (!prefix) { + return -1; + } + } + SDL_priority_prefixes[priority] = prefix; + return 0; +} + void SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { va_list ap; @@ -379,7 +409,7 @@ void SDL_LogMessage(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_ST static const char *GetCategoryPrefix(int category) { if (category < SDL_LOG_CATEGORY_RESERVED1) { - return SDL_category_prefixes[category]; + return SDL_category_names[category]; } if (category < SDL_LOG_CATEGORY_CUSTOM) { return "RESERVED"; @@ -518,9 +548,9 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority } #endif /* !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) */ - length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1; + length = SDL_strlen(SDL_priority_prefixes[priority]) + SDL_strlen(message) + 1 + 1 + 1; output = SDL_small_alloc(char, length, &isstack); - (void)SDL_snprintf(output, length, "%s: %s\r\n", SDL_priority_prefixes[priority], message); + (void)SDL_snprintf(output, length, "%s%s\r\n", SDL_priority_prefixes[priority], message); tstr = WIN_UTF8ToString(output); /* Output to debugger */ @@ -566,7 +596,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority FILE *pFile; pFile = fopen("SDL_Log.txt", "a"); if (pFile) { - (void)fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); + (void)fprintf(pFile, "%s%s\n", SDL_priority_prefixes[priority], message); (void)fclose(pFile); } } @@ -575,7 +605,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority FILE *pFile; pFile = fopen("ux0:/data/SDL_Log.txt", "a"); if (pFile) { - (void)fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); + (void)fprintf(pFile, "%s%s\n", SDL_priority_prefixes[priority], message); (void)fclose(pFile); } } @@ -584,14 +614,14 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority FILE *pFile; pFile = fopen("sdmc:/3ds/SDL_Log.txt", "a"); if (pFile) { - (void)fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); + (void)fprintf(pFile, "%s%s\n", SDL_priority_prefixes[priority], message); (void)fclose(pFile); } } #endif #if defined(HAVE_STDIO_H) && \ !(defined(SDL_PLATFORM_APPLE) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))) - (void)fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message); + (void)fprintf(stderr, "%s%s\n", SDL_priority_prefixes[priority], message); #endif } diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index b81e437b0a2d4..c671942e8f3f2 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -742,6 +742,7 @@ SDL3_0.0.0 { SDL_SetLogOutputFunction; SDL_SetLogPriorities; SDL_SetLogPriority; + SDL_SetLogPriorityPrefix; SDL_SetMainReady; SDL_SetMemoryFunctions; SDL_SetModState; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index e096d67202cc9..8e2a066b02df3 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -767,6 +767,7 @@ #define SDL_SetLogOutputFunction SDL_SetLogOutputFunction_REAL #define SDL_SetLogPriorities SDL_SetLogPriorities_REAL #define SDL_SetLogPriority SDL_SetLogPriority_REAL +#define SDL_SetLogPriorityPrefix SDL_SetLogPriorityPrefix_REAL #define SDL_SetMainReady SDL_SetMainReady_REAL #define SDL_SetMemoryFunctions SDL_SetMemoryFunctions_REAL #define SDL_SetModState SDL_SetModState_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index faf99fa0f58e1..cb9163bc98da8 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -777,6 +777,7 @@ SDL_DYNAPI_PROC(int,SDL_SetLinuxThreadPriorityAndPolicy,(Sint64 a, int b, int c) SDL_DYNAPI_PROC(void,SDL_SetLogOutputFunction,(SDL_LogOutputFunction a, void *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_SetLogPriorities,(SDL_LogPriority a),(a),) SDL_DYNAPI_PROC(void,SDL_SetLogPriority,(int a, SDL_LogPriority b),(a,b),) +SDL_DYNAPI_PROC(int,SDL_SetLogPriorityPrefix,(SDL_LogPriority a, const char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_SetMainReady,(void),(),) SDL_DYNAPI_PROC(int,SDL_SetMemoryFunctions,(SDL_malloc_func a, SDL_calloc_func b, SDL_realloc_func c, SDL_free_func d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_SetModState,(SDL_Keymod a),(a),) diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index 7b1aecc2f413d..7bc315805a83c 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/src/video/cocoa/SDL_cocoavideo.m @@ -315,9 +315,9 @@ void SDL_NSLog(const char *prefix, const char *text) { @autoreleasepool { NSString *nsText = [NSString stringWithUTF8String:text]; - if (prefix) { + if (prefix && *prefix) { NSString *nsPrefix = [NSString stringWithUTF8String:prefix]; - NSLog(@"%@: %@", nsPrefix, nsText); + NSLog(@"%@%@", nsPrefix, nsText); } else { NSLog(@"%@", nsText); } diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m index 90866df1192f0..827a7f2163fee 100644 --- a/src/video/uikit/SDL_uikitvideo.m +++ b/src/video/uikit/SDL_uikitvideo.m @@ -286,9 +286,9 @@ void SDL_NSLog(const char *prefix, const char *text) { @autoreleasepool { NSString *nsText = [NSString stringWithUTF8String:text]; - if (prefix) { + if (prefix && *prefix) { NSString *nsPrefix = [NSString stringWithUTF8String:prefix]; - NSLog(@"%@: %@", nsPrefix, nsText); + NSLog(@"%@%@", nsPrefix, nsText); } else { NSLog(@"%@", nsText); } From ad27d73a19d9d0fd43c9841b66878d8661af58b7 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Mon, 5 Aug 2024 16:03:59 +0000 Subject: [PATCH 181/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_hints.h | 16 ++++++++-------- include/SDL3/SDL_log.h | 7 +++++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 3e9de6051973d..b7716da6be1a3 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -4190,12 +4190,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_ResetHints(void); * \param name the hint to query. * \returns the string value of a hint or NULL if the hint isn't set. * - * \threadsafety It is safe to call this function from any thread, however - * the return value only remains valid until the hint is - * changed; if another thread might do so, the app should - * supply locks and/or make a copy of the string. Note that - * using a hint callback instead is always thread-safe, as SDL - * holds a lock on the thread subsystem during the callback. + * \threadsafety It is safe to call this function from any thread, however the + * return value only remains valid until the hint is changed; if + * another thread might do so, the app should supply locks + * and/or make a copy of the string. Note that using a hint + * callback instead is always thread-safe, as SDL holds a lock + * on the thread subsystem during the callback. * * \since This function is available since SDL 3.0.0. * @@ -4232,8 +4232,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bo * \param oldValue the previous hint value. * \param newValue the new value hint is to be set to. * - * \threadsafety This callback is fired from whatever thread is setting a - * new hint value. SDL holds a lock on the hint subsystem when + * \threadsafety This callback is fired from whatever thread is setting a new + * hint value. SDL holds a lock on the hint subsystem when * calling this callback. * * \since This datatype is available since SDL 3.0.0. diff --git a/include/SDL3/SDL_log.h b/include/SDL3/SDL_log.h index 2723b18f25b70..078ab9dbeab1b 100644 --- a/include/SDL3/SDL_log.h +++ b/include/SDL3/SDL_log.h @@ -184,10 +184,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_ResetLogPriorities(void); /** * Set the text prepended to log messages of a given priority. * - * By default SDL_LOG_PRIORITY_INFO and below have no prefix, and SDL_LOG_PRIORITY_WARN and higher have a prefix showing their priority, e.g. "WARNING: ". + * By default SDL_LOG_PRIORITY_INFO and below have no prefix, and + * SDL_LOG_PRIORITY_WARN and higher have a prefix showing their priority, e.g. + * "WARNING: ". * * \param priority the SDL_LogPriority to modify. - * \param prefix the prefix to use for that log priority, or NULL to use no prefix. + * \param prefix the prefix to use for that log priority, or NULL to use no + * prefix. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * From a82f19f6904ab036620a524ea93f3eba90003bf0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Aug 2024 22:40:37 -0700 Subject: [PATCH 182/253] Use the shifted version of the letter as the key name SDL_Keycode is defined as the unshifted key on the keyboard, but the key name is defined as the letter printed on that key, which is usually the shifted capital letter. Fixes https://github.com/libsdl-org/SDL/issues/5836 --- src/events/SDL_keymap.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/events/SDL_keymap.c b/src/events/SDL_keymap.c index 18300d9d60200..53bd6edd5b0e5 100644 --- a/src/events/SDL_keymap.c +++ b/src/events/SDL_keymap.c @@ -21,6 +21,7 @@ #include "SDL_internal.h" #include "SDL_keymap_c.h" +#include "SDL_keyboard_c.h" #include "../SDL_hashtable.h" struct SDL_Keymap @@ -1006,12 +1007,22 @@ const char *SDL_GetKeyName(SDL_Keycode key) case SDLK_DELETE: return SDL_GetScancodeName(SDL_SCANCODE_DELETE); default: - /* Unaccented letter keys on latin keyboards are normally - labeled in upper case (and probably on others like Greek or - Cyrillic too, so if you happen to know for sure, please - adapt this). */ - if (key >= 'a' && key <= 'z') { - key -= 32; + // SDL_Keycode is defined as the unshifted key on the keyboard, + // but the key name is defined as the letter printed on that key, + // which is usually the shifted capital letter. + if (key > 0x7F || (key >= 'a' && key <= 'z')) { + SDL_bool translated = SDL_FALSE; + SDL_Scancode scancode = SDL_GetScancodeFromKey(key, SDL_KMOD_NONE); + if (scancode != SDL_SCANCODE_UNKNOWN) { + SDL_Keycode capital = SDL_GetKeyFromScancode(scancode, SDL_KMOD_SHIFT); + if (capital > 0x7F || (capital >= 'A' && capital <= 'Z')) { + key = capital; + translated = SDL_TRUE; + } + } + if (!translated && key >= 'a' && key <= 'z') { + key = 'A' + (key - 'a'); + } } end = SDL_UCS4ToUTF8(key, name); From b7aca89466d02ec2da1efc1ba4739cfbe5d6900a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 09:16:43 -0700 Subject: [PATCH 183/253] Fixed key names when KEYCODE_OPTION_LATIN_LETTERS is enabled --- src/events/SDL_keymap.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/events/SDL_keymap.c b/src/events/SDL_keymap.c index 53bd6edd5b0e5..6f9a532d8e5ac 100644 --- a/src/events/SDL_keymap.c +++ b/src/events/SDL_keymap.c @@ -1010,19 +1010,16 @@ const char *SDL_GetKeyName(SDL_Keycode key) // SDL_Keycode is defined as the unshifted key on the keyboard, // but the key name is defined as the letter printed on that key, // which is usually the shifted capital letter. - if (key > 0x7F || (key >= 'a' && key <= 'z')) { - SDL_bool translated = SDL_FALSE; + if (key >= 'a' && key <= 'z') { + key = 'A' + (key - 'a'); + } else if (key > 0x7F) { SDL_Scancode scancode = SDL_GetScancodeFromKey(key, SDL_KMOD_NONE); if (scancode != SDL_SCANCODE_UNKNOWN) { SDL_Keycode capital = SDL_GetKeyFromScancode(scancode, SDL_KMOD_SHIFT); if (capital > 0x7F || (capital >= 'A' && capital <= 'Z')) { key = capital; - translated = SDL_TRUE; } } - if (!translated && key >= 'a' && key <= 'z') { - key = 'A' + (key - 'a'); - } } end = SDL_UCS4ToUTF8(key, name); From eac8e858d5137569ad6add0a4614873743f52037 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 09:28:06 -0700 Subject: [PATCH 184/253] Fixed key names for Thai keyboards Using the shifted versions of keys for the key names doesn't make any sense on the Thai keyboard. Thai keyboards are QWERTY plus Thai characters, so let's use the ASCII key names. --- src/events/SDL_keymap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/events/SDL_keymap.c b/src/events/SDL_keymap.c index 6f9a532d8e5ac..d777561e8c328 100644 --- a/src/events/SDL_keymap.c +++ b/src/events/SDL_keymap.c @@ -1015,6 +1015,11 @@ const char *SDL_GetKeyName(SDL_Keycode key) } else if (key > 0x7F) { SDL_Scancode scancode = SDL_GetScancodeFromKey(key, SDL_KMOD_NONE); if (scancode != SDL_SCANCODE_UNKNOWN) { + if (key >= 0x0E00 && key <= 0x0E7F) { + // Thai keyboards are QWERTY plus Thai characters, so let's use the ASCII key names + return SDL_GetScancodeName(scancode); + } + SDL_Keycode capital = SDL_GetKeyFromScancode(scancode, SDL_KMOD_SHIFT); if (capital > 0x7F || (capital >= 'A' && capital <= 'Z')) { key = capital; From d7256a77dbbc767f0f9d7e913beded3dbd03104e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 09:40:50 -0700 Subject: [PATCH 185/253] The KEYCODE_OPTION_LATIN_LETTERS uses the full QWERTY layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes sure we use ']' instead of 'ÑŠ' for the ']' key on the Russian keyboard layout, for example. --- src/events/SDL_keyboard.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 78abd861394b9..cad129f4d86fb 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -433,8 +433,7 @@ static SDL_Keycode SDL_GetEventKeycode(SDL_Keyboard *keyboard, SDL_Scancode scan modstate = SDL_KMOD_NONE; if ((keyboard->keycode_options & KEYCODE_OPTION_LATIN_LETTERS) && - keyboard->non_latin_letters && - scancode >= SDL_SCANCODE_A && scancode <= SDL_SCANCODE_Z) { + keyboard->non_latin_letters) { keycode = SDL_GetDefaultKeyFromScancode(scancode, modstate); } else { if ((keyboard->keycode_options & KEYCODE_OPTION_FRENCH_NUMBERS) && From 4073c4910e2445f16318b10bb62855f461759aea Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 09:30:02 -0700 Subject: [PATCH 186/253] Enable KEYCODE_OPTION_LATIN_LETTERS by default It turns out that the non-Latin keyboards (Russian, Thai, Greek, etc.) are almost all QWERTY layout plus native language labels. Feedback from users is that they expect to see the ASCII keycodes and key names when using those keyboards, so we'll enable this option by default. --- src/events/SDL_keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index cad129f4d86fb..f4b48ae6d3cab 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -40,7 +40,7 @@ #define KEYCODE_OPTION_HIDE_NUMPAD 0x01 #define KEYCODE_OPTION_FRENCH_NUMBERS 0x02 #define KEYCODE_OPTION_LATIN_LETTERS 0x04 -#define DEFAULT_KEYCODE_OPTIONS (KEYCODE_OPTION_FRENCH_NUMBERS) +#define DEFAULT_KEYCODE_OPTIONS (KEYCODE_OPTION_FRENCH_NUMBERS | KEYCODE_OPTION_LATIN_LETTERS) typedef struct SDL_KeyboardInstance { From d223264f170c80fee2d884c3626dfdfcb80abd7a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 10:17:48 -0700 Subject: [PATCH 187/253] Updated the documentation for SDL_HINT_KEYCODE_OPTIONS --- include/SDL3/SDL_hints.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index b7716da6be1a3..7f4391c4ccc9f 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2112,7 +2112,7 @@ extern "C" { * layout. e.g. pressing the key associated with SDL_SCANCODE_A on a Russian * keyboard would yield 'a' instead of 'Ñ„'. * - * The default value for this hint is "french_numbers" + * The default value for this hint is "french_numbers,latin_letters" * * Some platforms like Emscripten only provide modified keycodes and the * options are not used. From d68d32e12c92df441429bfb576bf0492032c16d3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 10:35:28 -0700 Subject: [PATCH 188/253] Revert "Removing a timer that isn't running is a success." This reverts commit 795499a529f27469e9c97de596a1606dfc900eec. This breaks compatibility with SDL2 and there isn't a compelling reason to make this change. --- src/timer/SDL_timer.c | 8 +++++++- test/testautomation_timer.c | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/timer/SDL_timer.c b/src/timer/SDL_timer.c index a936367f9b40a..20050952b949d 100644 --- a/src/timer/SDL_timer.c +++ b/src/timer/SDL_timer.c @@ -353,6 +353,7 @@ int SDL_RemoveTimer(SDL_TimerID id) { SDL_TimerData *data = &SDL_timer_data; SDL_TimerMap *prev, *entry; + SDL_bool canceled = SDL_FALSE; if (!id) { return SDL_InvalidParamError("id"); @@ -376,10 +377,15 @@ int SDL_RemoveTimer(SDL_TimerID id) if (entry) { if (!SDL_AtomicGet(&entry->timer->canceled)) { SDL_AtomicSet(&entry->timer->canceled, 1); + canceled = SDL_TRUE; } SDL_free(entry); } - return 0; + if (canceled) { + return 0; + } else { + return SDL_SetError("Timer not found"); + } } #else diff --git a/test/testautomation_timer.c b/test/testautomation_timer.c index 98dce1e6797e3..23d971218e374 100644 --- a/test/testautomation_timer.c +++ b/test/testautomation_timer.c @@ -142,7 +142,7 @@ static int timer_addRemoveTimer(void *arg) /* Try to remove timer again (should be a NOOP) */ result = SDL_RemoveTimer(id); SDLTest_AssertPass("Call to SDL_RemoveTimer()"); - SDLTest_AssertCheck(result == 0, "Check result value, expected: 0, got: %i", result); + SDLTest_AssertCheck(result < 0, "Check result value, expected: <0, got: %i", result); /* Reset state */ param = SDLTest_RandomIntegerInRange(-1024, 1024); @@ -162,7 +162,7 @@ static int timer_addRemoveTimer(void *arg) /* Remove timer again and check that callback was called */ result = SDL_RemoveTimer(id); SDLTest_AssertPass("Call to SDL_RemoveTimer()"); - SDLTest_AssertCheck(result == 0, "Check result value, expected: 0, got: %i", result); + SDLTest_AssertCheck(result < 0, "Check result value, expected: <0, got: %i", result); SDLTest_AssertCheck(g_timerCallbackCalled == 1, "Check callback WAS called, expected: 1, got: %i", g_timerCallbackCalled); return TEST_COMPLETED; From c298a3749b68122d985fe504127a9bcb72b40111 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 16:37:24 -0700 Subject: [PATCH 189/253] Expose the keymap separately from the event keycode This adds functions to query the keymap: * SDL_GetCurrentKeymap() * SDL_GetKeymapKeycode() * SDL_GetKeymapScancode() * SDL_ReleaseKeymap() and these are distinct from the function to query the event keycode associated with a scancode, which might be affected by SDL_HINT_KEYCODE_OPTIONS. Also added an SDL_bool parameter to SDL_GetKeyName() and SDL_GetKeyFromName() to enable upper case handling of the name. --- include/SDL3/SDL_keyboard.h | 94 ++++++++++--------- src/dynapi/SDL_dynapi.sym | 7 +- src/dynapi/SDL_dynapi_overrides.h | 7 +- src/dynapi/SDL_dynapi_procs.h | 11 ++- src/events/SDL_keyboard.c | 33 ++++--- src/events/SDL_keymap.c | 118 +++++++++++++++--------- src/events/SDL_keymap_c.h | 6 +- src/test/SDL_test_common.c | 2 +- src/video/cocoa/SDL_cocoakeyboard.m | 2 +- src/video/wayland/SDL_waylandevents.c | 4 +- src/video/windows/SDL_windowskeyboard.c | 2 +- src/video/x11/SDL_x11keyboard.c | 4 +- test/checkkeys.c | 12 ++- test/testautomation_keyboard.c | 78 ++++++++-------- test/testime.c | 2 +- 15 files changed, 216 insertions(+), 166 deletions(-) diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index 07bce7545b52a..48b7f3ad80dd2 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -185,80 +185,91 @@ extern SDL_DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); extern SDL_DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); /** - * Get the key code corresponding to the given scancode according to a default - * en_US keyboard layout. + * A keymap is a mapping from scancode and modifier state to keycode. * - * See SDL_Keycode for details. + * \sa SDL_GetCurrentKeymap + * \sa SDL_GetKeymapKeycode + * \sa SDL_GetKeymapScancode + * \sa SDL_ReleaseKeymap + */ +typedef struct SDL_Keymap SDL_Keymap; + +/** + * Get a reference to the current keyboard layout. * - * \param scancode the desired SDL_Scancode to query. - * \param modstate the modifier state to use when translating the scancode to - * a keycode. - * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. + * You should release the reference to the keymap with SDL_ReleaseKeymap() when you're done with it. + * + * \returns the current keymap, or NULL if the default US-QWERTY keymap is being used. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GetKeyName - * \sa SDL_GetScancodeFromKey + * \sa SDL_GetKeymapKeycode + * \sa SDL_GetKeymapScancode + * \sa SDL_ReleaseKeymap */ -extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate); +extern SDL_DECLSPEC SDL_Keymap * SDLCALL SDL_GetCurrentKeymap(void); /** - * Get the key code corresponding to the given scancode according to the - * current keyboard layout. + * Get the key code corresponding to the given scancode and modifier state using the provided keymap. * - * See SDL_Keycode for details. + * Note that this is not the same as the input that would be generated by pressing this key. There are many factors involved, such as dead key composition, input method editors, etc. If you're looking for a way to get text input, you should handle SDL_EVENT_TEXT_INPUT. * - * \param scancode the desired SDL_Scancode to query. + * \param keymap the SDL_Keymap to query, or NULL for the default keymap. + * \param scancode the SDL_Scancode to translate. * \param modstate the modifier state to use when translating the scancode to * a keycode. * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GetDefaultKeyFromScancode - * \sa SDL_GetKeyName - * \sa SDL_GetScancodeFromKey + * \sa SDL_GetCurrentKeymap + * \sa SDL_GetKeymapScancode */ -extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate); +extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeymapKeycode(SDL_Keymap *keymap, SDL_Scancode scancode, SDL_Keymod modstate); /** - * Get the scancode corresponding to the given key code according to a default - * en_US keyboard layout. + * Get the scancode and modifier state corresponding to the given key code using the provided keymap. * * Note that there may be multiple scancode+modifier states that can generate * this keycode, this will just return the first one found. * - * \param key the desired SDL_Keycode to query. + * \param keymap the SDL_Keymap to query, or NULL for the default keymap. + * \param keycode the SDL_Keycode to translate. * \param modstate a pointer to the modifier state that would be used when the * scancode generates this key, may be NULL. * \returns the SDL_Scancode that corresponds to the given SDL_Keycode. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GetScancodeFromKey - * \sa SDL_GetScancodeName + * \sa SDL_GetCurrentKeymap + * \sa SDL_GetKeymapKeycode */ -extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetDefaultScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate); +extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetKeymapScancode(SDL_Keymap *keymap, SDL_Keycode keycode, SDL_Keymod *modstate); /** - * Get the scancode corresponding to the given key code according to the - * current keyboard layout. - * - * Note that there may be multiple scancode+modifier states that can generate - * this keycode, this will just return the first one found. + * Release a reference to the current keyboard layout. * - * \param key the desired SDL_Keycode to query. - * \param modstate a pointer to the modifier state that would be used when the - * scancode generates this key, may be NULL. - * \returns the SDL_Scancode that corresponds to the given SDL_Keycode. + * \param keymap the SDL_Keymap to release, may be NULL. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GetDefaultScancodeFromKey - * \sa SDL_GetKeyFromScancode - * \sa SDL_GetScancodeName + * \sa SDL_GetCurrentKeymap */ -extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate); +extern SDL_DECLSPEC void SDLCALL SDL_ReleaseKeymap(SDL_Keymap *keymap); + +/** + * Get the key code that would be sent with the given scancode in a key event. + * + * This uses the information from the current keymap along with the options specified in SDL_HINT_KEYCODE_OPTIONS to get the keycode that would be delivered to the application in a key event. This is typically the unmodified version of the key based on the current keyboard layout. For example, the keycode for SDL_SCANCODE_A + SDL_KMOD_SHIFT using the US QWERTY layout would be 'a'. + * + * \param scancode the SDL_Scancode to translate. + * \param modstate the modifier state to use when translating the scancode to + * a keycode. + * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. + * + * \since This function is available since SDL 3.0.0. + */ +extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate); /** * Set a human-readable name for a scancode. @@ -318,12 +329,10 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam /** * Get a human-readable name for a key. * - * Both lowercase and uppercase alphabetic keycodes have uppercase names, e.g. - * SDL_Keycode 'a' and 'A' both have the name "A". - * * If the key doesn't have a name, this function returns an empty string (""). * * \param key the desired SDL_Keycode to query. + * \param uppercase SDL_TRUE if the name should be the letter printed on the key on the keyboard, which is usually uppercase, or SDL_FALSE to return the name of the key unchanged. * \returns a UTF-8 encoded string of the key name. * * \since This function is available since SDL 3.0.0. @@ -332,12 +341,13 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam * \sa SDL_GetKeyFromScancode * \sa SDL_GetScancodeFromKey */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyName(SDL_Keycode key); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyName(SDL_Keycode key, SDL_bool uppercase); /** * Get a key code from a human-readable name. * * \param name the human-readable key name. + * \param uppercase SDL_TRUE if the name is the letter printed on the key on the keyboard, which is usually uppercase, and this function should return the unshifted version of the key, or SDL_FALSE to return the key unchanged. * \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call * SDL_GetError() for more information. * @@ -347,7 +357,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyName(SDL_Keycode key); * \sa SDL_GetKeyName * \sa SDL_GetScancodeFromName */ -extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); +extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name, SDL_bool uppercase); /** * Start accepting Unicode text input events in a window. diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index c671942e8f3f2..01ba58d990c61 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -199,6 +199,7 @@ SDL3_0.0.0 { SDL_GetCurrentCameraDriver; SDL_GetCurrentDisplayMode; SDL_GetCurrentDisplayOrientation; + SDL_GetCurrentKeymap; SDL_GetCurrentRenderOutputSize; SDL_GetCurrentThreadID; SDL_GetCurrentTime; @@ -211,8 +212,6 @@ SDL3_0.0.0 { SDL_GetDaysInMonth; SDL_GetDefaultAssertionHandler; SDL_GetDefaultCursor; - SDL_GetDefaultKeyFromScancode; - SDL_GetDefaultScancodeFromKey; SDL_GetDesktopDisplayMode; SDL_GetDirect3D9AdapterIndex; SDL_GetDisplayBounds; @@ -329,6 +328,8 @@ SDL3_0.0.0 { SDL_GetKeyboardNameForID; SDL_GetKeyboardState; SDL_GetKeyboards; + SDL_GetKeymapKeycode; + SDL_GetKeymapScancode; SDL_GetLogOutputFunction; SDL_GetLogPriority; SDL_GetMasksForPixelFormat; @@ -413,7 +414,6 @@ SDL3_0.0.0 { SDL_GetRendererProperties; SDL_GetRevision; SDL_GetSIMDAlignment; - SDL_GetScancodeFromKey; SDL_GetScancodeFromName; SDL_GetScancodeName; SDL_GetSemaphoreValue; @@ -644,6 +644,7 @@ SDL3_0.0.0 { SDL_RegisterApp; SDL_RegisterEvents; SDL_ReleaseCameraFrame; + SDL_ReleaseKeymap; SDL_ReloadGamepadMappings; SDL_RemovePath; SDL_RemoveStoragePath; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 8e2a066b02df3..dc0dfe762d94a 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -224,6 +224,7 @@ #define SDL_GetCurrentCameraDriver SDL_GetCurrentCameraDriver_REAL #define SDL_GetCurrentDisplayMode SDL_GetCurrentDisplayMode_REAL #define SDL_GetCurrentDisplayOrientation SDL_GetCurrentDisplayOrientation_REAL +#define SDL_GetCurrentKeymap SDL_GetCurrentKeymap_REAL #define SDL_GetCurrentRenderOutputSize SDL_GetCurrentRenderOutputSize_REAL #define SDL_GetCurrentThreadID SDL_GetCurrentThreadID_REAL #define SDL_GetCurrentTime SDL_GetCurrentTime_REAL @@ -236,8 +237,6 @@ #define SDL_GetDaysInMonth SDL_GetDaysInMonth_REAL #define SDL_GetDefaultAssertionHandler SDL_GetDefaultAssertionHandler_REAL #define SDL_GetDefaultCursor SDL_GetDefaultCursor_REAL -#define SDL_GetDefaultKeyFromScancode SDL_GetDefaultKeyFromScancode_REAL -#define SDL_GetDefaultScancodeFromKey SDL_GetDefaultScancodeFromKey_REAL #define SDL_GetDesktopDisplayMode SDL_GetDesktopDisplayMode_REAL #define SDL_GetDirect3D9AdapterIndex SDL_GetDirect3D9AdapterIndex_REAL #define SDL_GetDisplayBounds SDL_GetDisplayBounds_REAL @@ -354,6 +353,8 @@ #define SDL_GetKeyboardNameForID SDL_GetKeyboardNameForID_REAL #define SDL_GetKeyboardState SDL_GetKeyboardState_REAL #define SDL_GetKeyboards SDL_GetKeyboards_REAL +#define SDL_GetKeymapKeycode SDL_GetKeymapKeycode_REAL +#define SDL_GetKeymapScancode SDL_GetKeymapScancode_REAL #define SDL_GetLogOutputFunction SDL_GetLogOutputFunction_REAL #define SDL_GetLogPriority SDL_GetLogPriority_REAL #define SDL_GetMasksForPixelFormat SDL_GetMasksForPixelFormat_REAL @@ -438,7 +439,6 @@ #define SDL_GetRendererProperties SDL_GetRendererProperties_REAL #define SDL_GetRevision SDL_GetRevision_REAL #define SDL_GetSIMDAlignment SDL_GetSIMDAlignment_REAL -#define SDL_GetScancodeFromKey SDL_GetScancodeFromKey_REAL #define SDL_GetScancodeFromName SDL_GetScancodeFromName_REAL #define SDL_GetScancodeName SDL_GetScancodeName_REAL #define SDL_GetSemaphoreValue SDL_GetSemaphoreValue_REAL @@ -669,6 +669,7 @@ #define SDL_RegisterApp SDL_RegisterApp_REAL #define SDL_RegisterEvents SDL_RegisterEvents_REAL #define SDL_ReleaseCameraFrame SDL_ReleaseCameraFrame_REAL +#define SDL_ReleaseKeymap SDL_ReleaseKeymap_REAL #define SDL_ReloadGamepadMappings SDL_ReloadGamepadMappings_REAL #define SDL_RemovePath SDL_RemovePath_REAL #define SDL_RemoveStoragePath SDL_RemoveStoragePath_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index cb9163bc98da8..12c25093a89ab 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -244,6 +244,7 @@ SDL_DYNAPI_PROC(const char*,SDL_GetCurrentAudioDriver,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetCurrentCameraDriver,(void),(),return) SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetCurrentDisplayMode,(SDL_DisplayID a),(a),return) SDL_DYNAPI_PROC(SDL_DisplayOrientation,SDL_GetCurrentDisplayOrientation,(SDL_DisplayID a),(a),return) +SDL_DYNAPI_PROC(SDL_Keymap*,SDL_GetCurrentKeymap,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetCurrentRenderOutputSize,(SDL_Renderer *a, int *b, int *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_ThreadID,SDL_GetCurrentThreadID,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetCurrentTime,(SDL_Time *a),(a),return) @@ -256,8 +257,6 @@ SDL_DYNAPI_PROC(int,SDL_GetDayOfYear,(int a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetDaysInMonth,(int a, int b),(a,b),return) SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetDefaultAssertionHandler,(void),(),return) SDL_DYNAPI_PROC(SDL_Cursor*,SDL_GetDefaultCursor,(void),(),return) -SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetDefaultKeyFromScancode,(SDL_Scancode a, SDL_Keymod b),(a,b),return) -SDL_DYNAPI_PROC(SDL_Scancode,SDL_GetDefaultScancodeFromKey,(SDL_Keycode a, SDL_Keymod *b),(a,b),return) SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetDesktopDisplayMode,(SDL_DisplayID a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetDirect3D9AdapterIndex,(SDL_DisplayID a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetDisplayBounds,(SDL_DisplayID a, SDL_Rect *b),(a,b),return) @@ -367,13 +366,15 @@ SDL_DYNAPI_PROC(SDL_JoystickType,SDL_GetJoystickTypeForID,(SDL_JoystickID a),(a) SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickVendor,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickVendorForID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(SDL_JoystickID*,SDL_GetJoysticks,(int *a),(a),return) -SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromName,(const char *a),(a),return) +SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromName,(const char *a, SDL_bool b),(a, b),return) SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromScancode,(SDL_Scancode a, SDL_Keymod b),(a,b),return) -SDL_DYNAPI_PROC(const char*,SDL_GetKeyName,(SDL_Keycode a),(a),return) +SDL_DYNAPI_PROC(const char*,SDL_GetKeyName,(SDL_Keycode a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetKeyboardFocus,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetKeyboardNameForID,(SDL_KeyboardID a),(a),return) SDL_DYNAPI_PROC(const Uint8*,SDL_GetKeyboardState,(int *a),(a),return) SDL_DYNAPI_PROC(SDL_KeyboardID*,SDL_GetKeyboards,(int *a),(a),return) +SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeymapKeycode,(SDL_Keymap *a, SDL_Scancode b, SDL_Keymod c),(a,b,c),return) +SDL_DYNAPI_PROC(SDL_Scancode,SDL_GetKeymapScancode,(SDL_Keymap *a, SDL_Keycode b, SDL_Keymod *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_GetLogOutputFunction,(SDL_LogOutputFunction *a, void **b),(a,b),) SDL_DYNAPI_PROC(SDL_LogPriority,SDL_GetLogPriority,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetMasksForPixelFormat,(SDL_PixelFormat a, int *b, Uint32 *c, Uint32 *d, Uint32 *e, Uint32 *f),(a,b,c,d,e,f),return) @@ -458,7 +459,6 @@ SDL_DYNAPI_PROC(const char *,SDL_GetRendererName,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetRendererProperties,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetRevision,(void),(),return) SDL_DYNAPI_PROC(size_t,SDL_GetSIMDAlignment,(void),(),return) -SDL_DYNAPI_PROC(SDL_Scancode,SDL_GetScancodeFromKey,(SDL_Keycode a, SDL_Keymod *b),(a,b),return) SDL_DYNAPI_PROC(SDL_Scancode,SDL_GetScancodeFromName,(const char *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetScancodeName,(SDL_Scancode a),(a),return) SDL_DYNAPI_PROC(Uint32,SDL_GetSemaphoreValue,(SDL_Semaphore *a),(a),return) @@ -680,6 +680,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU8,(SDL_IOStream *a, Uint8 *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_RegisterApp,(const char *a, Uint32 b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(Uint32,SDL_RegisterEvents,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_ReleaseCameraFrame,(SDL_Camera *a, SDL_Surface *b),(a,b),return) +SDL_DYNAPI_PROC(void,SDL_ReleaseKeymap,(SDL_Keymap *a),(a),) SDL_DYNAPI_PROC(int,SDL_ReloadGamepadMappings,(void),(),return) SDL_DYNAPI_PROC(int,SDL_RemovePath,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_RemoveStoragePath,(SDL_Storage *a, const char *b),(a,b),return) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index f4b48ae6d3cab..6aa54ba672f21 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -225,12 +225,19 @@ void SDL_ResetKeyboard(void) } } +SDL_Keymap *SDL_GetCurrentKeymap(void) +{ + SDL_Keyboard *keyboard = &SDL_keyboard; + + return keyboard->keymap; +} + void SDL_SetKeymap(SDL_Keymap *keymap, SDL_bool send_event) { SDL_Keyboard *keyboard = &SDL_keyboard; if (keyboard->keymap) { - SDL_DestroyKeymap(keyboard->keymap); + SDL_ReleaseKeymap(keyboard->keymap); } keyboard->keymap = keymap; @@ -424,8 +431,9 @@ static SDL_Keycode SDL_ConvertNumpadKeycode(SDL_Keycode keycode, SDL_bool numloc } } -static SDL_Keycode SDL_GetEventKeycode(SDL_Keyboard *keyboard, SDL_Scancode scancode, SDL_Keymod modstate) +SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate) { + SDL_Keyboard *keyboard = &SDL_keyboard; SDL_bool numlock = (modstate & SDL_KMOD_NUM) != 0; SDL_Keycode keycode; @@ -434,7 +442,7 @@ static SDL_Keycode SDL_GetEventKeycode(SDL_Keyboard *keyboard, SDL_Scancode scan if ((keyboard->keycode_options & KEYCODE_OPTION_LATIN_LETTERS) && keyboard->non_latin_letters) { - keycode = SDL_GetDefaultKeyFromScancode(scancode, modstate); + keycode = SDL_GetKeymapKeycode(NULL, scancode, modstate); } else { if ((keyboard->keycode_options & KEYCODE_OPTION_FRENCH_NUMBERS) && keyboard->french_numbers && @@ -443,7 +451,7 @@ static SDL_Keycode SDL_GetEventKeycode(SDL_Keyboard *keyboard, SDL_Scancode scan modstate |= SDL_KMOD_SHIFT; } - keycode = SDL_GetKeyFromScancode(scancode, modstate); + keycode = SDL_GetKeymapKeycode(keyboard->keymap, scancode, modstate); } if (keyboard->keycode_options & KEYCODE_OPTION_HIDE_NUMPAD) { @@ -501,7 +509,7 @@ static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_Keybo /* Update internal keyboard state */ keyboard->keystate[scancode] = state; - keycode = SDL_GetEventKeycode(keyboard, scancode, keyboard->modstate); + keycode = SDL_GetKeyFromScancode(scancode, keyboard->modstate); } else if (rawcode == 0) { /* Nothing to do! */ @@ -607,8 +615,9 @@ static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_Keybo int SDL_SendKeyboardUnicodeKey(Uint64 timestamp, Uint32 ch) { + SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Keymod modstate = SDL_KMOD_NONE; - SDL_Scancode scancode = SDL_GetScancodeFromKey(ch, &modstate); + SDL_Scancode scancode = SDL_GetKeymapScancode(keyboard->keymap, ch, &modstate); // Make sure we have this keycode in our keymap if (scancode == SDL_SCANCODE_UNKNOWN && ch < SDLK_SCANCODE_MASK) { @@ -836,7 +845,7 @@ void SDL_QuitKeyboard(void) SDL_keyboards = NULL; if (SDL_keyboard.keymap) { - SDL_DestroyKeymap(SDL_keyboard.keymap); + SDL_ReleaseKeymap(SDL_keyboard.keymap); SDL_keyboard.keymap = NULL; } @@ -879,13 +888,3 @@ void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle) } } -SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate) -{ - return SDL_GetKeymapKeycode(SDL_keyboard.keymap, scancode, modstate); -} - -SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate) -{ - return SDL_GetKeymapScancode(SDL_keyboard.keymap, key, modstate); -} - diff --git a/src/events/SDL_keymap.c b/src/events/SDL_keymap.c index d777561e8c328..ee05025113741 100644 --- a/src/events/SDL_keymap.c +++ b/src/events/SDL_keymap.c @@ -26,10 +26,14 @@ struct SDL_Keymap { + int refcount; SDL_HashTable *scancode_to_keycode; SDL_HashTable *keycode_to_scancode; }; +static SDL_Keycode SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate); +static SDL_Scancode SDL_GetDefaultScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate); + SDL_Keymap *SDL_CreateKeymap(void) { SDL_Keymap *keymap = (SDL_Keymap *)SDL_malloc(sizeof(*keymap)); @@ -37,15 +41,23 @@ SDL_Keymap *SDL_CreateKeymap(void) return NULL; } + keymap->refcount = 1; keymap->scancode_to_keycode = SDL_CreateHashTable(NULL, 64, SDL_HashID, SDL_KeyMatchID, NULL, SDL_FALSE); keymap->keycode_to_scancode = SDL_CreateHashTable(NULL, 64, SDL_HashID, SDL_KeyMatchID, NULL, SDL_FALSE); if (!keymap->scancode_to_keycode || !keymap->keycode_to_scancode) { - SDL_DestroyKeymap(keymap); + SDL_ReleaseKeymap(keymap); return NULL; } return keymap; } +void SDL_AcquireKeymap(SDL_Keymap *keymap) +{ + if (keymap) { + ++keymap->refcount; + } +} + static SDL_Keymod NormalizeModifierStateForKeymap(SDL_Keymod modstate) { // The modifiers that affect the keymap are: SHIFT, CAPS, ALT, and MODE @@ -116,21 +128,20 @@ SDL_Scancode SDL_GetKeymapScancode(SDL_Keymap *keymap, SDL_Keycode keycode, SDL_ return scancode; } -void SDL_ResetKeymap(SDL_Keymap *keymap) +void SDL_ReleaseKeymap(SDL_Keymap *keymap) { - if (keymap) { - SDL_EmptyHashTable(keymap->scancode_to_keycode); - SDL_EmptyHashTable(keymap->keycode_to_scancode); + if (!keymap) { + return; } -} -void SDL_DestroyKeymap(SDL_Keymap *keymap) -{ - if (keymap) { - SDL_DestroyHashTable(keymap->scancode_to_keycode); - SDL_DestroyHashTable(keymap->keycode_to_scancode); - SDL_free(keymap); + --keymap->refcount; + if (keymap->refcount != 0) { + return; } + + SDL_DestroyHashTable(keymap->scancode_to_keycode); + SDL_DestroyHashTable(keymap->keycode_to_scancode); + SDL_free(keymap); } static const SDL_Keycode normal_default_symbols[] = { @@ -193,7 +204,7 @@ static const SDL_Keycode shifted_default_symbols[] = { SDLK_QUESTION }; -SDL_Keycode SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate) +static SDL_Keycode SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate) { if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { SDL_InvalidParamError("scancode"); @@ -594,7 +605,7 @@ SDL_Keycode SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode, SDL_Keymod mods } } -SDL_Scancode SDL_GetDefaultScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate) +static SDL_Scancode SDL_GetDefaultScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate) { if (modstate) { *modstate = SDL_KMOD_NONE; @@ -984,7 +995,7 @@ SDL_Scancode SDL_GetScancodeFromName(const char *name) return SDL_SCANCODE_UNKNOWN; } -const char *SDL_GetKeyName(SDL_Keycode key) +const char *SDL_GetKeyName(SDL_Keycode key, SDL_bool uppercase) { char name[8]; char *end; @@ -1007,23 +1018,28 @@ const char *SDL_GetKeyName(SDL_Keycode key) case SDLK_DELETE: return SDL_GetScancodeName(SDL_SCANCODE_DELETE); default: - // SDL_Keycode is defined as the unshifted key on the keyboard, - // but the key name is defined as the letter printed on that key, - // which is usually the shifted capital letter. - if (key >= 'a' && key <= 'z') { - key = 'A' + (key - 'a'); - } else if (key > 0x7F) { - SDL_Scancode scancode = SDL_GetScancodeFromKey(key, SDL_KMOD_NONE); - if (scancode != SDL_SCANCODE_UNKNOWN) { - if (key >= 0x0E00 && key <= 0x0E7F) { - // Thai keyboards are QWERTY plus Thai characters, so let's use the ASCII key names - return SDL_GetScancodeName(scancode); - } + if (uppercase) { + // SDL_Keycode is defined as the unshifted key on the keyboard, + // but the key name is defined as the letter printed on that key, + // which is usually the shifted capital letter. + if (key >= 'a' && key <= 'z') { + key = 'A' + (key - 'a'); + } else if (key > 0x7F) { + SDL_Keymap *keymap = SDL_GetCurrentKeymap(); + SDL_Scancode scancode = SDL_GetKeymapScancode(keymap, key, NULL); + if (scancode != SDL_SCANCODE_UNKNOWN) { + if (key >= 0x0E00 && key <= 0x0E7F) { + // Thai keyboards are QWERTY plus Thai characters, so let's use the ASCII key names + SDL_ReleaseKeymap(keymap); + return SDL_GetScancodeName(scancode); + } - SDL_Keycode capital = SDL_GetKeyFromScancode(scancode, SDL_KMOD_SHIFT); - if (capital > 0x7F || (capital >= 'A' && capital <= 'Z')) { - key = capital; + SDL_Keycode capital = SDL_GetKeymapKeycode(keymap, scancode, SDL_KMOD_SHIFT); + if (capital > 0x7F || (capital >= 'A' && capital <= 'Z')) { + key = capital; + } } + SDL_ReleaseKeymap(keymap); } } @@ -1033,7 +1049,7 @@ const char *SDL_GetKeyName(SDL_Keycode key) } } -SDL_Keycode SDL_GetKeyFromName(const char *name) +SDL_Keycode SDL_GetKeyFromName(const char *name, SDL_bool uppercase) { SDL_Keycode key; @@ -1051,35 +1067,53 @@ SDL_Keycode SDL_GetKeyFromName(const char *name) key |= (Uint16)(name[++i] & 0x3F) << 12; key |= (Uint16)(name[++i] & 0x3F) << 6; key |= (Uint16)(name[++i] & 0x3F); - return key; + } else { + key = SDLK_UNKNOWN; } - return SDLK_UNKNOWN; } else if (key >= 0xE0) { if (SDL_strlen(name) == 3) { int i = 0; key = (Uint16)(name[i] & 0x0F) << 12; key |= (Uint16)(name[++i] & 0x3F) << 6; key |= (Uint16)(name[++i] & 0x3F); - return key; + } else { + key = SDLK_UNKNOWN; } - return SDLK_UNKNOWN; } else if (key >= 0xC0) { if (SDL_strlen(name) == 2) { int i = 0; key = (Uint16)(name[i] & 0x1F) << 6; key |= (Uint16)(name[++i] & 0x3F); - return key; + } else { + key = SDLK_UNKNOWN; } return SDLK_UNKNOWN; } else { - if (SDL_strlen(name) == 1) { + if (SDL_strlen(name) != 1) { + key = SDLK_UNKNOWN; + } + } + + if (key != SDLK_UNKNOWN) { + if (uppercase) { + // SDL_Keycode is defined as the unshifted key on the keyboard, + // but the key name is defined as the letter printed on that key, + // which is usually the shifted capital letter. if (key >= 'A' && key <= 'Z') { - key += 32; + key = 'a' + (key - 'A'); + } else if (key > 0x7F) { + SDL_Keymap *keymap = SDL_GetCurrentKeymap(); + SDL_Keymod modstate; + SDL_Scancode scancode = SDL_GetKeymapScancode(keymap, key, &modstate); + if (scancode != SDL_SCANCODE_UNKNOWN && (modstate & SDL_KMOD_SHIFT)) { + key = SDL_GetKeymapKeycode(keymap, scancode, SDL_KMOD_NONE); + } + SDL_ReleaseKeymap(keymap); } - return key; } - - /* Get the scancode for this name, and the associated keycode */ - return SDL_GetKeyFromScancode(SDL_GetScancodeFromName(name), SDL_KMOD_NONE); + return key; } + + /* Get the scancode for this name, and the associated keycode */ + return SDL_GetKeyFromScancode(SDL_GetScancodeFromName(name), SDL_KMOD_NONE); } diff --git a/src/events/SDL_keymap_c.h b/src/events/SDL_keymap_c.h index 93128a6300c23..6d30054909422 100644 --- a/src/events/SDL_keymap_c.h +++ b/src/events/SDL_keymap_c.h @@ -25,13 +25,11 @@ #include "../SDL_hashtable.h" -typedef struct SDL_Keymap SDL_Keymap; - SDL_Keymap *SDL_CreateKeymap(void); +void SDL_AcquireKeymap(SDL_Keymap *keymap); void SDL_SetKeymapEntry(SDL_Keymap *keymap, SDL_Scancode scancode, SDL_Keymod modstate, SDL_Keycode keycode); SDL_Keycode SDL_GetKeymapKeycode(SDL_Keymap *keymap, SDL_Scancode scancode, SDL_Keymod modstate); SDL_Scancode SDL_GetKeymapScancode(SDL_Keymap *keymap, SDL_Keycode keycode, SDL_Keymod *modstate); -void SDL_ResetKeymap(SDL_Keymap *keymap); -void SDL_DestroyKeymap(SDL_Keymap *keymap); +void SDL_ReleaseKeymap(SDL_Keymap *keymap); #endif /* SDL_keymap_c_h_ */ diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 5f84b36495854..9d8c398990304 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1717,7 +1717,7 @@ void SDLTest_PrintEvent(const SDL_Event *event) event->key.windowID, event->key.scancode, SDL_GetScancodeName(event->key.scancode), - event->key.key, SDL_GetKeyName(event->key.key), + event->key.key, SDL_GetKeyName(event->key.key, SDL_TRUE), modstr); break; } diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 977c23e93ca72..3a38fa6d5cab7 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -326,7 +326,7 @@ static void UpdateKeymap(SDL_CocoaVideoData *data, SDL_bool send_event) SDL_Scancode scancode = darwin_scancode_table[i]; if (scancode == SDL_SCANCODE_UNKNOWN || scancode == SDL_SCANCODE_DELETE || - (SDL_GetDefaultKeyFromScancode(scancode, SDL_KMOD_NONE) & SDLK_SCANCODE_MASK)) { + (SDL_GetKeymapKeycode(NULL, scancode, SDL_KMOD_NONE) & SDLK_SCANCODE_MASK)) { continue; } diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 7c77bee7e09e9..b2890f6ea450d 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -1124,7 +1124,7 @@ static void Wayland_keymap_iter(struct xkb_keymap *keymap, xkb_keycode_t key, vo /* Note: The default SDL scancode table sets this to right alt instead of AltGr/Mode, so handle it separately. */ if (syms[0] != XKB_KEY_ISO_Level3_Shift) { - keycode = SDL_GetDefaultKeyFromScancode(sc, sdlKeymap->modstate); + keycode = SDL_GetKeymapKeycode(NULL, sc, sdlKeymap->modstate); } else { keycode = SDLK_MODE; } @@ -1185,7 +1185,7 @@ static void Wayland_UpdateKeymap(struct SDL_WaylandInput *input) keymap.state = WAYLAND_xkb_state_new(input->xkb.keymap); if (!keymap.state) { SDL_SetError("failed to create XKB state"); - SDL_DestroyKeymap(keymap.keymap); + SDL_ReleaseKeymap(keymap.keymap); return; } diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index 3ff2afdb38fff..f9a40e441a082 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -107,7 +107,7 @@ void WIN_UpdateKeymap(SDL_bool send_event) scancode = windows_scancode_table[i]; if (scancode == SDL_SCANCODE_UNKNOWN || scancode == SDL_SCANCODE_DELETE || - (SDL_GetDefaultKeyFromScancode(scancode, SDL_KMOD_NONE) & SDLK_SCANCODE_MASK)) { + (SDL_GetKeymapKeycode(NULL, scancode, SDL_KMOD_NONE) & SDLK_SCANCODE_MASK)) { /* The Colemak mapping swaps Backspace and CapsLock */ if (mods[m] == SDL_KMOD_NONE && diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index dcfcdf8f1d924..c1a0566890c52 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/src/video/x11/SDL_x11keyboard.c @@ -280,7 +280,7 @@ int X11_InitKeyboard(SDL_VideoDevice *_this) if (scancode == data->key_layout[i]) { continue; } - if ((SDL_GetDefaultKeyFromScancode(scancode, SDL_KMOD_NONE) & SDLK_SCANCODE_MASK) && X11_ScancodeIsRemappable(scancode)) { + if ((SDL_GetKeymapKeycode(NULL, scancode, SDL_KMOD_NONE) & SDLK_SCANCODE_MASK) && X11_ScancodeIsRemappable(scancode)) { /* Not a character key and the scancode is safe to remap */ #ifdef DEBUG_KEYBOARD SDL_Log("Changing scancode, was %d (%s), now %d (%s)\n", data->key_layout[i], SDL_GetScancodeName(data->key_layout[i]), scancode, SDL_GetScancodeName(scancode)); @@ -382,7 +382,7 @@ void X11_UpdateKeymap(SDL_VideoDevice *_this, SDL_bool send_event) if (!keycode) { SDL_Scancode keyScancode = SDL_GetScancodeFromKeySym(keysym, (KeyCode)i); - keycode = SDL_GetDefaultKeyFromScancode(keyScancode, keymod_masks[m].sdl_mask); + keycode = SDL_GetKeymapKeycode(NULL, keyScancode, keymod_masks[m].sdl_mask); } SDL_SetKeymapEntry(keymap, scancode, keymod_masks[m].sdl_mask, keycode); } diff --git a/test/checkkeys.c b/test/checkkeys.c index 66c2e7ed604ae..9f3111fae9ab8 100644 --- a/test/checkkeys.c +++ b/test/checkkeys.c @@ -189,12 +189,13 @@ static void PrintKeymap(void) (SDL_KMOD_MODE | SDL_KMOD_SHIFT | SDL_KMOD_CAPS) }; int i, m; + SDL_Keymap *keymap = SDL_GetCurrentKeymap(); SDL_Log("Differences from the default keymap:\n"); for (m = 0; m < SDL_arraysize(mods); ++m) { for (i = 0; i < SDL_NUM_SCANCODES; ++i) { - SDL_Keycode key = SDL_GetKeyFromScancode((SDL_Scancode)i, mods[m]); - SDL_Keycode default_key = SDL_GetDefaultKeyFromScancode((SDL_Scancode)i, mods[m]); + SDL_Keycode key = SDL_GetKeymapKeycode(keymap, (SDL_Scancode)i, mods[m]); + SDL_Keycode default_key = SDL_GetKeymapKeycode(NULL, (SDL_Scancode)i, mods[m]); if (key != default_key) { char message[512]; char *spot; @@ -203,13 +204,14 @@ static void PrintKeymap(void) spot = message; left = sizeof(message); - print_string(&spot, &left, "Scancode %s", SDL_GetScancodeName((SDL_Scancode)i)); + print_string(&spot, &left, "Scancode %s (%d)", SDL_GetScancodeName((SDL_Scancode)i), i); print_modifiers(&spot, &left, mods[m]); - print_string(&spot, &left, ": %s 0x%x (default: %s 0x%x)", SDL_GetKeyName(key), key, SDL_GetKeyName(default_key), default_key); + print_string(&spot, &left, ": %s 0x%x (default: %s 0x%x)", SDL_GetKeyName(key, SDL_FALSE), key, SDL_GetKeyName(default_key, SDL_FALSE), default_key); SDL_Log("%s", message); } } } + SDL_ReleaseKeymap(keymap); } static void PrintModifierState(void) @@ -242,7 +244,7 @@ static void PrintKey(SDL_KeyboardEvent *event) event->raw, event->scancode, event->scancode == SDL_SCANCODE_UNKNOWN ? "UNKNOWN" : SDL_GetScancodeName(event->scancode), - event->key, SDL_GetKeyName(event->key)); + event->key, SDL_GetKeyName(event->key, SDL_TRUE)); } else { print_string(&spot, &left, "Unknown Key (raw 0x%.2x, scancode %d = %s) %s ", diff --git a/test/testautomation_keyboard.c b/test/testautomation_keyboard.c index 87f27817a1ad2..90d3cf6462ba7 100644 --- a/test/testautomation_keyboard.c +++ b/test/testautomation_keyboard.c @@ -59,39 +59,43 @@ static int keyboard_getKeyFromName(void *arg) SDL_Keycode result; /* Case where Key is known, 1 character input */ - result = SDL_GetKeyFromName("A"); - SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/single)"); - SDLTest_AssertCheck(result == SDLK_A, "Verify result from call, expected: %d, got: %" SDL_PRIs32, SDLK_A, result); + result = SDL_GetKeyFromName("A", SDL_TRUE); + SDLTest_AssertPass("Call to SDL_GetKeyFromName('A', SDL_TRUE)"); + SDLTest_AssertCheck(result == SDLK_A, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_A, result); + + result = SDL_GetKeyFromName("A", SDL_FALSE); + SDLTest_AssertPass("Call to SDL_GetKeyFromName('A', SDL_FALSE)"); + SDLTest_AssertCheck(result == 'A', "Verify result from call, expected: %d, got: %" SDL_PRIu32, 'A', result); /* Case where Key is known, 2 character input */ - result = SDL_GetKeyFromName("F1"); + result = SDL_GetKeyFromName("F1", SDL_TRUE); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/double)"); - SDLTest_AssertCheck(result == SDLK_F1, "Verify result from call, expected: %d, got: %" SDL_PRIs32, SDLK_F1, result); + SDLTest_AssertCheck(result == SDLK_F1, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_F1, result); /* Case where Key is known, 3 character input */ - result = SDL_GetKeyFromName("End"); + result = SDL_GetKeyFromName("End", SDL_TRUE); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/triple)"); - SDLTest_AssertCheck(result == SDLK_END, "Verify result from call, expected: %d, got: %" SDL_PRIs32, SDLK_END, result); + SDLTest_AssertCheck(result == SDLK_END, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_END, result); /* Case where Key is known, 4 character input */ - result = SDL_GetKeyFromName("Find"); + result = SDL_GetKeyFromName("Find", SDL_TRUE); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/quad)"); - SDLTest_AssertCheck(result == SDLK_FIND, "Verify result from call, expected: %d, got: %" SDL_PRIs32, SDLK_FIND, result); + SDLTest_AssertCheck(result == SDLK_FIND, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_FIND, result); /* Case where Key is known, multiple character input */ - result = SDL_GetKeyFromName("MediaStop"); + result = SDL_GetKeyFromName("MediaStop", SDL_TRUE); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/multi)"); - SDLTest_AssertCheck(result == SDLK_MEDIA_STOP, "Verify result from call, expected: %d, got: %" SDL_PRIs32, SDLK_MEDIA_STOP, result); + SDLTest_AssertCheck(result == SDLK_MEDIA_STOP, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_MEDIA_STOP, result); /* Case where Key is unknown */ - result = SDL_GetKeyFromName("NotThere"); + result = SDL_GetKeyFromName("NotThere", SDL_TRUE); SDLTest_AssertPass("Call to SDL_GetKeyFromName(unknown)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIs32, SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); /* Case where input is NULL/invalid */ - result = SDL_GetKeyFromName(NULL); + result = SDL_GetKeyFromName(NULL, SDL_TRUE); SDLTest_AssertPass("Call to SDL_GetKeyFromName(NULL)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIs32, SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); return TEST_COMPLETED; } @@ -126,12 +130,12 @@ static int keyboard_getKeyFromScancode(void *arg) /* Case where input is valid */ result = SDL_GetKeyFromScancode(SDL_SCANCODE_A, SDL_KMOD_NONE); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(valid)"); - SDLTest_AssertCheck(result == SDLK_A, "Verify result from call, expected: %d, got: %" SDL_PRIs32, SDLK_A, result); + SDLTest_AssertCheck(result == SDLK_A, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_A, result); /* Case where input is zero */ result = SDL_GetKeyFromScancode(SDL_SCANCODE_UNKNOWN, SDL_KMOD_NONE); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(0)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIs32, SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); /* Clear error message */ SDL_ClearError(); @@ -140,13 +144,13 @@ static int keyboard_getKeyFromScancode(void *arg) /* Case where input is invalid (too small) */ result = SDL_GetKeyFromScancode((SDL_Scancode)-999, SDL_KMOD_NONE); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(-999)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIs32, SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); checkInvalidScancodeError(); /* Case where input is invalid (too big) */ result = SDL_GetKeyFromScancode((SDL_Scancode)999, SDL_KMOD_NONE); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(999)"); - SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIs32, SDLK_UNKNOWN, result); + SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); checkInvalidScancodeError(); return TEST_COMPLETED; @@ -164,42 +168,42 @@ static int keyboard_getKeyName(void *arg) /* Case where key has a 1 character name */ expected = "3"; - result = SDL_GetKeyName(SDLK_3); + result = SDL_GetKeyName(SDLK_3, SDL_TRUE); SDLTest_AssertPass("Call to SDL_GetKeyName()"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: %s, got: %s", expected, result); /* Case where key has a 2 character name */ expected = "F1"; - result = SDL_GetKeyName(SDLK_F1); + result = SDL_GetKeyName(SDLK_F1, SDL_TRUE); SDLTest_AssertPass("Call to SDL_GetKeyName()"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: %s, got: %s", expected, result); /* Case where key has a 3 character name */ expected = "Cut"; - result = SDL_GetKeyName(SDLK_CUT); + result = SDL_GetKeyName(SDLK_CUT, SDL_TRUE); SDLTest_AssertPass("Call to SDL_GetKeyName()"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: %s, got: %s", expected, result); /* Case where key has a 4 character name */ expected = "Down"; - result = SDL_GetKeyName(SDLK_DOWN); + result = SDL_GetKeyName(SDLK_DOWN, SDL_TRUE); SDLTest_AssertPass("Call to SDL_GetKeyName()"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: %s, got: %s", expected, result); /* Case where key has a N character name */ expected = "MediaPlay"; - result = SDL_GetKeyName(SDLK_MEDIA_PLAY); + result = SDL_GetKeyName(SDLK_MEDIA_PLAY, SDL_TRUE); SDLTest_AssertPass("Call to SDL_GetKeyName()"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: %s, got: %s", expected, result); /* Case where key has a N character name with space */ expected = "Keypad MemStore"; - result = SDL_GetKeyName(SDLK_KP_MEMSTORE); + result = SDL_GetKeyName(SDLK_KP_MEMSTORE, SDL_TRUE); SDLTest_AssertPass("Call to SDL_GetKeyName()"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: %s, got: %s", expected, result); @@ -246,8 +250,8 @@ static int keyboard_getKeyNameNegative(void *arg) /* Unknown keycode */ keycode = SDLK_UNKNOWN; - result = SDL_GetKeyName(keycode); - SDLTest_AssertPass("Call to SDL_GetKeyName(%" SDL_PRIs32 "/unknown)", keycode); + result = SDL_GetKeyName(keycode, SDL_TRUE); + SDLTest_AssertPass("Call to SDL_GetKeyName(%" SDL_PRIu32 "/unknown)", keycode); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result); @@ -257,8 +261,8 @@ static int keyboard_getKeyNameNegative(void *arg) /* Negative keycode */ keycode = (SDL_Keycode)SDLTest_RandomIntegerInRange(-255, -1); - result = SDL_GetKeyName(keycode); - SDLTest_AssertPass("Call to SDL_GetKeyName(%" SDL_PRIs32 "/negative)", keycode); + result = SDL_GetKeyName(keycode, SDL_TRUE); + SDLTest_AssertPass("Call to SDL_GetKeyName(%" SDL_PRIu32 "/negative)", keycode); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result); checkInvalidScancodeError(); @@ -494,25 +498,25 @@ static int keyboard_setTextInputAreaNegative(void *arg) } /** - * Check call to SDL_GetScancodeFromKey + * Check call to SDL_getKeymapScancode * - * \sa SDL_GetScancodeFromKey + * \sa SDL_getKeymapScancode * \sa SDL_Keycode */ -static int keyboard_getScancodeFromKey(void *arg) +static int keyboard_getKeymapScancode(void *arg) { SDL_Scancode scancode; SDL_Keymod modstate; /* Regular key */ - scancode = SDL_GetDefaultScancodeFromKey(SDLK_4, &modstate); - SDLTest_AssertPass("Call to SDL_GetScancodeFromKey(SDLK_4)"); + scancode = SDL_GetKeymapScancode(NULL, SDLK_4, &modstate); + SDLTest_AssertPass("Call to SDL_GetKeymapScancode(SDLK_4)"); SDLTest_AssertCheck(scancode == SDL_SCANCODE_4, "Validate return value from SDL_GetDefaultScancodeFromKey, expected: %d, got: %d", SDL_SCANCODE_4, scancode); SDLTest_AssertCheck(modstate == SDL_KMOD_NONE, "Validate modstate from SDL_GetDefaultScancodeFromKey, expected: %d, got: %d", SDL_KMOD_NONE, modstate); /* Virtual key */ - scancode = SDL_GetDefaultScancodeFromKey(SDLK_PLUS, &modstate); - SDLTest_AssertPass("Call to SDL_GetScancodeFromKey(SDLK_PLUS)"); + scancode = SDL_GetKeymapScancode(NULL, SDLK_PLUS, &modstate); + SDLTest_AssertPass("Call to SDL_GetKeymapScancode(SDLK_PLUS)"); SDLTest_AssertCheck(scancode == SDL_SCANCODE_EQUALS, "Validate return value from SDL_GetDefaultScancodeFromKey, expected: %d, got: %d", SDL_SCANCODE_EQUALS, scancode); SDLTest_AssertCheck(modstate == SDL_KMOD_SHIFT, "Validate modstate from SDL_GetDefaultScancodeFromKey, expected: %d, got: %d", SDL_KMOD_SHIFT, modstate); @@ -674,7 +678,7 @@ static const SDLTest_TestCaseReference keyboardTest9 = { }; static const SDLTest_TestCaseReference keyboardTest10 = { - (SDLTest_TestCaseFp)keyboard_getScancodeFromKey, "keyboard_getScancodeFromKey", "Check call to SDL_GetScancodeFromKey", TEST_ENABLED + (SDLTest_TestCaseFp)keyboard_getKeymapScancode, "keyboard_getKeymapScancode", "Check call to SDL_getKeymapScancode", TEST_ENABLED }; static const SDLTest_TestCaseReference keyboardTest11 = { diff --git a/test/testime.c b/test/testime.c index f6cc4f0368d18..6be70a60ff63a 100644 --- a/test/testime.c +++ b/test/testime.c @@ -1209,7 +1209,7 @@ int main(int argc, char *argv[]) event.key.scancode, SDL_GetScancodeName(event.key.scancode), SDL_static_cast(Uint32, event.key.key), - SDL_GetKeyName(event.key.key)); + SDL_GetKeyName(event.key.key, SDL_TRUE)); break; } case SDL_EVENT_TEXT_INPUT: { From 1966472f7395829e36c5cdbb4daa64cb9779514a Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 6 Aug 2024 00:02:59 +0000 Subject: [PATCH 190/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_keyboard.h | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index 48b7f3ad80dd2..0ee30a66f6e49 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -197,9 +197,11 @@ typedef struct SDL_Keymap SDL_Keymap; /** * Get a reference to the current keyboard layout. * - * You should release the reference to the keymap with SDL_ReleaseKeymap() when you're done with it. + * You should release the reference to the keymap with SDL_ReleaseKeymap() + * when you're done with it. * - * \returns the current keymap, or NULL if the default US-QWERTY keymap is being used. + * \returns the current keymap, or NULL if the default US-QWERTY keymap is + * being used. * * \since This function is available since SDL 3.0.0. * @@ -210,9 +212,13 @@ typedef struct SDL_Keymap SDL_Keymap; extern SDL_DECLSPEC SDL_Keymap * SDLCALL SDL_GetCurrentKeymap(void); /** - * Get the key code corresponding to the given scancode and modifier state using the provided keymap. + * Get the key code corresponding to the given scancode and modifier state + * using the provided keymap. * - * Note that this is not the same as the input that would be generated by pressing this key. There are many factors involved, such as dead key composition, input method editors, etc. If you're looking for a way to get text input, you should handle SDL_EVENT_TEXT_INPUT. + * Note that this is not the same as the input that would be generated by + * pressing this key. There are many factors involved, such as dead key + * composition, input method editors, etc. If you're looking for a way to get + * text input, you should handle SDL_EVENT_TEXT_INPUT. * * \param keymap the SDL_Keymap to query, or NULL for the default keymap. * \param scancode the SDL_Scancode to translate. @@ -228,7 +234,8 @@ extern SDL_DECLSPEC SDL_Keymap * SDLCALL SDL_GetCurrentKeymap(void); extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeymapKeycode(SDL_Keymap *keymap, SDL_Scancode scancode, SDL_Keymod modstate); /** - * Get the scancode and modifier state corresponding to the given key code using the provided keymap. + * Get the scancode and modifier state corresponding to the given key code + * using the provided keymap. * * Note that there may be multiple scancode+modifier states that can generate * this keycode, this will just return the first one found. @@ -260,7 +267,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseKeymap(SDL_Keymap *keymap); /** * Get the key code that would be sent with the given scancode in a key event. * - * This uses the information from the current keymap along with the options specified in SDL_HINT_KEYCODE_OPTIONS to get the keycode that would be delivered to the application in a key event. This is typically the unmodified version of the key based on the current keyboard layout. For example, the keycode for SDL_SCANCODE_A + SDL_KMOD_SHIFT using the US QWERTY layout would be 'a'. + * This uses the information from the current keymap along with the options + * specified in SDL_HINT_KEYCODE_OPTIONS to get the keycode that would be + * delivered to the application in a key event. This is typically the + * unmodified version of the key based on the current keyboard layout. For + * example, the keycode for SDL_SCANCODE_A + SDL_KMOD_SHIFT using the US + * QWERTY layout would be 'a'. * * \param scancode the SDL_Scancode to translate. * \param modstate the modifier state to use when translating the scancode to @@ -332,7 +344,9 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam * If the key doesn't have a name, this function returns an empty string (""). * * \param key the desired SDL_Keycode to query. - * \param uppercase SDL_TRUE if the name should be the letter printed on the key on the keyboard, which is usually uppercase, or SDL_FALSE to return the name of the key unchanged. + * \param uppercase SDL_TRUE if the name should be the letter printed on the + * key on the keyboard, which is usually uppercase, or + * SDL_FALSE to return the name of the key unchanged. * \returns a UTF-8 encoded string of the key name. * * \since This function is available since SDL 3.0.0. @@ -347,7 +361,10 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyName(SDL_Keycode key, SDL_boo * Get a key code from a human-readable name. * * \param name the human-readable key name. - * \param uppercase SDL_TRUE if the name is the letter printed on the key on the keyboard, which is usually uppercase, and this function should return the unshifted version of the key, or SDL_FALSE to return the key unchanged. + * \param uppercase SDL_TRUE if the name is the letter printed on the key on + * the keyboard, which is usually uppercase, and this + * function should return the unshifted version of the key, + * or SDL_FALSE to return the key unchanged. * \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call * SDL_GetError() for more information. * From a13c993e402cce95d5a916571eb46555419aed53 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 18:04:17 -0700 Subject: [PATCH 191/253] Removed keymaps from the API This is unnecessary complication for applications. We can always add it again later if we find that it's really useful. --- include/SDL3/SDL_keyboard.h | 95 ++------------------------- src/dynapi/SDL_dynapi.sym | 4 -- src/dynapi/SDL_dynapi_overrides.h | 4 -- src/dynapi/SDL_dynapi_procs.h | 6 +- src/events/SDL_keyboard.c | 44 +++++++------ src/events/SDL_keymap.c | 3 +- src/events/SDL_keymap_c.h | 3 +- src/video/wayland/SDL_waylandevents.c | 4 +- src/video/x11/SDL_x11events.c | 2 +- test/checkkeys.c | 44 ------------- test/testautomation_keyboard.c | 81 +++++++++-------------- 11 files changed, 70 insertions(+), 220 deletions(-) diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index 0ee30a66f6e49..f5b474a33f1f4 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -185,103 +185,22 @@ extern SDL_DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); extern SDL_DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); /** - * A keymap is a mapping from scancode and modifier state to keycode. + * Get the key code corresponding to the given scancode according to the + * current keyboard layout. * - * \sa SDL_GetCurrentKeymap - * \sa SDL_GetKeymapKeycode - * \sa SDL_GetKeymapScancode - * \sa SDL_ReleaseKeymap - */ -typedef struct SDL_Keymap SDL_Keymap; - -/** - * Get a reference to the current keyboard layout. - * - * You should release the reference to the keymap with SDL_ReleaseKeymap() - * when you're done with it. - * - * \returns the current keymap, or NULL if the default US-QWERTY keymap is - * being used. - * - * \since This function is available since SDL 3.0.0. - * - * \sa SDL_GetKeymapKeycode - * \sa SDL_GetKeymapScancode - * \sa SDL_ReleaseKeymap - */ -extern SDL_DECLSPEC SDL_Keymap * SDLCALL SDL_GetCurrentKeymap(void); - -/** - * Get the key code corresponding to the given scancode and modifier state - * using the provided keymap. - * - * Note that this is not the same as the input that would be generated by - * pressing this key. There are many factors involved, such as dead key - * composition, input method editors, etc. If you're looking for a way to get - * text input, you should handle SDL_EVENT_TEXT_INPUT. + * If you want to get the keycode as it would be delivered in key events, including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should pass `key_event` as SDL_TRUE. Otherwise this function simply translates the scancode based on the given modifier state. * - * \param keymap the SDL_Keymap to query, or NULL for the default keymap. - * \param scancode the SDL_Scancode to translate. + * \param scancode the desired SDL_Scancode to query. * \param modstate the modifier state to use when translating the scancode to * a keycode. + * \param key_event SDL_TRUE if the keycode will be used in key events. * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GetCurrentKeymap - * \sa SDL_GetKeymapScancode - */ -extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeymapKeycode(SDL_Keymap *keymap, SDL_Scancode scancode, SDL_Keymod modstate); - -/** - * Get the scancode and modifier state corresponding to the given key code - * using the provided keymap. - * - * Note that there may be multiple scancode+modifier states that can generate - * this keycode, this will just return the first one found. - * - * \param keymap the SDL_Keymap to query, or NULL for the default keymap. - * \param keycode the SDL_Keycode to translate. - * \param modstate a pointer to the modifier state that would be used when the - * scancode generates this key, may be NULL. - * \returns the SDL_Scancode that corresponds to the given SDL_Keycode. - * - * \since This function is available since SDL 3.0.0. - * - * \sa SDL_GetCurrentKeymap - * \sa SDL_GetKeymapKeycode - */ -extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetKeymapScancode(SDL_Keymap *keymap, SDL_Keycode keycode, SDL_Keymod *modstate); - -/** - * Release a reference to the current keyboard layout. - * - * \param keymap the SDL_Keymap to release, may be NULL. - * - * \since This function is available since SDL 3.0.0. - * - * \sa SDL_GetCurrentKeymap - */ -extern SDL_DECLSPEC void SDLCALL SDL_ReleaseKeymap(SDL_Keymap *keymap); - -/** - * Get the key code that would be sent with the given scancode in a key event. - * - * This uses the information from the current keymap along with the options - * specified in SDL_HINT_KEYCODE_OPTIONS to get the keycode that would be - * delivered to the application in a key event. This is typically the - * unmodified version of the key based on the current keyboard layout. For - * example, the keycode for SDL_SCANCODE_A + SDL_KMOD_SHIFT using the US - * QWERTY layout would be 'a'. - * - * \param scancode the SDL_Scancode to translate. - * \param modstate the modifier state to use when translating the scancode to - * a keycode. - * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. - * - * \since This function is available since SDL 3.0.0. + * \sa SDL_GetKeyName */ -extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate); +extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, SDL_bool key_event); /** * Set a human-readable name for a scancode. diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 01ba58d990c61..7c4bcd6578bf1 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -199,7 +199,6 @@ SDL3_0.0.0 { SDL_GetCurrentCameraDriver; SDL_GetCurrentDisplayMode; SDL_GetCurrentDisplayOrientation; - SDL_GetCurrentKeymap; SDL_GetCurrentRenderOutputSize; SDL_GetCurrentThreadID; SDL_GetCurrentTime; @@ -328,8 +327,6 @@ SDL3_0.0.0 { SDL_GetKeyboardNameForID; SDL_GetKeyboardState; SDL_GetKeyboards; - SDL_GetKeymapKeycode; - SDL_GetKeymapScancode; SDL_GetLogOutputFunction; SDL_GetLogPriority; SDL_GetMasksForPixelFormat; @@ -644,7 +641,6 @@ SDL3_0.0.0 { SDL_RegisterApp; SDL_RegisterEvents; SDL_ReleaseCameraFrame; - SDL_ReleaseKeymap; SDL_ReloadGamepadMappings; SDL_RemovePath; SDL_RemoveStoragePath; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index dc0dfe762d94a..4832cd7c093b9 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -224,7 +224,6 @@ #define SDL_GetCurrentCameraDriver SDL_GetCurrentCameraDriver_REAL #define SDL_GetCurrentDisplayMode SDL_GetCurrentDisplayMode_REAL #define SDL_GetCurrentDisplayOrientation SDL_GetCurrentDisplayOrientation_REAL -#define SDL_GetCurrentKeymap SDL_GetCurrentKeymap_REAL #define SDL_GetCurrentRenderOutputSize SDL_GetCurrentRenderOutputSize_REAL #define SDL_GetCurrentThreadID SDL_GetCurrentThreadID_REAL #define SDL_GetCurrentTime SDL_GetCurrentTime_REAL @@ -353,8 +352,6 @@ #define SDL_GetKeyboardNameForID SDL_GetKeyboardNameForID_REAL #define SDL_GetKeyboardState SDL_GetKeyboardState_REAL #define SDL_GetKeyboards SDL_GetKeyboards_REAL -#define SDL_GetKeymapKeycode SDL_GetKeymapKeycode_REAL -#define SDL_GetKeymapScancode SDL_GetKeymapScancode_REAL #define SDL_GetLogOutputFunction SDL_GetLogOutputFunction_REAL #define SDL_GetLogPriority SDL_GetLogPriority_REAL #define SDL_GetMasksForPixelFormat SDL_GetMasksForPixelFormat_REAL @@ -669,7 +666,6 @@ #define SDL_RegisterApp SDL_RegisterApp_REAL #define SDL_RegisterEvents SDL_RegisterEvents_REAL #define SDL_ReleaseCameraFrame SDL_ReleaseCameraFrame_REAL -#define SDL_ReleaseKeymap SDL_ReleaseKeymap_REAL #define SDL_ReloadGamepadMappings SDL_ReloadGamepadMappings_REAL #define SDL_RemovePath SDL_RemovePath_REAL #define SDL_RemoveStoragePath SDL_RemoveStoragePath_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 12c25093a89ab..a9241744542cc 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -244,7 +244,6 @@ SDL_DYNAPI_PROC(const char*,SDL_GetCurrentAudioDriver,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetCurrentCameraDriver,(void),(),return) SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetCurrentDisplayMode,(SDL_DisplayID a),(a),return) SDL_DYNAPI_PROC(SDL_DisplayOrientation,SDL_GetCurrentDisplayOrientation,(SDL_DisplayID a),(a),return) -SDL_DYNAPI_PROC(SDL_Keymap*,SDL_GetCurrentKeymap,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetCurrentRenderOutputSize,(SDL_Renderer *a, int *b, int *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_ThreadID,SDL_GetCurrentThreadID,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetCurrentTime,(SDL_Time *a),(a),return) @@ -367,14 +366,12 @@ SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickVendor,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickVendorForID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(SDL_JoystickID*,SDL_GetJoysticks,(int *a),(a),return) SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromName,(const char *a, SDL_bool b),(a, b),return) -SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromScancode,(SDL_Scancode a, SDL_Keymod b),(a,b),return) +SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromScancode,(SDL_Scancode a, SDL_Keymod b, SDL_bool c),(a,b,c),return) SDL_DYNAPI_PROC(const char*,SDL_GetKeyName,(SDL_Keycode a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetKeyboardFocus,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetKeyboardNameForID,(SDL_KeyboardID a),(a),return) SDL_DYNAPI_PROC(const Uint8*,SDL_GetKeyboardState,(int *a),(a),return) SDL_DYNAPI_PROC(SDL_KeyboardID*,SDL_GetKeyboards,(int *a),(a),return) -SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeymapKeycode,(SDL_Keymap *a, SDL_Scancode b, SDL_Keymod c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_Scancode,SDL_GetKeymapScancode,(SDL_Keymap *a, SDL_Keycode b, SDL_Keymod *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_GetLogOutputFunction,(SDL_LogOutputFunction *a, void **b),(a,b),) SDL_DYNAPI_PROC(SDL_LogPriority,SDL_GetLogPriority,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetMasksForPixelFormat,(SDL_PixelFormat a, int *b, Uint32 *c, Uint32 *d, Uint32 *e, Uint32 *f),(a,b,c,d,e,f),return) @@ -680,7 +677,6 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU8,(SDL_IOStream *a, Uint8 *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_RegisterApp,(const char *a, Uint32 b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(Uint32,SDL_RegisterEvents,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_ReleaseCameraFrame,(SDL_Camera *a, SDL_Surface *b),(a,b),return) -SDL_DYNAPI_PROC(void,SDL_ReleaseKeymap,(SDL_Keymap *a),(a),) SDL_DYNAPI_PROC(int,SDL_ReloadGamepadMappings,(void),(),return) SDL_DYNAPI_PROC(int,SDL_RemovePath,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_RemoveStoragePath,(SDL_Storage *a, const char *b),(a,b),return) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 6aa54ba672f21..e4788a71d0c3b 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -229,6 +229,8 @@ SDL_Keymap *SDL_GetCurrentKeymap(void) { SDL_Keyboard *keyboard = &SDL_keyboard; + SDL_AcquireKeymap(keyboard->keymap); + return keyboard->keymap; } @@ -431,33 +433,37 @@ static SDL_Keycode SDL_ConvertNumpadKeycode(SDL_Keycode keycode, SDL_bool numloc } } -SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate) +SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, SDL_bool key_event) { SDL_Keyboard *keyboard = &SDL_keyboard; - SDL_bool numlock = (modstate & SDL_KMOD_NUM) != 0; SDL_Keycode keycode; - // We won't be applying any modifiers by default - modstate = SDL_KMOD_NONE; + if (key_event) { + SDL_bool numlock = (modstate & SDL_KMOD_NUM) != 0; - if ((keyboard->keycode_options & KEYCODE_OPTION_LATIN_LETTERS) && - keyboard->non_latin_letters) { - keycode = SDL_GetKeymapKeycode(NULL, scancode, modstate); - } else { - if ((keyboard->keycode_options & KEYCODE_OPTION_FRENCH_NUMBERS) && - keyboard->french_numbers && - (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0)) { - // Add the shift state to generate a numeric keycode - modstate |= SDL_KMOD_SHIFT; + // We won't be applying any modifiers by default + modstate = SDL_KMOD_NONE; + + if ((keyboard->keycode_options & KEYCODE_OPTION_LATIN_LETTERS) && + keyboard->non_latin_letters) { + keycode = SDL_GetKeymapKeycode(NULL, scancode, modstate); + } else { + if ((keyboard->keycode_options & KEYCODE_OPTION_FRENCH_NUMBERS) && + keyboard->french_numbers && + (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0)) { + // Add the shift state to generate a numeric keycode + modstate |= SDL_KMOD_SHIFT; + } + + keycode = SDL_GetKeymapKeycode(keyboard->keymap, scancode, modstate); } + if (keyboard->keycode_options & KEYCODE_OPTION_HIDE_NUMPAD) { + keycode = SDL_ConvertNumpadKeycode(keycode, numlock); + } + } else { keycode = SDL_GetKeymapKeycode(keyboard->keymap, scancode, modstate); } - - if (keyboard->keycode_options & KEYCODE_OPTION_HIDE_NUMPAD) { - keycode = SDL_ConvertNumpadKeycode(keycode, numlock); - } - return keycode; } @@ -509,7 +515,7 @@ static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_Keybo /* Update internal keyboard state */ keyboard->keystate[scancode] = state; - keycode = SDL_GetKeyFromScancode(scancode, keyboard->modstate); + keycode = SDL_GetKeyFromScancode(scancode, keyboard->modstate, SDL_TRUE); } else if (rawcode == 0) { /* Nothing to do! */ diff --git a/src/events/SDL_keymap.c b/src/events/SDL_keymap.c index ee05025113741..452ee24a98883 100644 --- a/src/events/SDL_keymap.c +++ b/src/events/SDL_keymap.c @@ -1114,6 +1114,5 @@ SDL_Keycode SDL_GetKeyFromName(const char *name, SDL_bool uppercase) return key; } - /* Get the scancode for this name, and the associated keycode */ - return SDL_GetKeyFromScancode(SDL_GetScancodeFromName(name), SDL_KMOD_NONE); + return SDL_GetKeyFromScancode(SDL_GetScancodeFromName(name), SDL_KMOD_NONE, SDL_FALSE); } diff --git a/src/events/SDL_keymap_c.h b/src/events/SDL_keymap_c.h index 6d30054909422..d6b4f1803b2c9 100644 --- a/src/events/SDL_keymap_c.h +++ b/src/events/SDL_keymap_c.h @@ -23,8 +23,9 @@ #ifndef SDL_keymap_c_h_ #define SDL_keymap_c_h_ -#include "../SDL_hashtable.h" +typedef struct SDL_Keymap SDL_Keymap; +SDL_Keymap *SDL_GetCurrentKeymap(void); SDL_Keymap *SDL_CreateKeymap(void); void SDL_AcquireKeymap(SDL_Keymap *keymap); void SDL_SetKeymapEntry(SDL_Keymap *keymap, SDL_Scancode scancode, SDL_Keymod modstate, SDL_Keycode keycode); diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index b2890f6ea450d..3f9aa8663dea6 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -1457,7 +1457,7 @@ static void Wayland_ReconcileModifiers(struct SDL_WaylandInput *input) static void Wayland_HandleModifierKeys(struct SDL_WaylandInput *input, SDL_Scancode scancode, SDL_bool pressed) { - const SDL_Keycode keycode = SDL_GetKeyFromScancode(scancode, SDL_KMOD_NONE); + const SDL_Keycode keycode = SDL_GetKeyFromScancode(scancode, SDL_KMOD_NONE, SDL_FALSE); SDL_Keymod mod; switch (keycode) { @@ -1536,7 +1536,7 @@ static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, wl_array_for_each (key, keys) { const SDL_Scancode scancode = Wayland_get_scancode_from_key(input, *key + 8); - const SDL_Keycode keycode = SDL_GetKeyFromScancode(scancode, SDL_KMOD_NONE); + const SDL_Keycode keycode = SDL_GetKeyFromScancode(scancode, SDL_KMOD_NONE, SDL_FALSE); switch (keycode) { case SDLK_LSHIFT: diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index cb46a4e377c6f..b5b5d60f810a0 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -313,7 +313,7 @@ void X11_ReconcileKeyboardState(SDL_VideoDevice *_this) if (x11KeyPressed && !sdlKeyPressed) { /* Only update modifier state for keys that are pressed in another application */ - switch (SDL_GetKeyFromScancode(scancode, SDL_KMOD_NONE)) { + switch (SDL_GetKeyFromScancode(scancode, SDL_KMOD_NONE, SDL_FALSE)) { case SDLK_LCTRL: case SDLK_RCTRL: case SDLK_LSHIFT: diff --git a/test/checkkeys.c b/test/checkkeys.c index 9f3111fae9ab8..b10e7aaf721b8 100644 --- a/test/checkkeys.c +++ b/test/checkkeys.c @@ -172,48 +172,6 @@ static void print_modifiers(char **text, size_t *maxlen, SDL_Keymod mod) } } -static void PrintKeymap(void) -{ - SDL_Keymod mods[] = { - SDL_KMOD_NONE, - SDL_KMOD_SHIFT, - SDL_KMOD_CAPS, - (SDL_KMOD_SHIFT | SDL_KMOD_CAPS), - SDL_KMOD_ALT, - (SDL_KMOD_ALT | SDL_KMOD_SHIFT), - (SDL_KMOD_ALT | SDL_KMOD_CAPS), - (SDL_KMOD_ALT | SDL_KMOD_SHIFT | SDL_KMOD_CAPS), - SDL_KMOD_MODE, - (SDL_KMOD_MODE | SDL_KMOD_SHIFT), - (SDL_KMOD_MODE | SDL_KMOD_CAPS), - (SDL_KMOD_MODE | SDL_KMOD_SHIFT | SDL_KMOD_CAPS) - }; - int i, m; - SDL_Keymap *keymap = SDL_GetCurrentKeymap(); - - SDL_Log("Differences from the default keymap:\n"); - for (m = 0; m < SDL_arraysize(mods); ++m) { - for (i = 0; i < SDL_NUM_SCANCODES; ++i) { - SDL_Keycode key = SDL_GetKeymapKeycode(keymap, (SDL_Scancode)i, mods[m]); - SDL_Keycode default_key = SDL_GetKeymapKeycode(NULL, (SDL_Scancode)i, mods[m]); - if (key != default_key) { - char message[512]; - char *spot; - size_t left; - - spot = message; - left = sizeof(message); - - print_string(&spot, &left, "Scancode %s (%d)", SDL_GetScancodeName((SDL_Scancode)i), i); - print_modifiers(&spot, &left, mods[m]); - print_string(&spot, &left, ": %s 0x%x (default: %s 0x%x)", SDL_GetKeyName(key, SDL_FALSE), key, SDL_GetKeyName(default_key, SDL_FALSE), default_key); - SDL_Log("%s", message); - } - } - } - SDL_ReleaseKeymap(keymap); -} - static void PrintModifierState(void) { char message[512]; @@ -434,7 +392,6 @@ static void loop(void) break; case SDL_EVENT_KEYMAP_CHANGED: SDL_Log("Keymap changed!\n"); - PrintKeymap(); break; case SDL_EVENT_QUIT: done = 1; @@ -548,7 +505,6 @@ int main(int argc, char *argv[]) /* Print initial state */ SDL_PumpEvents(); - PrintKeymap(); PrintModifierState(); /* Watch keystrokes */ diff --git a/test/testautomation_keyboard.c b/test/testautomation_keyboard.c index 90d3cf6462ba7..6a895f0b0f334 100644 --- a/test/testautomation_keyboard.c +++ b/test/testautomation_keyboard.c @@ -128,12 +128,12 @@ static int keyboard_getKeyFromScancode(void *arg) SDL_Keycode result; /* Case where input is valid */ - result = SDL_GetKeyFromScancode(SDL_SCANCODE_A, SDL_KMOD_NONE); + result = SDL_GetKeyFromScancode(SDL_SCANCODE_A, SDL_KMOD_NONE, SDL_FALSE); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(valid)"); SDLTest_AssertCheck(result == SDLK_A, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_A, result); /* Case where input is zero */ - result = SDL_GetKeyFromScancode(SDL_SCANCODE_UNKNOWN, SDL_KMOD_NONE); + result = SDL_GetKeyFromScancode(SDL_SCANCODE_UNKNOWN, SDL_KMOD_NONE, SDL_FALSE); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(0)"); SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); @@ -142,13 +142,13 @@ static int keyboard_getKeyFromScancode(void *arg) SDLTest_AssertPass("Call to SDL_ClearError()"); /* Case where input is invalid (too small) */ - result = SDL_GetKeyFromScancode((SDL_Scancode)-999, SDL_KMOD_NONE); + result = SDL_GetKeyFromScancode((SDL_Scancode)-999, SDL_KMOD_NONE, SDL_FALSE); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(-999)"); SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); checkInvalidScancodeError(); /* Case where input is invalid (too big) */ - result = SDL_GetKeyFromScancode((SDL_Scancode)999, SDL_KMOD_NONE); + result = SDL_GetKeyFromScancode((SDL_Scancode)999, SDL_KMOD_NONE, SDL_FALSE); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(999)"); SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); checkInvalidScancodeError(); @@ -497,32 +497,6 @@ static int keyboard_setTextInputAreaNegative(void *arg) return TEST_COMPLETED; } -/** - * Check call to SDL_getKeymapScancode - * - * \sa SDL_getKeymapScancode - * \sa SDL_Keycode - */ -static int keyboard_getKeymapScancode(void *arg) -{ - SDL_Scancode scancode; - SDL_Keymod modstate; - - /* Regular key */ - scancode = SDL_GetKeymapScancode(NULL, SDLK_4, &modstate); - SDLTest_AssertPass("Call to SDL_GetKeymapScancode(SDLK_4)"); - SDLTest_AssertCheck(scancode == SDL_SCANCODE_4, "Validate return value from SDL_GetDefaultScancodeFromKey, expected: %d, got: %d", SDL_SCANCODE_4, scancode); - SDLTest_AssertCheck(modstate == SDL_KMOD_NONE, "Validate modstate from SDL_GetDefaultScancodeFromKey, expected: %d, got: %d", SDL_KMOD_NONE, modstate); - - /* Virtual key */ - scancode = SDL_GetKeymapScancode(NULL, SDLK_PLUS, &modstate); - SDLTest_AssertPass("Call to SDL_GetKeymapScancode(SDLK_PLUS)"); - SDLTest_AssertCheck(scancode == SDL_SCANCODE_EQUALS, "Validate return value from SDL_GetDefaultScancodeFromKey, expected: %d, got: %d", SDL_SCANCODE_EQUALS, scancode); - SDLTest_AssertCheck(modstate == SDL_KMOD_SHIFT, "Validate modstate from SDL_GetDefaultScancodeFromKey, expected: %d, got: %d", SDL_KMOD_SHIFT, modstate); - - return TEST_COMPLETED; -} - /** * Check call to SDL_GetScancodeFromName * @@ -641,67 +615,74 @@ static int keyboard_getScancodeFromNameNegative(void *arg) /* ================= Test References ================== */ /* Keyboard test cases */ -static const SDLTest_TestCaseReference keyboardTest1 = { +static const SDLTest_TestCaseReference keyboardTestGetKeyboardState = { (SDLTest_TestCaseFp)keyboard_getKeyboardState, "keyboard_getKeyboardState", "Check call to SDL_GetKeyboardState with and without numkeys reference", TEST_ENABLED }; -static const SDLTest_TestCaseReference keyboardTest2 = { +static const SDLTest_TestCaseReference keyboardTestGetKeyboardFocus = { (SDLTest_TestCaseFp)keyboard_getKeyboardFocus, "keyboard_getKeyboardFocus", "Check call to SDL_GetKeyboardFocus", TEST_ENABLED }; -static const SDLTest_TestCaseReference keyboardTest3 = { +static const SDLTest_TestCaseReference keyboardTestGetKeyFromName = { (SDLTest_TestCaseFp)keyboard_getKeyFromName, "keyboard_getKeyFromName", "Check call to SDL_GetKeyFromName for known, unknown and invalid name", TEST_ENABLED }; -static const SDLTest_TestCaseReference keyboardTest4 = { +static const SDLTest_TestCaseReference keyboardTestGetKeyFromScancode = { (SDLTest_TestCaseFp)keyboard_getKeyFromScancode, "keyboard_getKeyFromScancode", "Check call to SDL_GetKeyFromScancode", TEST_ENABLED }; -static const SDLTest_TestCaseReference keyboardTest5 = { +static const SDLTest_TestCaseReference keyboardTestGetKeyName = { (SDLTest_TestCaseFp)keyboard_getKeyName, "keyboard_getKeyName", "Check call to SDL_GetKeyName", TEST_ENABLED }; -static const SDLTest_TestCaseReference keyboardTest6 = { +static const SDLTest_TestCaseReference keyboardTestGetSetModState = { (SDLTest_TestCaseFp)keyboard_getSetModState, "keyboard_getSetModState", "Check call to SDL_GetModState and SDL_SetModState", TEST_ENABLED }; -static const SDLTest_TestCaseReference keyboardTest7 = { +static const SDLTest_TestCaseReference keyboardTestStartStopTextInput = { (SDLTest_TestCaseFp)keyboard_startStopTextInput, "keyboard_startStopTextInput", "Check call to SDL_StartTextInput and SDL_StopTextInput", TEST_ENABLED }; -static const SDLTest_TestCaseReference keyboardTest8 = { +static const SDLTest_TestCaseReference keyboardTestSetTextInputArea = { (SDLTest_TestCaseFp)keyboard_setTextInputArea, "keyboard_setTextInputArea", "Check call to SDL_SetTextInputArea", TEST_ENABLED }; -static const SDLTest_TestCaseReference keyboardTest9 = { +static const SDLTest_TestCaseReference keyboardTestSetTextInputAreaNegative = { (SDLTest_TestCaseFp)keyboard_setTextInputAreaNegative, "keyboard_setTextInputAreaNegative", "Check call to SDL_SetTextInputArea with invalid data", TEST_ENABLED }; -static const SDLTest_TestCaseReference keyboardTest10 = { - (SDLTest_TestCaseFp)keyboard_getKeymapScancode, "keyboard_getKeymapScancode", "Check call to SDL_getKeymapScancode", TEST_ENABLED -}; - -static const SDLTest_TestCaseReference keyboardTest11 = { +static const SDLTest_TestCaseReference keyboardTestGetScancodeFromName = { (SDLTest_TestCaseFp)keyboard_getScancodeFromName, "keyboard_getScancodeFromName", "Check call to SDL_GetScancodeFromName", TEST_ENABLED }; -static const SDLTest_TestCaseReference keyboardTest12 = { +static const SDLTest_TestCaseReference keyboardTestGetScancodeFromNameNegative = { (SDLTest_TestCaseFp)keyboard_getScancodeFromNameNegative, "keyboard_getScancodeFromNameNegative", "Check call to SDL_GetScancodeFromName with invalid data", TEST_ENABLED }; -static const SDLTest_TestCaseReference keyboardTest13 = { +static const SDLTest_TestCaseReference keyboardTestGetKeyNameNegative = { (SDLTest_TestCaseFp)keyboard_getKeyNameNegative, "keyboard_getKeyNameNegative", "Check call to SDL_GetKeyName with invalid data", TEST_ENABLED }; -static const SDLTest_TestCaseReference keyboardTest14 = { +static const SDLTest_TestCaseReference keyboardTestGetScancodeNameNegative = { (SDLTest_TestCaseFp)keyboard_getScancodeNameNegative, "keyboard_getScancodeNameNegative", "Check call to SDL_GetScancodeName with invalid data", TEST_ENABLED }; /* Sequence of Keyboard test cases */ static const SDLTest_TestCaseReference *keyboardTests[] = { - &keyboardTest1, &keyboardTest2, &keyboardTest3, &keyboardTest4, &keyboardTest5, &keyboardTest6, - &keyboardTest7, &keyboardTest8, &keyboardTest9, &keyboardTest10, &keyboardTest11, &keyboardTest12, - &keyboardTest13, &keyboardTest14, NULL + &keyboardTestGetKeyboardState, + &keyboardTestGetKeyboardFocus, + &keyboardTestGetKeyFromName, + &keyboardTestGetKeyFromScancode, + &keyboardTestGetKeyName, + &keyboardTestGetSetModState, + &keyboardTestStartStopTextInput, + &keyboardTestSetTextInputArea, + &keyboardTestSetTextInputAreaNegative, + &keyboardTestGetScancodeFromName, + &keyboardTestGetScancodeFromNameNegative, + &keyboardTestGetKeyNameNegative, + &keyboardTestGetScancodeNameNegative, + NULL }; /* Keyboard test suite (global) */ From ac7df9d01f118e1d240331c7b4abfaae09250eba Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 18:19:39 -0700 Subject: [PATCH 192/253] Removed acquire/release of keymaps, which isn't needed internally. --- src/events/SDL_keyboard.c | 6 ++---- src/events/SDL_keymap.c | 21 ++------------------- src/events/SDL_keymap_c.h | 3 +-- src/video/wayland/SDL_waylandevents.c | 2 +- 4 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index e4788a71d0c3b..fc23ebe317ba5 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -229,8 +229,6 @@ SDL_Keymap *SDL_GetCurrentKeymap(void) { SDL_Keyboard *keyboard = &SDL_keyboard; - SDL_AcquireKeymap(keyboard->keymap); - return keyboard->keymap; } @@ -239,7 +237,7 @@ void SDL_SetKeymap(SDL_Keymap *keymap, SDL_bool send_event) SDL_Keyboard *keyboard = &SDL_keyboard; if (keyboard->keymap) { - SDL_ReleaseKeymap(keyboard->keymap); + SDL_DestroyKeymap(keyboard->keymap); } keyboard->keymap = keymap; @@ -851,7 +849,7 @@ void SDL_QuitKeyboard(void) SDL_keyboards = NULL; if (SDL_keyboard.keymap) { - SDL_ReleaseKeymap(SDL_keyboard.keymap); + SDL_DestroyKeymap(SDL_keyboard.keymap); SDL_keyboard.keymap = NULL; } diff --git a/src/events/SDL_keymap.c b/src/events/SDL_keymap.c index 452ee24a98883..054fb0950786e 100644 --- a/src/events/SDL_keymap.c +++ b/src/events/SDL_keymap.c @@ -26,7 +26,6 @@ struct SDL_Keymap { - int refcount; SDL_HashTable *scancode_to_keycode; SDL_HashTable *keycode_to_scancode; }; @@ -41,23 +40,15 @@ SDL_Keymap *SDL_CreateKeymap(void) return NULL; } - keymap->refcount = 1; keymap->scancode_to_keycode = SDL_CreateHashTable(NULL, 64, SDL_HashID, SDL_KeyMatchID, NULL, SDL_FALSE); keymap->keycode_to_scancode = SDL_CreateHashTable(NULL, 64, SDL_HashID, SDL_KeyMatchID, NULL, SDL_FALSE); if (!keymap->scancode_to_keycode || !keymap->keycode_to_scancode) { - SDL_ReleaseKeymap(keymap); + SDL_DestroyKeymap(keymap); return NULL; } return keymap; } -void SDL_AcquireKeymap(SDL_Keymap *keymap) -{ - if (keymap) { - ++keymap->refcount; - } -} - static SDL_Keymod NormalizeModifierStateForKeymap(SDL_Keymod modstate) { // The modifiers that affect the keymap are: SHIFT, CAPS, ALT, and MODE @@ -128,17 +119,12 @@ SDL_Scancode SDL_GetKeymapScancode(SDL_Keymap *keymap, SDL_Keycode keycode, SDL_ return scancode; } -void SDL_ReleaseKeymap(SDL_Keymap *keymap) +void SDL_DestroyKeymap(SDL_Keymap *keymap) { if (!keymap) { return; } - --keymap->refcount; - if (keymap->refcount != 0) { - return; - } - SDL_DestroyHashTable(keymap->scancode_to_keycode); SDL_DestroyHashTable(keymap->keycode_to_scancode); SDL_free(keymap); @@ -1030,7 +1016,6 @@ const char *SDL_GetKeyName(SDL_Keycode key, SDL_bool uppercase) if (scancode != SDL_SCANCODE_UNKNOWN) { if (key >= 0x0E00 && key <= 0x0E7F) { // Thai keyboards are QWERTY plus Thai characters, so let's use the ASCII key names - SDL_ReleaseKeymap(keymap); return SDL_GetScancodeName(scancode); } @@ -1039,7 +1024,6 @@ const char *SDL_GetKeyName(SDL_Keycode key, SDL_bool uppercase) key = capital; } } - SDL_ReleaseKeymap(keymap); } } @@ -1108,7 +1092,6 @@ SDL_Keycode SDL_GetKeyFromName(const char *name, SDL_bool uppercase) if (scancode != SDL_SCANCODE_UNKNOWN && (modstate & SDL_KMOD_SHIFT)) { key = SDL_GetKeymapKeycode(keymap, scancode, SDL_KMOD_NONE); } - SDL_ReleaseKeymap(keymap); } } return key; diff --git a/src/events/SDL_keymap_c.h b/src/events/SDL_keymap_c.h index d6b4f1803b2c9..72da37a373a08 100644 --- a/src/events/SDL_keymap_c.h +++ b/src/events/SDL_keymap_c.h @@ -27,10 +27,9 @@ typedef struct SDL_Keymap SDL_Keymap; SDL_Keymap *SDL_GetCurrentKeymap(void); SDL_Keymap *SDL_CreateKeymap(void); -void SDL_AcquireKeymap(SDL_Keymap *keymap); void SDL_SetKeymapEntry(SDL_Keymap *keymap, SDL_Scancode scancode, SDL_Keymod modstate, SDL_Keycode keycode); SDL_Keycode SDL_GetKeymapKeycode(SDL_Keymap *keymap, SDL_Scancode scancode, SDL_Keymod modstate); SDL_Scancode SDL_GetKeymapScancode(SDL_Keymap *keymap, SDL_Keycode keycode, SDL_Keymod *modstate); -void SDL_ReleaseKeymap(SDL_Keymap *keymap); +void SDL_DestroyKeymap(SDL_Keymap *keymap); #endif /* SDL_keymap_c_h_ */ diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 3f9aa8663dea6..70a79586eb721 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -1185,7 +1185,7 @@ static void Wayland_UpdateKeymap(struct SDL_WaylandInput *input) keymap.state = WAYLAND_xkb_state_new(input->xkb.keymap); if (!keymap.state) { SDL_SetError("failed to create XKB state"); - SDL_ReleaseKeymap(keymap.keymap); + SDL_DestroyKeymap(keymap.keymap); return; } From 4f7c0e7c4617931ebb642bf54c69dd2d1d22cc94 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 18:49:19 -0700 Subject: [PATCH 193/253] Fixed key names for non-latin keyboard layouts --- src/events/SDL_keyboard.c | 52 ++++++++++++++++++++++++++------------- src/events/SDL_keymap.c | 28 +++++++-------------- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index fc23ebe317ba5..c6d73d5d00348 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -57,7 +57,8 @@ typedef struct SDL_Keyboard Uint8 keystate[SDL_NUM_SCANCODES]; SDL_Keymap *keymap; SDL_bool french_numbers; - SDL_bool non_latin_letters; + SDL_bool latin_letters; + SDL_bool thai_keyboard; Uint32 keycode_options; SDL_bool autorelease_pending; Uint64 hardware_timestamp; @@ -229,6 +230,17 @@ SDL_Keymap *SDL_GetCurrentKeymap(void) { SDL_Keyboard *keyboard = &SDL_keyboard; + if (keyboard->thai_keyboard) { + // Thai keyboards are QWERTY plus Thai characters, use the default QWERTY keymap + return NULL; + } + + if ((keyboard->keycode_options & KEYCODE_OPTION_LATIN_LETTERS) && + !keyboard->latin_letters) { + // We'll use the default QWERTY keymap + return NULL; + } + return keyboard->keymap; } @@ -253,10 +265,17 @@ void SDL_SetKeymap(SDL_Keymap *keymap, SDL_bool send_event) } // Detect non-Latin keymap - keyboard->non_latin_letters = SDL_TRUE; + keyboard->thai_keyboard = SDL_FALSE; + keyboard->latin_letters = SDL_FALSE; for (int i = SDL_SCANCODE_A; i <= SDL_SCANCODE_D; ++i) { - if (SDL_GetKeymapKeycode(keymap, (SDL_Scancode)i, SDL_KMOD_NONE) <= 0xFF) { - keyboard->non_latin_letters = SDL_FALSE; + SDL_Keycode key = SDL_GetKeymapKeycode(keymap, (SDL_Scancode)i, SDL_KMOD_NONE); + if (key <= 0xFF) { + keyboard->latin_letters = SDL_TRUE; + break; + } + + if (key >= 0x0E00 && key <= 0x0E7F) { + keyboard->thai_keyboard = SDL_TRUE; break; } } @@ -437,30 +456,29 @@ SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, S SDL_Keycode keycode; if (key_event) { + SDL_Keymap *keymap = SDL_GetCurrentKeymap(); SDL_bool numlock = (modstate & SDL_KMOD_NUM) != 0; // We won't be applying any modifiers by default modstate = SDL_KMOD_NONE; - if ((keyboard->keycode_options & KEYCODE_OPTION_LATIN_LETTERS) && - keyboard->non_latin_letters) { - keycode = SDL_GetKeymapKeycode(NULL, scancode, modstate); - } else { - if ((keyboard->keycode_options & KEYCODE_OPTION_FRENCH_NUMBERS) && - keyboard->french_numbers && - (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0)) { - // Add the shift state to generate a numeric keycode - modstate |= SDL_KMOD_SHIFT; - } - - keycode = SDL_GetKeymapKeycode(keyboard->keymap, scancode, modstate); + if ((keyboard->keycode_options & KEYCODE_OPTION_FRENCH_NUMBERS) && + keyboard->french_numbers && + (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0)) { + // Add the shift state to generate a numeric keycode + modstate |= SDL_KMOD_SHIFT; } + keycode = SDL_GetKeymapKeycode(keymap, scancode, modstate); + if (keyboard->keycode_options & KEYCODE_OPTION_HIDE_NUMPAD) { keycode = SDL_ConvertNumpadKeycode(keycode, numlock); } } else { - keycode = SDL_GetKeymapKeycode(keyboard->keymap, scancode, modstate); + // Use the real keymap + SDL_Keymap *keymap = keyboard->keymap; + + keycode = SDL_GetKeymapKeycode(keymap, scancode, modstate); } return keycode; } diff --git a/src/events/SDL_keymap.c b/src/events/SDL_keymap.c index 054fb0950786e..4f94170b7c13d 100644 --- a/src/events/SDL_keymap.c +++ b/src/events/SDL_keymap.c @@ -1008,17 +1008,11 @@ const char *SDL_GetKeyName(SDL_Keycode key, SDL_bool uppercase) // SDL_Keycode is defined as the unshifted key on the keyboard, // but the key name is defined as the letter printed on that key, // which is usually the shifted capital letter. - if (key >= 'a' && key <= 'z') { - key = 'A' + (key - 'a'); - } else if (key > 0x7F) { + if (key > 0x7F || (key >= 'a' && key <= 'z')) { SDL_Keymap *keymap = SDL_GetCurrentKeymap(); - SDL_Scancode scancode = SDL_GetKeymapScancode(keymap, key, NULL); - if (scancode != SDL_SCANCODE_UNKNOWN) { - if (key >= 0x0E00 && key <= 0x0E7F) { - // Thai keyboards are QWERTY plus Thai characters, so let's use the ASCII key names - return SDL_GetScancodeName(scancode); - } - + SDL_Keymod modstate; + SDL_Scancode scancode = SDL_GetKeymapScancode(keymap, key, &modstate); + if (scancode != SDL_SCANCODE_UNKNOWN && !(modstate & SDL_KMOD_SHIFT)) { SDL_Keycode capital = SDL_GetKeymapKeycode(keymap, scancode, SDL_KMOD_SHIFT); if (capital > 0x7F || (capital >= 'A' && capital <= 'Z')) { key = capital; @@ -1083,15 +1077,11 @@ SDL_Keycode SDL_GetKeyFromName(const char *name, SDL_bool uppercase) // SDL_Keycode is defined as the unshifted key on the keyboard, // but the key name is defined as the letter printed on that key, // which is usually the shifted capital letter. - if (key >= 'A' && key <= 'Z') { - key = 'a' + (key - 'A'); - } else if (key > 0x7F) { - SDL_Keymap *keymap = SDL_GetCurrentKeymap(); - SDL_Keymod modstate; - SDL_Scancode scancode = SDL_GetKeymapScancode(keymap, key, &modstate); - if (scancode != SDL_SCANCODE_UNKNOWN && (modstate & SDL_KMOD_SHIFT)) { - key = SDL_GetKeymapKeycode(keymap, scancode, SDL_KMOD_NONE); - } + SDL_Keymap *keymap = SDL_GetCurrentKeymap(); + SDL_Keymod modstate; + SDL_Scancode scancode = SDL_GetKeymapScancode(keymap, key, &modstate); + if (scancode != SDL_SCANCODE_UNKNOWN && (modstate & SDL_KMOD_SHIFT)) { + key = SDL_GetKeymapKeycode(keymap, scancode, SDL_KMOD_NONE); } } return key; From afec46dbee7011c57e6ba75d6141823151158c92 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 19:09:18 -0700 Subject: [PATCH 194/253] Re-added SDL_GetScancodeFromKey() --- include/SDL3/SDL_keyboard.h | 20 ++++++++++++++++++++ src/dynapi/SDL_dynapi.sym | 1 + src/dynapi/SDL_dynapi_overrides.h | 1 + src/dynapi/SDL_dynapi_procs.h | 1 + src/events/SDL_keyboard.c | 18 +++++++++++------- 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index f5b474a33f1f4..5a6f86efbe6f6 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -199,9 +199,29 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); * \since This function is available since SDL 3.0.0. * * \sa SDL_GetKeyName + * \sa SDL_GetScancodeFromKey */ extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, SDL_bool key_event); +/** + * Get the scancode corresponding to the given key code according to the + * current keyboard layout. + * + * Note that there may be multiple scancode+modifier states that can generate + * this keycode, this will just return the first one found. + * + * \param key the desired SDL_Keycode to query. + * \param modstate a pointer to the modifier state that would be used when the + * scancode generates this key, may be NULL. + * \returns the SDL_Scancode that corresponds to the given SDL_Keycode. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GetKeyFromScancode + * \sa SDL_GetScancodeName + */ +extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate); + /** * Set a human-readable name for a scancode. * diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 7c4bcd6578bf1..572417966d3c5 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -411,6 +411,7 @@ SDL3_0.0.0 { SDL_GetRendererProperties; SDL_GetRevision; SDL_GetSIMDAlignment; + SDL_GetScancodeFromKey; SDL_GetScancodeFromName; SDL_GetScancodeName; SDL_GetSemaphoreValue; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 4832cd7c093b9..7e8550db84d72 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -436,6 +436,7 @@ #define SDL_GetRendererProperties SDL_GetRendererProperties_REAL #define SDL_GetRevision SDL_GetRevision_REAL #define SDL_GetSIMDAlignment SDL_GetSIMDAlignment_REAL +#define SDL_GetScancodeFromKey SDL_GetScancodeFromKey_REAL #define SDL_GetScancodeFromName SDL_GetScancodeFromName_REAL #define SDL_GetScancodeName SDL_GetScancodeName_REAL #define SDL_GetSemaphoreValue SDL_GetSemaphoreValue_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index a9241744542cc..6cbded81cdf38 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -456,6 +456,7 @@ SDL_DYNAPI_PROC(const char *,SDL_GetRendererName,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetRendererProperties,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetRevision,(void),(),return) SDL_DYNAPI_PROC(size_t,SDL_GetSIMDAlignment,(void),(),return) +SDL_DYNAPI_PROC(SDL_Scancode,SDL_GetScancodeFromKey,(SDL_Keycode a, SDL_Keymod *b),(a,b),return) SDL_DYNAPI_PROC(SDL_Scancode,SDL_GetScancodeFromName,(const char *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetScancodeName,(SDL_Scancode a),(a),return) SDL_DYNAPI_PROC(Uint32,SDL_GetSemaphoreValue,(SDL_Semaphore *a),(a),return) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index c6d73d5d00348..ad4bd92010574 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -453,11 +453,11 @@ static SDL_Keycode SDL_ConvertNumpadKeycode(SDL_Keycode keycode, SDL_bool numloc SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, SDL_bool key_event) { SDL_Keyboard *keyboard = &SDL_keyboard; - SDL_Keycode keycode; if (key_event) { SDL_Keymap *keymap = SDL_GetCurrentKeymap(); SDL_bool numlock = (modstate & SDL_KMOD_NUM) != 0; + SDL_Keycode keycode; // We won't be applying any modifiers by default modstate = SDL_KMOD_NONE; @@ -474,13 +474,17 @@ SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, S if (keyboard->keycode_options & KEYCODE_OPTION_HIDE_NUMPAD) { keycode = SDL_ConvertNumpadKeycode(keycode, numlock); } - } else { - // Use the real keymap - SDL_Keymap *keymap = keyboard->keymap; - - keycode = SDL_GetKeymapKeycode(keymap, scancode, modstate); + return keycode; } - return keycode; + + return SDL_GetKeymapKeycode(keyboard->keymap, scancode, modstate); +} + +SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate) +{ + SDL_Keyboard *keyboard = &SDL_keyboard; + + return SDL_GetKeymapScancode(keyboard->keymap, key, modstate); } static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, Uint8 state) From 725b95dc84ef124fd748b44d4b4a358fa6ef44a3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 19:12:38 -0700 Subject: [PATCH 195/253] Fixed SDL_GetDefaultScancodeFromKey() --- src/events/SDL_keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/events/SDL_keymap.c b/src/events/SDL_keymap.c index 4f94170b7c13d..de5a63312bc58 100644 --- a/src/events/SDL_keymap.c +++ b/src/events/SDL_keymap.c @@ -613,7 +613,7 @@ static SDL_Scancode SDL_GetDefaultScancodeFromKey(SDL_Keycode key, SDL_Keymod *m if (modstate) { *modstate = SDL_KMOD_SHIFT; } - return (SDL_Scancode)(SDL_SCANCODE_A + key - 'Z'); + return (SDL_Scancode)(SDL_SCANCODE_A + key - 'A'); } for (int i = 0; i < SDL_arraysize(normal_default_symbols); ++i) { From 0d3db8390d8506fd0a1b3294bfb6d8fa10c05bdd Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 6 Aug 2024 02:47:18 +0000 Subject: [PATCH 196/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_keyboard.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index 5a6f86efbe6f6..fa074d27d434c 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -188,7 +188,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); * Get the key code corresponding to the given scancode according to the * current keyboard layout. * - * If you want to get the keycode as it would be delivered in key events, including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should pass `key_event` as SDL_TRUE. Otherwise this function simply translates the scancode based on the given modifier state. + * If you want to get the keycode as it would be delivered in key events, + * including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should + * pass `key_event` as SDL_TRUE. Otherwise this function simply translates the + * scancode based on the given modifier state. * * \param scancode the desired SDL_Scancode to query. * \param modstate the modifier state to use when translating the scancode to From a1998d106daf1ed1c30ff7a2dfb2a9c7c34d4040 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Aug 2024 20:58:41 -0700 Subject: [PATCH 197/253] Putting the simple back into Simple DirectMedia Layer --- include/SDL3/SDL_keyboard.h | 11 ++--------- src/dynapi/SDL_dynapi_procs.h | 4 ++-- src/events/SDL_keymap.c | 6 ++++-- src/test/SDL_test_common.c | 2 +- test/checkkeys.c | 2 +- test/testautomation_keyboard.c | 34 +++++++++++++++------------------- test/testime.c | 2 +- 7 files changed, 26 insertions(+), 35 deletions(-) diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index fa074d27d434c..d4f9b22cd9d95 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -286,9 +286,6 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam * If the key doesn't have a name, this function returns an empty string (""). * * \param key the desired SDL_Keycode to query. - * \param uppercase SDL_TRUE if the name should be the letter printed on the - * key on the keyboard, which is usually uppercase, or - * SDL_FALSE to return the name of the key unchanged. * \returns a UTF-8 encoded string of the key name. * * \since This function is available since SDL 3.0.0. @@ -297,16 +294,12 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam * \sa SDL_GetKeyFromScancode * \sa SDL_GetScancodeFromKey */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyName(SDL_Keycode key, SDL_bool uppercase); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyName(SDL_Keycode key); /** * Get a key code from a human-readable name. * * \param name the human-readable key name. - * \param uppercase SDL_TRUE if the name is the letter printed on the key on - * the keyboard, which is usually uppercase, and this - * function should return the unshifted version of the key, - * or SDL_FALSE to return the key unchanged. * \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call * SDL_GetError() for more information. * @@ -316,7 +309,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyName(SDL_Keycode key, SDL_boo * \sa SDL_GetKeyName * \sa SDL_GetScancodeFromName */ -extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name, SDL_bool uppercase); +extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); /** * Start accepting Unicode text input events in a window. diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 6cbded81cdf38..44d96651ae19b 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -365,9 +365,9 @@ SDL_DYNAPI_PROC(SDL_JoystickType,SDL_GetJoystickTypeForID,(SDL_JoystickID a),(a) SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickVendor,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickVendorForID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(SDL_JoystickID*,SDL_GetJoysticks,(int *a),(a),return) -SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromName,(const char *a, SDL_bool b),(a, b),return) +SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromName,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromScancode,(SDL_Scancode a, SDL_Keymod b, SDL_bool c),(a,b,c),return) -SDL_DYNAPI_PROC(const char*,SDL_GetKeyName,(SDL_Keycode a, SDL_bool b),(a,b),return) +SDL_DYNAPI_PROC(const char*,SDL_GetKeyName,(SDL_Keycode a),(a),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetKeyboardFocus,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetKeyboardNameForID,(SDL_KeyboardID a),(a),return) SDL_DYNAPI_PROC(const Uint8*,SDL_GetKeyboardState,(int *a),(a),return) diff --git a/src/events/SDL_keymap.c b/src/events/SDL_keymap.c index de5a63312bc58..d69f3f156a599 100644 --- a/src/events/SDL_keymap.c +++ b/src/events/SDL_keymap.c @@ -981,8 +981,9 @@ SDL_Scancode SDL_GetScancodeFromName(const char *name) return SDL_SCANCODE_UNKNOWN; } -const char *SDL_GetKeyName(SDL_Keycode key, SDL_bool uppercase) +const char *SDL_GetKeyName(SDL_Keycode key) { + const SDL_bool uppercase = SDL_TRUE; char name[8]; char *end; @@ -1027,8 +1028,9 @@ const char *SDL_GetKeyName(SDL_Keycode key, SDL_bool uppercase) } } -SDL_Keycode SDL_GetKeyFromName(const char *name, SDL_bool uppercase) +SDL_Keycode SDL_GetKeyFromName(const char *name) { + const SDL_bool uppercase = SDL_TRUE; SDL_Keycode key; /* Check input */ diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 9d8c398990304..5f84b36495854 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1717,7 +1717,7 @@ void SDLTest_PrintEvent(const SDL_Event *event) event->key.windowID, event->key.scancode, SDL_GetScancodeName(event->key.scancode), - event->key.key, SDL_GetKeyName(event->key.key, SDL_TRUE), + event->key.key, SDL_GetKeyName(event->key.key), modstr); break; } diff --git a/test/checkkeys.c b/test/checkkeys.c index b10e7aaf721b8..33cb73b1ed100 100644 --- a/test/checkkeys.c +++ b/test/checkkeys.c @@ -202,7 +202,7 @@ static void PrintKey(SDL_KeyboardEvent *event) event->raw, event->scancode, event->scancode == SDL_SCANCODE_UNKNOWN ? "UNKNOWN" : SDL_GetScancodeName(event->scancode), - event->key, SDL_GetKeyName(event->key, SDL_TRUE)); + event->key, SDL_GetKeyName(event->key)); } else { print_string(&spot, &left, "Unknown Key (raw 0x%.2x, scancode %d = %s) %s ", diff --git a/test/testautomation_keyboard.c b/test/testautomation_keyboard.c index 6a895f0b0f334..f5786e53b7e4b 100644 --- a/test/testautomation_keyboard.c +++ b/test/testautomation_keyboard.c @@ -59,41 +59,37 @@ static int keyboard_getKeyFromName(void *arg) SDL_Keycode result; /* Case where Key is known, 1 character input */ - result = SDL_GetKeyFromName("A", SDL_TRUE); + result = SDL_GetKeyFromName("A"); SDLTest_AssertPass("Call to SDL_GetKeyFromName('A', SDL_TRUE)"); SDLTest_AssertCheck(result == SDLK_A, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_A, result); - result = SDL_GetKeyFromName("A", SDL_FALSE); - SDLTest_AssertPass("Call to SDL_GetKeyFromName('A', SDL_FALSE)"); - SDLTest_AssertCheck(result == 'A', "Verify result from call, expected: %d, got: %" SDL_PRIu32, 'A', result); - /* Case where Key is known, 2 character input */ - result = SDL_GetKeyFromName("F1", SDL_TRUE); + result = SDL_GetKeyFromName("F1"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/double)"); SDLTest_AssertCheck(result == SDLK_F1, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_F1, result); /* Case where Key is known, 3 character input */ - result = SDL_GetKeyFromName("End", SDL_TRUE); + result = SDL_GetKeyFromName("End"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/triple)"); SDLTest_AssertCheck(result == SDLK_END, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_END, result); /* Case where Key is known, 4 character input */ - result = SDL_GetKeyFromName("Find", SDL_TRUE); + result = SDL_GetKeyFromName("Find"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/quad)"); SDLTest_AssertCheck(result == SDLK_FIND, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_FIND, result); /* Case where Key is known, multiple character input */ - result = SDL_GetKeyFromName("MediaStop", SDL_TRUE); + result = SDL_GetKeyFromName("MediaStop"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/multi)"); SDLTest_AssertCheck(result == SDLK_MEDIA_STOP, "Verify result from call, expected: %d, got: %" SDL_PRIu32, SDLK_MEDIA_STOP, result); /* Case where Key is unknown */ - result = SDL_GetKeyFromName("NotThere", SDL_TRUE); + result = SDL_GetKeyFromName("NotThere"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(unknown)"); SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); /* Case where input is NULL/invalid */ - result = SDL_GetKeyFromName(NULL, SDL_TRUE); + result = SDL_GetKeyFromName(NULL); SDLTest_AssertPass("Call to SDL_GetKeyFromName(NULL)"); SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %d, got: %" SDL_PRIu32, SDLK_UNKNOWN, result); @@ -168,42 +164,42 @@ static int keyboard_getKeyName(void *arg) /* Case where key has a 1 character name */ expected = "3"; - result = SDL_GetKeyName(SDLK_3, SDL_TRUE); + result = SDL_GetKeyName(SDLK_3); SDLTest_AssertPass("Call to SDL_GetKeyName()"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: %s, got: %s", expected, result); /* Case where key has a 2 character name */ expected = "F1"; - result = SDL_GetKeyName(SDLK_F1, SDL_TRUE); + result = SDL_GetKeyName(SDLK_F1); SDLTest_AssertPass("Call to SDL_GetKeyName()"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: %s, got: %s", expected, result); /* Case where key has a 3 character name */ expected = "Cut"; - result = SDL_GetKeyName(SDLK_CUT, SDL_TRUE); + result = SDL_GetKeyName(SDLK_CUT); SDLTest_AssertPass("Call to SDL_GetKeyName()"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: %s, got: %s", expected, result); /* Case where key has a 4 character name */ expected = "Down"; - result = SDL_GetKeyName(SDLK_DOWN, SDL_TRUE); + result = SDL_GetKeyName(SDLK_DOWN); SDLTest_AssertPass("Call to SDL_GetKeyName()"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: %s, got: %s", expected, result); /* Case where key has a N character name */ expected = "MediaPlay"; - result = SDL_GetKeyName(SDLK_MEDIA_PLAY, SDL_TRUE); + result = SDL_GetKeyName(SDLK_MEDIA_PLAY); SDLTest_AssertPass("Call to SDL_GetKeyName()"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: %s, got: %s", expected, result); /* Case where key has a N character name with space */ expected = "Keypad MemStore"; - result = SDL_GetKeyName(SDLK_KP_MEMSTORE, SDL_TRUE); + result = SDL_GetKeyName(SDLK_KP_MEMSTORE); SDLTest_AssertPass("Call to SDL_GetKeyName()"); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: %s, got: %s", expected, result); @@ -250,7 +246,7 @@ static int keyboard_getKeyNameNegative(void *arg) /* Unknown keycode */ keycode = SDLK_UNKNOWN; - result = SDL_GetKeyName(keycode, SDL_TRUE); + result = SDL_GetKeyName(keycode); SDLTest_AssertPass("Call to SDL_GetKeyName(%" SDL_PRIu32 "/unknown)", keycode); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result); @@ -261,7 +257,7 @@ static int keyboard_getKeyNameNegative(void *arg) /* Negative keycode */ keycode = (SDL_Keycode)SDLTest_RandomIntegerInRange(-255, -1); - result = SDL_GetKeyName(keycode, SDL_TRUE); + result = SDL_GetKeyName(keycode); SDLTest_AssertPass("Call to SDL_GetKeyName(%" SDL_PRIu32 "/negative)", keycode); SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL"); SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result); diff --git a/test/testime.c b/test/testime.c index 6be70a60ff63a..f6cc4f0368d18 100644 --- a/test/testime.c +++ b/test/testime.c @@ -1209,7 +1209,7 @@ int main(int argc, char *argv[]) event.key.scancode, SDL_GetScancodeName(event.key.scancode), SDL_static_cast(Uint32, event.key.key), - SDL_GetKeyName(event.key.key, SDL_TRUE)); + SDL_GetKeyName(event.key.key)); break; } case SDL_EVENT_TEXT_INPUT: { From 44927fe5e3765e5a1e20eb74461f7f63e24f68d0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 6 Aug 2024 05:45:48 -0700 Subject: [PATCH 198/253] Added detail about why a file couldn't be opened (thanks mgerhardy!) Fixes https://github.com/libsdl-org/SDL/issues/10484 (cherry picked from commit 15120133202da5980c17b4bf363b5fdb6f32de6b) --- src/file/SDL_iostream.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/file/SDL_iostream.c b/src/file/SDL_iostream.c index ef1d21d240c57..d10de2da7954d 100644 --- a/src/file/SDL_iostream.c +++ b/src/file/SDL_iostream.c @@ -26,6 +26,7 @@ #ifdef HAVE_STDIO_H #include +#include #include #endif #ifdef HAVE_LIMITS_H @@ -565,7 +566,7 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode) FILE *fp = fdopen(fd, mode); if (!fp) { close(fd); - SDL_SetError("Unable to open file descriptor (%d) from URI %s", fd, file); + SDL_SetError("Unable to open file descriptor (%d) from URI %s: %s", fd, file, strerror(errno)); return NULL; } @@ -655,7 +656,7 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode) #endif if (!fp) { - SDL_SetError("Couldn't open %s", file); + SDL_SetError("Couldn't open %s: %s", file, strerror(errno)); } else if (!IsRegularFileOrPipe(fp)) { fclose(fp); fp = NULL; From ca127106ee9533f0a47dc1775b72da889f745cf6 Mon Sep 17 00:00:00 2001 From: Dragon-Baroque <74261498+Dragon-Baroque@users.noreply.github.com> Date: Tue, 6 Aug 2024 13:50:06 +0200 Subject: [PATCH 199/253] Add MIME targets to SDL_EVENT_DROP_TEXT in X11 src/video/x11/SDL_x11events.c Add Text targets "text/plain;charset=utf-8", "UTF8_STRING", "TEXT" to "text/plain". --- src/video/x11/SDL_x11events.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index b5b5d60f810a0..94ebf47ce8b94 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -126,9 +126,19 @@ static Atom X11_PickTarget(Display *disp, Atom list[], int list_count) int i; for (i = 0; i < list_count && request == None; i++) { name = X11_XGetAtomName(disp, list[i]); - if ((SDL_strcmp("text/uri-list", name) == 0) || (SDL_strcmp("text/plain", name) == 0)) { + /* Preferred MIME targets */ + if ((SDL_strcmp("text/uri-list", name) == 0) || + (SDL_strcmp("text/plain;charset=utf-8", name) == 0) || + (SDL_strcmp("UTF8_STRING", name) == 0)) { request = list[i]; } + /* Fallback MIME targets */ + if ((SDL_strcmp("text/plain", name) == 0) || + (SDL_strcmp("TEXT", name) == 0)) { + if (request == None) { + request = list[i]; + } + } X11_XFree(name); } return request; @@ -1759,7 +1769,10 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent) if (name) { char *token = SDL_strtok_r((char *)p.data, "\r\n", &saveptr); while (token) { - if (SDL_strcmp("text/plain", name) == 0) { + if ((SDL_strcmp("text/plain;charset=utf-8", name) == 0) || + (SDL_strcmp("UTF8_STRING", name) == 0) || + (SDL_strcmp("text/plain", name) == 0) || + (SDL_strcmp("TEXT", name) == 0)) { SDL_SendDropText(data->window, token); } else if (SDL_strcmp("text/uri-list", name) == 0) { if (SDL_URIToLocal(token, token) >= 0) { From e612ce511b0d5a46f40cc414f4963b560d233f3f Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 6 Aug 2024 10:18:39 -0400 Subject: [PATCH 200/253] wayland: Add support for high-DPI custom cursors Add a cursor caching system and viewport support, to allow for high-DPI, fractionally-scaled, custom cursors. --- src/video/wayland/SDL_waylandmouse.c | 163 +++++++++++++++++++++------ 1 file changed, 128 insertions(+), 35 deletions(-) diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index 156e8a7ac0011..69af379e7745e 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -37,6 +37,7 @@ #include "cursor-shape-v1-client-protocol.h" #include "pointer-constraints-unstable-v1-client-protocol.h" +#include "viewporter-client-protocol.h" #include "../../SDL_hints_c.h" @@ -47,6 +48,18 @@ static int Wayland_SetRelativeMouseMode(SDL_bool enabled); typedef struct { struct Wayland_SHMBuffer shmBuffer; + + int dst_width; + int dst_height; + float scale; + + struct wl_list node; +} Wayland_CachedCustomCursor; + +typedef struct +{ + SDL_Surface *sdl_cursor_surface; + struct wl_list cursor_cache; } Wayland_CustomCursor; typedef struct @@ -70,13 +83,14 @@ struct SDL_CursorData { union { - struct Wayland_SHMBuffer custom; + Wayland_CustomCursor custom; Wayland_SystemCursor system; } cursor_data; + struct wl_surface *surface; + struct wp_viewport *viewport; int hot_x, hot_y; - int w, h; SDL_bool is_system_cursor; }; @@ -342,7 +356,7 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, SDL_CursorData * /* First, find the appropriate theme based on the current scale... */ focus = SDL_GetMouse()->focus; if (focus) { - /* Cursors use integer scaling. */ + /* TODO: Use the fractional scale once GNOME supports viewports on cursor surfaces. */ *scale = SDL_ceilf(focus->internal->windowed_scale_factor); } else { *scale = 1.0f; @@ -411,43 +425,92 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, SDL_CursorData * } cdata->hot_x = cursor->images[0]->hotspot_x; cdata->hot_y = cursor->images[0]->hotspot_y; - cdata->w = cursor->images[0]->width; - cdata->h = cursor->images[0]->height; return SDL_TRUE; } +static Wayland_CachedCustomCursor *Wayland_GetCachedCustomCursor(SDL_Cursor *cursor) +{ + SDL_VideoDevice *vd = SDL_GetVideoDevice(); + SDL_VideoData *wd = vd->internal; + SDL_CursorData *data = cursor->internal; + Wayland_CachedCustomCursor *cache; + SDL_Window *focus = SDL_GetMouseFocus(); + float scale = 1.0f; + + if (focus && SDL_SurfaceHasAlternateImages(data->cursor_data.custom.sdl_cursor_surface)) { + scale = focus->internal->windowed_scale_factor; + } + + /* Only use fractional scale values if viewports are available. */ + if (!wd->viewporter) { + scale = SDL_ceilf(scale); + } + + /* Is this cursor already cached at the target scale? */ + wl_list_for_each(cache, &data->cursor_data.custom.cursor_cache, node) { + if (cache->scale == scale) { + return cache; + } + } + + cache = SDL_calloc(1, sizeof(Wayland_CachedCustomCursor)); + if (!cache) { + return NULL; + } + + SDL_Surface *surface = SDL_GetSurfaceImage(data->cursor_data.custom.sdl_cursor_surface, scale); + if (!surface) { + SDL_free(cache); + return NULL; + } + + /* Allocate shared memory buffer for this cursor */ + if (Wayland_AllocSHMBuffer(surface->w, surface->h, &cache->shmBuffer) != 0) { + SDL_free(cursor->internal); + SDL_free(cursor); + return NULL; + } + + /* Wayland requires premultiplied alpha for its surfaces. */ + SDL_PremultiplyAlpha(surface->w, surface->h, + surface->format, surface->pixels, surface->pitch, + SDL_PIXELFORMAT_ARGB8888, cache->shmBuffer.shm_data, surface->w * 4, SDL_TRUE); + + cache->dst_width = data->cursor_data.custom.sdl_cursor_surface->w; + cache->dst_height = data->cursor_data.custom.sdl_cursor_surface->h; + cache->scale = scale; + WAYLAND_wl_list_insert(&data->cursor_data.custom.cursor_cache, &cache->node); + SDL_DestroySurface(surface); + + return cache; +} + static SDL_Cursor *Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) { + SDL_VideoDevice *vd = SDL_GetVideoDevice(); + SDL_VideoData *wd = vd->internal; + SDL_Cursor *cursor = SDL_calloc(1, sizeof(*cursor)); if (cursor) { - SDL_VideoDevice *vd = SDL_GetVideoDevice(); - SDL_VideoData *wd = vd->internal; SDL_CursorData *data = SDL_calloc(1, sizeof(*data)); if (!data) { SDL_free(cursor); return NULL; } cursor->internal = data; - - /* Allocate shared memory buffer for this cursor */ - if (Wayland_AllocSHMBuffer(surface->w, surface->h, &data->cursor_data.custom) != 0) { - SDL_free(cursor->internal); - SDL_free(cursor); - return NULL; - } - - /* Wayland requires premultiplied alpha for its surfaces. */ - SDL_PremultiplyAlpha(surface->w, surface->h, - surface->format, surface->pixels, surface->pitch, - SDL_PIXELFORMAT_ARGB8888, data->cursor_data.custom.shm_data, surface->w * 4, SDL_TRUE); - + WAYLAND_wl_list_init(&data->cursor_data.custom.cursor_cache); + data->hot_x = hot_x; + data->hot_y = hot_y; data->surface = wl_compositor_create_surface(wd->compositor); wl_surface_set_user_data(data->surface, NULL); - data->hot_x = hot_x; - data->hot_y = hot_y; - data->w = surface->w; - data->h = surface->h; + data->cursor_data.custom.sdl_cursor_surface = surface; + ++surface->refcount; + + /* If the cursor has only one size, just prepare it now. */ + if (!SDL_SurfaceHasAlternateImages(surface)) { + Wayland_GetCachedCustomCursor(cursor); + } } return cursor; @@ -496,7 +559,18 @@ static void Wayland_FreeCursorData(SDL_CursorData *d) } SDL_free(d->cursor_data.system.frames); } else { - Wayland_ReleaseSHMBuffer(&d->cursor_data.custom); + Wayland_CachedCustomCursor *c, *temp; + wl_list_for_each_safe(c, temp, &d->cursor_data.custom.cursor_cache, node) { + Wayland_ReleaseSHMBuffer(&c->shmBuffer); + SDL_free(c); + } + + SDL_DestroySurface(d->cursor_data.custom.sdl_cursor_surface); + } + + if (d->viewport) { + wp_viewport_destroy(d->viewport); + d->viewport = NULL; } if (d->surface) { @@ -602,6 +676,8 @@ static int Wayland_ShowCursor(SDL_Cursor *cursor) struct SDL_WaylandInput *input = d->input; struct wl_pointer *pointer = d->pointer; float scale = 1.0f; + int dst_width = 0; + int dst_height = 0; if (!pointer) { return -1; @@ -617,25 +693,19 @@ static int Wayland_ShowCursor(SDL_Cursor *cursor) if (cursor) { SDL_CursorData *data = cursor->internal; - /* TODO: High-DPI custom cursors? -flibit */ if (data->is_system_cursor) { if (input->cursor_shape) { Wayland_SetSystemCursorShape(input, data->cursor_data.system.id); - input->current_cursor = data; return 0; - } else if (!wayland_get_system_cursor(d, data, &scale)) { + } + + if (!wayland_get_system_cursor(d, data, &scale)) { return -1; } } - wl_surface_set_buffer_scale(data->surface, (int32_t)scale); - wl_pointer_set_cursor(pointer, - input->pointer_enter_serial, - data->surface, - (int32_t)(data->hot_x / scale), - (int32_t)(data->hot_y / scale)); if (data->is_system_cursor) { wl_surface_attach(data->surface, data->cursor_data.system.frames[0].wl_buffer, 0, 0); @@ -647,8 +717,31 @@ static int Wayland_ShowCursor(SDL_Cursor *cursor) wl_callback_add_listener(data->cursor_data.system.frame_callback, &cursor_frame_listener, data); } } else { - wl_surface_attach(data->surface, data->cursor_data.custom.wl_buffer, 0, 0); + Wayland_CachedCustomCursor *cached = Wayland_GetCachedCustomCursor(cursor); + dst_width = cached->dst_width; + dst_height = cached->dst_height; + scale = cached->scale; + wl_surface_attach(data->surface, cached->shmBuffer.wl_buffer, 0, 0); } + + /* TODO: Make the viewport path the default in all cases once GNOME finally supports viewports on cursor surfaces. */ + if (SDL_ceilf(scale) != scale && d->viewporter) { + if (!data->viewport) { + data->viewport = wp_viewporter_get_viewport(d->viewporter, data->surface); + } + wl_surface_set_buffer_scale(data->surface, 1); + wp_viewport_set_source(data->viewport, wl_fixed_from_int(-1), wl_fixed_from_int(-1), wl_fixed_from_int(-1), wl_fixed_from_int(-1)); + wp_viewport_set_destination(data->viewport, dst_width, dst_height); + wl_pointer_set_cursor(pointer, input->pointer_enter_serial, data->surface, data->hot_x, data->hot_y); + } else { + if (data->viewport) { + wp_viewport_destroy(data->viewport); + data->viewport = NULL; + } + wl_surface_set_buffer_scale(data->surface, (int32_t)scale); + wl_pointer_set_cursor(pointer, input->pointer_enter_serial, data->surface, (int32_t)(data->hot_x / scale), (int32_t)(data->hot_y / scale)); + } + if (wl_surface_get_version(data->surface) >= WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION) { wl_surface_damage_buffer(data->surface, 0, 0, SDL_MAX_SINT32, SDL_MAX_SINT32); } else { From 57f9c6f7bb324bf9e0b1fd24d29f1a00968c41c9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 6 Aug 2024 07:20:33 -0700 Subject: [PATCH 201/253] Renamed SDL_Get/SetRelativeMouseMode to SDL_Get/SetWindowRelativeMouseMode() Fixes https://github.com/libsdl-org/SDL/issues/10041 --- docs/README-migration.md | 4 + include/SDL3/SDL_mouse.h | 36 +++---- include/SDL3/SDL_video.h | 3 +- src/dynapi/SDL_dynapi.sym | 4 +- src/dynapi/SDL_dynapi_overrides.h | 4 +- src/dynapi/SDL_dynapi_procs.h | 4 +- src/events/SDL_keyboard.c | 3 + src/events/SDL_mouse.c | 11 +++ src/events/SDL_mouse_c.h | 5 + src/test/SDL_test_common.c | 11 ++- src/video/SDL_video.c | 33 ++++++- test/relative_mode.markdown | 2 +- test/testautomation_mouse.c | 155 +++++++++++++++++------------- test/testmanymouse.c | 6 +- test/testrelative.c | 12 +-- 15 files changed, 184 insertions(+), 109 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 529dae78a1c25..56e843961c96e 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -1106,6 +1106,10 @@ SDL_SystemCursor's items from SDL2 have been renamed to match CSS cursor names. The following functions have been renamed: * SDL_FreeCursor() => SDL_DestroyCursor() +The following functions have been removed: +* SDL_SetRelativeMouseMode() - replaced with SDL_SetWindowRelativeMouseMode() +* SDL_GetRelativeMouseMode() - replaced with SDL_GetWindowRelativeMouseMode() + The following symbols have been renamed: * SDL_SYSTEM_CURSOR_ARROW => SDL_SYSTEM_CURSOR_DEFAULT * SDL_SYSTEM_CURSOR_HAND => SDL_SYSTEM_CURSOR_POINTER diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index 4284eccca141c..814858ea58f89 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -288,23 +288,36 @@ extern SDL_DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, extern SDL_DECLSPEC int SDLCALL SDL_WarpMouseGlobal(float x, float y); /** - * Set relative mouse mode. + * Set relative mouse mode for a window. * - * While the mouse is in relative mode, the cursor is hidden, the mouse + * While the window has focus and relative mouse mode is enabled, the cursor is hidden, the mouse * position is constrained to the window, and SDL will report continuous * relative mouse motion even if the mouse is at the edge of the window. * - * This function will flush any pending mouse motion. + * This function will flush any pending mouse motion for this window. * + * \param window the window to change. * \param enabled SDL_TRUE to enable relative mode, SDL_FALSE to disable. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GetRelativeMouseMode + * \sa SDL_GetWindowRelativeMouseMode */ -extern SDL_DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); +extern SDL_DECLSPEC int SDLCALL SDL_SetWindowRelativeMouseMode(SDL_Window *window, SDL_bool enabled); + +/** + * Query whether relative mouse mode is enabled for a window. + * + * \param window the window to query. + * \returns SDL_TRUE if relative mode is enabled for a window or SDL_FALSE otherwise. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_SetWindowRelativeMouseMode + */ +extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowRelativeMouseMode(SDL_Window *window); /** * Capture the mouse and to track input outside an SDL window. @@ -321,7 +334,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); * mouse while the user is dragging something, until the user releases a mouse * button. It is not recommended that you capture the mouse for long periods * of time, such as the entire time your app is running. For that, you should - * probably use SDL_SetRelativeMouseMode() or SDL_SetWindowMouseGrab(), + * probably use SDL_SetWindowRelativeMouseMode() or SDL_SetWindowMouseGrab(), * depending on your goals. * * While captured, mouse events still report coordinates relative to the @@ -352,17 +365,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); */ extern SDL_DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled); -/** - * Query whether relative mouse mode is enabled. - * - * \returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise. - * - * \since This function is available since SDL 3.0.0. - * - * \sa SDL_SetRelativeMouseMode - */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void); - /** * Create a cursor using the specified bitmap data and mask (in MSB format). * diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index f78a9c16e07cd..97844ef29aaac 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -155,7 +155,8 @@ typedef Uint64 SDL_WindowFlags; #define SDL_WINDOW_MODAL SDL_UINT64_C(0x0000000000001000) /**< window is modal */ #define SDL_WINDOW_HIGH_PIXEL_DENSITY SDL_UINT64_C(0x0000000000002000) /**< window uses high pixel density back buffer if possible */ #define SDL_WINDOW_MOUSE_CAPTURE SDL_UINT64_C(0x0000000000004000) /**< window has mouse captured (unrelated to MOUSE_GRABBED) */ -#define SDL_WINDOW_ALWAYS_ON_TOP SDL_UINT64_C(0x0000000000008000) /**< window should always be above others */ +#define SDL_WINDOW_MOUSE_RELATIVE_MODE SDL_UINT64_C(0x0000000000008000) /**< window has relative mode enabled */ +#define SDL_WINDOW_ALWAYS_ON_TOP SDL_UINT64_C(0x0000000000010000) /**< window should always be above others */ #define SDL_WINDOW_UTILITY SDL_UINT64_C(0x0000000000020000) /**< window should be treated as a utility window, not showing in the task bar and window list */ #define SDL_WINDOW_TOOLTIP SDL_UINT64_C(0x0000000000040000) /**< window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window */ #define SDL_WINDOW_POPUP_MENU SDL_UINT64_C(0x0000000000080000) /**< window should be treated as a popup menu, requires a parent window */ diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 572417966d3c5..e9cc39f89228f 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -386,7 +386,6 @@ SDL3_0.0.0 { SDL_GetRectIntersectionFloat; SDL_GetRectUnion; SDL_GetRectUnionFloat; - SDL_GetRelativeMouseMode; SDL_GetRelativeMouseState; SDL_GetRenderClipRect; SDL_GetRenderColorScale; @@ -485,6 +484,7 @@ SDL3_0.0.0 { SDL_GetWindowPixelFormat; SDL_GetWindowPosition; SDL_GetWindowProperties; + SDL_GetWindowRelativeMouseMode; SDL_GetWindowSafeArea; SDL_GetWindowSize; SDL_GetWindowSizeInPixels; @@ -749,7 +749,6 @@ SDL3_0.0.0 { SDL_SetPointerProperty; SDL_SetPointerPropertyWithCleanup; SDL_SetPrimarySelectionText; - SDL_SetRelativeMouseMode; SDL_SetRenderClipRect; SDL_SetRenderColorScale; SDL_SetRenderDrawBlendMode; @@ -795,6 +794,7 @@ SDL3_0.0.0 { SDL_SetWindowMouseRect; SDL_SetWindowOpacity; SDL_SetWindowPosition; + SDL_SetWindowRelativeMouseMode; SDL_SetWindowResizable; SDL_SetWindowShape; SDL_SetWindowSize; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 7e8550db84d72..cc28c71b32761 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -411,7 +411,6 @@ #define SDL_GetRectIntersectionFloat SDL_GetRectIntersectionFloat_REAL #define SDL_GetRectUnion SDL_GetRectUnion_REAL #define SDL_GetRectUnionFloat SDL_GetRectUnionFloat_REAL -#define SDL_GetRelativeMouseMode SDL_GetRelativeMouseMode_REAL #define SDL_GetRelativeMouseState SDL_GetRelativeMouseState_REAL #define SDL_GetRenderClipRect SDL_GetRenderClipRect_REAL #define SDL_GetRenderColorScale SDL_GetRenderColorScale_REAL @@ -510,6 +509,7 @@ #define SDL_GetWindowPixelFormat SDL_GetWindowPixelFormat_REAL #define SDL_GetWindowPosition SDL_GetWindowPosition_REAL #define SDL_GetWindowProperties SDL_GetWindowProperties_REAL +#define SDL_GetWindowRelativeMouseMode SDL_GetWindowRelativeMouseMode_REAL #define SDL_GetWindowSafeArea SDL_GetWindowSafeArea_REAL #define SDL_GetWindowSize SDL_GetWindowSize_REAL #define SDL_GetWindowSizeInPixels SDL_GetWindowSizeInPixels_REAL @@ -774,7 +774,6 @@ #define SDL_SetPointerProperty SDL_SetPointerProperty_REAL #define SDL_SetPointerPropertyWithCleanup SDL_SetPointerPropertyWithCleanup_REAL #define SDL_SetPrimarySelectionText SDL_SetPrimarySelectionText_REAL -#define SDL_SetRelativeMouseMode SDL_SetRelativeMouseMode_REAL #define SDL_SetRenderClipRect SDL_SetRenderClipRect_REAL #define SDL_SetRenderColorScale SDL_SetRenderColorScale_REAL #define SDL_SetRenderDrawBlendMode SDL_SetRenderDrawBlendMode_REAL @@ -820,6 +819,7 @@ #define SDL_SetWindowMouseRect SDL_SetWindowMouseRect_REAL #define SDL_SetWindowOpacity SDL_SetWindowOpacity_REAL #define SDL_SetWindowPosition SDL_SetWindowPosition_REAL +#define SDL_SetWindowRelativeMouseMode SDL_SetWindowRelativeMouseMode_REAL #define SDL_SetWindowResizable SDL_SetWindowResizable_REAL #define SDL_SetWindowShape SDL_SetWindowShape_REAL #define SDL_SetWindowSize SDL_SetWindowSize_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 44d96651ae19b..480b38d1c10d9 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -431,7 +431,6 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectIntersection,(const SDL_Rect *a, const SDL_R SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectIntersectionFloat,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetRectUnion,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetRectUnionFloat,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRelativeMouseMode,(void),(),return) SDL_DYNAPI_PROC(SDL_MouseButtonFlags,SDL_GetRelativeMouseState,(float *a, float *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetRenderClipRect,(SDL_Renderer *a, SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetRenderColorScale,(SDL_Renderer *a, float *b),(a,b),return) @@ -530,6 +529,7 @@ SDL_DYNAPI_PROC(float,SDL_GetWindowPixelDensity,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_PixelFormat,SDL_GetWindowPixelFormat,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetWindowPosition,(SDL_Window *a, int *b, int *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetWindowProperties,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowRelativeMouseMode,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetWindowSafeArea,(SDL_Window *a, SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetWindowSize,(SDL_Window *a, int *b, int *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetWindowSizeInPixels,(SDL_Window *a, int *b, int *c),(a,b,c),return) @@ -784,7 +784,6 @@ SDL_DYNAPI_PROC(int,SDL_SetPaletteColors,(SDL_Palette *a, const SDL_Color *b, in SDL_DYNAPI_PROC(int,SDL_SetPointerProperty,(SDL_PropertiesID a, const char *b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_SetPointerPropertyWithCleanup,(SDL_PropertiesID a, const char *b, void *c, SDL_CleanupPropertyCallback d, void *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_SetPrimarySelectionText,(const char *a),(a),return) -SDL_DYNAPI_PROC(int,SDL_SetRelativeMouseMode,(SDL_bool a),(a),return) SDL_DYNAPI_PROC(int,SDL_SetRenderClipRect,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetRenderColorScale,(SDL_Renderer *a, float b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode b),(a,b),return) @@ -830,6 +829,7 @@ SDL_DYNAPI_PROC(int,SDL_SetWindowMouseGrab,(SDL_Window *a, SDL_bool b),(a,b),ret SDL_DYNAPI_PROC(int,SDL_SetWindowMouseRect,(SDL_Window *a, const SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetWindowOpacity,(SDL_Window *a, float b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetWindowPosition,(SDL_Window *a, int b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_SetWindowRelativeMouseMode,(SDL_Window *a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetWindowResizable,(SDL_Window *a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetWindowShape,(SDL_Window *a, SDL_Surface *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetWindowSize,(SDL_Window *a, int b, int c),(a,b,c),return) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index ad4bd92010574..45dbdc0e70fcc 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -357,6 +357,9 @@ int SDL_SetKeyboardFocus(SDL_Window *window) } } } + + SDL_UpdateRelativeMouseMode(); + return 0; } diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index b56fc76434127..7842f2a636283 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -1393,6 +1393,17 @@ SDL_bool SDL_GetRelativeMouseMode(void) return mouse->relative_mode; } +void SDL_UpdateRelativeMouseMode(void) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + SDL_Window *focus = SDL_GetKeyboardFocus(); + SDL_bool relative_mode = (focus && (focus->flags & SDL_WINDOW_MOUSE_RELATIVE_MODE)); + + if (relative_mode != mouse->relative_mode) { + SDL_SetRelativeMouseMode(relative_mode); + } +} + int SDL_UpdateMouseCapture(SDL_bool force_release) { SDL_Mouse *mouse = SDL_GetMouse(); diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h index acd2e7785b8eb..fd6456f91fe10 100644 --- a/src/events/SDL_mouse_c.h +++ b/src/events/SDL_mouse_c.h @@ -179,6 +179,11 @@ extern int SDL_SendMouseWheel(Uint64 timestamp, SDL_Window *window, SDL_MouseID /* Warp the mouse within the window, potentially overriding relative mode */ extern void SDL_PerformWarpMouseInWindow(SDL_Window *window, float x, float y, SDL_bool ignore_relative_mode); +/* Relative mouse mode */ +extern int SDL_SetRelativeMouseMode(SDL_bool enabled); +extern SDL_bool SDL_GetRelativeMouseMode(void); +extern void SDL_UpdateRelativeMouseMode(void); + /* TODO RECONNECT: Set mouse state to "zero" */ #if 0 extern void SDL_ResetMouse(void); diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 5f84b36495854..b84e25db21408 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -2353,9 +2353,9 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event } } if (withShift) { - SDL_Window *current_win = SDL_GetKeyboardFocus(); - if (current_win) { - const SDL_bool shouldCapture = !(SDL_GetWindowFlags(current_win) & SDL_WINDOW_MOUSE_CAPTURE); + SDL_Window *window = SDL_GetWindowFromEvent(event); + if (window) { + const SDL_bool shouldCapture = !(SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_CAPTURE); const int rc = SDL_CaptureMouse(shouldCapture); SDL_Log("%sapturing mouse %s!\n", shouldCapture ? "C" : "Unc", (rc == 0) ? "succeeded" : "failed"); } @@ -2364,7 +2364,10 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event case SDLK_R: if (withControl) { /* Ctrl-R toggle mouse relative mode */ - SDL_SetRelativeMouseMode(!SDL_GetRelativeMouseMode()); + SDL_Window *window = SDL_GetWindowFromEvent(event); + if (window) { + SDL_SetWindowRelativeMouseMode(window, !SDL_GetWindowRelativeMouseMode(window)); + } } break; case SDLK_T: diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index bd8768471a57d..590606eb1e119 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -3780,6 +3780,35 @@ const SDL_Rect *SDL_GetWindowMouseRect(SDL_Window *window) } } +int SDL_SetWindowRelativeMouseMode(SDL_Window *window, SDL_bool enabled) +{ + CHECK_WINDOW_MAGIC(window, -1); + + if (enabled == SDL_GetWindowRelativeMouseMode(window)) { + return 0; + } + + if (enabled) { + window->flags |= SDL_WINDOW_MOUSE_RELATIVE_MODE; + } else { + window->flags &= ~SDL_WINDOW_MOUSE_RELATIVE_MODE; + } + SDL_UpdateRelativeMouseMode(); + + return 0; +} + +SDL_bool SDL_GetWindowRelativeMouseMode(SDL_Window *window) +{ + CHECK_WINDOW_MAGIC(window, SDL_FALSE); + + if (window->flags & SDL_WINDOW_MOUSE_RELATIVE_MODE) { + return SDL_TRUE; + } else { + return SDL_FALSE; + } +} + int SDL_FlashWindow(SDL_Window *window, SDL_FlashOperation operation) { CHECK_WINDOW_MAGIC(window, -1); @@ -5389,7 +5418,6 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID) { int dummybutton; int retval = -1; - SDL_bool relative_mode; SDL_bool show_cursor_prev; SDL_Window *current_window; SDL_MessageBoxData mbdata; @@ -5403,7 +5431,6 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID) (void)SDL_AtomicIncRef(&SDL_messagebox_count); current_window = SDL_GetKeyboardFocus(); - relative_mode = SDL_GetRelativeMouseMode(); SDL_UpdateMouseCapture(SDL_FALSE); SDL_SetRelativeMouseMode(SDL_FALSE); show_cursor_prev = SDL_CursorVisible(); @@ -5477,7 +5504,7 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID) if (!show_cursor_prev) { SDL_HideCursor(); } - SDL_SetRelativeMouseMode(relative_mode); + SDL_UpdateRelativeMouseMode(); SDL_UpdateMouseCapture(SDL_FALSE); return retval; diff --git a/test/relative_mode.markdown b/test/relative_mode.markdown index 23f04f5fe0a31..bd99c9f0181d5 100644 --- a/test/relative_mode.markdown +++ b/test/relative_mode.markdown @@ -42,7 +42,7 @@ Code SDL_Init(SDL_INIT_VIDEO); win = SDL_CreateWindow("Test", 800, 600, 0); - SDL_SetRelativeMouseMode(SDL_TRUE); + SDL_SetWindowRelativeMouseMode(win, SDL_TRUE); while (1) { diff --git a/test/testautomation_mouse.c b/test/testautomation_mouse.c index f24da3a6527bf..fa33f9a1204ed 100644 --- a/test/testautomation_mouse.c +++ b/test/testautomation_mouse.c @@ -342,87 +342,97 @@ static int mouse_getCursor(void *arg) return TEST_COMPLETED; } +#define MOUSE_TESTWINDOW_WIDTH 320 +#define MOUSE_TESTWINDOW_HEIGHT 200 + +/** + * Creates a test window + */ +static SDL_Window *createMouseSuiteTestWindow(void) +{ + int width = MOUSE_TESTWINDOW_WIDTH, height = MOUSE_TESTWINDOW_HEIGHT; + SDL_Window *window; + window = SDL_CreateWindow("mousecreateMouseSuiteTestWindow", width, height, 0); + SDLTest_AssertPass("SDL_CreateWindow()"); + SDLTest_AssertCheck(window != NULL, "Check SDL_CreateWindow result"); + return window; +} + +/** + * Destroy test window + */ +static void destroyMouseSuiteTestWindow(SDL_Window *window) +{ + if (window) { + SDL_DestroyWindow(window); + window = NULL; + SDLTest_AssertPass("SDL_DestroyWindow()"); + } +} + /** - * Check call to SDL_GetRelativeMouseMode and SDL_SetRelativeMouseMode + * Check call to SDL_GetWindowRelativeMouseMode and SDL_SetWindowRelativeMouseMode * - * \sa SDL_GetRelativeMouseMode - * \sa SDL_SetRelativeMouseMode + * \sa SDL_GetWindowRelativeMouseMode + * \sa SDL_SetWindowRelativeMouseMode */ static int mouse_getSetRelativeMouseMode(void *arg) { + SDL_Window *window; int result; int i; SDL_bool initialState; SDL_bool currentState; + /* Create test window */ + window = createMouseSuiteTestWindow(); + if (!window) { + return TEST_ABORTED; + } + /* Capture original state so we can revert back to it later */ - initialState = SDL_GetRelativeMouseMode(); - SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()"); + initialState = SDL_GetWindowRelativeMouseMode(window); + SDLTest_AssertPass("Call to SDL_GetWindowRelativeMouseMode(window)"); /* Repeat twice to check D->D transition */ for (i = 0; i < 2; i++) { /* Disable - should always be supported */ - result = SDL_SetRelativeMouseMode(SDL_FALSE); - SDLTest_AssertPass("Call to SDL_SetRelativeMouseMode(FALSE)"); - SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetRelativeMouseMode, expected: 0, got: %i", result); - currentState = SDL_GetRelativeMouseMode(); - SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()"); + result = SDL_SetWindowRelativeMouseMode(window, SDL_FALSE); + SDLTest_AssertPass("Call to SDL_SetWindowRelativeMouseMode(window, FALSE)"); + SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetWindowRelativeMouseMode, expected: 0, got: %i", result); + currentState = SDL_GetWindowRelativeMouseMode(window); + SDLTest_AssertPass("Call to SDL_GetWindowRelativeMouseMode(window)"); SDLTest_AssertCheck(currentState == SDL_FALSE, "Validate current state is FALSE, got: %i", currentState); } /* Repeat twice to check D->E->E transition */ for (i = 0; i < 2; i++) { /* Enable - may not be supported */ - result = SDL_SetRelativeMouseMode(SDL_TRUE); - SDLTest_AssertPass("Call to SDL_SetRelativeMouseMode(TRUE)"); + result = SDL_SetWindowRelativeMouseMode(window, SDL_TRUE); + SDLTest_AssertPass("Call to SDL_SetWindowRelativeMouseMode(window, TRUE)"); if (result != -1) { - SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetRelativeMouseMode, expected: 0, got: %i", result); - currentState = SDL_GetRelativeMouseMode(); - SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()"); + SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetWindowRelativeMouseMode, expected: 0, got: %i", result); + currentState = SDL_GetWindowRelativeMouseMode(window); + SDLTest_AssertPass("Call to SDL_GetWindowRelativeMouseMode(window)"); SDLTest_AssertCheck(currentState == SDL_TRUE, "Validate current state is TRUE, got: %i", currentState); } } /* Disable to check E->D transition */ - result = SDL_SetRelativeMouseMode(SDL_FALSE); - SDLTest_AssertPass("Call to SDL_SetRelativeMouseMode(FALSE)"); - SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetRelativeMouseMode, expected: 0, got: %i", result); - currentState = SDL_GetRelativeMouseMode(); - SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()"); + result = SDL_SetWindowRelativeMouseMode(window, SDL_FALSE); + SDLTest_AssertPass("Call to SDL_SetWindowRelativeMouseMode(window, FALSE)"); + SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetWindowRelativeMouseMode, expected: 0, got: %i", result); + currentState = SDL_GetWindowRelativeMouseMode(window); + SDLTest_AssertPass("Call to SDL_GetWindowRelativeMouseMode(window)"); SDLTest_AssertCheck(currentState == SDL_FALSE, "Validate current state is FALSE, got: %i", currentState); /* Revert to original state - ignore result */ - result = SDL_SetRelativeMouseMode(initialState); + result = SDL_SetWindowRelativeMouseMode(window, initialState); - return TEST_COMPLETED; -} - -#define MOUSE_TESTWINDOW_WIDTH 320 -#define MOUSE_TESTWINDOW_HEIGHT 200 - -/** - * Creates a test window - */ -static SDL_Window *createMouseSuiteTestWindow(void) -{ - int width = MOUSE_TESTWINDOW_WIDTH, height = MOUSE_TESTWINDOW_HEIGHT; - SDL_Window *window; - window = SDL_CreateWindow("mousecreateMouseSuiteTestWindow", width, height, 0); - SDLTest_AssertPass("SDL_CreateWindow()"); - SDLTest_AssertCheck(window != NULL, "Check SDL_CreateWindow result"); - return window; -} + /* Clean up test window */ + destroyMouseSuiteTestWindow(window); -/** - * Destroy test window - */ -static void destroyMouseSuiteTestWindow(SDL_Window *window) -{ - if (window) { - SDL_DestroyWindow(window); - window = NULL; - SDLTest_AssertPass("SDL_DestroyWindow()"); - } + return TEST_COMPLETED; } /** @@ -598,58 +608,69 @@ static int mouse_getGlobalMouseState(void *arg) /* ================= Test References ================== */ /* Mouse test cases */ -static const SDLTest_TestCaseReference mouseTest1 = { +static const SDLTest_TestCaseReference mouseTestGetMouseState = { (SDLTest_TestCaseFp)mouse_getMouseState, "mouse_getMouseState", "Check call to SDL_GetMouseState", TEST_ENABLED }; -static const SDLTest_TestCaseReference mouseTest2 = { +static const SDLTest_TestCaseReference mouseTestGetRelativeMouseState = { (SDLTest_TestCaseFp)mouse_getRelativeMouseState, "mouse_getRelativeMouseState", "Check call to SDL_GetRelativeMouseState", TEST_ENABLED }; -static const SDLTest_TestCaseReference mouseTest3 = { +static const SDLTest_TestCaseReference mouseTestCreateFreeCursor = { (SDLTest_TestCaseFp)mouse_createFreeCursor, "mouse_createFreeCursor", "Check call to SDL_CreateCursor and SDL_DestroyCursor", TEST_ENABLED }; -static const SDLTest_TestCaseReference mouseTest4 = { +static const SDLTest_TestCaseReference mouseTestShowCursor = { (SDLTest_TestCaseFp)mouse_showCursor, "mouse_showCursor", "Check call to SDL_ShowCursor", TEST_ENABLED }; -static const SDLTest_TestCaseReference mouseTest5 = { +static const SDLTest_TestCaseReference mouseTestSetCursor = { (SDLTest_TestCaseFp)mouse_setCursor, "mouse_setCursor", "Check call to SDL_SetCursor", TEST_ENABLED }; -static const SDLTest_TestCaseReference mouseTest6 = { +static const SDLTest_TestCaseReference mouseTestGetCursor = { (SDLTest_TestCaseFp)mouse_getCursor, "mouse_getCursor", "Check call to SDL_GetCursor", TEST_ENABLED }; -static const SDLTest_TestCaseReference mouseTest7 = { +static const SDLTest_TestCaseReference mouseTestWarpMouseInWindow = { (SDLTest_TestCaseFp)mouse_warpMouseInWindow, "mouse_warpMouseInWindow", "Check call to SDL_WarpMouseInWindow", TEST_ENABLED }; -static const SDLTest_TestCaseReference mouseTest8 = { - (SDLTest_TestCaseFp)mouse_getMouseFocus, "mouse_getMouseFocus", "Check call to SDL_getMouseFocus", TEST_ENABLED +static const SDLTest_TestCaseReference mouseTestGetMouseFocus = { + (SDLTest_TestCaseFp)mouse_getMouseFocus, "mouse_getMouseFocus", "Check call to SDL_GetMouseFocus", TEST_ENABLED }; -static const SDLTest_TestCaseReference mouseTest9 = { +static const SDLTest_TestCaseReference mouseTestCreateFreeColorCursor = { (SDLTest_TestCaseFp)mouse_createFreeColorCursor, "mouse_createFreeColorCursor", "Check call to SDL_CreateColorCursor and SDL_DestroyCursor", TEST_ENABLED }; -static const SDLTest_TestCaseReference mouseTest10 = { - (SDLTest_TestCaseFp)mouse_getSetRelativeMouseMode, "mouse_getSetRelativeMouseMode", "Check call to SDL_GetRelativeMouseMode and SDL_SetRelativeMouseMode", TEST_ENABLED +static const SDLTest_TestCaseReference mouseTestGetSetRelativeMouseMode = { + (SDLTest_TestCaseFp)mouse_getSetRelativeMouseMode, "mouse_getSetRelativeMouseMode", "Check call to SDL_GetWindowRelativeMouseMode and SDL_SetWindowRelativeMouseMode", TEST_ENABLED }; -static const SDLTest_TestCaseReference mouseTest11 = { - (SDLTest_TestCaseFp)mouse_getDefaultCursor, "mouse_getDefaultCursor", "Check call to mouse_getDefaultCursor", TEST_ENABLED +static const SDLTest_TestCaseReference mouseTestGetDefaultCursor = { + (SDLTest_TestCaseFp)mouse_getDefaultCursor, "mouse_getDefaultCursor", "Check call to SDL_GetDefaultCursor", TEST_ENABLED }; -static const SDLTest_TestCaseReference mouseTest12 = { - (SDLTest_TestCaseFp)mouse_getGlobalMouseState, "mouse_getGlobalMouseState", "Check call to mouse_getGlobalMouseState", TEST_ENABLED +static const SDLTest_TestCaseReference mouseTestGetGlobalMouseState = { + (SDLTest_TestCaseFp)mouse_getGlobalMouseState, "mouse_getGlobalMouseState", "Check call to SDL_GetGlobalMouseState", TEST_ENABLED }; /* Sequence of Mouse test cases */ static const SDLTest_TestCaseReference *mouseTests[] = { - &mouseTest1, &mouseTest2, &mouseTest3, &mouseTest4, &mouseTest5, &mouseTest6, - &mouseTest7, &mouseTest8, &mouseTest9, &mouseTest10, &mouseTest11, &mouseTest12, NULL + &mouseTestGetMouseState, + &mouseTestGetRelativeMouseState, + &mouseTestCreateFreeCursor, + &mouseTestShowCursor, + &mouseTestSetCursor, + &mouseTestGetCursor, + &mouseTestWarpMouseInWindow, + &mouseTestGetMouseFocus, + &mouseTestCreateFreeColorCursor, + &mouseTestGetSetRelativeMouseMode, + &mouseTestGetDefaultCursor, + &mouseTestGetGlobalMouseState, + NULL }; /* Mouse test suite (global) */ diff --git a/test/testmanymouse.c b/test/testmanymouse.c index 03c672ce3e385..6ee9a7d96d801 100644 --- a/test/testmanymouse.c +++ b/test/testmanymouse.c @@ -538,10 +538,10 @@ int main(int argc, char *argv[]) SDL_SetPointerProperty(SDL_GetRendererProperties(renderer), PROP_ARROW_CURSOR_TEXTURE, cursor_arrow); SDL_SetPointerProperty(SDL_GetRendererProperties(renderer), PROP_CROSS_CURSOR_TEXTURE, cursor_cross); - } - /* We only get mouse motion for distinct devices when relative mode is enabled */ - SDL_SetRelativeMouseMode(SDL_TRUE); + /* We only get mouse motion for distinct devices when relative mode is enabled */ + SDL_SetWindowRelativeMouseMode(state->windows[i], SDL_TRUE); + } /* Main render loop */ done = 0; diff --git a/test/testrelative.c b/test/testrelative.c index 1671217dd348a..12e21a9323ba9 100644 --- a/test/testrelative.c +++ b/test/testrelative.c @@ -32,11 +32,7 @@ static void DrawRects(SDL_Renderer *renderer) SDL_RenderFillRect(renderer, &rect); SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); - if (SDL_GetRelativeMouseMode()) { - SDLTest_DrawString(renderer, 0.f, 0.f, "Relative Mode: Enabled"); - } else { - SDLTest_DrawString(renderer, 0.f, 0.f, "Relative Mode: Disabled"); - } + SDLTest_DrawString(renderer, 0.f, 0.f, "Relative Mode: Enabled"); } static void CenterMouse() @@ -196,8 +192,10 @@ int main(int argc, char *argv[]) */ if (warp) { SDL_HideCursor(); - } else if (SDL_SetRelativeMouseMode(SDL_TRUE) < 0) { - return 3; /* Relative mode failed, just exit. */ + } else { + for (i = 0; i < state->num_windows; ++i) { + SDL_SetWindowRelativeMouseMode(state->windows[i], SDL_TRUE); + } } rect.x = DEFAULT_WINDOW_WIDTH / 2; From 627cb8acd09e6cbf8362d808634a26f37382c73d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 6 Aug 2024 07:36:42 -0700 Subject: [PATCH 202/253] SDL_EventFilter functions now return SDL_bool --- docs/README-migration.md | 2 ++ include/SDL3/SDL_events.h | 10 +++++----- src/events/SDL_windowevents.c | 6 +++--- src/joystick/SDL_gamepad.c | 4 ++-- src/main/SDL_main_callbacks.c | 4 ++-- src/render/SDL_render.c | 4 ++-- test/testautomation_clipboard.c | 4 ++-- test/testautomation_events.c | 4 ++-- 8 files changed, 20 insertions(+), 18 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 56e843961c96e..aebcd7ecb7d04 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -379,6 +379,8 @@ SDL_AddEventWatch() now returns -1 if it fails because it ran out of memory and SDL_RegisterEvents() now returns 0 if it couldn't allocate any user events. +SDL_EventFilter functions now return SDL_bool. + The following symbols have been renamed: * SDL_APP_DIDENTERBACKGROUND => SDL_EVENT_DID_ENTER_BACKGROUND * SDL_APP_DIDENTERFOREGROUND => SDL_EVENT_DID_ENTER_FOREGROUND diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index 4c113f9a3efce..6e5a305e51003 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -1218,7 +1218,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event); * \param userdata what was passed as `userdata` to SDL_SetEventFilter() or * SDL_AddEventWatch, etc. * \param event the event that triggered the callback. - * \returns 1 to permit event to be added to the queue, and 0 to disallow it. + * \returns SDL_TRUE to permit event to be added to the queue, and SDL_FALSE to disallow it. * When used with SDL_AddEventWatch, the return value is ignored. * * \threadsafety SDL may call this callback at any time from any thread; the @@ -1230,14 +1230,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event); * \sa SDL_SetEventFilter * \sa SDL_AddEventWatch */ -typedef int (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event); +typedef SDL_bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event); /** * Set up a filter to process all events before they change internal state and * are posted to the internal event queue. * - * If the filter function returns 1 when called, then the event will be added - * to the internal queue. If it returns 0, then the event will be dropped from + * If the filter function returns SDL_TRUE when called, then the event will be added + * to the internal queue. If it returns SDL_FALSE, then the event will be dropped from * the queue, but the internal state will still be updated. This allows * selective filtering of dynamically arriving events. * @@ -1346,7 +1346,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter, void /** * Run a specific filter function on the current event queue, removing any - * events for which the filter returns 0. + * events for which the filter returns SDL_FALSE. * * See SDL_SetEventFilter() for more information. Unlike SDL_SetEventFilter(), * this function does not change the filter permanently, it only uses the diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c index 80fd511c151be..262f3da27c58a 100644 --- a/src/events/SDL_windowevents.c +++ b/src/events/SDL_windowevents.c @@ -26,16 +26,16 @@ #include "SDL_mouse_c.h" -static int SDLCALL RemoveSupercededWindowEvents(void *userdata, SDL_Event *event) +static SDL_bool SDLCALL RemoveSupercededWindowEvents(void *userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; if (event->type == new_event->type && event->window.windowID == new_event->window.windowID) { /* We're about to post a new move event, drop the old one */ - return 0; + return SDL_FALSE; } - return 1; + return SDL_TRUE; } int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c index 0d9648ab0463f..d08d83b24a928 100644 --- a/src/joystick/SDL_gamepad.c +++ b/src/joystick/SDL_gamepad.c @@ -363,7 +363,7 @@ static void SDL_PrivateGamepadRemapped(SDL_JoystickID instance_id) /* * Event filter to fire gamepad events from joystick ones */ -static int SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event) +static SDL_bool SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event) { SDL_Gamepad *gamepad; @@ -422,7 +422,7 @@ static int SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event) break; } - return 1; + return SDL_TRUE; } /* SDL defines sensor orientation relative to the device natural diff --git a/src/main/SDL_main_callbacks.c b/src/main/SDL_main_callbacks.c index f867b62ba9e60..c247632fc5583 100644 --- a/src/main/SDL_main_callbacks.c +++ b/src/main/SDL_main_callbacks.c @@ -69,7 +69,7 @@ static void SDL_DispatchMainCallbackEvents(void) } } -static int SDLCALL SDL_MainCallbackEventWatcher(void *userdata, SDL_Event *event) +static SDL_bool SDLCALL SDL_MainCallbackEventWatcher(void *userdata, SDL_Event *event) { if (ShouldDispatchImmediately(event)) { // Make sure any currently queued events are processed then dispatch this before continuing @@ -78,7 +78,7 @@ static int SDLCALL SDL_MainCallbackEventWatcher(void *userdata, SDL_Event *event } else { // We'll process this event later from the main event queue } - return 0; + return SDL_TRUE; } SDL_bool SDL_HasMainCallbacks(void) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 17b24a171d21e..5886a286ec5c7 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -818,7 +818,7 @@ const char *SDL_GetRenderDriver(int index) #endif } -static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event) +static SDL_bool SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event) { SDL_Renderer *renderer = (SDL_Renderer *)userdata; @@ -855,7 +855,7 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event) UpdateHDRProperties(renderer); } - return 0; + return SDL_TRUE; } int SDL_CreateWindowAndRenderer(const char *title, int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer) diff --git a/test/testautomation_clipboard.c b/test/testautomation_clipboard.c index 1b67434f184c5..5b1c4a4f39a5f 100644 --- a/test/testautomation_clipboard.c +++ b/test/testautomation_clipboard.c @@ -9,12 +9,12 @@ static int clipboard_update_count; -static int ClipboardEventWatch(void *userdata, SDL_Event *event) +static SDL_bool ClipboardEventWatch(void *userdata, SDL_Event *event) { if (event->type == SDL_EVENT_CLIPBOARD_UPDATE) { ++clipboard_update_count; } - return 0; + return SDL_TRUE; } enum diff --git a/test/testautomation_events.c b/test/testautomation_events.c index b7fae05d5c73f..71c4de8e84c56 100644 --- a/test/testautomation_events.c +++ b/test/testautomation_events.c @@ -25,7 +25,7 @@ static int g_userdataValue2 = 2; #define MAX_ITERATIONS 100 /* Event filter that sets some flags and optionally checks userdata */ -static int SDLCALL events_sampleNullEventFilter(void *userdata, SDL_Event *event) +static SDL_bool SDLCALL events_sampleNullEventFilter(void *userdata, SDL_Event *event) { g_eventFilterCalled = 1; @@ -36,7 +36,7 @@ static int SDLCALL events_sampleNullEventFilter(void *userdata, SDL_Event *event } } - return 0; + return SDL_TRUE; } /** From 57fa3bc08e5e8b7c713f81b1f90a672b150508cc Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 6 Aug 2024 15:00:23 +0000 Subject: [PATCH 203/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_events.h | 13 +++++++------ include/SDL3/SDL_mouse.h | 10 ++++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index 6e5a305e51003..1bf311f819d32 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -1218,8 +1218,9 @@ extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event); * \param userdata what was passed as `userdata` to SDL_SetEventFilter() or * SDL_AddEventWatch, etc. * \param event the event that triggered the callback. - * \returns SDL_TRUE to permit event to be added to the queue, and SDL_FALSE to disallow it. - * When used with SDL_AddEventWatch, the return value is ignored. + * \returns SDL_TRUE to permit event to be added to the queue, and SDL_FALSE + * to disallow it. When used with SDL_AddEventWatch, the return value + * is ignored. * * \threadsafety SDL may call this callback at any time from any thread; the * application is responsible for locking resources the callback @@ -1236,10 +1237,10 @@ typedef SDL_bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event); * Set up a filter to process all events before they change internal state and * are posted to the internal event queue. * - * If the filter function returns SDL_TRUE when called, then the event will be added - * to the internal queue. If it returns SDL_FALSE, then the event will be dropped from - * the queue, but the internal state will still be updated. This allows - * selective filtering of dynamically arriving events. + * If the filter function returns SDL_TRUE when called, then the event will be + * added to the internal queue. If it returns SDL_FALSE, then the event will + * be dropped from the queue, but the internal state will still be updated. + * This allows selective filtering of dynamically arriving events. * * **WARNING**: Be very careful of what you do in the event filter function, * as it may run in a different thread! diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index 814858ea58f89..74954d63d5442 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -290,9 +290,10 @@ extern SDL_DECLSPEC int SDLCALL SDL_WarpMouseGlobal(float x, float y); /** * Set relative mouse mode for a window. * - * While the window has focus and relative mouse mode is enabled, the cursor is hidden, the mouse - * position is constrained to the window, and SDL will report continuous - * relative mouse motion even if the mouse is at the edge of the window. + * While the window has focus and relative mouse mode is enabled, the cursor + * is hidden, the mouse position is constrained to the window, and SDL will + * report continuous relative mouse motion even if the mouse is at the edge of + * the window. * * This function will flush any pending mouse motion for this window. * @@ -311,7 +312,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetWindowRelativeMouseMode(SDL_Window *windo * Query whether relative mouse mode is enabled for a window. * * \param window the window to query. - * \returns SDL_TRUE if relative mode is enabled for a window or SDL_FALSE otherwise. + * \returns SDL_TRUE if relative mode is enabled for a window or SDL_FALSE + * otherwise. * * \since This function is available since SDL 3.0.0. * From 10abe1a75bf3ce781aaddd0a03a94d73e5de69b9 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 6 Aug 2024 11:13:58 -0400 Subject: [PATCH 204/253] wayland: Free the scaled cursor surface if SHM allocation fails --- src/video/wayland/SDL_waylandmouse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index 69af379e7745e..30570c67ccb06 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -466,8 +466,8 @@ static Wayland_CachedCustomCursor *Wayland_GetCachedCustomCursor(SDL_Cursor *cur /* Allocate shared memory buffer for this cursor */ if (Wayland_AllocSHMBuffer(surface->w, surface->h, &cache->shmBuffer) != 0) { - SDL_free(cursor->internal); - SDL_free(cursor); + SDL_free(cache); + SDL_DestroySurface(surface); return NULL; } From 0e37bc7c3ff441cce201bdded0f1ace11702c648 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 6 Aug 2024 11:17:13 -0400 Subject: [PATCH 205/253] wayland: Bail out if a null cached cursor is returned --- src/video/wayland/SDL_waylandmouse.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index 30570c67ccb06..3a88fcf06daab 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -718,6 +718,9 @@ static int Wayland_ShowCursor(SDL_Cursor *cursor) } } else { Wayland_CachedCustomCursor *cached = Wayland_GetCachedCustomCursor(cursor); + if (!cached) { + return -1; + } dst_width = cached->dst_width; dst_height = cached->dst_height; scale = cached->scale; From 75d89f8e12f7fe39f394b54a0453baced6c36417 Mon Sep 17 00:00:00 2001 From: Ivan Mogilko Date: Fri, 13 Oct 2023 20:43:19 +0300 Subject: [PATCH 206/253] Fix potential access violation in testautomation_clipboard.c --- test/testautomation_clipboard.c | 80 ++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 30 deletions(-) diff --git a/test/testautomation_clipboard.c b/test/testautomation_clipboard.c index 5b1c4a4f39a5f..7e1ae3a9a5e76 100644 --- a/test/testautomation_clipboard.c +++ b/test/testautomation_clipboard.c @@ -176,13 +176,18 @@ static int clipboard_testClipboardDataFunctions(void *arg) "Verify has test text data, expected SDL_TRUE, got SDL_FALSE"); text = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT], &size); SDLTest_AssertCheck( - text && text[size] == '\0', - "Verify test text data, expected null termination, got %c", - text[size]); - SDLTest_AssertCheck( - text && SDL_strcmp(text, expected_text) == 0, - "Verify test text data, expected \"%s\", got \"%s\"", - expected_text, text); + text != NULL, + "Verify has test text data, expected valid result, got NULL"); + if (text) { + SDLTest_AssertCheck( + text[size] == '\0', + "Verify test text data, expected null termination, got %c", + text[size]); + SDLTest_AssertCheck( + SDL_strcmp(text, expected_text) == 0, + "Verify test text data, expected \"%s\", got \"%s\"", + expected_text, text); + } SDLTest_AssertCheck( size == SDL_strlen(expected_text), "Verify test text size, expected %d, got %d", @@ -196,13 +201,18 @@ static int clipboard_testClipboardDataFunctions(void *arg) "Verify has test text data, expected SDL_TRUE, got SDL_FALSE"); text = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_CUSTOM_TEXT], &size); SDLTest_AssertCheck( - text && text[size] == '\0', - "Verify test text data, expected null termination, got %c", - text[size]); - SDLTest_AssertCheck( - text && SDL_strcmp(text, expected_text) == 0, - "Verify test text data, expected \"%s\", got \"%s\"", - expected_text, text); + text != NULL, + "Verify has test text data, expected valid result, got NULL"); + if (text) { + SDLTest_AssertCheck( + text[size] == '\0', + "Verify test text data, expected null termination, got %c", + text[size]); + SDLTest_AssertCheck( + SDL_strcmp(text, expected_text) == 0, + "Verify test text data, expected \"%s\", got \"%s\"", + expected_text, text); + } SDLTest_AssertCheck( size == SDL_strlen(expected_text), "Verify test text size, expected %d, got %d", @@ -215,7 +225,7 @@ static int clipboard_testClipboardDataFunctions(void *arg) "Verify has test text data, expected SDL_TRUE, got SDL_FALSE"); data = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_DATA], &size); SDLTest_AssertCheck( - SDL_memcmp(data, test_data1.data, test_data1.data_size) == 0, + data && SDL_memcmp(data, test_data1.data, test_data1.data_size) == 0, "Verify test data"); SDLTest_AssertCheck( size == test_data1.data_size, @@ -278,13 +288,18 @@ static int clipboard_testClipboardDataFunctions(void *arg) "Verify has test text data, expected SDL_TRUE, got SDL_FALSE"); text = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT], &size); SDLTest_AssertCheck( - text && text[size] == '\0', - "Verify test text data, expected null termination, got %c", - text[size]); - SDLTest_AssertCheck( - text && SDL_strcmp(text, expected_text) == 0, - "Verify test text data, expected \"%s\", got \"%s\"", - expected_text, text); + text != NULL, + "Verify has test text data, expected valid result, got NULL"); + if (text) { + SDLTest_AssertCheck( + text[size] == '\0', + "Verify test text data, expected null termination, got %c", + text[size]); + SDLTest_AssertCheck( + SDL_strcmp(text, expected_text) == 0, + "Verify test text data, expected \"%s\", got \"%s\"", + expected_text, text); + } SDLTest_AssertCheck( size == SDL_strlen(expected_text), "Verify test text size, expected %d, got %d", @@ -298,13 +313,18 @@ static int clipboard_testClipboardDataFunctions(void *arg) "Verify has test text data, expected SDL_TRUE, got SDL_FALSE"); text = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_CUSTOM_TEXT], &size); SDLTest_AssertCheck( - text && text[size] == '\0', - "Verify test text data, expected null termination, got %c", - text[size]); - SDLTest_AssertCheck( - text && SDL_strcmp(text, expected_text) == 0, - "Verify test text data, expected \"%s\", got \"%s\"", - expected_text, text); + text != NULL, + "Verify has test text data, expected valid result, got NULL"); + if (text) { + SDLTest_AssertCheck( + text[size] == '\0', + "Verify test text data, expected null termination, got %c", + text[size]); + SDLTest_AssertCheck( + SDL_strcmp(text, expected_text) == 0, + "Verify test text data, expected \"%s\", got \"%s\"", + expected_text, text); + } SDLTest_AssertCheck( size == SDL_strlen(expected_text), "Verify test text size, expected %d, got %d", @@ -313,7 +333,7 @@ static int clipboard_testClipboardDataFunctions(void *arg) data = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_DATA], &size); SDLTest_AssertCheck( - SDL_memcmp(data, test_data2.data, test_data2.data_size) == 0, + data && SDL_memcmp(data, test_data2.data, test_data2.data_size) == 0, "Verify test data"); SDLTest_AssertCheck( size == test_data2.data_size, From 0fa2049fef2abe24bd8307ee5605edad96240848 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 6 Aug 2024 17:12:25 +0000 Subject: [PATCH 207/253] Document iconv functions + add testautomation (#10131) * stdinc: document SDL_iconv* functions * iconv: add automation tests * iconv: don't potentially crash on invalid inputs --- include/SDL3/SDL_stdinc.h | 66 +++++++++++++++++- src/stdlib/SDL_iconv.c | 14 +++- test/testautomation_stdlib.c | 129 +++++++++++++++++++++++++++++++++++ 3 files changed, 204 insertions(+), 5 deletions(-) diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index 14e07509952c3..cbd374432a942 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -2899,14 +2899,70 @@ extern SDL_DECLSPEC float SDLCALL SDL_tanf(float x); #define SDL_ICONV_EILSEQ (size_t)-3 #define SDL_ICONV_EINVAL (size_t)-4 -/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */ typedef struct SDL_iconv_data_t *SDL_iconv_t; + +/** + * This function allocates a context for the specified character set conversion. + * + * \param tocode The target character encoding, must not be NULL. + * \param fromcode The source character encoding, must not be NULL. + * \returns a handle that must be freed with SDL_iconv_close, + * or SDL_ICONV_ERROR on failure. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_iconv + * \sa SDL_iconv_close + * \sa SDL_iconv_string + */ extern SDL_DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode); + +/** + * This function frees a context used for character set conversion. + * + * \param cd The character set conversion handle. + * \returns 0 on success, or -1 on failure. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_iconv + * \sa SDL_iconv_open + * \sa SDL_iconv_string + */ extern SDL_DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); + +/** + * This function converts text between encodings, reading from and writing to a buffer. + * It returns the number of succesful conversions. + * + * \param cd The character set conversion context, created in SDL_iconv_open(). + * \param inbuf Address of variable that points to the first character of the input sequence. + * \param inbytesleft The number of bytes in the input buffer. + * \param outbuf Address of variable that points to the output buffer. + * \param outbytesleft The number of bytes in the output buffer. + * \returns the number of conversions on success, else + * SDL_ICONV_E2BIG is returned when the output buffer is too small, or + * SDL_ICONV_EILSEQ is returned when an invalid input sequence is encountered, or + * SDL_ICONV_EINVAL is returned when an incomplete input sequence is encountered. + * + * On exit: + * - inbuf will point to the beginning of the next multibyte sequence. + * On error, this is the location of the problematic input sequence. + * On success, this is the end of the input sequence. + * - inbytesleft will be set to the number of bytes left to convert, which will be 0 on success. + * - outbuf will point to the location where to store the next output byte. + * - outbytesleft will be set to the number of bytes left in the output buffer. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_iconv_open + * \sa SDL_iconv_close + * \sa SDL_iconv_string + */ extern SDL_DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, - size_t * inbytesleft, char **outbuf, - size_t * outbytesleft); + size_t *inbytesleft, char **outbuf, + size_t *outbytesleft); /** * Helper function to convert a string's encoding in one call. @@ -2928,6 +2984,10 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, * \returns a new string, converted to the new encoding, or NULL on error. * * \since This function is available since SDL 3.0.0. + * + * \sa SDL_iconv_open + * \sa SDL_iconv_close + * \sa SDL_iconv */ extern SDL_DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, diff --git a/src/stdlib/SDL_iconv.c b/src/stdlib/SDL_iconv.c index dfda45b480b72..b31ee0c42c198 100644 --- a/src/stdlib/SDL_iconv.c +++ b/src/stdlib/SDL_iconv.c @@ -39,6 +39,9 @@ SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode) int SDL_iconv_close(SDL_iconv_t cd) { + if ((size_t)cd == SDL_ICONV_ERROR) { + return -1; + } return iconv_close((iconv_t)((uintptr_t)cd)); } @@ -46,6 +49,9 @@ size_t SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { + if ((size_t)cd == SDL_ICONV_ERROR) { + return SDL_ICONV_ERROR; + } /* iconv's second parameter may or may not be `const char const *` depending on the C runtime's whims. Casting to void * seems to make everyone happy, though. */ const size_t retCode = iconv((iconv_t)((uintptr_t)cd), (void *)inbuf, inbytesleft, outbuf, outbytesleft); @@ -236,6 +242,9 @@ size_t SDL_iconv(SDL_iconv_t cd, Uint32 ch = 0; size_t total; + if ((size_t)cd == SDL_ICONV_ERROR) { + return SDL_ICONV_ERROR; + } if (!inbuf || !*inbuf) { /* Reset the context */ return 0; @@ -769,9 +778,10 @@ size_t SDL_iconv(SDL_iconv_t cd, int SDL_iconv_close(SDL_iconv_t cd) { - if (cd != (SDL_iconv_t)-1) { - SDL_free(cd); + if (cd == (SDL_iconv_t)-1) { + return -1; } + SDL_free(cd); return 0; } diff --git a/test/testautomation_stdlib.c b/test/testautomation_stdlib.c index 44a0907264019..5e649ab391ab5 100644 --- a/test/testautomation_stdlib.c +++ b/test/testautomation_stdlib.c @@ -1064,6 +1064,130 @@ stdlib_overflow(void *arg) return TEST_COMPLETED; } +static void format_for_description(char *buffer, size_t buflen, const char *text) { + if (text == NULL) { + SDL_strlcpy(buffer, "NULL", buflen); + } else { + SDL_snprintf(buffer, buflen, "\"%s\"", text); + } +} + +static int +stdlib_iconv(void *arg) +{ + struct { + SDL_bool expect_success; + const char *from_encoding; + const char *text; + const char *to_encoding; + const char *expected; + } inputs[] = { + { SDL_FALSE, "bogus-from-encoding", NULL, "bogus-to-encoding", NULL }, + { SDL_FALSE, "bogus-from-encoding", "hello world", "bogus-to-encoding", NULL }, + { SDL_FALSE, "bogus-from-encoding", "hello world", "ascii", NULL }, + { SDL_TRUE, "utf-8", NULL, "ascii", "" }, + { SDL_TRUE, "utf-8", "hello world", "ascii", "hello world" }, + { SDL_TRUE, "utf-8", "\xe2\x8c\xa8\xf0\x9f\x92\xbb", "utf-16le", "\x28\x23\x3d\xd8\xbb\xdc\x00" }, + }; + SDL_iconv_t cd; + size_t i; + + for (i = 0; i < SDL_arraysize(inputs); i++) { + char to_encoding_str[32]; + char from_encoding_str[32]; + char text_str[32]; + size_t len_text = 0; + int r; + char out_buffer[6]; + const char *in_ptr; + size_t in_pos; + char *out_ptr; + char *output; + size_t iconv_result; + size_t out_len; + SDL_bool is_error; + size_t out_pos; + + SDLTest_AssertPass("case %d", (int)i); + format_for_description(to_encoding_str, SDL_arraysize(to_encoding_str), inputs[i].to_encoding); + format_for_description(from_encoding_str, SDL_arraysize(from_encoding_str), inputs[i].from_encoding); + format_for_description(text_str, SDL_arraysize(text_str), inputs[i].text); + + if (inputs[i].text) { + len_text = SDL_strlen(inputs[i].text) + 1; + } + + SDLTest_AssertPass("About to call SDL_iconv_open(%s, %s)", to_encoding_str, from_encoding_str); + cd = SDL_iconv_open(inputs[i].to_encoding, inputs[i].from_encoding); + if (inputs[i].expect_success) { + SDLTest_AssertCheck(cd != (SDL_iconv_t)SDL_ICONV_ERROR, "result must NOT be SDL_ICONV_ERROR"); + } else { + SDLTest_AssertCheck(cd == (SDL_iconv_t)SDL_ICONV_ERROR, "result must be SDL_ICONV_ERROR"); + } + + in_ptr = inputs[i].text; + in_pos = 0; + out_pos = 0; + do { + size_t in_left; + size_t count_written; + size_t count_read; + + in_left = len_text - in_pos; + out_ptr = out_buffer; + out_len = SDL_arraysize(out_buffer); + SDLTest_AssertPass("About to call SDL_iconv(cd, %s+%d, .., dest, ..)", text_str, (int)in_pos); + iconv_result = SDL_iconv(cd, &in_ptr, &in_left, &out_ptr, &out_len); + count_written = SDL_arraysize(out_buffer) - out_len; + count_read = in_ptr - inputs[i].text - in_pos; + in_pos += count_read; + + is_error = iconv_result == SDL_ICONV_ERROR + || iconv_result == SDL_ICONV_EILSEQ + || iconv_result == SDL_ICONV_EINVAL; + if (inputs[i].expect_success) { + SDLTest_AssertCheck(!is_error, "result must NOT be an error code"); + SDLTest_AssertCheck(count_written > 0 || inputs[i].expected[out_pos] == '\0', "%" SDL_PRIu64 " bytes have been written", (Uint64)count_written); + SDLTest_AssertCheck(out_pos <= SDL_strlen(inputs[i].expected), "Data written by SDL_iconv cannot be longer then reference output"); + SDLTest_CompareMemory(out_buffer, count_written, inputs[i].expected + out_pos, count_written); + } else { + SDLTest_AssertCheck(is_error, "result must be an error code"); + break; + } + out_pos += count_written; + if (count_written == 0) { + break; + } + if (count_read == 0) { + SDLTest_AssertCheck(SDL_FALSE, "SDL_iconv wrote data, but read no data"); + break; + } + } while (!is_error && in_pos < len_text); + + SDLTest_AssertPass("About to call SDL_iconv_close(cd)"); + r = SDL_iconv_close(cd); + if (inputs[i].expect_success) { + SDLTest_AssertCheck(r == 0, "result must be 0"); + } else { + SDLTest_AssertCheck(r == -1, "result must be -1"); + } + + SDLTest_AssertPass("About to call SDL_iconv_string(%s, %s, %s, %" SDL_PRIu64 ")", + to_encoding_str, from_encoding_str, text_str, (Uint64)len_text); + output = SDL_iconv_string(inputs[i].to_encoding, inputs[i].from_encoding, inputs[i].text, len_text); + if (inputs[i].expect_success) { + SDLTest_AssertCheck(output != NULL, "result must NOT be NULL"); + SDLTest_AssertCheck(SDL_strncmp(inputs[i].expected, output, SDL_strlen(inputs[i].expected)) == 0, + "converted string should be correct"); + } else { + SDLTest_AssertCheck(output == NULL, "result must be NULL"); + } + SDL_free(output); + } + + return TEST_COMPLETED; +} + /* ================= Test References ================== */ /* Standard C routine test cases */ @@ -1103,6 +1227,10 @@ static const SDLTest_TestCaseReference stdlibTestOverflow = { stdlib_overflow, "stdlib_overflow", "Overflow detection", TEST_ENABLED }; +static const SDLTest_TestCaseReference stdlibIconv = { + stdlib_iconv, "stdlib_iconv", "Calls to iconv", TEST_ENABLED +}; + /* Sequence of Standard C routine test cases */ static const SDLTest_TestCaseReference *stdlibTests[] = { &stdlibTest_strnlen, @@ -1114,6 +1242,7 @@ static const SDLTest_TestCaseReference *stdlibTests[] = { &stdlibTest_sscanf, &stdlibTest_aligned_alloc, &stdlibTestOverflow, + &stdlibIconv, NULL }; From 1ecf05be93710b6d16cc1fa2581712d098dfcb48 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 6 Aug 2024 17:12:54 +0000 Subject: [PATCH 208/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_stdinc.h | 42 ++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index cbd374432a942..621a159e42055 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -2902,12 +2902,13 @@ extern SDL_DECLSPEC float SDLCALL SDL_tanf(float x); typedef struct SDL_iconv_data_t *SDL_iconv_t; /** - * This function allocates a context for the specified character set conversion. + * This function allocates a context for the specified character set + * conversion. * * \param tocode The target character encoding, must not be NULL. * \param fromcode The source character encoding, must not be NULL. - * \returns a handle that must be freed with SDL_iconv_close, - * or SDL_ICONV_ERROR on failure. + * \returns a handle that must be freed with SDL_iconv_close, or + * SDL_ICONV_ERROR on failure. * * \since This function is available since SDL 3.0.0. * @@ -2933,26 +2934,31 @@ extern SDL_DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, extern SDL_DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); /** - * This function converts text between encodings, reading from and writing to a buffer. + * This function converts text between encodings, reading from and writing to + * a buffer. + * * It returns the number of succesful conversions. * - * \param cd The character set conversion context, created in SDL_iconv_open(). - * \param inbuf Address of variable that points to the first character of the input sequence. + * \param cd The character set conversion context, created in + * SDL_iconv_open(). + * \param inbuf Address of variable that points to the first character of the + * input sequence. * \param inbytesleft The number of bytes in the input buffer. * \param outbuf Address of variable that points to the output buffer. * \param outbytesleft The number of bytes in the output buffer. - * \returns the number of conversions on success, else - * SDL_ICONV_E2BIG is returned when the output buffer is too small, or - * SDL_ICONV_EILSEQ is returned when an invalid input sequence is encountered, or - * SDL_ICONV_EINVAL is returned when an incomplete input sequence is encountered. - * - * On exit: - * - inbuf will point to the beginning of the next multibyte sequence. - * On error, this is the location of the problematic input sequence. - * On success, this is the end of the input sequence. - * - inbytesleft will be set to the number of bytes left to convert, which will be 0 on success. - * - outbuf will point to the location where to store the next output byte. - * - outbytesleft will be set to the number of bytes left in the output buffer. + * \returns the number of conversions on success, else SDL_ICONV_E2BIG is + * returned when the output buffer is too small, or SDL_ICONV_EILSEQ + * is returned when an invalid input sequence is encountered, or + * SDL_ICONV_EINVAL is returned when an incomplete input sequence is + * encountered. + * + * On exit: - inbuf will point to the beginning of the next multibyte + * sequence. On error, this is the location of the problematic input + * sequence. On success, this is the end of the input sequence. - + * inbytesleft will be set to the number of bytes left to convert, + * which will be 0 on success. - outbuf will point to the location + * where to store the next output byte. - outbytesleft will be set to + * the number of bytes left in the output buffer. * * \since This function is available since SDL 3.0.0. * From 8a3bb11024790b39b582c13d641c7bc990cd0b9e Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Tue, 6 Aug 2024 17:17:11 +0000 Subject: [PATCH 209/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_stdinc.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index 621a159e42055..b5ec668b00b0f 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -2952,13 +2952,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); * SDL_ICONV_EINVAL is returned when an incomplete input sequence is * encountered. * - * On exit: - inbuf will point to the beginning of the next multibyte - * sequence. On error, this is the location of the problematic input - * sequence. On success, this is the end of the input sequence. - - * inbytesleft will be set to the number of bytes left to convert, - * which will be 0 on success. - outbuf will point to the location - * where to store the next output byte. - outbytesleft will be set to - * the number of bytes left in the output buffer. + * On exit: + * + * - inbuf will point to the beginning of the next multibyte + * sequence. On error, this is the location of the problematic + * input sequence. On success, this is the end of the input + * sequence. - inbytesleft will be set to the number of bytes left + * to convert, which will be 0 on success. - outbuf will point to + * the location where to store the next output byte. - outbytesleft + * will be set to the number of bytes left in the output buffer. * * \since This function is available since SDL 3.0.0. * From 83d1d1c053dbd0848c6e34d9098c23ce3738effd Mon Sep 17 00:00:00 2001 From: hsnovel Date: Tue, 6 Aug 2024 10:00:41 -0700 Subject: [PATCH 210/253] add failsafe for querying cache line size on linux --- src/cpuinfo/SDL_cpuinfo.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index 80790db9f22bb..734960b2332d2 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -69,6 +69,10 @@ #endif #endif +#if defined (SDL_PLATFORM_FREEBSD) +#include +#endif + #if defined(SDL_PLATFORM_ANDROID) && defined(__arm__) && !defined(HAVE_GETAUXVAL) #include #endif @@ -841,6 +845,7 @@ static const char *SDL_GetCPUName(void) int SDL_GetCPUCacheLineSize(void) { const char *cpuType = SDL_GetCPUType(); + int cacheline_size = SDL_CACHELINE_SIZE; /* initial guess */ int a, b, c, d; (void)a; (void)b; @@ -848,14 +853,34 @@ int SDL_GetCPUCacheLineSize(void) (void)d; if (SDL_strcmp(cpuType, "GenuineIntel") == 0 || SDL_strcmp(cpuType, "CentaurHauls") == 0 || SDL_strcmp(cpuType, " Shanghai ") == 0) { cpuid(0x00000001, a, b, c, d); - return ((b >> 8) & 0xff) * 8; + cacheline_size = ((b >> 8) & 0xff) * 8; } else if (SDL_strcmp(cpuType, "AuthenticAMD") == 0 || SDL_strcmp(cpuType, "HygonGenuine") == 0) { cpuid(0x80000005, a, b, c, d); - return c & 0xff; + cacheline_size = c & 0xff; } else { - /* Just make a guess here... */ - return SDL_CACHELINE_SIZE; +#if defined(HAVE_SYSCONF) && defined(_SC_LEVEL1_DCACHE_LINESIZE) + if ((cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE)) > 0) { + return cacheline_size; + } else { + cacheline_size = SDL_CACHELINE_SIZE; + } +#endif +#if defined(SDL_PLATFORM_LINUX) + { + FILE *f = fopen("/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size", "r"); + if (f) { + int size; + if (fscanf(f, "%d", &size) == 1) { + cacheline_size = size; + } + fclose(f); + } + } +#elif defined(__FREEBSD__) && defined(CACHE_LINE_SIZE) + cacheline_size = CACHE_LINE_SIZE; +#endif } + return cacheline_size; } #define SDL_CPUFEATURES_RESET_VALUE 0xFFFFFFFF From 15bfef57cd4293494a6207871706f3aa2176fd7c Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Sun, 4 Aug 2024 15:15:18 -0400 Subject: [PATCH 211/253] d3d12: Generate Xbox C macros, adjust SDL_Render files accordingly --- src/render/direct3d12/SDL_render_d3d12.c | 194 +- .../direct3d12/SDL_shaders_d3d12_xboxone.cpp | 2 +- .../SDL_shaders_d3d12_xboxseries.cpp | 2 +- src/video/directx/SDL_d3d12.h | 13 +- src/video/directx/SDL_d3d12_xbox_cmacros.h | 4761 +++++++++++++++++ src/video/directx/gen_xbox_cmacros.cs | 91 + 6 files changed, 4962 insertions(+), 101 deletions(-) create mode 100644 src/video/directx/SDL_d3d12_xbox_cmacros.h create mode 100644 src/video/directx/gen_xbox_cmacros.cs diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index 7c54149f7f6d6..f4bdc89933652 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -435,7 +435,7 @@ static void D3D12_ReleaseAll(SDL_Renderer *renderer) /* Check for any leaks if in debug mode */ if (data->dxgiDebug) { DXGI_DEBUG_RLO_FLAGS rloFlags = (DXGI_DEBUG_RLO_FLAGS)(DXGI_DEBUG_RLO_DETAIL | DXGI_DEBUG_RLO_IGNORE_INTERNAL); - D3D_CALL(data->dxgiDebug, ReportLiveObjects, SDL_DXGI_DEBUG_ALL, rloFlags); + IDXGIDebug_ReportLiveObjects(data->dxgiDebug, SDL_DXGI_DEBUG_ALL, rloFlags); D3D_SAFE_RELEASE(data->dxgiDebug); } #endif @@ -473,9 +473,9 @@ static D3D12_GPU_DESCRIPTOR_HANDLE D3D12_CPUtoGPUHandle(ID3D12DescriptorHeap *he static void D3D12_WaitForGPU(D3D12_RenderData *data) { if (data->commandQueue && data->fence && data->fenceEvent) { - D3D_CALL(data->commandQueue, Signal, data->fence, data->fenceValue); - if (D3D_CALL(data->fence, GetCompletedValue) < data->fenceValue) { - D3D_CALL(data->fence, SetEventOnCompletion, + ID3D12CommandQueue_Signal(data->commandQueue, data->fence, data->fenceValue); + if (ID3D12Fence_GetCompletedValue(data->fence) < data->fenceValue) { + ID3D12Fence_SetEventOnCompletion(data->fence, data->fenceValue, data->fenceEvent); WaitForSingleObjectEx(data->fenceEvent, INFINITE, FALSE); @@ -515,7 +515,7 @@ static void D3D12_TransitionResource(D3D12_RenderData *data, barrier.Transition.StateAfter = afterState; barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES; - D3D_CALL(data->commandList, ResourceBarrier, 1, &barrier); + ID3D12GraphicsCommandList2_ResourceBarrier(data->commandList, 1, &barrier); } } @@ -525,8 +525,8 @@ static void D3D12_ResetCommandList(D3D12_RenderData *data) ID3D12DescriptorHeap *rootDescriptorHeaps[] = { data->srvDescriptorHeap, data->samplerDescriptorHeap }; ID3D12CommandAllocator *commandAllocator = data->commandAllocators[data->currentBackBufferIndex]; - D3D_CALL(commandAllocator, Reset); - D3D_CALL(data->commandList, Reset, commandAllocator, NULL); + ID3D12CommandAllocator_Reset(commandAllocator); + ID3D12GraphicsCommandList2_Reset(data->commandList, commandAllocator, NULL); data->currentPipelineState = NULL; data->currentVertexBuffer = 0; data->issueBatch = SDL_FALSE; @@ -541,7 +541,7 @@ static void D3D12_ResetCommandList(D3D12_RenderData *data) } data->currentUploadBuffer = 0; - D3D_CALL(data->commandList, SetDescriptorHeaps, 2, rootDescriptorHeaps); + ID3D12GraphicsCommandList2_SetDescriptorHeaps(data->commandList, 2, rootDescriptorHeaps); } static int D3D12_IssueBatch(D3D12_RenderData *data) @@ -549,12 +549,12 @@ static int D3D12_IssueBatch(D3D12_RenderData *data) HRESULT result = S_OK; /* Issue the command list */ - result = D3D_CALL(data->commandList, Close); + result = ID3D12GraphicsCommandList2_Close(data->commandList); if (FAILED(result)) { WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D12_IssueBatch"), result); return result; } - D3D_CALL(data->commandQueue, ExecuteCommandLists, 1, (ID3D12CommandList *const *)&data->commandList); + ID3D12CommandQueue_ExecuteCommandLists(data->commandQueue, 1, (ID3D12CommandList *const *)&data->commandList); D3D12_WaitForGPU(data); @@ -685,7 +685,7 @@ static D3D12_PipelineState *D3D12_CreatePipelineState(SDL_Renderer *renderer, pipelineDesc.SampleDesc.Count = 1; pipelineDesc.SampleDesc.Quality = 0; - result = D3D_CALL(data->d3dDevice, CreateGraphicsPipelineState, + result = ID3D12Device1_CreateGraphicsPipelineState(data->d3dDevice, &pipelineDesc, D3D_GUID(SDL_IID_ID3D12PipelineState), (void **)&pipelineState); @@ -737,7 +737,7 @@ static HRESULT D3D12_CreateVertexBuffer(D3D12_RenderData *data, size_t vbidx, si vbufferDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; vbufferDesc.Flags = D3D12_RESOURCE_FLAG_NONE; - result = D3D_CALL(data->d3dDevice, CreateCommittedResource, + result = ID3D12Device1_CreateCommittedResource(data->d3dDevice, &vbufferHeapProps, D3D12_HEAP_FLAG_NONE, &vbufferDesc, @@ -751,7 +751,7 @@ static HRESULT D3D12_CreateVertexBuffer(D3D12_RenderData *data, size_t vbidx, si return result; } - data->vertexBuffers[vbidx].view.BufferLocation = D3D_CALL(data->vertexBuffers[vbidx].resource, GetGPUVirtualAddress); + data->vertexBuffers[vbidx].view.BufferLocation = ID3D12Resource_GetGPUVirtualAddress(data->vertexBuffers[vbidx].resource); data->vertexBuffers[vbidx].view.StrideInBytes = sizeof(VertexPositionColor); data->vertexBuffers[vbidx].size = size; @@ -835,7 +835,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) goto done; } if (SUCCEEDED(D3D12GetDebugInterfaceFunc(D3D_GUID(SDL_IID_ID3D12Debug), (void **)&data->debugInterface))) { - D3D_CALL(data->debugInterface, EnableDebugLayer); + ID3D12Debug_EnableDebugLayer(data->debugInterface); } } #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ @@ -871,8 +871,8 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) goto done; } - D3D_CALL(dxgiInfoQueue, SetBreakOnSeverity, SDL_DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, TRUE); - D3D_CALL(dxgiInfoQueue, SetBreakOnSeverity, SDL_DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION, TRUE); + IDXGIInfoQueue_SetBreakOnSeverity(dxgiInfoQueue, SDL_DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, TRUE); + IDXGIInfoQueue_SetBreakOnSeverity(dxgiInfoQueue, SDL_DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION, TRUE); D3D_SAFE_RELEASE(dxgiInfoQueue); #endif /* __IDXGIInfoQueue_INTERFACE_DEFINED__ */ creationFlags = DXGI_CREATE_FACTORY_DEBUG; @@ -885,7 +885,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) } /* Prefer a high performance adapter if there are multiple choices */ - result = D3D_CALL(data->dxgiFactory, EnumAdapterByGpuPreference, + result = IDXGIFactory6_EnumAdapterByGpuPreference(data->dxgiFactory, 0, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, D3D_GUID(SDL_IID_IDXGIAdapter4), @@ -910,7 +910,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) D3D12_MESSAGE_SEVERITY severities[] = { D3D12_MESSAGE_SEVERITY_INFO }; D3D12_INFO_QUEUE_FILTER filter; - result = D3D_CALL(d3dDevice, QueryInterface, D3D_GUID(SDL_IID_ID3D12InfoQueue), (void **)&infoQueue); + result = ID3D12Device1_QueryInterface(d3dDevice, D3D_GUID(SDL_IID_ID3D12InfoQueue), (void **)&infoQueue); if (FAILED(result)) { WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device to ID3D12InfoQueue"), result); goto done; @@ -919,16 +919,16 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) SDL_zero(filter); filter.DenyList.NumSeverities = 1; filter.DenyList.pSeverityList = severities; - D3D_CALL(infoQueue, PushStorageFilter, &filter); + ID3D12InfoQueue_PushStorageFilter(infoQueue, &filter); - D3D_CALL(infoQueue, SetBreakOnSeverity, D3D12_MESSAGE_SEVERITY_ERROR, TRUE); - D3D_CALL(infoQueue, SetBreakOnSeverity, D3D12_MESSAGE_SEVERITY_CORRUPTION, TRUE); + ID3D12InfoQueue_SetBreakOnSeverity(infoQueue, D3D12_MESSAGE_SEVERITY_ERROR, TRUE); + ID3D12InfoQueue_SetBreakOnSeverity(infoQueue, D3D12_MESSAGE_SEVERITY_CORRUPTION, TRUE); D3D_SAFE_RELEASE(infoQueue); } #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ - result = D3D_CALL(d3dDevice, QueryInterface, D3D_GUID(SDL_IID_ID3D12Device1), (void **)&data->d3dDevice); + result = ID3D12Device_QueryInterface(d3dDevice, D3D_GUID(SDL_IID_ID3D12Device1), (void **)&data->d3dDevice); if (FAILED(result)) { WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device to ID3D12Device1"), result); goto done; @@ -939,7 +939,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE; queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT; - result = D3D_CALL(data->d3dDevice, CreateCommandQueue, + result = ID3D12Device1_CreateCommandQueue(data->d3dDevice, &queueDesc, D3D_GUID(SDL_IID_ID3D12CommandQueue), (void **)&data->commandQueue); @@ -952,7 +952,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) SDL_zero(descriptorHeapDesc); descriptorHeapDesc.NumDescriptors = SDL_D3D12_NUM_BUFFERS; descriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV; - result = D3D_CALL(data->d3dDevice, CreateDescriptorHeap, + result = ID3D12Device1_CreateDescriptorHeap(data->d3dDevice, &descriptorHeapDesc, D3D_GUID(SDL_IID_ID3D12DescriptorHeap), (void **)&data->rtvDescriptorHeap); @@ -960,10 +960,10 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateDescriptorHeap [rtv]"), result); goto done; } - data->rtvDescriptorSize = D3D_CALL(d3dDevice, GetDescriptorHandleIncrementSize, D3D12_DESCRIPTOR_HEAP_TYPE_RTV); + data->rtvDescriptorSize = ID3D12Device1_GetDescriptorHandleIncrementSize(d3dDevice, D3D12_DESCRIPTOR_HEAP_TYPE_RTV); descriptorHeapDesc.NumDescriptors = SDL_D3D12_MAX_NUM_TEXTURES; - result = D3D_CALL(data->d3dDevice, CreateDescriptorHeap, + result = ID3D12Device1_CreateDescriptorHeap(data->d3dDevice, &descriptorHeapDesc, D3D_GUID(SDL_IID_ID3D12DescriptorHeap), (void **)&data->textureRTVDescriptorHeap); @@ -976,7 +976,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) descriptorHeapDesc.NumDescriptors = SDL_D3D12_MAX_NUM_TEXTURES; descriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; descriptorHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; - result = D3D_CALL(data->d3dDevice, CreateDescriptorHeap, + result = ID3D12Device1_CreateDescriptorHeap(data->d3dDevice, &descriptorHeapDesc, D3D_GUID(SDL_IID_ID3D12DescriptorHeap), (void **)&data->srvDescriptorHeap); @@ -985,13 +985,13 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) goto done; } rootDescriptorHeaps[0] = data->srvDescriptorHeap; - data->srvDescriptorSize = D3D_CALL(d3dDevice, GetDescriptorHandleIncrementSize, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + data->srvDescriptorSize = ID3D12Device1_GetDescriptorHandleIncrementSize(d3dDevice, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); SDL_zero(descriptorHeapDesc); descriptorHeapDesc.NumDescriptors = 4; descriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER; descriptorHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; - result = D3D_CALL(data->d3dDevice, CreateDescriptorHeap, + result = ID3D12Device1_CreateDescriptorHeap(data->d3dDevice, &descriptorHeapDesc, D3D_GUID(SDL_IID_ID3D12DescriptorHeap), (void **)&data->samplerDescriptorHeap); @@ -1000,11 +1000,11 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) goto done; } rootDescriptorHeaps[1] = data->samplerDescriptorHeap; - data->samplerDescriptorSize = D3D_CALL(d3dDevice, GetDescriptorHandleIncrementSize, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER); + data->samplerDescriptorSize = ID3D12Device1_GetDescriptorHandleIncrementSize(d3dDevice, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER); /* Create a command allocator for each back buffer */ for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) { - result = D3D_CALL(data->d3dDevice, CreateCommandAllocator, + result = ID3D12Device1_CreateCommandAllocator(data->d3dDevice, D3D12_COMMAND_LIST_TYPE_DIRECT, D3D_GUID(SDL_IID_ID3D12CommandAllocator), (void **)&data->commandAllocators[i]); @@ -1015,7 +1015,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) } /* Create the command list */ - result = D3D_CALL(data->d3dDevice, CreateCommandList, + result = ID3D12Device1_CreateCommandList(data->d3dDevice, 0, D3D12_COMMAND_LIST_TYPE_DIRECT, data->commandAllocators[0], @@ -1028,10 +1028,10 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) } /* Set the descriptor heaps to the correct initial value */ - D3D_CALL(data->commandList, SetDescriptorHeaps, 2, rootDescriptorHeaps); + ID3D12GraphicsCommandList2_SetDescriptorHeaps(data->commandList, 2, rootDescriptorHeaps); /* Create the fence and fence event */ - result = D3D_CALL(data->d3dDevice, CreateFence, + result = ID3D12Device_CreateFence(data->d3dDevice, data->fenceValue, D3D12_FENCE_FLAG_NONE, D3D_GUID(SDL_IID_ID3D12Fence), @@ -1053,7 +1053,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) for (i = 0; i < NUM_ROOTSIGS; ++i) { D3D12_SHADER_BYTECODE rootSigData; D3D12_GetRootSignatureData((D3D12_RootSignature)i, &rootSigData); - result = D3D_CALL(data->d3dDevice, CreateRootSignature, + result = ID3D12Device1_CreateRootSignature(data->d3dDevice, 0, rootSigData.pShaderBytecode, rootSigData.BytecodeLength, @@ -1120,7 +1120,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) samplerDesc.AddressU = samplerParams[i].address; samplerDesc.AddressV = samplerParams[i].address; data->samplers[i].ptr = data->samplers[0].ptr + i * data->samplerDescriptorSize; - D3D_CALL(data->d3dDevice, CreateSampler, &samplerDesc, data->samplers[i]); + ID3D12Device1_CreateSampler(data->d3dDevice, &samplerDesc, data->samplers[i]); } /* Initialize the pool allocator for SRVs */ @@ -1258,7 +1258,7 @@ static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h) goto done; } - result = D3D_CALL(data->dxgiFactory, CreateSwapChainForHwnd, + result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory, (IUnknown *)data->commandQueue, hwnd, &swapChainDesc, @@ -1270,9 +1270,9 @@ static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h) goto done; } - D3D_CALL(data->dxgiFactory, MakeWindowAssociation, hwnd, DXGI_MWA_NO_WINDOW_CHANGES); + IDXGIFactory6_MakeWindowAssociation(data->dxgiFactory, hwnd, DXGI_MWA_NO_WINDOW_CHANGES); - result = D3D_CALL(swapChain, QueryInterface, D3D_GUID(SDL_IID_IDXGISwapChain4), (void **)&data->swapChain); + result = IDXGISwapChain1_QueryInterface(swapChain, D3D_GUID(SDL_IID_IDXGISwapChain4), (void **)&data->swapChain); if (FAILED(result)) { WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain1::QueryInterface"), result); goto done; @@ -1281,7 +1281,7 @@ static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h) /* Ensure that the swapchain does not queue more than one frame at a time. This both reduces latency * and ensures that the application will only render after each VSync, minimizing power consumption. */ - result = D3D_CALL(data->swapChain, SetMaximumFrameLatency, 1); + result = IDXGISwapChain4_SetMaximumFrameLatency(data->swapChain, 1); if (FAILED(result)) { WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain4::SetMaximumFrameLatency"), result); goto done; @@ -1304,9 +1304,9 @@ static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h) colorspace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; break; } - if (SUCCEEDED(D3D_CALL(data->swapChain, CheckColorSpaceSupport, colorspace, &colorspace_support)) && + if (SUCCEEDED(IDXGISwapChain3_CheckColorSpaceSupport(data->swapChain, colorspace, &colorspace_support)) && (colorspace_support & DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT)) { - result = D3D_CALL(data->swapChain, SetColorSpace1, colorspace); + result = IDXGISwapChain3_SetColorSpace1(data->swapChain, colorspace); if (FAILED(result)) { WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain3::SetColorSpace1"), result); goto done; @@ -1369,7 +1369,7 @@ static HRESULT D3D12_CreateWindowSizeDependentResources(SDL_Renderer *renderer) /* Release resources in the current command list */ D3D12_IssueBatch(data); - D3D_CALL(data->commandList, OMSetRenderTargets, 0, NULL, FALSE, NULL); + ID3D12GraphicsCommandList2_OMSetRenderTargets(data->commandList, 0, NULL, FALSE, NULL); /* Release render targets */ for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) { @@ -1390,7 +1390,7 @@ static HRESULT D3D12_CreateWindowSizeDependentResources(SDL_Renderer *renderer) #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) if (data->swapChain) { /* If the swap chain already exists, resize it. */ - result = D3D_CALL(data->swapChain, ResizeBuffers, + result = IDXGISwapChain_ResizeBuffers(data->swapChain, 0, w, h, DXGI_FORMAT_UNKNOWN, @@ -1417,7 +1417,7 @@ static HRESULT D3D12_CreateWindowSizeDependentResources(SDL_Renderer *renderer) /* Set the proper rotation for the swap chain. */ if (WIN_IsWindows8OrGreater()) { if (data->swapEffect == DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL) { - result = D3D_CALL(data->swapChain, SetRotation, data->rotation); /* NOLINT(clang-analyzer-core.NullDereference) */ + result = IDXGISwapChain4_SetRotation(data->swapChain, data->rotation); /* NOLINT(clang-analyzer-core.NullDereference) */ if (FAILED(result)) { WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain4::SetRotation"), result); goto done; @@ -1435,7 +1435,7 @@ static HRESULT D3D12_CreateWindowSizeDependentResources(SDL_Renderer *renderer) goto done; } #else - result = D3D_CALL(data->swapChain, GetBuffer, /* NOLINT(clang-analyzer-core.NullDereference) */ + result = IDXGISwapChain4_GetBuffer(data->swapChain, /* NOLINT(clang-analyzer-core.NullDereference) */ i, D3D_GUID(SDL_IID_ID3D12Resource), (void **)&data->renderTargets[i]); @@ -1452,14 +1452,14 @@ static HRESULT D3D12_CreateWindowSizeDependentResources(SDL_Renderer *renderer) SDL_zero(rtvDescriptor); D3D_CALL_RET(data->rtvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &rtvDescriptor); rtvDescriptor.ptr += i * data->rtvDescriptorSize; - D3D_CALL(data->d3dDevice, CreateRenderTargetView, data->renderTargets[i], &rtvDesc, rtvDescriptor); + ID3D12Device1_CreateRenderTargetView(data->d3dDevice, data->renderTargets[i], &rtvDesc, rtvDescriptor); } /* Set back buffer index to current buffer */ #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) data->currentBackBufferIndex = 0; #else - data->currentBackBufferIndex = D3D_CALL(data->swapChain, GetCurrentBackBufferIndex); + data->currentBackBufferIndex = IDXGISwapChain4_GetCurrentBackBufferIndex(data->swapChain); #endif /* Set the swap chain target immediately, so that a target is always set @@ -1467,7 +1467,7 @@ static HRESULT D3D12_CreateWindowSizeDependentResources(SDL_Renderer *renderer) * null references in places like ReadPixels! */ data->currentRenderTargetView = D3D12_GetCurrentRenderTargetView(renderer); - D3D_CALL(data->commandList, OMSetRenderTargets, 1, &data->currentRenderTargetView, FALSE, NULL); + ID3D12GraphicsCommandList2_OMSetRenderTargets(data->commandList, 1, &data->currentRenderTargetView, FALSE, NULL); D3D12_TransitionResource(data, data->renderTargets[data->currentBackBufferIndex], D3D12_RESOURCE_STATE_PRESENT, @@ -1543,7 +1543,11 @@ static int GetTextureProperty(SDL_PropertiesID props, const char *name, ID3D12Re { IUnknown *unknown = (IUnknown*)SDL_GetPointerProperty(props, name, NULL); if (unknown) { - HRESULT result = D3D_CALL(unknown, QueryInterface, D3D_GUID(SDL_IID_ID3D12Resource), (void **)texture); +#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) + HRESULT result = unknown->QueryInterface(D3D_GUID(SDL_IID_ID3D12Resource), (void **)texture); +#else + HRESULT result = IUnknown_QueryInterface(unknown, D3D_GUID(SDL_IID_ID3D12Resource), (void **)texture); +#endif if (FAILED(result)) { return WIN_SetErrorFromHRESULT(name, result); } @@ -1613,7 +1617,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL return -1; } if (!textureData->mainTexture) { - result = D3D_CALL(rendererData->d3dDevice, CreateCommittedResource, + result = ID3D12Device1_CreateCommittedResource(rendererData->d3dDevice, &heapProps, D3D12_HEAP_FLAG_NONE, &textureDesc, @@ -1639,7 +1643,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL return -1; } if (!textureData->mainTextureU) { - result = D3D_CALL(rendererData->d3dDevice, CreateCommittedResource, + result = ID3D12Device1_CreateCommittedResource(rendererData->d3dDevice, &heapProps, D3D12_HEAP_FLAG_NONE, &textureDesc, @@ -1658,7 +1662,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL return -1; } if (!textureData->mainTextureV) { - result = D3D_CALL(rendererData->d3dDevice, CreateCommittedResource, + result = ID3D12Device1_CreateCommittedResource(rendererData->d3dDevice, &heapProps, D3D12_HEAP_FLAG_NONE, &textureDesc, @@ -1710,7 +1714,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceView); textureData->mainTextureResourceView.ptr += textureData->mainSRVIndex * rendererData->srvDescriptorSize; - D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, + ID3D12Device1_CreateShaderResourceView(rendererData->d3dDevice, textureData->mainTexture, &resourceViewDesc, textureData->mainTextureResourceView); @@ -1719,7 +1723,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceViewU); textureData->mainSRVIndexU = D3D12_GetAvailableSRVIndex(renderer); textureData->mainTextureResourceViewU.ptr += textureData->mainSRVIndexU * rendererData->srvDescriptorSize; - D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, + ID3D12Device1_CreateShaderResourceView(rendererData->d3dDevice, textureData->mainTextureU, &resourceViewDesc, textureData->mainTextureResourceViewU); @@ -1727,7 +1731,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceViewV); textureData->mainSRVIndexV = D3D12_GetAvailableSRVIndex(renderer); textureData->mainTextureResourceViewV.ptr += textureData->mainSRVIndexV * rendererData->srvDescriptorSize; - D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, + ID3D12Device1_CreateShaderResourceView(rendererData->d3dDevice, textureData->mainTextureV, &resourceViewDesc, textureData->mainTextureResourceViewV); @@ -1746,7 +1750,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceViewNV); textureData->mainSRVIndexNV = D3D12_GetAvailableSRVIndex(renderer); textureData->mainTextureResourceViewNV.ptr += textureData->mainSRVIndexNV * rendererData->srvDescriptorSize; - D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, + ID3D12Device1_CreateShaderResourceView(rendererData->d3dDevice, textureData->mainTexture, &nvResourceViewDesc, textureData->mainTextureResourceViewNV); @@ -1763,7 +1767,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL D3D_CALL_RET(rendererData->textureRTVDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureRenderTargetView); textureData->mainTextureRenderTargetView.ptr += textureData->mainSRVIndex * rendererData->rtvDescriptorSize; - D3D_CALL(rendererData->d3dDevice, CreateRenderTargetView, + ID3D12Device1_CreateRenderTargetView(rendererData->d3dDevice, (ID3D12Resource *)textureData->mainTexture, &renderTargetViewDesc, textureData->mainTextureRenderTargetView); @@ -1846,7 +1850,7 @@ static int D3D12_UpdateTextureInternal(D3D12_RenderData *rendererData, ID3D12Res uploadDesc.Flags = D3D12_RESOURCE_FLAG_NONE; /* Figure out how much we need to allocate for the upload buffer */ - D3D_CALL(rendererData->d3dDevice, GetCopyableFootprints, + ID3D12Device1_GetCopyableFootprints(rendererData->d3dDevice, &textureDesc, plane, 1, @@ -1863,7 +1867,7 @@ static int D3D12_UpdateTextureInternal(D3D12_RenderData *rendererData, ID3D12Res heapProps.VisibleNodeMask = 1; /* Create the upload buffer */ - result = D3D_CALL(rendererData->d3dDevice, CreateCommittedResource, + result = ID3D12Device1_CreateCommittedResource(rendererData->d3dDevice, &heapProps, D3D12_HEAP_FLAG_NONE, &uploadDesc, @@ -1877,7 +1881,7 @@ static int D3D12_UpdateTextureInternal(D3D12_RenderData *rendererData, ID3D12Res /* Get a write-only pointer to data in the upload buffer: */ uploadBuffer = rendererData->uploadBuffers[rendererData->currentUploadBuffer]; - result = D3D_CALL(uploadBuffer, Map, + result = ID3D12Resource_Map(uploadBuffer, 0, NULL, (void **)&textureMemory); @@ -1906,7 +1910,7 @@ static int D3D12_UpdateTextureInternal(D3D12_RenderData *rendererData, ID3D12Res } /* Commit the changes back to the upload buffer: */ - D3D_CALL(uploadBuffer, Unmap, 0, NULL); + ID3D12Resource_Unmap(uploadBuffer, 0, NULL); /* Make sure the destination is in the correct resource state */ D3D12_TransitionResource(rendererData, texture, *resourceState, D3D12_RESOURCE_STATE_COPY_DEST); @@ -1922,7 +1926,7 @@ static int D3D12_UpdateTextureInternal(D3D12_RenderData *rendererData, ID3D12Res srcLocation.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; srcLocation.PlacedFootprint = placedTextureDesc; - D3D_CALL(rendererData->commandList, CopyTextureRegion, + ID3D12GraphicsCommandList2_CopyTextureRegion(rendererData->commandList, &dstLocation, x, y, @@ -2097,7 +2101,7 @@ static int D3D12_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, uploadDesc.Flags = D3D12_RESOURCE_FLAG_NONE; /* Figure out how much we need to allocate for the upload buffer */ - D3D_CALL(rendererData->d3dDevice, GetCopyableFootprints, + ID3D12Device1_GetCopyableFootprints(rendererData->d3dDevice, &textureDesc, 0, 1, @@ -2113,7 +2117,7 @@ static int D3D12_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, heapProps.VisibleNodeMask = 1; /* Create the upload buffer */ - result = D3D_CALL(rendererData->d3dDevice, CreateCommittedResource, + result = ID3D12Device1_CreateCommittedResource(rendererData->d3dDevice, &heapProps, D3D12_HEAP_FLAG_NONE, &uploadDesc, @@ -2126,7 +2130,7 @@ static int D3D12_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, } /* Get a write-only pointer to data in the upload buffer: */ - result = D3D_CALL(textureData->stagingBuffer, Map, + result = ID3D12Resource_Map(textureData->stagingBuffer, 0, NULL, (void **)&textureMemory); @@ -2186,7 +2190,7 @@ static void D3D12_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture) } #endif /* Commit the pixel buffer's changes back to the staging texture: */ - D3D_CALL(textureData->stagingBuffer, Unmap, 0, NULL); + ID3D12Resource_Unmap(textureData->stagingBuffer, 0, NULL); SDL_zero(textureDesc); D3D_CALL_RET(textureData->mainTexture, GetDesc, &textureDesc); @@ -2222,7 +2226,7 @@ static void D3D12_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture) srcLocation.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; srcLocation.PlacedFootprint = placedTextureDesc; - D3D_CALL(rendererData->commandList, CopyTextureRegion, + ID3D12GraphicsCommandList2_CopyTextureRegion(rendererData->commandList, &dstLocation, textureData->lockedRect.x, textureData->lockedRect.y, @@ -2403,16 +2407,16 @@ static int D3D12_UpdateVertexBuffer(SDL_Renderer *renderer, } vertexBuffer = rendererData->vertexBuffers[vbidx].resource; - result = D3D_CALL(vertexBuffer, Map, 0, &range, (void **)&vertexBufferData); + result = ID3D12Resource_Map(vertexBuffer, 0, &range, (void **)&vertexBufferData); if (FAILED(result)) { return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Resource::Map [vertex buffer]"), result); } SDL_memcpy(vertexBufferData, vertexData, dataSizeInBytes); - D3D_CALL(vertexBuffer, Unmap, 0, NULL); + ID3D12Resource_Unmap(vertexBuffer, 0, NULL); rendererData->vertexBuffers[vbidx].view.SizeInBytes = (UINT)dataSizeInBytes; - D3D_CALL(rendererData->commandList, IASetVertexBuffers, 0, 1, &rendererData->vertexBuffers[vbidx].view); + ID3D12GraphicsCommandList2_IASetVertexBuffers(rendererData->commandList, 0, 1, &rendererData->vertexBuffers[vbidx].view); rendererData->currentVertexBuffer++; if (rendererData->currentVertexBuffer >= SDL_D3D12_NUM_VERTEX_BUFFERS) { @@ -2507,7 +2511,7 @@ static int D3D12_UpdateViewport(SDL_Renderer *renderer) d3dviewport.MinDepth = 0.0f; d3dviewport.MaxDepth = 1.0f; /* SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}\n", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height); */ - D3D_CALL(data->commandList, RSSetViewports, 1, &d3dviewport); + ID3D12GraphicsCommandList_RSSetViewports(data->commandList, 1, &d3dviewport); data->viewportDirty = SDL_FALSE; @@ -2632,8 +2636,8 @@ static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c return -1; } - D3D_CALL(rendererData->commandList, SetPipelineState, currentPipelineState->pipelineState); - D3D_CALL(rendererData->commandList, SetGraphicsRootSignature, + ID3D12GraphicsCommandList2_SetPipelineState(rendererData->commandList, currentPipelineState->pipelineState); + ID3D12GraphicsCommandList2_SetGraphicsRootSignature(rendererData->commandList, rendererData->rootSignatures[D3D12_GetRootSignatureType(currentPipelineState->shader)]); /* When we change these we will need to re-upload the constant buffer and reset any descriptors */ updateSubresource = SDL_TRUE; @@ -2643,7 +2647,7 @@ static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c } if (renderTargetView.ptr != rendererData->currentRenderTargetView.ptr) { - D3D_CALL(rendererData->commandList, OMSetRenderTargets, 1, &renderTargetView, FALSE, NULL); + ID3D12GraphicsCommandList2_OMSetRenderTargets(rendererData->commandList, 1, &renderTargetView, FALSE, NULL); rendererData->currentRenderTargetView = renderTargetView; } @@ -2660,7 +2664,7 @@ static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c /* D3D12_GetViewportAlignedD3DRect will have set the SDL error */ return -1; } - D3D_CALL(rendererData->commandList, RSSetScissorRects, 1, &scissorRect); + ID3D12GraphicsCommandList2_RSSetScissorRects(rendererData->commandList, 1, &scissorRect); rendererData->cliprectDirty = SDL_FALSE; } @@ -2672,7 +2676,7 @@ static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c if (firstShaderResource.ptr != rendererData->currentShaderResource.ptr) { for (i = 0; i < numShaderResources; ++i) { D3D12_GPU_DESCRIPTOR_HANDLE GPUHandle = D3D12_CPUtoGPUHandle(rendererData->srvDescriptorHeap, shaderResources[i]); - D3D_CALL(rendererData->commandList, SetGraphicsRootDescriptorTable, i + 2, GPUHandle); + ID3D12GraphicsCommandList2_SetGraphicsRootDescriptorTable(rendererData->commandList, i + 2, GPUHandle); } rendererData->currentShaderResource.ptr = firstShaderResource.ptr; } @@ -2694,13 +2698,13 @@ static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c break; } - D3D_CALL(rendererData->commandList, SetGraphicsRootDescriptorTable, tableIndex, GPUHandle); + ID3D12GraphicsCommandList2_SetGraphicsRootDescriptorTable(rendererData->commandList, tableIndex, GPUHandle); rendererData->currentSampler = *sampler; } if (updateSubresource == SDL_TRUE || SDL_memcmp(&rendererData->vertexShaderConstantsData.model, newmatrix, sizeof(*newmatrix)) != 0) { SDL_memcpy(&rendererData->vertexShaderConstantsData.model, newmatrix, sizeof(*newmatrix)); - D3D_CALL(rendererData->commandList, SetGraphicsRoot32BitConstants, + ID3D12GraphicsCommandList2_SetGraphicsRoot32BitConstants(rendererData->commandList, 0, 32, &rendererData->vertexShaderConstantsData, @@ -2714,7 +2718,7 @@ static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c if (updateSubresource == SDL_TRUE || SDL_memcmp(shader_constants, ¤tPipelineState->shader_constants, sizeof(*shader_constants)) != 0) { - D3D_CALL(rendererData->commandList, SetGraphicsRoot32BitConstants, + ID3D12GraphicsCommandList2_SetGraphicsRoot32BitConstants(rendererData->commandList, 1, sizeof(*shader_constants) / sizeof(float), shader_constants, @@ -2802,8 +2806,8 @@ static int D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c static void D3D12_DrawPrimitives(SDL_Renderer *renderer, D3D12_PRIMITIVE_TOPOLOGY primitiveTopology, const size_t vertexStart, const size_t vertexCount) { D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal; - D3D_CALL(rendererData->commandList, IASetPrimitiveTopology, primitiveTopology); - D3D_CALL(rendererData->commandList, DrawInstanced, (UINT)vertexCount, 1, (UINT)vertexStart, 0); + ID3D12GraphicsCommandList2_IASetPrimitiveTopology(rendererData->commandList, primitiveTopology); + ID3D12GraphicsCommandList2_DrawInstanced(rendererData->commandList, (UINT)vertexCount, 1, (UINT)vertexStart, 0); } static void D3D12_InvalidateCachedState(SDL_Renderer *renderer) @@ -2888,7 +2892,7 @@ static int D3D12_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, color.r *= cmd->data.color.color_scale; color.g *= cmd->data.color.color_scale; color.b *= cmd->data.color.color_scale; - D3D_CALL(rendererData->commandList, ClearRenderTargetView, rtvDescriptor, &color.r, 0, NULL); + ID3D12GraphicsCommandList2_ClearRenderTargetView(rendererData->commandList, rtvDescriptor, &color.r, 0, NULL); break; } @@ -2996,7 +3000,7 @@ static SDL_Surface *D3D12_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rec readbackDesc.Flags = D3D12_RESOURCE_FLAG_NONE; /* Figure out how much we need to allocate for the upload buffer */ - D3D_CALL(data->d3dDevice, GetCopyableFootprints, + ID3D12Device1_GetCopyableFootprints(data->d3dDevice, &textureDesc, 0, 1, @@ -3011,7 +3015,7 @@ static SDL_Surface *D3D12_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rec heapProps.CreationNodeMask = 1; heapProps.VisibleNodeMask = 1; - result = D3D_CALL(data->d3dDevice, CreateCommittedResource, + result = ID3D12Device1_CreateCommittedResource(data->d3dDevice, &heapProps, D3D12_HEAP_FLAG_NONE, &readbackDesc, @@ -3062,7 +3066,7 @@ static SDL_Surface *D3D12_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rec srcLocation.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; srcLocation.SubresourceIndex = 0; - D3D_CALL(data->commandList, CopyTextureRegion, + ID3D12GraphicsCommandList2_CopyTextureRegion(data->commandList, &dstLocation, 0, 0, 0, &srcLocation, @@ -3075,7 +3079,7 @@ static SDL_Surface *D3D12_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rec D3D12_TransitionResource(data, backBuffer, D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET); /* Map the staging texture's data to CPU-accessible memory: */ - result = D3D_CALL(readbackBuffer, Map, + result = ID3D12Resource_Map(readbackBuffer, 0, NULL, (void **)&textureMemory); @@ -3092,7 +3096,7 @@ static SDL_Surface *D3D12_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rec pitchedDesc.RowPitch); /* Unmap the texture: */ - D3D_CALL(readbackBuffer, Unmap, 0, NULL); + ID3D12Resource_Unmap(readbackBuffer, 0, NULL); done: D3D_SAFE_RELEASE(readbackBuffer); @@ -3111,8 +3115,8 @@ static int D3D12_RenderPresent(SDL_Renderer *renderer) D3D12_RESOURCE_STATE_PRESENT); /* Issue the command list */ - result = D3D_CALL(data->commandList, Close); - D3D_CALL(data->commandQueue, ExecuteCommandLists, 1, (ID3D12CommandList *const *)&data->commandList); + result = ID3D12GraphicsCommandList2_Close(data->commandList); + ID3D12CommandQueue_ExecuteCommandLists(data->commandQueue, 1, (ID3D12CommandList *const *)&data->commandList); #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) result = D3D12_XBOX_PresentFrame(data->commandQueue, data->frameToken, data->renderTargets[data->currentBackBufferIndex]); @@ -3120,7 +3124,7 @@ static int D3D12_RenderPresent(SDL_Renderer *renderer) /* The application may optionally specify "dirty" or "scroll" * rects to improve efficiency in certain scenarios. */ - result = D3D_CALL(data->swapChain, Present, data->syncInterval, data->presentFlags); + result = IDXGISwapChain_Present(data->swapChain, data->syncInterval, data->presentFlags); #endif if (FAILED(result) && result != DXGI_ERROR_WAS_STILL_DRAWING) { @@ -3138,10 +3142,10 @@ static int D3D12_RenderPresent(SDL_Renderer *renderer) return -1; } else { /* Wait for the GPU and move to the next frame */ - result = D3D_CALL(data->commandQueue, Signal, data->fence, data->fenceValue); + result = ID3D12CommandQueue_Signal(data->commandQueue, data->fence, data->fenceValue); - if (D3D_CALL(data->fence, GetCompletedValue) < data->fenceValue) { - result = D3D_CALL(data->fence, SetEventOnCompletion, + if (ID3D12Fence_GetCompletedValue(data->fence) < data->fenceValue) { + result = ID3D12Fence_SetEventOnCompletion(data->fence, data->fenceValue, data->fenceEvent); WaitForSingleObjectEx(data->fenceEvent, INFINITE, FALSE); @@ -3152,7 +3156,7 @@ static int D3D12_RenderPresent(SDL_Renderer *renderer) data->currentBackBufferIndex++; data->currentBackBufferIndex %= SDL_D3D12_NUM_BUFFERS; #else - data->currentBackBufferIndex = D3D_CALL(data->swapChain, GetCurrentBackBufferIndex); + data->currentBackBufferIndex = IDXGISwapChain4_GetCurrentBackBufferIndex(data->swapChain); #endif /* Reset the command allocator and command list, and transition back to render target */ diff --git a/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp b/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp index 829e075563398..d43b1b6900f56 100644 --- a/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp +++ b/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp @@ -25,7 +25,7 @@ #include #include "../../core/windows/SDL_windows.h" -#include +#include "../../video/directx/SDL_d3d12.h" #include "SDL_shaders_d3d12.h" diff --git a/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp b/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp index 90322edd2ef88..40ccd6e504059 100644 --- a/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp +++ b/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp @@ -25,7 +25,7 @@ #include #include "../../core/windows/SDL_windows.h" -#include +#include "../../video/directx/SDL_d3d12.h" #include "SDL_shaders_d3d12.h" diff --git a/src/video/directx/SDL_d3d12.h b/src/video/directx/SDL_d3d12.h index db3429aa1c66c..03e3d96df9ca7 100644 --- a/src/video/directx/SDL_d3d12.h +++ b/src/video/directx/SDL_d3d12.h @@ -50,8 +50,9 @@ X = NULL; \ } -/* FIXME: Remove this in favor of the COBJMACROS defines */ -#define D3D_CALL(THIS, FUNC, ...) (THIS)->lpVtbl->FUNC((THIS), ##__VA_ARGS__) +/* Some D3D12 calls are mismatched between Windows/Xbox, so we need to wrap the + * C function ourselves :( + */ #define D3D_CALL_RET(THIS, FUNC, ...) (THIS)->lpVtbl->FUNC((THIS), ##__VA_ARGS__) #else /* !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) */ @@ -78,8 +79,12 @@ /* DXGI_PRESENT flags are removed on Xbox */ #define DXGI_PRESENT_ALLOW_TEARING 0 -/* FIXME: Xbox D3D12 does not define the COBJMACROS, so we need to define them ourselves */ -#define D3D_CALL(THIS, FUNC, ...) (THIS)->FUNC(__VA_ARGS__) +/* Xbox D3D12 does not define the COBJMACROS, so we need to define them ourselves */ +#include "SDL_d3d12_xbox_cmacros.h" + +/* Xbox's D3D12 ABI actually varies from Windows, if a function does not exist + * in the above header then you need to use this instead :( + */ #define D3D_CALL_RET(THIS, FUNC, RETVAL, ...) *(RETVAL) = (THIS)->FUNC(__VA_ARGS__) #endif /* !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) */ diff --git a/src/video/directx/SDL_d3d12_xbox_cmacros.h b/src/video/directx/SDL_d3d12_xbox_cmacros.h new file mode 100644 index 0000000000000..aa9e4ce2b9a56 --- /dev/null +++ b/src/video/directx/SDL_d3d12_xbox_cmacros.h @@ -0,0 +1,4761 @@ +/* This file is autogenerated, DO NOT MODIFY */ +#define ID3D12Object_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Object_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Object_Release(This) \ + ( (This)->Release() ) +#define ID3D12Object_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Object_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Object_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Object_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12DeviceChild_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DeviceChild_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DeviceChild_Release(This) \ + ( (This)->Release() ) +#define ID3D12DeviceChild_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12DeviceChild_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12DeviceChild_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12DeviceChild_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12DeviceChild_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12RootSignature_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12RootSignature_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12RootSignature_Release(This) \ + ( (This)->Release() ) +#define ID3D12RootSignature_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12RootSignature_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12RootSignature_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12RootSignature_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12RootSignature_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12RootSignatureDeserializer_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12RootSignatureDeserializer_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12RootSignatureDeserializer_Release(This) \ + ( (This)->Release() ) +#define ID3D12RootSignatureDeserializer_GetRootSignatureDesc(This) \ + ( (This)->GetRootSignatureDesc() ) +#define ID3D12VersionedRootSignatureDeserializer_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12VersionedRootSignatureDeserializer_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12VersionedRootSignatureDeserializer_Release(This) \ + ( (This)->Release() ) +#define ID3D12VersionedRootSignatureDeserializer_GetRootSignatureDescAtVersion(This,convertToVersion,ppDesc) \ + ( (This)->GetRootSignatureDescAtVersion(convertToVersion,ppDesc) ) +#define ID3D12VersionedRootSignatureDeserializer_GetUnconvertedRootSignatureDesc(This) \ + ( (This)->GetUnconvertedRootSignatureDesc() ) +#define ID3D12Pageable_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Pageable_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Pageable_Release(This) \ + ( (This)->Release() ) +#define ID3D12Pageable_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Pageable_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Pageable_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Pageable_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Pageable_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12Heap_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Heap_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Heap_Release(This) \ + ( (This)->Release() ) +#define ID3D12Heap_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Heap_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Heap_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Heap_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Heap_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12Resource_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Resource_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Resource_Release(This) \ + ( (This)->Release() ) +#define ID3D12Resource_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Resource_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Resource_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Resource_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Resource_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12Resource_Map(This,Subresource,pReadRange,ppData) \ + ( (This)->Map(Subresource,pReadRange,ppData) ) +#define ID3D12Resource_Unmap(This,Subresource,pWrittenRange) \ + ( (This)->Unmap(Subresource,pWrittenRange) ) +#define ID3D12Resource_GetGPUVirtualAddress(This) \ + ( (This)->GetGPUVirtualAddress() ) +#define ID3D12Resource_WriteToSubresource(This,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->WriteToSubresource(DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) +#define ID3D12Resource_ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) \ + ( (This)->ReadFromSubresource(pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) ) +#define ID3D12Resource_GetHeapProperties(This,pHeapProperties,pHeapFlags) \ + ( (This)->GetHeapProperties(pHeapProperties,pHeapFlags) ) +#define ID3D12CommandAllocator_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12CommandAllocator_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12CommandAllocator_Release(This) \ + ( (This)->Release() ) +#define ID3D12CommandAllocator_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12CommandAllocator_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12CommandAllocator_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12CommandAllocator_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12CommandAllocator_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12CommandAllocator_Reset(This) \ + ( (This)->Reset() ) +#define ID3D12Fence_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Fence_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Fence_Release(This) \ + ( (This)->Release() ) +#define ID3D12Fence_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Fence_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Fence_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Fence_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Fence_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12Fence_GetCompletedValue(This) \ + ( (This)->GetCompletedValue() ) +#define ID3D12Fence_SetEventOnCompletion(This,Value,hEvent) \ + ( (This)->SetEventOnCompletion(Value,hEvent) ) +#define ID3D12Fence_Signal(This,Value) \ + ( (This)->Signal(Value) ) +#define ID3D12Fence1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Fence1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Fence1_Release(This) \ + ( (This)->Release() ) +#define ID3D12Fence1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Fence1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Fence1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Fence1_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Fence1_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12Fence1_GetCompletedValue(This) \ + ( (This)->GetCompletedValue() ) +#define ID3D12Fence1_SetEventOnCompletion(This,Value,hEvent) \ + ( (This)->SetEventOnCompletion(Value,hEvent) ) +#define ID3D12Fence1_Signal(This,Value) \ + ( (This)->Signal(Value) ) +#define ID3D12Fence1_GetCreationFlags(This) \ + ( (This)->GetCreationFlags() ) +#define ID3D12PipelineState_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12PipelineState_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12PipelineState_Release(This) \ + ( (This)->Release() ) +#define ID3D12PipelineState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12PipelineState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12PipelineState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12PipelineState_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12PipelineState_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12PipelineState_GetCachedBlob(This,ppBlob) \ + ( (This)->GetCachedBlob(ppBlob) ) +#define ID3D12DescriptorHeap_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DescriptorHeap_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DescriptorHeap_Release(This) \ + ( (This)->Release() ) +#define ID3D12DescriptorHeap_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12DescriptorHeap_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12DescriptorHeap_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12DescriptorHeap_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12DescriptorHeap_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12QueryHeap_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12QueryHeap_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12QueryHeap_Release(This) \ + ( (This)->Release() ) +#define ID3D12QueryHeap_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12QueryHeap_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12QueryHeap_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12QueryHeap_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12QueryHeap_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12CommandSignature_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12CommandSignature_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12CommandSignature_Release(This) \ + ( (This)->Release() ) +#define ID3D12CommandSignature_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12CommandSignature_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12CommandSignature_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12CommandSignature_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12CommandSignature_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12CommandList_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12CommandList_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12CommandList_Release(This) \ + ( (This)->Release() ) +#define ID3D12CommandList_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12CommandList_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12CommandList_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12CommandList_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12CommandList_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12CommandList_GetType(This) \ + ( (This)->GetType() ) +#define ID3D12GraphicsCommandList_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12GraphicsCommandList_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12GraphicsCommandList_Release(This) \ + ( (This)->Release() ) +#define ID3D12GraphicsCommandList_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12GraphicsCommandList_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12GraphicsCommandList_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12GraphicsCommandList_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12GraphicsCommandList_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12GraphicsCommandList_GetType(This) \ + ( (This)->GetType() ) +#define ID3D12GraphicsCommandList_Close(This) \ + ( (This)->Close() ) +#define ID3D12GraphicsCommandList_Reset(This,pAllocator,pInitialState) \ + ( (This)->Reset(pAllocator,pInitialState) ) +#define ID3D12GraphicsCommandList_ClearState(This,pPipelineState) \ + ( (This)->ClearState(pPipelineState) ) +#define ID3D12GraphicsCommandList_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->DrawInstanced(VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->DrawIndexedInstanced(IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->Dispatch(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->CopyBufferRegion(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) +#define ID3D12GraphicsCommandList_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->CopyTextureRegion(pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) +#define ID3D12GraphicsCommandList_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->CopyResource(pDstResource,pSrcResource) ) +#define ID3D12GraphicsCommandList_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->CopyTiles(pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) +#define ID3D12GraphicsCommandList_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->ResolveSubresource(pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) +#define ID3D12GraphicsCommandList_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->IASetPrimitiveTopology(PrimitiveTopology) ) +#define ID3D12GraphicsCommandList_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->RSSetViewports(NumViewports,pViewports) ) +#define ID3D12GraphicsCommandList_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->RSSetScissorRects(NumRects,pRects) ) +#define ID3D12GraphicsCommandList_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->OMSetBlendFactor(BlendFactor) ) +#define ID3D12GraphicsCommandList_OMSetStencilRef(This,StencilRef) \ + ( (This)->OMSetStencilRef(StencilRef) ) +#define ID3D12GraphicsCommandList_SetPipelineState(This,pPipelineState) \ + ( (This)->SetPipelineState(pPipelineState) ) +#define ID3D12GraphicsCommandList_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->ResourceBarrier(NumBarriers,pBarriers) ) +#define ID3D12GraphicsCommandList_ExecuteBundle(This,pCommandList) \ + ( (This)->ExecuteBundle(pCommandList) ) +#define ID3D12GraphicsCommandList_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->SetDescriptorHeaps(NumDescriptorHeaps,ppDescriptorHeaps) ) +#define ID3D12GraphicsCommandList_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->SetComputeRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->SetGraphicsRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetComputeRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetGraphicsRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList_IASetIndexBuffer(This,pView) \ + ( (This)->IASetIndexBuffer(pView) ) +#define ID3D12GraphicsCommandList_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->IASetVertexBuffers(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->SOSetTargets(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->OMSetRenderTargets(NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) +#define ID3D12GraphicsCommandList_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->ClearDepthStencilView(DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) +#define ID3D12GraphicsCommandList_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->ClearRenderTargetView(RenderTargetView,ColorRGBA,NumRects,pRects) ) +#define ID3D12GraphicsCommandList_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewUint(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewFloat(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList_DiscardResource(This,pResource,pRegion) \ + ( (This)->DiscardResource(pResource,pRegion) ) +#define ID3D12GraphicsCommandList_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->BeginQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->EndQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->ResolveQueryData(pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) +#define ID3D12GraphicsCommandList_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->SetPredication(pBuffer,AlignedBufferOffset,Operation) ) +#define ID3D12GraphicsCommandList_SetMarker(This,Metadata,pData,Size) \ + ( (This)->SetMarker(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->BeginEvent(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList_EndEvent(This) \ + ( (This)->EndEvent() ) +#define ID3D12GraphicsCommandList_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->ExecuteIndirect(pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) +#define ID3D12GraphicsCommandList1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12GraphicsCommandList1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12GraphicsCommandList1_Release(This) \ + ( (This)->Release() ) +#define ID3D12GraphicsCommandList1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12GraphicsCommandList1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12GraphicsCommandList1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12GraphicsCommandList1_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12GraphicsCommandList1_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12GraphicsCommandList1_GetType(This) \ + ( (This)->GetType() ) +#define ID3D12GraphicsCommandList1_Close(This) \ + ( (This)->Close() ) +#define ID3D12GraphicsCommandList1_Reset(This,pAllocator,pInitialState) \ + ( (This)->Reset(pAllocator,pInitialState) ) +#define ID3D12GraphicsCommandList1_ClearState(This,pPipelineState) \ + ( (This)->ClearState(pPipelineState) ) +#define ID3D12GraphicsCommandList1_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->DrawInstanced(VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList1_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->DrawIndexedInstanced(IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList1_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->Dispatch(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList1_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->CopyBufferRegion(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) +#define ID3D12GraphicsCommandList1_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->CopyTextureRegion(pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) +#define ID3D12GraphicsCommandList1_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->CopyResource(pDstResource,pSrcResource) ) +#define ID3D12GraphicsCommandList1_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->CopyTiles(pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) +#define ID3D12GraphicsCommandList1_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->ResolveSubresource(pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) +#define ID3D12GraphicsCommandList1_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->IASetPrimitiveTopology(PrimitiveTopology) ) +#define ID3D12GraphicsCommandList1_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->RSSetViewports(NumViewports,pViewports) ) +#define ID3D12GraphicsCommandList1_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->RSSetScissorRects(NumRects,pRects) ) +#define ID3D12GraphicsCommandList1_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->OMSetBlendFactor(BlendFactor) ) +#define ID3D12GraphicsCommandList1_OMSetStencilRef(This,StencilRef) \ + ( (This)->OMSetStencilRef(StencilRef) ) +#define ID3D12GraphicsCommandList1_SetPipelineState(This,pPipelineState) \ + ( (This)->SetPipelineState(pPipelineState) ) +#define ID3D12GraphicsCommandList1_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->ResourceBarrier(NumBarriers,pBarriers) ) +#define ID3D12GraphicsCommandList1_ExecuteBundle(This,pCommandList) \ + ( (This)->ExecuteBundle(pCommandList) ) +#define ID3D12GraphicsCommandList1_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->SetDescriptorHeaps(NumDescriptorHeaps,ppDescriptorHeaps) ) +#define ID3D12GraphicsCommandList1_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->SetComputeRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList1_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->SetGraphicsRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList1_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetComputeRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList1_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetGraphicsRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList1_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList1_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList1_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList1_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList1_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList1_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList1_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList1_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList1_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList1_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList1_IASetIndexBuffer(This,pView) \ + ( (This)->IASetIndexBuffer(pView) ) +#define ID3D12GraphicsCommandList1_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->IASetVertexBuffers(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList1_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->SOSetTargets(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList1_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->OMSetRenderTargets(NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) +#define ID3D12GraphicsCommandList1_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->ClearDepthStencilView(DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) +#define ID3D12GraphicsCommandList1_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->ClearRenderTargetView(RenderTargetView,ColorRGBA,NumRects,pRects) ) +#define ID3D12GraphicsCommandList1_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewUint(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList1_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewFloat(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList1_DiscardResource(This,pResource,pRegion) \ + ( (This)->DiscardResource(pResource,pRegion) ) +#define ID3D12GraphicsCommandList1_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->BeginQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList1_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->EndQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList1_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->ResolveQueryData(pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) +#define ID3D12GraphicsCommandList1_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->SetPredication(pBuffer,AlignedBufferOffset,Operation) ) +#define ID3D12GraphicsCommandList1_SetMarker(This,Metadata,pData,Size) \ + ( (This)->SetMarker(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList1_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->BeginEvent(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList1_EndEvent(This) \ + ( (This)->EndEvent() ) +#define ID3D12GraphicsCommandList1_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->ExecuteIndirect(pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) +#define ID3D12GraphicsCommandList1_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList1_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT64(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList1_OMSetDepthBounds(This,Min,Max) \ + ( (This)->OMSetDepthBounds(Min,Max) ) +#define ID3D12GraphicsCommandList1_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->SetSamplePositions(NumSamplesPerPixel,NumPixels,pSamplePositions) ) +#define ID3D12GraphicsCommandList1_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->ResolveSubresourceRegion(pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) +#define ID3D12GraphicsCommandList1_SetViewInstanceMask(This,Mask) \ + ( (This)->SetViewInstanceMask(Mask) ) +#define ID3D12GraphicsCommandList2_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12GraphicsCommandList2_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12GraphicsCommandList2_Release(This) \ + ( (This)->Release() ) +#define ID3D12GraphicsCommandList2_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12GraphicsCommandList2_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12GraphicsCommandList2_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12GraphicsCommandList2_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12GraphicsCommandList2_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12GraphicsCommandList2_GetType(This) \ + ( (This)->GetType() ) +#define ID3D12GraphicsCommandList2_Close(This) \ + ( (This)->Close() ) +#define ID3D12GraphicsCommandList2_Reset(This,pAllocator,pInitialState) \ + ( (This)->Reset(pAllocator,pInitialState) ) +#define ID3D12GraphicsCommandList2_ClearState(This,pPipelineState) \ + ( (This)->ClearState(pPipelineState) ) +#define ID3D12GraphicsCommandList2_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->DrawInstanced(VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList2_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->DrawIndexedInstanced(IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList2_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->Dispatch(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList2_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->CopyBufferRegion(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) +#define ID3D12GraphicsCommandList2_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->CopyTextureRegion(pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) +#define ID3D12GraphicsCommandList2_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->CopyResource(pDstResource,pSrcResource) ) +#define ID3D12GraphicsCommandList2_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->CopyTiles(pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) +#define ID3D12GraphicsCommandList2_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->ResolveSubresource(pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) +#define ID3D12GraphicsCommandList2_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->IASetPrimitiveTopology(PrimitiveTopology) ) +#define ID3D12GraphicsCommandList2_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->RSSetViewports(NumViewports,pViewports) ) +#define ID3D12GraphicsCommandList2_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->RSSetScissorRects(NumRects,pRects) ) +#define ID3D12GraphicsCommandList2_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->OMSetBlendFactor(BlendFactor) ) +#define ID3D12GraphicsCommandList2_OMSetStencilRef(This,StencilRef) \ + ( (This)->OMSetStencilRef(StencilRef) ) +#define ID3D12GraphicsCommandList2_SetPipelineState(This,pPipelineState) \ + ( (This)->SetPipelineState(pPipelineState) ) +#define ID3D12GraphicsCommandList2_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->ResourceBarrier(NumBarriers,pBarriers) ) +#define ID3D12GraphicsCommandList2_ExecuteBundle(This,pCommandList) \ + ( (This)->ExecuteBundle(pCommandList) ) +#define ID3D12GraphicsCommandList2_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->SetDescriptorHeaps(NumDescriptorHeaps,ppDescriptorHeaps) ) +#define ID3D12GraphicsCommandList2_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->SetComputeRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList2_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->SetGraphicsRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList2_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetComputeRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList2_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetGraphicsRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList2_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList2_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList2_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList2_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList2_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList2_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList2_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList2_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList2_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList2_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList2_IASetIndexBuffer(This,pView) \ + ( (This)->IASetIndexBuffer(pView) ) +#define ID3D12GraphicsCommandList2_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->IASetVertexBuffers(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList2_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->SOSetTargets(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList2_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->OMSetRenderTargets(NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) +#define ID3D12GraphicsCommandList2_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->ClearDepthStencilView(DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) +#define ID3D12GraphicsCommandList2_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->ClearRenderTargetView(RenderTargetView,ColorRGBA,NumRects,pRects) ) +#define ID3D12GraphicsCommandList2_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewUint(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList2_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewFloat(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList2_DiscardResource(This,pResource,pRegion) \ + ( (This)->DiscardResource(pResource,pRegion) ) +#define ID3D12GraphicsCommandList2_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->BeginQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList2_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->EndQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList2_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->ResolveQueryData(pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) +#define ID3D12GraphicsCommandList2_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->SetPredication(pBuffer,AlignedBufferOffset,Operation) ) +#define ID3D12GraphicsCommandList2_SetMarker(This,Metadata,pData,Size) \ + ( (This)->SetMarker(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList2_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->BeginEvent(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList2_EndEvent(This) \ + ( (This)->EndEvent() ) +#define ID3D12GraphicsCommandList2_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->ExecuteIndirect(pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) +#define ID3D12GraphicsCommandList2_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList2_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT64(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList2_OMSetDepthBounds(This,Min,Max) \ + ( (This)->OMSetDepthBounds(Min,Max) ) +#define ID3D12GraphicsCommandList2_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->SetSamplePositions(NumSamplesPerPixel,NumPixels,pSamplePositions) ) +#define ID3D12GraphicsCommandList2_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->ResolveSubresourceRegion(pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) +#define ID3D12GraphicsCommandList2_SetViewInstanceMask(This,Mask) \ + ( (This)->SetViewInstanceMask(Mask) ) +#define ID3D12GraphicsCommandList2_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->WriteBufferImmediate(Count,pParams,pModes) ) +#define ID3D12CommandQueue_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12CommandQueue_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12CommandQueue_Release(This) \ + ( (This)->Release() ) +#define ID3D12CommandQueue_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12CommandQueue_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12CommandQueue_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12CommandQueue_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12CommandQueue_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12CommandQueue_UpdateTileMappings(This,pResource,NumResourceRegions,pResourceRegionStartCoordinates,pResourceRegionSizes,pHeap,NumRanges,pRangeFlags,pHeapRangeStartOffsets,pRangeTileCounts,Flags) \ + ( (This)->UpdateTileMappings(pResource,NumResourceRegions,pResourceRegionStartCoordinates,pResourceRegionSizes,pHeap,NumRanges,pRangeFlags,pHeapRangeStartOffsets,pRangeTileCounts,Flags) ) +#define ID3D12CommandQueue_CopyTileMappings(This,pDstResource,pDstRegionStartCoordinate,pSrcResource,pSrcRegionStartCoordinate,pRegionSize,Flags) \ + ( (This)->CopyTileMappings(pDstResource,pDstRegionStartCoordinate,pSrcResource,pSrcRegionStartCoordinate,pRegionSize,Flags) ) +#define ID3D12CommandQueue_ExecuteCommandLists(This,NumCommandLists,ppCommandLists) \ + ( (This)->ExecuteCommandLists(NumCommandLists,ppCommandLists) ) +#define ID3D12CommandQueue_SetMarker(This,Metadata,pData,Size) \ + ( (This)->SetMarker(Metadata,pData,Size) ) +#define ID3D12CommandQueue_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->BeginEvent(Metadata,pData,Size) ) +#define ID3D12CommandQueue_EndEvent(This) \ + ( (This)->EndEvent() ) +#define ID3D12CommandQueue_Signal(This,pFence,Value) \ + ( (This)->Signal(pFence,Value) ) +#define ID3D12CommandQueue_Wait(This,pFence,Value) \ + ( (This)->Wait(pFence,Value) ) +#define ID3D12CommandQueue_GetTimestampFrequency(This,pFrequency) \ + ( (This)->GetTimestampFrequency(pFrequency) ) +#define ID3D12CommandQueue_GetClockCalibration(This,pGpuTimestamp,pCpuTimestamp) \ + ( (This)->GetClockCalibration(pGpuTimestamp,pCpuTimestamp) ) +#define ID3D12Device_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12PipelineLibrary_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12PipelineLibrary_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12PipelineLibrary_Release(This) \ + ( (This)->Release() ) +#define ID3D12PipelineLibrary_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12PipelineLibrary_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12PipelineLibrary_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12PipelineLibrary_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12PipelineLibrary_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12PipelineLibrary_StorePipeline(This,pName,pPipeline) \ + ( (This)->StorePipeline(pName,pPipeline) ) +#define ID3D12PipelineLibrary_LoadGraphicsPipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->LoadGraphicsPipeline(pName,pDesc,riid,ppPipelineState) ) +#define ID3D12PipelineLibrary_LoadComputePipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->LoadComputePipeline(pName,pDesc,riid,ppPipelineState) ) +#define ID3D12PipelineLibrary_GetSerializedSize(This) \ + ( (This)->GetSerializedSize() ) +#define ID3D12PipelineLibrary_Serialize(This,pData,DataSizeInBytes) \ + ( (This)->Serialize(pData,DataSizeInBytes) ) +#define ID3D12PipelineLibrary1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12PipelineLibrary1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12PipelineLibrary1_Release(This) \ + ( (This)->Release() ) +#define ID3D12PipelineLibrary1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12PipelineLibrary1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12PipelineLibrary1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12PipelineLibrary1_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12PipelineLibrary1_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12PipelineLibrary1_StorePipeline(This,pName,pPipeline) \ + ( (This)->StorePipeline(pName,pPipeline) ) +#define ID3D12PipelineLibrary1_LoadGraphicsPipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->LoadGraphicsPipeline(pName,pDesc,riid,ppPipelineState) ) +#define ID3D12PipelineLibrary1_LoadComputePipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->LoadComputePipeline(pName,pDesc,riid,ppPipelineState) ) +#define ID3D12PipelineLibrary1_GetSerializedSize(This) \ + ( (This)->GetSerializedSize() ) +#define ID3D12PipelineLibrary1_Serialize(This,pData,DataSizeInBytes) \ + ( (This)->Serialize(pData,DataSizeInBytes) ) +#define ID3D12PipelineLibrary1_LoadPipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->LoadPipeline(pName,pDesc,riid,ppPipelineState) ) +#define ID3D12Device1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device1_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device1_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device1_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device1_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device1_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device1_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device1_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device1_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device1_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device1_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device1_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device1_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device1_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device1_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device1_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device1_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device1_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device1_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device1_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device1_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device1_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device1_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device1_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device1_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device1_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device1_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device1_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device1_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device1_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device1_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device1_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device1_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device1_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device1_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device1_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device1_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device1_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device1_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device1_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device2_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device2_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device2_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device2_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device2_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device2_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device2_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device2_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device2_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device2_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device2_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device2_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device2_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device2_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device2_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device2_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device2_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device2_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device2_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device2_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device2_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device2_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device2_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device2_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device2_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device2_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device2_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device2_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device2_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device2_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device2_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device2_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device2_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device2_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device2_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device2_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device2_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device2_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device2_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device2_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device2_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device2_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device2_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device2_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device2_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreatePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device3_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device3_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device3_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device3_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device3_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device3_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device3_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device3_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device3_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device3_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device3_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device3_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device3_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device3_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device3_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device3_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device3_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device3_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device3_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device3_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device3_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device3_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device3_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device3_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device3_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device3_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device3_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device3_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device3_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device3_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device3_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device3_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device3_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device3_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device3_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device3_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device3_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device3_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device3_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device3_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device3_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device3_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device3_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device3_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device3_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreatePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device3_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress(pAddress,riid,ppvHeap) ) +#define ID3D12Device3_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromFileMapping(hFileMapping,riid,ppvHeap) ) +#define ID3D12Device3_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->EnqueueMakeResident(Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) +#define ID3D12ProtectedSession_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12ProtectedSession_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12ProtectedSession_Release(This) \ + ( (This)->Release() ) +#define ID3D12ProtectedSession_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12ProtectedSession_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12ProtectedSession_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12ProtectedSession_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12ProtectedSession_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12ProtectedSession_GetStatusFence(This,riid,ppFence) \ + ( (This)->GetStatusFence(riid,ppFence) ) +#define ID3D12ProtectedSession_GetSessionStatus(This) \ + ( (This)->GetSessionStatus() ) +#define ID3D12ProtectedResourceSession_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12ProtectedResourceSession_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12ProtectedResourceSession_Release(This) \ + ( (This)->Release() ) +#define ID3D12ProtectedResourceSession_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12ProtectedResourceSession_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12ProtectedResourceSession_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12ProtectedResourceSession_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12ProtectedResourceSession_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12ProtectedResourceSession_GetStatusFence(This,riid,ppFence) \ + ( (This)->GetStatusFence(riid,ppFence) ) +#define ID3D12ProtectedResourceSession_GetSessionStatus(This) \ + ( (This)->GetSessionStatus() ) +#define ID3D12Device4_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device4_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device4_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device4_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device4_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device4_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device4_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device4_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device4_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device4_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device4_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device4_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device4_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device4_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device4_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device4_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device4_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device4_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device4_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device4_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device4_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device4_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device4_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device4_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device4_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device4_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device4_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device4_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device4_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device4_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device4_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device4_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device4_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device4_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device4_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device4_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device4_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device4_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device4_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device4_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device4_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device4_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device4_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device4_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device4_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreatePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device4_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress(pAddress,riid,ppvHeap) ) +#define ID3D12Device4_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromFileMapping(hFileMapping,riid,ppvHeap) ) +#define ID3D12Device4_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->EnqueueMakeResident(Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) +#define ID3D12Device4_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->CreateCommandList1(nodeMask,type,flags,riid,ppCommandList) ) +#define ID3D12Device4_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession(pDesc,riid,ppSession) ) +#define ID3D12Device4_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource1(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device4_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->CreateHeap1(pDesc,pProtectedSession,riid,ppvHeap) ) +#define ID3D12Device4_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->CreateReservedResource1(pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#define ID3D12LifetimeOwner_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12LifetimeOwner_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12LifetimeOwner_Release(This) \ + ( (This)->Release() ) +#define ID3D12LifetimeOwner_LifetimeStateUpdated(This,NewState) \ + ( (This)->LifetimeStateUpdated(NewState) ) +#define ID3D12SwapChainAssistant_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12SwapChainAssistant_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12SwapChainAssistant_Release(This) \ + ( (This)->Release() ) +#define ID3D12SwapChainAssistant_GetSwapChainObject(This,riid,ppv) \ + ( (This)->GetSwapChainObject(riid,ppv) ) +#define ID3D12SwapChainAssistant_GetCurrentResourceAndCommandQueue(This,riidResource,ppvResource,riidQueue,ppvQueue) \ + ( (This)->GetCurrentResourceAndCommandQueue(riidResource,ppvResource,riidQueue,ppvQueue) ) +#define ID3D12SwapChainAssistant_InsertImplicitSync(This) \ + ( (This)->InsertImplicitSync() ) +#define ID3D12LifetimeTracker_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12LifetimeTracker_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12LifetimeTracker_Release(This) \ + ( (This)->Release() ) +#define ID3D12LifetimeTracker_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12LifetimeTracker_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12LifetimeTracker_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12LifetimeTracker_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12LifetimeTracker_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12LifetimeTracker_DestroyOwnedObject(This,pObject) \ + ( (This)->DestroyOwnedObject(pObject) ) +#define ID3D12StateObject_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12StateObject_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12StateObject_Release(This) \ + ( (This)->Release() ) +#define ID3D12StateObject_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12StateObject_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12StateObject_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12StateObject_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12StateObject_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12StateObjectProperties_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12StateObjectProperties_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12StateObjectProperties_Release(This) \ + ( (This)->Release() ) +#define ID3D12StateObjectProperties_GetShaderIdentifier(This,pExportName) \ + ( (This)->GetShaderIdentifier(pExportName) ) +#define ID3D12StateObjectProperties_GetShaderStackSize(This,pExportName) \ + ( (This)->GetShaderStackSize(pExportName) ) +#define ID3D12StateObjectProperties_GetPipelineStackSize(This) \ + ( (This)->GetPipelineStackSize() ) +#define ID3D12StateObjectProperties_SetPipelineStackSize(This,PipelineStackSizeInBytes) \ + ( (This)->SetPipelineStackSize(PipelineStackSizeInBytes) ) +#define ID3D12StateObjectProperties1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12StateObjectProperties1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12StateObjectProperties1_Release(This) \ + ( (This)->Release() ) +#define ID3D12StateObjectProperties1_GetShaderIdentifier(This,pExportName) \ + ( (This)->GetShaderIdentifier(pExportName) ) +#define ID3D12StateObjectProperties1_GetShaderStackSize(This,pExportName) \ + ( (This)->GetShaderStackSize(pExportName) ) +#define ID3D12StateObjectProperties1_GetPipelineStackSize(This) \ + ( (This)->GetPipelineStackSize() ) +#define ID3D12StateObjectProperties1_SetPipelineStackSize(This,PipelineStackSizeInBytes) \ + ( (This)->SetPipelineStackSize(PipelineStackSizeInBytes) ) +#define ID3D12WorkGraphProperties_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12WorkGraphProperties_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12WorkGraphProperties_Release(This) \ + ( (This)->Release() ) +#define ID3D12WorkGraphProperties_GetNumWorkGraphs(This) \ + ( (This)->GetNumWorkGraphs() ) +#define ID3D12WorkGraphProperties_GetProgramName(This,WorkGraphIndex) \ + ( (This)->GetProgramName(WorkGraphIndex) ) +#define ID3D12WorkGraphProperties_GetWorkGraphIndex(This,pProgramName) \ + ( (This)->GetWorkGraphIndex(pProgramName) ) +#define ID3D12WorkGraphProperties_GetNumNodes(This,WorkGraphIndex) \ + ( (This)->GetNumNodes(WorkGraphIndex) ) +#define ID3D12WorkGraphProperties_GetNodeIndex(This,WorkGraphIndex,NodeID) \ + ( (This)->GetNodeIndex(WorkGraphIndex,NodeID) ) +#define ID3D12WorkGraphProperties_GetNodeLocalRootArgumentsTableIndex(This,WorkGraphIndex,NodeIndex) \ + ( (This)->GetNodeLocalRootArgumentsTableIndex(WorkGraphIndex,NodeIndex) ) +#define ID3D12WorkGraphProperties_GetNumEntrypoints(This,WorkGraphIndex) \ + ( (This)->GetNumEntrypoints(WorkGraphIndex) ) +#define ID3D12WorkGraphProperties_GetEntrypointIndex(This,WorkGraphIndex,NodeID) \ + ( (This)->GetEntrypointIndex(WorkGraphIndex,NodeID) ) +#define ID3D12WorkGraphProperties_GetEntrypointRecordSizeInBytes(This,WorkGraphIndex,EntrypointIndex) \ + ( (This)->GetEntrypointRecordSizeInBytes(WorkGraphIndex,EntrypointIndex) ) +#define ID3D12WorkGraphProperties_GetWorkGraphMemoryRequirements(This,WorkGraphIndex,pWorkGraphMemoryRequirements) \ + ( (This)->GetWorkGraphMemoryRequirements(WorkGraphIndex,pWorkGraphMemoryRequirements) ) +#define ID3D12WorkGraphProperties_GetEntrypointRecordAlignmentInBytes(This,WorkGraphIndex,EntrypointIndex) \ + ( (This)->GetEntrypointRecordAlignmentInBytes(WorkGraphIndex,EntrypointIndex) ) +#define ID3D12Device5_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device5_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device5_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device5_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device5_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device5_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device5_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device5_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device5_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device5_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device5_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device5_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device5_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device5_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device5_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device5_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device5_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device5_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device5_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device5_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device5_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device5_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device5_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device5_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device5_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device5_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device5_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device5_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device5_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device5_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device5_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device5_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device5_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device5_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device5_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device5_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device5_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device5_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device5_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device5_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device5_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device5_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device5_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device5_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device5_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreatePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device5_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress(pAddress,riid,ppvHeap) ) +#define ID3D12Device5_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromFileMapping(hFileMapping,riid,ppvHeap) ) +#define ID3D12Device5_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->EnqueueMakeResident(Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) +#define ID3D12Device5_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->CreateCommandList1(nodeMask,type,flags,riid,ppCommandList) ) +#define ID3D12Device5_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession(pDesc,riid,ppSession) ) +#define ID3D12Device5_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource1(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device5_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->CreateHeap1(pDesc,pProtectedSession,riid,ppvHeap) ) +#define ID3D12Device5_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->CreateReservedResource1(pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#define ID3D12Device5_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->CreateLifetimeTracker(pOwner,riid,ppvTracker) ) +#define ID3D12Device5_RemoveDevice(This) \ + ( (This)->RemoveDevice() ) +#define ID3D12Device5_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->EnumerateMetaCommands(pNumMetaCommands,pDescs) ) +#define ID3D12Device5_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->EnumerateMetaCommandParameters(CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) +#define ID3D12Device5_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->CreateMetaCommand(CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) +#define ID3D12Device5_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->CreateStateObject(pDesc,riid,ppStateObject) ) +#define ID3D12Device5_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->GetRaytracingAccelerationStructurePrebuildInfo(pDesc,pInfo) ) +#define ID3D12Device5_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->CheckDriverMatchingIdentifier(SerializedDataType,pIdentifierToCheck) ) +#define ID3D12DeviceRemovedExtendedDataSettings_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DeviceRemovedExtendedDataSettings_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DeviceRemovedExtendedDataSettings_Release(This) \ + ( (This)->Release() ) +#define ID3D12DeviceRemovedExtendedDataSettings_SetAutoBreadcrumbsEnablement(This,Enablement) \ + ( (This)->SetAutoBreadcrumbsEnablement(Enablement) ) +#define ID3D12DeviceRemovedExtendedDataSettings_SetPageFaultEnablement(This,Enablement) \ + ( (This)->SetPageFaultEnablement(Enablement) ) +#define ID3D12DeviceRemovedExtendedDataSettings_SetWatsonDumpEnablement(This,Enablement) \ + ( (This)->SetWatsonDumpEnablement(Enablement) ) +#define ID3D12DeviceRemovedExtendedDataSettings1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DeviceRemovedExtendedDataSettings1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DeviceRemovedExtendedDataSettings1_Release(This) \ + ( (This)->Release() ) +#define ID3D12DeviceRemovedExtendedDataSettings1_SetAutoBreadcrumbsEnablement(This,Enablement) \ + ( (This)->SetAutoBreadcrumbsEnablement(Enablement) ) +#define ID3D12DeviceRemovedExtendedDataSettings1_SetPageFaultEnablement(This,Enablement) \ + ( (This)->SetPageFaultEnablement(Enablement) ) +#define ID3D12DeviceRemovedExtendedDataSettings1_SetWatsonDumpEnablement(This,Enablement) \ + ( (This)->SetWatsonDumpEnablement(Enablement) ) +#define ID3D12DeviceRemovedExtendedDataSettings1_SetBreadcrumbContextEnablement(This,Enablement) \ + ( (This)->SetBreadcrumbContextEnablement(Enablement) ) +#define ID3D12DeviceRemovedExtendedDataSettings2_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DeviceRemovedExtendedDataSettings2_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DeviceRemovedExtendedDataSettings2_Release(This) \ + ( (This)->Release() ) +#define ID3D12DeviceRemovedExtendedDataSettings2_SetAutoBreadcrumbsEnablement(This,Enablement) \ + ( (This)->SetAutoBreadcrumbsEnablement(Enablement) ) +#define ID3D12DeviceRemovedExtendedDataSettings2_SetPageFaultEnablement(This,Enablement) \ + ( (This)->SetPageFaultEnablement(Enablement) ) +#define ID3D12DeviceRemovedExtendedDataSettings2_SetWatsonDumpEnablement(This,Enablement) \ + ( (This)->SetWatsonDumpEnablement(Enablement) ) +#define ID3D12DeviceRemovedExtendedDataSettings2_SetBreadcrumbContextEnablement(This,Enablement) \ + ( (This)->SetBreadcrumbContextEnablement(Enablement) ) +#define ID3D12DeviceRemovedExtendedDataSettings2_UseMarkersOnlyAutoBreadcrumbs(This,MarkersOnly) \ + ( (This)->UseMarkersOnlyAutoBreadcrumbs(MarkersOnly) ) +#define ID3D12DeviceRemovedExtendedData_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DeviceRemovedExtendedData_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DeviceRemovedExtendedData_Release(This) \ + ( (This)->Release() ) +#define ID3D12DeviceRemovedExtendedData_GetAutoBreadcrumbsOutput(This,pOutput) \ + ( (This)->GetAutoBreadcrumbsOutput(pOutput) ) +#define ID3D12DeviceRemovedExtendedData_GetPageFaultAllocationOutput(This,pOutput) \ + ( (This)->GetPageFaultAllocationOutput(pOutput) ) +#define ID3D12DeviceRemovedExtendedData1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DeviceRemovedExtendedData1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DeviceRemovedExtendedData1_Release(This) \ + ( (This)->Release() ) +#define ID3D12DeviceRemovedExtendedData1_GetAutoBreadcrumbsOutput(This,pOutput) \ + ( (This)->GetAutoBreadcrumbsOutput(pOutput) ) +#define ID3D12DeviceRemovedExtendedData1_GetPageFaultAllocationOutput(This,pOutput) \ + ( (This)->GetPageFaultAllocationOutput(pOutput) ) +#define ID3D12DeviceRemovedExtendedData1_GetAutoBreadcrumbsOutput1(This,pOutput) \ + ( (This)->GetAutoBreadcrumbsOutput1(pOutput) ) +#define ID3D12DeviceRemovedExtendedData1_GetPageFaultAllocationOutput1(This,pOutput) \ + ( (This)->GetPageFaultAllocationOutput1(pOutput) ) +#define ID3D12DeviceRemovedExtendedData2_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DeviceRemovedExtendedData2_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DeviceRemovedExtendedData2_Release(This) \ + ( (This)->Release() ) +#define ID3D12DeviceRemovedExtendedData2_GetAutoBreadcrumbsOutput(This,pOutput) \ + ( (This)->GetAutoBreadcrumbsOutput(pOutput) ) +#define ID3D12DeviceRemovedExtendedData2_GetPageFaultAllocationOutput(This,pOutput) \ + ( (This)->GetPageFaultAllocationOutput(pOutput) ) +#define ID3D12DeviceRemovedExtendedData2_GetAutoBreadcrumbsOutput1(This,pOutput) \ + ( (This)->GetAutoBreadcrumbsOutput1(pOutput) ) +#define ID3D12DeviceRemovedExtendedData2_GetPageFaultAllocationOutput1(This,pOutput) \ + ( (This)->GetPageFaultAllocationOutput1(pOutput) ) +#define ID3D12DeviceRemovedExtendedData2_GetPageFaultAllocationOutput2(This,pOutput) \ + ( (This)->GetPageFaultAllocationOutput2(pOutput) ) +#define ID3D12DeviceRemovedExtendedData2_GetDeviceState(This) \ + ( (This)->GetDeviceState() ) +#define ID3D12Device6_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device6_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device6_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device6_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device6_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device6_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device6_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device6_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device6_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device6_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device6_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device6_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device6_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device6_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device6_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device6_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device6_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device6_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device6_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device6_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device6_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device6_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device6_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device6_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device6_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device6_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device6_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device6_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device6_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device6_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device6_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device6_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device6_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device6_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device6_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device6_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device6_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device6_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device6_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device6_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device6_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device6_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device6_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device6_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device6_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreatePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device6_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress(pAddress,riid,ppvHeap) ) +#define ID3D12Device6_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromFileMapping(hFileMapping,riid,ppvHeap) ) +#define ID3D12Device6_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->EnqueueMakeResident(Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) +#define ID3D12Device6_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->CreateCommandList1(nodeMask,type,flags,riid,ppCommandList) ) +#define ID3D12Device6_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession(pDesc,riid,ppSession) ) +#define ID3D12Device6_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource1(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device6_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->CreateHeap1(pDesc,pProtectedSession,riid,ppvHeap) ) +#define ID3D12Device6_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->CreateReservedResource1(pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#define ID3D12Device6_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->CreateLifetimeTracker(pOwner,riid,ppvTracker) ) +#define ID3D12Device6_RemoveDevice(This) \ + ( (This)->RemoveDevice() ) +#define ID3D12Device6_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->EnumerateMetaCommands(pNumMetaCommands,pDescs) ) +#define ID3D12Device6_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->EnumerateMetaCommandParameters(CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) +#define ID3D12Device6_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->CreateMetaCommand(CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) +#define ID3D12Device6_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->CreateStateObject(pDesc,riid,ppStateObject) ) +#define ID3D12Device6_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->GetRaytracingAccelerationStructurePrebuildInfo(pDesc,pInfo) ) +#define ID3D12Device6_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->CheckDriverMatchingIdentifier(SerializedDataType,pIdentifierToCheck) ) +#define ID3D12Device6_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->SetBackgroundProcessingMode(Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) +#define ID3D12ProtectedResourceSession1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12ProtectedResourceSession1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12ProtectedResourceSession1_Release(This) \ + ( (This)->Release() ) +#define ID3D12ProtectedResourceSession1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12ProtectedResourceSession1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12ProtectedResourceSession1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12ProtectedResourceSession1_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12ProtectedResourceSession1_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12ProtectedResourceSession1_GetStatusFence(This,riid,ppFence) \ + ( (This)->GetStatusFence(riid,ppFence) ) +#define ID3D12ProtectedResourceSession1_GetSessionStatus(This) \ + ( (This)->GetSessionStatus() ) +#define ID3D12Device7_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device7_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device7_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device7_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device7_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device7_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device7_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device7_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device7_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device7_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device7_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device7_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device7_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device7_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device7_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device7_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device7_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device7_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device7_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device7_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device7_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device7_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device7_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device7_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device7_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device7_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device7_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device7_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device7_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device7_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device7_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device7_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device7_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device7_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device7_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device7_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device7_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device7_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device7_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device7_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device7_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device7_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device7_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device7_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device7_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreatePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device7_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress(pAddress,riid,ppvHeap) ) +#define ID3D12Device7_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromFileMapping(hFileMapping,riid,ppvHeap) ) +#define ID3D12Device7_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->EnqueueMakeResident(Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) +#define ID3D12Device7_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->CreateCommandList1(nodeMask,type,flags,riid,ppCommandList) ) +#define ID3D12Device7_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession(pDesc,riid,ppSession) ) +#define ID3D12Device7_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource1(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device7_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->CreateHeap1(pDesc,pProtectedSession,riid,ppvHeap) ) +#define ID3D12Device7_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->CreateReservedResource1(pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#define ID3D12Device7_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->CreateLifetimeTracker(pOwner,riid,ppvTracker) ) +#define ID3D12Device7_RemoveDevice(This) \ + ( (This)->RemoveDevice() ) +#define ID3D12Device7_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->EnumerateMetaCommands(pNumMetaCommands,pDescs) ) +#define ID3D12Device7_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->EnumerateMetaCommandParameters(CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) +#define ID3D12Device7_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->CreateMetaCommand(CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) +#define ID3D12Device7_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->CreateStateObject(pDesc,riid,ppStateObject) ) +#define ID3D12Device7_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->GetRaytracingAccelerationStructurePrebuildInfo(pDesc,pInfo) ) +#define ID3D12Device7_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->CheckDriverMatchingIdentifier(SerializedDataType,pIdentifierToCheck) ) +#define ID3D12Device7_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->SetBackgroundProcessingMode(Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) +#define ID3D12Device7_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->AddToStateObject(pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) +#define ID3D12Device7_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession1(pDesc,riid,ppSession) ) +#define ID3D12Device8_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device8_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device8_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device8_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device8_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device8_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device8_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device8_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device8_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device8_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device8_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device8_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device8_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device8_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device8_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device8_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device8_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device8_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device8_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device8_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device8_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device8_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device8_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device8_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device8_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device8_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device8_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device8_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device8_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device8_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device8_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device8_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device8_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device8_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device8_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device8_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device8_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device8_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device8_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device8_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device8_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device8_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device8_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device8_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device8_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreatePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device8_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress(pAddress,riid,ppvHeap) ) +#define ID3D12Device8_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromFileMapping(hFileMapping,riid,ppvHeap) ) +#define ID3D12Device8_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->EnqueueMakeResident(Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) +#define ID3D12Device8_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->CreateCommandList1(nodeMask,type,flags,riid,ppCommandList) ) +#define ID3D12Device8_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession(pDesc,riid,ppSession) ) +#define ID3D12Device8_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource1(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device8_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->CreateHeap1(pDesc,pProtectedSession,riid,ppvHeap) ) +#define ID3D12Device8_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->CreateReservedResource1(pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#define ID3D12Device8_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->CreateLifetimeTracker(pOwner,riid,ppvTracker) ) +#define ID3D12Device8_RemoveDevice(This) \ + ( (This)->RemoveDevice() ) +#define ID3D12Device8_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->EnumerateMetaCommands(pNumMetaCommands,pDescs) ) +#define ID3D12Device8_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->EnumerateMetaCommandParameters(CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) +#define ID3D12Device8_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->CreateMetaCommand(CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) +#define ID3D12Device8_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->CreateStateObject(pDesc,riid,ppStateObject) ) +#define ID3D12Device8_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->GetRaytracingAccelerationStructurePrebuildInfo(pDesc,pInfo) ) +#define ID3D12Device8_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->CheckDriverMatchingIdentifier(SerializedDataType,pIdentifierToCheck) ) +#define ID3D12Device8_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->SetBackgroundProcessingMode(Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) +#define ID3D12Device8_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->AddToStateObject(pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) +#define ID3D12Device8_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession1(pDesc,riid,ppSession) ) +#define ID3D12Device8_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource2(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device8_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource1(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device8_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->CreateSamplerFeedbackUnorderedAccessView(pTargetedResource,pFeedbackResource,DestDescriptor) ) +#define ID3D12Device8_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints1(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Resource1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Resource1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Resource1_Release(This) \ + ( (This)->Release() ) +#define ID3D12Resource1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Resource1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Resource1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Resource1_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Resource1_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12Resource1_Map(This,Subresource,pReadRange,ppData) \ + ( (This)->Map(Subresource,pReadRange,ppData) ) +#define ID3D12Resource1_Unmap(This,Subresource,pWrittenRange) \ + ( (This)->Unmap(Subresource,pWrittenRange) ) +#define ID3D12Resource1_GetGPUVirtualAddress(This) \ + ( (This)->GetGPUVirtualAddress() ) +#define ID3D12Resource1_WriteToSubresource(This,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->WriteToSubresource(DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) +#define ID3D12Resource1_ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) \ + ( (This)->ReadFromSubresource(pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) ) +#define ID3D12Resource1_GetHeapProperties(This,pHeapProperties,pHeapFlags) \ + ( (This)->GetHeapProperties(pHeapProperties,pHeapFlags) ) +#define ID3D12Resource1_GetProtectedResourceSession(This,riid,ppProtectedSession) \ + ( (This)->GetProtectedResourceSession(riid,ppProtectedSession) ) +#define ID3D12Resource2_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Resource2_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Resource2_Release(This) \ + ( (This)->Release() ) +#define ID3D12Resource2_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Resource2_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Resource2_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Resource2_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Resource2_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12Resource2_Map(This,Subresource,pReadRange,ppData) \ + ( (This)->Map(Subresource,pReadRange,ppData) ) +#define ID3D12Resource2_Unmap(This,Subresource,pWrittenRange) \ + ( (This)->Unmap(Subresource,pWrittenRange) ) +#define ID3D12Resource2_GetGPUVirtualAddress(This) \ + ( (This)->GetGPUVirtualAddress() ) +#define ID3D12Resource2_WriteToSubresource(This,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->WriteToSubresource(DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) +#define ID3D12Resource2_ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) \ + ( (This)->ReadFromSubresource(pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) ) +#define ID3D12Resource2_GetHeapProperties(This,pHeapProperties,pHeapFlags) \ + ( (This)->GetHeapProperties(pHeapProperties,pHeapFlags) ) +#define ID3D12Resource2_GetProtectedResourceSession(This,riid,ppProtectedSession) \ + ( (This)->GetProtectedResourceSession(riid,ppProtectedSession) ) +#define ID3D12Heap1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Heap1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Heap1_Release(This) \ + ( (This)->Release() ) +#define ID3D12Heap1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Heap1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Heap1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Heap1_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Heap1_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12Heap1_GetProtectedResourceSession(This,riid,ppProtectedSession) \ + ( (This)->GetProtectedResourceSession(riid,ppProtectedSession) ) +#define ID3D12GraphicsCommandList3_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12GraphicsCommandList3_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12GraphicsCommandList3_Release(This) \ + ( (This)->Release() ) +#define ID3D12GraphicsCommandList3_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12GraphicsCommandList3_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12GraphicsCommandList3_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12GraphicsCommandList3_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12GraphicsCommandList3_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12GraphicsCommandList3_GetType(This) \ + ( (This)->GetType() ) +#define ID3D12GraphicsCommandList3_Close(This) \ + ( (This)->Close() ) +#define ID3D12GraphicsCommandList3_Reset(This,pAllocator,pInitialState) \ + ( (This)->Reset(pAllocator,pInitialState) ) +#define ID3D12GraphicsCommandList3_ClearState(This,pPipelineState) \ + ( (This)->ClearState(pPipelineState) ) +#define ID3D12GraphicsCommandList3_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->DrawInstanced(VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList3_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->DrawIndexedInstanced(IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList3_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->Dispatch(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList3_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->CopyBufferRegion(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) +#define ID3D12GraphicsCommandList3_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->CopyTextureRegion(pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) +#define ID3D12GraphicsCommandList3_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->CopyResource(pDstResource,pSrcResource) ) +#define ID3D12GraphicsCommandList3_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->CopyTiles(pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) +#define ID3D12GraphicsCommandList3_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->ResolveSubresource(pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) +#define ID3D12GraphicsCommandList3_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->IASetPrimitiveTopology(PrimitiveTopology) ) +#define ID3D12GraphicsCommandList3_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->RSSetViewports(NumViewports,pViewports) ) +#define ID3D12GraphicsCommandList3_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->RSSetScissorRects(NumRects,pRects) ) +#define ID3D12GraphicsCommandList3_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->OMSetBlendFactor(BlendFactor) ) +#define ID3D12GraphicsCommandList3_OMSetStencilRef(This,StencilRef) \ + ( (This)->OMSetStencilRef(StencilRef) ) +#define ID3D12GraphicsCommandList3_SetPipelineState(This,pPipelineState) \ + ( (This)->SetPipelineState(pPipelineState) ) +#define ID3D12GraphicsCommandList3_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->ResourceBarrier(NumBarriers,pBarriers) ) +#define ID3D12GraphicsCommandList3_ExecuteBundle(This,pCommandList) \ + ( (This)->ExecuteBundle(pCommandList) ) +#define ID3D12GraphicsCommandList3_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->SetDescriptorHeaps(NumDescriptorHeaps,ppDescriptorHeaps) ) +#define ID3D12GraphicsCommandList3_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->SetComputeRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList3_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->SetGraphicsRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList3_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetComputeRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList3_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetGraphicsRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList3_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList3_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList3_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList3_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList3_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList3_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList3_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList3_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList3_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList3_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList3_IASetIndexBuffer(This,pView) \ + ( (This)->IASetIndexBuffer(pView) ) +#define ID3D12GraphicsCommandList3_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->IASetVertexBuffers(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList3_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->SOSetTargets(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList3_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->OMSetRenderTargets(NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) +#define ID3D12GraphicsCommandList3_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->ClearDepthStencilView(DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) +#define ID3D12GraphicsCommandList3_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->ClearRenderTargetView(RenderTargetView,ColorRGBA,NumRects,pRects) ) +#define ID3D12GraphicsCommandList3_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewUint(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList3_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewFloat(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList3_DiscardResource(This,pResource,pRegion) \ + ( (This)->DiscardResource(pResource,pRegion) ) +#define ID3D12GraphicsCommandList3_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->BeginQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList3_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->EndQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList3_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->ResolveQueryData(pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) +#define ID3D12GraphicsCommandList3_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->SetPredication(pBuffer,AlignedBufferOffset,Operation) ) +#define ID3D12GraphicsCommandList3_SetMarker(This,Metadata,pData,Size) \ + ( (This)->SetMarker(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList3_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->BeginEvent(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList3_EndEvent(This) \ + ( (This)->EndEvent() ) +#define ID3D12GraphicsCommandList3_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->ExecuteIndirect(pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) +#define ID3D12GraphicsCommandList3_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList3_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT64(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList3_OMSetDepthBounds(This,Min,Max) \ + ( (This)->OMSetDepthBounds(Min,Max) ) +#define ID3D12GraphicsCommandList3_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->SetSamplePositions(NumSamplesPerPixel,NumPixels,pSamplePositions) ) +#define ID3D12GraphicsCommandList3_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->ResolveSubresourceRegion(pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) +#define ID3D12GraphicsCommandList3_SetViewInstanceMask(This,Mask) \ + ( (This)->SetViewInstanceMask(Mask) ) +#define ID3D12GraphicsCommandList3_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->WriteBufferImmediate(Count,pParams,pModes) ) +#define ID3D12GraphicsCommandList3_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->SetProtectedResourceSession(pProtectedResourceSession) ) +#define ID3D12MetaCommand_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12MetaCommand_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12MetaCommand_Release(This) \ + ( (This)->Release() ) +#define ID3D12MetaCommand_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12MetaCommand_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12MetaCommand_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12MetaCommand_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12MetaCommand_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12MetaCommand_GetRequiredParameterResourceSize(This,Stage,ParameterIndex) \ + ( (This)->GetRequiredParameterResourceSize(Stage,ParameterIndex) ) +#define ID3D12GraphicsCommandList4_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12GraphicsCommandList4_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12GraphicsCommandList4_Release(This) \ + ( (This)->Release() ) +#define ID3D12GraphicsCommandList4_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12GraphicsCommandList4_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12GraphicsCommandList4_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12GraphicsCommandList4_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12GraphicsCommandList4_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12GraphicsCommandList4_GetType(This) \ + ( (This)->GetType() ) +#define ID3D12GraphicsCommandList4_Close(This) \ + ( (This)->Close() ) +#define ID3D12GraphicsCommandList4_Reset(This,pAllocator,pInitialState) \ + ( (This)->Reset(pAllocator,pInitialState) ) +#define ID3D12GraphicsCommandList4_ClearState(This,pPipelineState) \ + ( (This)->ClearState(pPipelineState) ) +#define ID3D12GraphicsCommandList4_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->DrawInstanced(VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList4_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->DrawIndexedInstanced(IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList4_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->Dispatch(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList4_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->CopyBufferRegion(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) +#define ID3D12GraphicsCommandList4_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->CopyTextureRegion(pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) +#define ID3D12GraphicsCommandList4_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->CopyResource(pDstResource,pSrcResource) ) +#define ID3D12GraphicsCommandList4_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->CopyTiles(pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) +#define ID3D12GraphicsCommandList4_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->ResolveSubresource(pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) +#define ID3D12GraphicsCommandList4_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->IASetPrimitiveTopology(PrimitiveTopology) ) +#define ID3D12GraphicsCommandList4_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->RSSetViewports(NumViewports,pViewports) ) +#define ID3D12GraphicsCommandList4_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->RSSetScissorRects(NumRects,pRects) ) +#define ID3D12GraphicsCommandList4_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->OMSetBlendFactor(BlendFactor) ) +#define ID3D12GraphicsCommandList4_OMSetStencilRef(This,StencilRef) \ + ( (This)->OMSetStencilRef(StencilRef) ) +#define ID3D12GraphicsCommandList4_SetPipelineState(This,pPipelineState) \ + ( (This)->SetPipelineState(pPipelineState) ) +#define ID3D12GraphicsCommandList4_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->ResourceBarrier(NumBarriers,pBarriers) ) +#define ID3D12GraphicsCommandList4_ExecuteBundle(This,pCommandList) \ + ( (This)->ExecuteBundle(pCommandList) ) +#define ID3D12GraphicsCommandList4_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->SetDescriptorHeaps(NumDescriptorHeaps,ppDescriptorHeaps) ) +#define ID3D12GraphicsCommandList4_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->SetComputeRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList4_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->SetGraphicsRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList4_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetComputeRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList4_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetGraphicsRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList4_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList4_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList4_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList4_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList4_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList4_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList4_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList4_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList4_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList4_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList4_IASetIndexBuffer(This,pView) \ + ( (This)->IASetIndexBuffer(pView) ) +#define ID3D12GraphicsCommandList4_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->IASetVertexBuffers(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList4_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->SOSetTargets(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList4_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->OMSetRenderTargets(NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) +#define ID3D12GraphicsCommandList4_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->ClearDepthStencilView(DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) +#define ID3D12GraphicsCommandList4_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->ClearRenderTargetView(RenderTargetView,ColorRGBA,NumRects,pRects) ) +#define ID3D12GraphicsCommandList4_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewUint(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList4_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewFloat(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList4_DiscardResource(This,pResource,pRegion) \ + ( (This)->DiscardResource(pResource,pRegion) ) +#define ID3D12GraphicsCommandList4_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->BeginQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList4_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->EndQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList4_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->ResolveQueryData(pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) +#define ID3D12GraphicsCommandList4_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->SetPredication(pBuffer,AlignedBufferOffset,Operation) ) +#define ID3D12GraphicsCommandList4_SetMarker(This,Metadata,pData,Size) \ + ( (This)->SetMarker(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList4_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->BeginEvent(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList4_EndEvent(This) \ + ( (This)->EndEvent() ) +#define ID3D12GraphicsCommandList4_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->ExecuteIndirect(pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) +#define ID3D12GraphicsCommandList4_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList4_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT64(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList4_OMSetDepthBounds(This,Min,Max) \ + ( (This)->OMSetDepthBounds(Min,Max) ) +#define ID3D12GraphicsCommandList4_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->SetSamplePositions(NumSamplesPerPixel,NumPixels,pSamplePositions) ) +#define ID3D12GraphicsCommandList4_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->ResolveSubresourceRegion(pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) +#define ID3D12GraphicsCommandList4_SetViewInstanceMask(This,Mask) \ + ( (This)->SetViewInstanceMask(Mask) ) +#define ID3D12GraphicsCommandList4_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->WriteBufferImmediate(Count,pParams,pModes) ) +#define ID3D12GraphicsCommandList4_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->SetProtectedResourceSession(pProtectedResourceSession) ) +#define ID3D12GraphicsCommandList4_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->BeginRenderPass(NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) +#define ID3D12GraphicsCommandList4_EndRenderPass(This) \ + ( (This)->EndRenderPass() ) +#define ID3D12GraphicsCommandList4_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->InitializeMetaCommand(pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList4_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->ExecuteMetaCommand(pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList4_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->BuildRaytracingAccelerationStructure(pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) +#define ID3D12GraphicsCommandList4_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->EmitRaytracingAccelerationStructurePostbuildInfo(pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) +#define ID3D12GraphicsCommandList4_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->CopyRaytracingAccelerationStructure(DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) +#define ID3D12GraphicsCommandList4_SetPipelineState1(This,pStateObject) \ + ( (This)->SetPipelineState1(pStateObject) ) +#define ID3D12GraphicsCommandList4_DispatchRays(This,pDesc) \ + ( (This)->DispatchRays(pDesc) ) +#define ID3D12ShaderCacheSession_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12ShaderCacheSession_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12ShaderCacheSession_Release(This) \ + ( (This)->Release() ) +#define ID3D12ShaderCacheSession_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12ShaderCacheSession_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12ShaderCacheSession_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12ShaderCacheSession_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12ShaderCacheSession_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12ShaderCacheSession_FindValue(This,pKey,KeySize,pValue,pValueSize) \ + ( (This)->FindValue(pKey,KeySize,pValue,pValueSize) ) +#define ID3D12ShaderCacheSession_StoreValue(This,pKey,KeySize,pValue,ValueSize) \ + ( (This)->StoreValue(pKey,KeySize,pValue,ValueSize) ) +#define ID3D12ShaderCacheSession_SetDeleteOnDestroy(This) \ + ( (This)->SetDeleteOnDestroy() ) +#define ID3D12Device9_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device9_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device9_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device9_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device9_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device9_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device9_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device9_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device9_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device9_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device9_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device9_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device9_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device9_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device9_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device9_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device9_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device9_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device9_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device9_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device9_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device9_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device9_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device9_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device9_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device9_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device9_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device9_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device9_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device9_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device9_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device9_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device9_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device9_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device9_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device9_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device9_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device9_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device9_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device9_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device9_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device9_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device9_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device9_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device9_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreatePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device9_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress(pAddress,riid,ppvHeap) ) +#define ID3D12Device9_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromFileMapping(hFileMapping,riid,ppvHeap) ) +#define ID3D12Device9_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->EnqueueMakeResident(Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) +#define ID3D12Device9_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->CreateCommandList1(nodeMask,type,flags,riid,ppCommandList) ) +#define ID3D12Device9_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession(pDesc,riid,ppSession) ) +#define ID3D12Device9_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource1(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device9_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->CreateHeap1(pDesc,pProtectedSession,riid,ppvHeap) ) +#define ID3D12Device9_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->CreateReservedResource1(pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#define ID3D12Device9_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->CreateLifetimeTracker(pOwner,riid,ppvTracker) ) +#define ID3D12Device9_RemoveDevice(This) \ + ( (This)->RemoveDevice() ) +#define ID3D12Device9_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->EnumerateMetaCommands(pNumMetaCommands,pDescs) ) +#define ID3D12Device9_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->EnumerateMetaCommandParameters(CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) +#define ID3D12Device9_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->CreateMetaCommand(CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) +#define ID3D12Device9_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->CreateStateObject(pDesc,riid,ppStateObject) ) +#define ID3D12Device9_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->GetRaytracingAccelerationStructurePrebuildInfo(pDesc,pInfo) ) +#define ID3D12Device9_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->CheckDriverMatchingIdentifier(SerializedDataType,pIdentifierToCheck) ) +#define ID3D12Device9_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->SetBackgroundProcessingMode(Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) +#define ID3D12Device9_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->AddToStateObject(pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) +#define ID3D12Device9_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession1(pDesc,riid,ppSession) ) +#define ID3D12Device9_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource2(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device9_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource1(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device9_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->CreateSamplerFeedbackUnorderedAccessView(pTargetedResource,pFeedbackResource,DestDescriptor) ) +#define ID3D12Device9_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints1(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device9_CreateShaderCacheSession(This,pDesc,riid,ppvSession) \ + ( (This)->CreateShaderCacheSession(pDesc,riid,ppvSession) ) +#define ID3D12Device9_ShaderCacheControl(This,Kinds,Control) \ + ( (This)->ShaderCacheControl(Kinds,Control) ) +#define ID3D12Device9_CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue1(pDesc,CreatorID,riid,ppCommandQueue) ) +#define ID3D12Device10_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device10_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device10_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device10_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device10_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device10_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device10_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device10_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device10_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device10_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device10_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device10_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device10_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device10_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device10_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device10_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device10_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device10_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device10_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device10_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device10_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device10_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device10_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device10_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device10_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device10_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device10_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device10_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device10_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device10_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device10_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device10_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device10_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device10_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device10_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device10_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device10_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device10_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device10_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device10_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device10_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device10_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device10_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device10_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device10_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreatePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device10_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress(pAddress,riid,ppvHeap) ) +#define ID3D12Device10_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromFileMapping(hFileMapping,riid,ppvHeap) ) +#define ID3D12Device10_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->EnqueueMakeResident(Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) +#define ID3D12Device10_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->CreateCommandList1(nodeMask,type,flags,riid,ppCommandList) ) +#define ID3D12Device10_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession(pDesc,riid,ppSession) ) +#define ID3D12Device10_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource1(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device10_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->CreateHeap1(pDesc,pProtectedSession,riid,ppvHeap) ) +#define ID3D12Device10_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->CreateReservedResource1(pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#define ID3D12Device10_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->CreateLifetimeTracker(pOwner,riid,ppvTracker) ) +#define ID3D12Device10_RemoveDevice(This) \ + ( (This)->RemoveDevice() ) +#define ID3D12Device10_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->EnumerateMetaCommands(pNumMetaCommands,pDescs) ) +#define ID3D12Device10_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->EnumerateMetaCommandParameters(CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) +#define ID3D12Device10_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->CreateMetaCommand(CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) +#define ID3D12Device10_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->CreateStateObject(pDesc,riid,ppStateObject) ) +#define ID3D12Device10_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->GetRaytracingAccelerationStructurePrebuildInfo(pDesc,pInfo) ) +#define ID3D12Device10_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->CheckDriverMatchingIdentifier(SerializedDataType,pIdentifierToCheck) ) +#define ID3D12Device10_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->SetBackgroundProcessingMode(Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) +#define ID3D12Device10_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->AddToStateObject(pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) +#define ID3D12Device10_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession1(pDesc,riid,ppSession) ) +#define ID3D12Device10_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource2(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device10_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource1(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device10_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->CreateSamplerFeedbackUnorderedAccessView(pTargetedResource,pFeedbackResource,DestDescriptor) ) +#define ID3D12Device10_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints1(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device10_CreateShaderCacheSession(This,pDesc,riid,ppvSession) \ + ( (This)->CreateShaderCacheSession(pDesc,riid,ppvSession) ) +#define ID3D12Device10_ShaderCacheControl(This,Kinds,Control) \ + ( (This)->ShaderCacheControl(Kinds,Control) ) +#define ID3D12Device10_CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue1(pDesc,CreatorID,riid,ppCommandQueue) ) +#define ID3D12Device10_CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource3(pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) ) +#define ID3D12Device10_CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->CreatePlacedResource2(pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) ) +#define ID3D12Device10_CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->CreateReservedResource2(pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) ) +#define ID3D12Device11_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device11_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device11_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device11_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device11_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device11_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device11_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device11_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device11_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device11_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device11_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device11_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device11_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device11_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device11_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device11_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device11_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device11_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device11_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device11_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device11_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device11_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device11_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device11_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device11_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device11_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device11_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device11_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device11_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device11_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device11_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device11_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device11_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device11_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device11_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device11_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device11_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device11_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device11_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device11_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device11_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device11_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device11_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device11_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device11_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreatePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device11_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress(pAddress,riid,ppvHeap) ) +#define ID3D12Device11_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromFileMapping(hFileMapping,riid,ppvHeap) ) +#define ID3D12Device11_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->EnqueueMakeResident(Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) +#define ID3D12Device11_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->CreateCommandList1(nodeMask,type,flags,riid,ppCommandList) ) +#define ID3D12Device11_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession(pDesc,riid,ppSession) ) +#define ID3D12Device11_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource1(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device11_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->CreateHeap1(pDesc,pProtectedSession,riid,ppvHeap) ) +#define ID3D12Device11_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->CreateReservedResource1(pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#define ID3D12Device11_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->CreateLifetimeTracker(pOwner,riid,ppvTracker) ) +#define ID3D12Device11_RemoveDevice(This) \ + ( (This)->RemoveDevice() ) +#define ID3D12Device11_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->EnumerateMetaCommands(pNumMetaCommands,pDescs) ) +#define ID3D12Device11_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->EnumerateMetaCommandParameters(CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) +#define ID3D12Device11_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->CreateMetaCommand(CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) +#define ID3D12Device11_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->CreateStateObject(pDesc,riid,ppStateObject) ) +#define ID3D12Device11_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->GetRaytracingAccelerationStructurePrebuildInfo(pDesc,pInfo) ) +#define ID3D12Device11_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->CheckDriverMatchingIdentifier(SerializedDataType,pIdentifierToCheck) ) +#define ID3D12Device11_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->SetBackgroundProcessingMode(Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) +#define ID3D12Device11_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->AddToStateObject(pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) +#define ID3D12Device11_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession1(pDesc,riid,ppSession) ) +#define ID3D12Device11_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource2(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device11_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource1(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device11_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->CreateSamplerFeedbackUnorderedAccessView(pTargetedResource,pFeedbackResource,DestDescriptor) ) +#define ID3D12Device11_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints1(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device11_CreateShaderCacheSession(This,pDesc,riid,ppvSession) \ + ( (This)->CreateShaderCacheSession(pDesc,riid,ppvSession) ) +#define ID3D12Device11_ShaderCacheControl(This,Kinds,Control) \ + ( (This)->ShaderCacheControl(Kinds,Control) ) +#define ID3D12Device11_CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue1(pDesc,CreatorID,riid,ppCommandQueue) ) +#define ID3D12Device11_CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource3(pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) ) +#define ID3D12Device11_CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->CreatePlacedResource2(pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) ) +#define ID3D12Device11_CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->CreateReservedResource2(pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) ) +#define ID3D12Device11_CreateSampler2(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler2(pDesc,DestDescriptor) ) +#define ID3D12Device12_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device12_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device12_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device12_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device12_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device12_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device12_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device12_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device12_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device12_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device12_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device12_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device12_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device12_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device12_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device12_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device12_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device12_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device12_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device12_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device12_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device12_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device12_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device12_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device12_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device12_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device12_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device12_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device12_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device12_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device12_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device12_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device12_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device12_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device12_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device12_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device12_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device12_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device12_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device12_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device12_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device12_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device12_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device12_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device12_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreatePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device12_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress(pAddress,riid,ppvHeap) ) +#define ID3D12Device12_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromFileMapping(hFileMapping,riid,ppvHeap) ) +#define ID3D12Device12_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->EnqueueMakeResident(Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) +#define ID3D12Device12_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->CreateCommandList1(nodeMask,type,flags,riid,ppCommandList) ) +#define ID3D12Device12_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession(pDesc,riid,ppSession) ) +#define ID3D12Device12_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource1(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device12_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->CreateHeap1(pDesc,pProtectedSession,riid,ppvHeap) ) +#define ID3D12Device12_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->CreateReservedResource1(pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#define ID3D12Device12_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->CreateLifetimeTracker(pOwner,riid,ppvTracker) ) +#define ID3D12Device12_RemoveDevice(This) \ + ( (This)->RemoveDevice() ) +#define ID3D12Device12_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->EnumerateMetaCommands(pNumMetaCommands,pDescs) ) +#define ID3D12Device12_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->EnumerateMetaCommandParameters(CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) +#define ID3D12Device12_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->CreateMetaCommand(CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) +#define ID3D12Device12_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->CreateStateObject(pDesc,riid,ppStateObject) ) +#define ID3D12Device12_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->GetRaytracingAccelerationStructurePrebuildInfo(pDesc,pInfo) ) +#define ID3D12Device12_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->CheckDriverMatchingIdentifier(SerializedDataType,pIdentifierToCheck) ) +#define ID3D12Device12_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->SetBackgroundProcessingMode(Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) +#define ID3D12Device12_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->AddToStateObject(pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) +#define ID3D12Device12_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession1(pDesc,riid,ppSession) ) +#define ID3D12Device12_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource2(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device12_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource1(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device12_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->CreateSamplerFeedbackUnorderedAccessView(pTargetedResource,pFeedbackResource,DestDescriptor) ) +#define ID3D12Device12_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints1(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device12_CreateShaderCacheSession(This,pDesc,riid,ppvSession) \ + ( (This)->CreateShaderCacheSession(pDesc,riid,ppvSession) ) +#define ID3D12Device12_ShaderCacheControl(This,Kinds,Control) \ + ( (This)->ShaderCacheControl(Kinds,Control) ) +#define ID3D12Device12_CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue1(pDesc,CreatorID,riid,ppCommandQueue) ) +#define ID3D12Device12_CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource3(pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) ) +#define ID3D12Device12_CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->CreatePlacedResource2(pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) ) +#define ID3D12Device12_CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->CreateReservedResource2(pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) ) +#define ID3D12Device12_CreateSampler2(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler2(pDesc,DestDescriptor) ) +#define ID3D12Device13_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device13_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device13_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device13_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device13_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device13_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device13_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device13_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device13_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device13_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device13_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device13_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device13_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device13_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device13_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device13_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device13_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device13_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device13_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device13_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device13_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device13_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device13_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device13_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device13_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device13_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device13_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device13_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device13_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device13_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device13_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device13_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device13_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device13_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device13_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device13_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device13_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device13_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device13_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device13_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device13_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device13_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device13_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device13_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device13_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreatePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device13_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress(pAddress,riid,ppvHeap) ) +#define ID3D12Device13_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromFileMapping(hFileMapping,riid,ppvHeap) ) +#define ID3D12Device13_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->EnqueueMakeResident(Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) +#define ID3D12Device13_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->CreateCommandList1(nodeMask,type,flags,riid,ppCommandList) ) +#define ID3D12Device13_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession(pDesc,riid,ppSession) ) +#define ID3D12Device13_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource1(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device13_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->CreateHeap1(pDesc,pProtectedSession,riid,ppvHeap) ) +#define ID3D12Device13_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->CreateReservedResource1(pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#define ID3D12Device13_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->CreateLifetimeTracker(pOwner,riid,ppvTracker) ) +#define ID3D12Device13_RemoveDevice(This) \ + ( (This)->RemoveDevice() ) +#define ID3D12Device13_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->EnumerateMetaCommands(pNumMetaCommands,pDescs) ) +#define ID3D12Device13_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->EnumerateMetaCommandParameters(CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) +#define ID3D12Device13_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->CreateMetaCommand(CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) +#define ID3D12Device13_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->CreateStateObject(pDesc,riid,ppStateObject) ) +#define ID3D12Device13_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->GetRaytracingAccelerationStructurePrebuildInfo(pDesc,pInfo) ) +#define ID3D12Device13_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->CheckDriverMatchingIdentifier(SerializedDataType,pIdentifierToCheck) ) +#define ID3D12Device13_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->SetBackgroundProcessingMode(Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) +#define ID3D12Device13_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->AddToStateObject(pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) +#define ID3D12Device13_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession1(pDesc,riid,ppSession) ) +#define ID3D12Device13_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource2(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device13_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource1(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device13_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->CreateSamplerFeedbackUnorderedAccessView(pTargetedResource,pFeedbackResource,DestDescriptor) ) +#define ID3D12Device13_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints1(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device13_CreateShaderCacheSession(This,pDesc,riid,ppvSession) \ + ( (This)->CreateShaderCacheSession(pDesc,riid,ppvSession) ) +#define ID3D12Device13_ShaderCacheControl(This,Kinds,Control) \ + ( (This)->ShaderCacheControl(Kinds,Control) ) +#define ID3D12Device13_CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue1(pDesc,CreatorID,riid,ppCommandQueue) ) +#define ID3D12Device13_CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource3(pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) ) +#define ID3D12Device13_CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->CreatePlacedResource2(pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) ) +#define ID3D12Device13_CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->CreateReservedResource2(pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) ) +#define ID3D12Device13_CreateSampler2(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler2(pDesc,DestDescriptor) ) +#define ID3D12Device13_OpenExistingHeapFromAddress1(This,pAddress,size,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress1(pAddress,size,riid,ppvHeap) ) +#define ID3D12Device14_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Device14_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Device14_Release(This) \ + ( (This)->Release() ) +#define ID3D12Device14_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12Device14_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12Device14_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12Device14_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12Device14_GetNodeCount(This) \ + ( (This)->GetNodeCount() ) +#define ID3D12Device14_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue(pDesc,riid,ppCommandQueue) ) +#define ID3D12Device14_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->CreateCommandAllocator(type,riid,ppCommandAllocator) ) +#define ID3D12Device14_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateGraphicsPipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device14_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreateComputePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device14_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->CreateCommandList(nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) +#define ID3D12Device14_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->CheckFeatureSupport(Feature,pFeatureSupportData,FeatureSupportDataSize) ) +#define ID3D12Device14_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->CreateDescriptorHeap(pDescriptorHeapDesc,riid,ppvHeap) ) +#define ID3D12Device14_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->GetDescriptorHandleIncrementSize(DescriptorHeapType) ) +#define ID3D12Device14_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->CreateRootSignature(nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) +#define ID3D12Device14_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->CreateConstantBufferView(pDesc,DestDescriptor) ) +#define ID3D12Device14_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateShaderResourceView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device14_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->CreateUnorderedAccessView(pResource,pCounterResource,pDesc,DestDescriptor) ) +#define ID3D12Device14_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateRenderTargetView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device14_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->CreateDepthStencilView(pResource,pDesc,DestDescriptor) ) +#define ID3D12Device14_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler(pDesc,DestDescriptor) ) +#define ID3D12Device14_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->CopyDescriptors(NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) +#define ID3D12Device14_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->CopyDescriptorsSimple(NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) +#define ID3D12Device14_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device14_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device14_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device14_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreateReservedResource(pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device14_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->CreateSharedHandle(pObject,pAttributes,Access,Name,pHandle) ) +#define ID3D12Device14_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->OpenSharedHandle(NTHandle,riid,ppvObj) ) +#define ID3D12Device14_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->OpenSharedHandleByName(Name,Access,pNTHandle) ) +#define ID3D12Device14_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->MakeResident(NumObjects,ppObjects) ) +#define ID3D12Device14_Evict(This,NumObjects,ppObjects) \ + ( (This)->Evict(NumObjects,ppObjects) ) +#define ID3D12Device14_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->CreateFence(InitialValue,Flags,riid,ppFence) ) +#define ID3D12Device14_GetDeviceRemovedReason(This) \ + ( (This)->GetDeviceRemovedReason() ) +#define ID3D12Device14_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device14_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->CreateQueryHeap(pDesc,riid,ppvHeap) ) +#define ID3D12Device14_SetStablePowerState(This,Enable) \ + ( (This)->SetStablePowerState(Enable) ) +#define ID3D12Device14_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->CreateCommandSignature(pDesc,pRootSignature,riid,ppvCommandSignature) ) +#define ID3D12Device14_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->GetResourceTiling(pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) +#define ID3D12Device14_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->CreatePipelineLibrary(pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) +#define ID3D12Device14_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->SetEventOnMultipleFenceCompletion(ppFences,pFenceValues,NumFences,Flags,hEvent) ) +#define ID3D12Device14_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->SetResidencyPriority(NumObjects,ppObjects,pPriorities) ) +#define ID3D12Device14_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->CreatePipelineState(pDesc,riid,ppPipelineState) ) +#define ID3D12Device14_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress(pAddress,riid,ppvHeap) ) +#define ID3D12Device14_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromFileMapping(hFileMapping,riid,ppvHeap) ) +#define ID3D12Device14_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->EnqueueMakeResident(Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) +#define ID3D12Device14_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->CreateCommandList1(nodeMask,type,flags,riid,ppCommandList) ) +#define ID3D12Device14_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession(pDesc,riid,ppSession) ) +#define ID3D12Device14_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource1(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device14_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->CreateHeap1(pDesc,pProtectedSession,riid,ppvHeap) ) +#define ID3D12Device14_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->CreateReservedResource1(pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) +#define ID3D12Device14_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->CreateLifetimeTracker(pOwner,riid,ppvTracker) ) +#define ID3D12Device14_RemoveDevice(This) \ + ( (This)->RemoveDevice() ) +#define ID3D12Device14_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->EnumerateMetaCommands(pNumMetaCommands,pDescs) ) +#define ID3D12Device14_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->EnumerateMetaCommandParameters(CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) +#define ID3D12Device14_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->CreateMetaCommand(CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) +#define ID3D12Device14_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->CreateStateObject(pDesc,riid,ppStateObject) ) +#define ID3D12Device14_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->GetRaytracingAccelerationStructurePrebuildInfo(pDesc,pInfo) ) +#define ID3D12Device14_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->CheckDriverMatchingIdentifier(SerializedDataType,pIdentifierToCheck) ) +#define ID3D12Device14_SetBackgroundProcessingMode(This,Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) \ + ( (This)->SetBackgroundProcessingMode(Mode,MeasurementsAction,hEventToSignalUponCompletion,pbFurtherMeasurementsDesired) ) +#define ID3D12Device14_AddToStateObject(This,pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) \ + ( (This)->AddToStateObject(pAddition,pStateObjectToGrowFrom,riid,ppNewStateObject) ) +#define ID3D12Device14_CreateProtectedResourceSession1(This,pDesc,riid,ppSession) \ + ( (This)->CreateProtectedResourceSession1(pDesc,riid,ppSession) ) +#define ID3D12Device14_CreateCommittedResource2(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource2(pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) +#define ID3D12Device14_CreatePlacedResource1(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->CreatePlacedResource1(pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) +#define ID3D12Device14_CreateSamplerFeedbackUnorderedAccessView(This,pTargetedResource,pFeedbackResource,DestDescriptor) \ + ( (This)->CreateSamplerFeedbackUnorderedAccessView(pTargetedResource,pFeedbackResource,DestDescriptor) ) +#define ID3D12Device14_GetCopyableFootprints1(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->GetCopyableFootprints1(pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) +#define ID3D12Device14_CreateShaderCacheSession(This,pDesc,riid,ppvSession) \ + ( (This)->CreateShaderCacheSession(pDesc,riid,ppvSession) ) +#define ID3D12Device14_ShaderCacheControl(This,Kinds,Control) \ + ( (This)->ShaderCacheControl(Kinds,Control) ) +#define ID3D12Device14_CreateCommandQueue1(This,pDesc,CreatorID,riid,ppCommandQueue) \ + ( (This)->CreateCommandQueue1(pDesc,CreatorID,riid,ppCommandQueue) ) +#define ID3D12Device14_CreateCommittedResource3(This,pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) \ + ( (This)->CreateCommittedResource3(pHeapProperties,HeapFlags,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riidResource,ppvResource) ) +#define ID3D12Device14_CreatePlacedResource2(This,pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->CreatePlacedResource2(pHeap,HeapOffset,pDesc,InitialLayout,pOptimizedClearValue,NumCastableFormats,pCastableFormats,riid,ppvResource) ) +#define ID3D12Device14_CreateReservedResource2(This,pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) \ + ( (This)->CreateReservedResource2(pDesc,InitialLayout,pOptimizedClearValue,pProtectedSession,NumCastableFormats,pCastableFormats,riid,ppvResource) ) +#define ID3D12Device14_CreateSampler2(This,pDesc,DestDescriptor) \ + ( (This)->CreateSampler2(pDesc,DestDescriptor) ) +#define ID3D12Device14_OpenExistingHeapFromAddress1(This,pAddress,size,riid,ppvHeap) \ + ( (This)->OpenExistingHeapFromAddress1(pAddress,size,riid,ppvHeap) ) +#define ID3D12Device14_CreateRootSignatureFromSubobjectInLibrary(This,nodeMask,pLibraryBlob,blobLengthInBytes,subobjectName,riid,ppvRootSignature) \ + ( (This)->CreateRootSignatureFromSubobjectInLibrary(nodeMask,pLibraryBlob,blobLengthInBytes,subobjectName,riid,ppvRootSignature) ) +#define ID3D12VirtualizationGuestDevice_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12VirtualizationGuestDevice_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12VirtualizationGuestDevice_Release(This) \ + ( (This)->Release() ) +#define ID3D12VirtualizationGuestDevice_ShareWithHost(This,pObject,pHandle) \ + ( (This)->ShareWithHost(pObject,pHandle) ) +#define ID3D12VirtualizationGuestDevice_CreateFenceFd(This,pFence,FenceValue,pFenceFd) \ + ( (This)->CreateFenceFd(pFence,FenceValue,pFenceFd) ) +#define ID3D12Tools_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Tools_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Tools_Release(This) \ + ( (This)->Release() ) +#define ID3D12Tools_EnableShaderInstrumentation(This,bEnable) \ + ( (This)->EnableShaderInstrumentation(bEnable) ) +#define ID3D12Tools_ShaderInstrumentationEnabled(This) \ + ( (This)->ShaderInstrumentationEnabled() ) +#define ID3D12SDKConfiguration_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12SDKConfiguration_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12SDKConfiguration_Release(This) \ + ( (This)->Release() ) +#define ID3D12SDKConfiguration_SetSDKVersion(This,SDKVersion,SDKPath) \ + ( (This)->SetSDKVersion(SDKVersion,SDKPath) ) +#define ID3D12SDKConfiguration1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12SDKConfiguration1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12SDKConfiguration1_Release(This) \ + ( (This)->Release() ) +#define ID3D12SDKConfiguration1_SetSDKVersion(This,SDKVersion,SDKPath) \ + ( (This)->SetSDKVersion(SDKVersion,SDKPath) ) +#define ID3D12SDKConfiguration1_CreateDeviceFactory(This,SDKVersion,SDKPath,riid,ppvFactory) \ + ( (This)->CreateDeviceFactory(SDKVersion,SDKPath,riid,ppvFactory) ) +#define ID3D12SDKConfiguration1_FreeUnusedSDKs(This) \ + ( (This)->FreeUnusedSDKs() ) +#define ID3D12DeviceFactory_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DeviceFactory_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DeviceFactory_Release(This) \ + ( (This)->Release() ) +#define ID3D12DeviceFactory_InitializeFromGlobalState(This) \ + ( (This)->InitializeFromGlobalState() ) +#define ID3D12DeviceFactory_ApplyToGlobalState(This) \ + ( (This)->ApplyToGlobalState() ) +#define ID3D12DeviceFactory_SetFlags(This,flags) \ + ( (This)->SetFlags(flags) ) +#define ID3D12DeviceFactory_GetFlags(This) \ + ( (This)->GetFlags() ) +#define ID3D12DeviceFactory_GetConfigurationInterface(This,clsid,iid,ppv) \ + ( (This)->GetConfigurationInterface(clsid,iid,ppv) ) +#define ID3D12DeviceFactory_EnableExperimentalFeatures(This,NumFeatures,pIIDs,pConfigurationStructs,pConfigurationStructSizes) \ + ( (This)->EnableExperimentalFeatures(NumFeatures,pIIDs,pConfigurationStructs,pConfigurationStructSizes) ) +#define ID3D12DeviceFactory_CreateDevice(This,adapter,FeatureLevel,riid,ppvDevice) \ + ( (This)->CreateDevice(adapter,FeatureLevel,riid,ppvDevice) ) +#define ID3D12DeviceConfiguration_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DeviceConfiguration_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DeviceConfiguration_Release(This) \ + ( (This)->Release() ) +#define ID3D12DeviceConfiguration_GetEnabledExperimentalFeatures(This,pGuids,NumGuids) \ + ( (This)->GetEnabledExperimentalFeatures(pGuids,NumGuids) ) +#define ID3D12DeviceConfiguration_SerializeVersionedRootSignature(This,pDesc,ppResult,ppError) \ + ( (This)->SerializeVersionedRootSignature(pDesc,ppResult,ppError) ) +#define ID3D12DeviceConfiguration_CreateVersionedRootSignatureDeserializer(This,pBlob,Size,riid,ppvDeserializer) \ + ( (This)->CreateVersionedRootSignatureDeserializer(pBlob,Size,riid,ppvDeserializer) ) +#define ID3D12DeviceConfiguration1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DeviceConfiguration1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DeviceConfiguration1_Release(This) \ + ( (This)->Release() ) +#define ID3D12DeviceConfiguration1_GetEnabledExperimentalFeatures(This,pGuids,NumGuids) \ + ( (This)->GetEnabledExperimentalFeatures(pGuids,NumGuids) ) +#define ID3D12DeviceConfiguration1_SerializeVersionedRootSignature(This,pDesc,ppResult,ppError) \ + ( (This)->SerializeVersionedRootSignature(pDesc,ppResult,ppError) ) +#define ID3D12DeviceConfiguration1_CreateVersionedRootSignatureDeserializer(This,pBlob,Size,riid,ppvDeserializer) \ + ( (This)->CreateVersionedRootSignatureDeserializer(pBlob,Size,riid,ppvDeserializer) ) +#define ID3D12DeviceConfiguration1_CreateVersionedRootSignatureDeserializerFromSubobjectInLibrary(This,pLibraryBlob,Size,RootSignatureSubobjectName,riid,ppvDeserializer) \ + ( (This)->CreateVersionedRootSignatureDeserializerFromSubobjectInLibrary(pLibraryBlob,Size,RootSignatureSubobjectName,riid,ppvDeserializer) ) +#define ID3D12GraphicsCommandList5_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12GraphicsCommandList5_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12GraphicsCommandList5_Release(This) \ + ( (This)->Release() ) +#define ID3D12GraphicsCommandList5_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12GraphicsCommandList5_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12GraphicsCommandList5_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12GraphicsCommandList5_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12GraphicsCommandList5_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12GraphicsCommandList5_GetType(This) \ + ( (This)->GetType() ) +#define ID3D12GraphicsCommandList5_Close(This) \ + ( (This)->Close() ) +#define ID3D12GraphicsCommandList5_Reset(This,pAllocator,pInitialState) \ + ( (This)->Reset(pAllocator,pInitialState) ) +#define ID3D12GraphicsCommandList5_ClearState(This,pPipelineState) \ + ( (This)->ClearState(pPipelineState) ) +#define ID3D12GraphicsCommandList5_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->DrawInstanced(VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList5_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->DrawIndexedInstanced(IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList5_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->Dispatch(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList5_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->CopyBufferRegion(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) +#define ID3D12GraphicsCommandList5_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->CopyTextureRegion(pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) +#define ID3D12GraphicsCommandList5_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->CopyResource(pDstResource,pSrcResource) ) +#define ID3D12GraphicsCommandList5_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->CopyTiles(pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) +#define ID3D12GraphicsCommandList5_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->ResolveSubresource(pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) +#define ID3D12GraphicsCommandList5_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->IASetPrimitiveTopology(PrimitiveTopology) ) +#define ID3D12GraphicsCommandList5_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->RSSetViewports(NumViewports,pViewports) ) +#define ID3D12GraphicsCommandList5_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->RSSetScissorRects(NumRects,pRects) ) +#define ID3D12GraphicsCommandList5_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->OMSetBlendFactor(BlendFactor) ) +#define ID3D12GraphicsCommandList5_OMSetStencilRef(This,StencilRef) \ + ( (This)->OMSetStencilRef(StencilRef) ) +#define ID3D12GraphicsCommandList5_SetPipelineState(This,pPipelineState) \ + ( (This)->SetPipelineState(pPipelineState) ) +#define ID3D12GraphicsCommandList5_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->ResourceBarrier(NumBarriers,pBarriers) ) +#define ID3D12GraphicsCommandList5_ExecuteBundle(This,pCommandList) \ + ( (This)->ExecuteBundle(pCommandList) ) +#define ID3D12GraphicsCommandList5_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->SetDescriptorHeaps(NumDescriptorHeaps,ppDescriptorHeaps) ) +#define ID3D12GraphicsCommandList5_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->SetComputeRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList5_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->SetGraphicsRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList5_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetComputeRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList5_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetGraphicsRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList5_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList5_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList5_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList5_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList5_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList5_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList5_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList5_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList5_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList5_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList5_IASetIndexBuffer(This,pView) \ + ( (This)->IASetIndexBuffer(pView) ) +#define ID3D12GraphicsCommandList5_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->IASetVertexBuffers(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList5_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->SOSetTargets(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList5_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->OMSetRenderTargets(NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) +#define ID3D12GraphicsCommandList5_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->ClearDepthStencilView(DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) +#define ID3D12GraphicsCommandList5_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->ClearRenderTargetView(RenderTargetView,ColorRGBA,NumRects,pRects) ) +#define ID3D12GraphicsCommandList5_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewUint(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList5_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewFloat(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList5_DiscardResource(This,pResource,pRegion) \ + ( (This)->DiscardResource(pResource,pRegion) ) +#define ID3D12GraphicsCommandList5_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->BeginQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList5_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->EndQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList5_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->ResolveQueryData(pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) +#define ID3D12GraphicsCommandList5_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->SetPredication(pBuffer,AlignedBufferOffset,Operation) ) +#define ID3D12GraphicsCommandList5_SetMarker(This,Metadata,pData,Size) \ + ( (This)->SetMarker(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList5_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->BeginEvent(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList5_EndEvent(This) \ + ( (This)->EndEvent() ) +#define ID3D12GraphicsCommandList5_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->ExecuteIndirect(pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) +#define ID3D12GraphicsCommandList5_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList5_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT64(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList5_OMSetDepthBounds(This,Min,Max) \ + ( (This)->OMSetDepthBounds(Min,Max) ) +#define ID3D12GraphicsCommandList5_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->SetSamplePositions(NumSamplesPerPixel,NumPixels,pSamplePositions) ) +#define ID3D12GraphicsCommandList5_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->ResolveSubresourceRegion(pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) +#define ID3D12GraphicsCommandList5_SetViewInstanceMask(This,Mask) \ + ( (This)->SetViewInstanceMask(Mask) ) +#define ID3D12GraphicsCommandList5_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->WriteBufferImmediate(Count,pParams,pModes) ) +#define ID3D12GraphicsCommandList5_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->SetProtectedResourceSession(pProtectedResourceSession) ) +#define ID3D12GraphicsCommandList5_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->BeginRenderPass(NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) +#define ID3D12GraphicsCommandList5_EndRenderPass(This) \ + ( (This)->EndRenderPass() ) +#define ID3D12GraphicsCommandList5_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->InitializeMetaCommand(pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList5_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->ExecuteMetaCommand(pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList5_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->BuildRaytracingAccelerationStructure(pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) +#define ID3D12GraphicsCommandList5_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->EmitRaytracingAccelerationStructurePostbuildInfo(pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) +#define ID3D12GraphicsCommandList5_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->CopyRaytracingAccelerationStructure(DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) +#define ID3D12GraphicsCommandList5_SetPipelineState1(This,pStateObject) \ + ( (This)->SetPipelineState1(pStateObject) ) +#define ID3D12GraphicsCommandList5_DispatchRays(This,pDesc) \ + ( (This)->DispatchRays(pDesc) ) +#define ID3D12GraphicsCommandList5_RSSetShadingRate(This,baseShadingRate,combiners) \ + ( (This)->RSSetShadingRate(baseShadingRate,combiners) ) +#define ID3D12GraphicsCommandList5_RSSetShadingRateImage(This,shadingRateImage) \ + ( (This)->RSSetShadingRateImage(shadingRateImage) ) +#define ID3D12GraphicsCommandList6_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12GraphicsCommandList6_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12GraphicsCommandList6_Release(This) \ + ( (This)->Release() ) +#define ID3D12GraphicsCommandList6_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12GraphicsCommandList6_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12GraphicsCommandList6_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12GraphicsCommandList6_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12GraphicsCommandList6_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12GraphicsCommandList6_GetType(This) \ + ( (This)->GetType() ) +#define ID3D12GraphicsCommandList6_Close(This) \ + ( (This)->Close() ) +#define ID3D12GraphicsCommandList6_Reset(This,pAllocator,pInitialState) \ + ( (This)->Reset(pAllocator,pInitialState) ) +#define ID3D12GraphicsCommandList6_ClearState(This,pPipelineState) \ + ( (This)->ClearState(pPipelineState) ) +#define ID3D12GraphicsCommandList6_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->DrawInstanced(VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList6_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->DrawIndexedInstanced(IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList6_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->Dispatch(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList6_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->CopyBufferRegion(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) +#define ID3D12GraphicsCommandList6_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->CopyTextureRegion(pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) +#define ID3D12GraphicsCommandList6_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->CopyResource(pDstResource,pSrcResource) ) +#define ID3D12GraphicsCommandList6_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->CopyTiles(pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) +#define ID3D12GraphicsCommandList6_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->ResolveSubresource(pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) +#define ID3D12GraphicsCommandList6_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->IASetPrimitiveTopology(PrimitiveTopology) ) +#define ID3D12GraphicsCommandList6_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->RSSetViewports(NumViewports,pViewports) ) +#define ID3D12GraphicsCommandList6_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->RSSetScissorRects(NumRects,pRects) ) +#define ID3D12GraphicsCommandList6_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->OMSetBlendFactor(BlendFactor) ) +#define ID3D12GraphicsCommandList6_OMSetStencilRef(This,StencilRef) \ + ( (This)->OMSetStencilRef(StencilRef) ) +#define ID3D12GraphicsCommandList6_SetPipelineState(This,pPipelineState) \ + ( (This)->SetPipelineState(pPipelineState) ) +#define ID3D12GraphicsCommandList6_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->ResourceBarrier(NumBarriers,pBarriers) ) +#define ID3D12GraphicsCommandList6_ExecuteBundle(This,pCommandList) \ + ( (This)->ExecuteBundle(pCommandList) ) +#define ID3D12GraphicsCommandList6_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->SetDescriptorHeaps(NumDescriptorHeaps,ppDescriptorHeaps) ) +#define ID3D12GraphicsCommandList6_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->SetComputeRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList6_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->SetGraphicsRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList6_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetComputeRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList6_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetGraphicsRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList6_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList6_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList6_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList6_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList6_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList6_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList6_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList6_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList6_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList6_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList6_IASetIndexBuffer(This,pView) \ + ( (This)->IASetIndexBuffer(pView) ) +#define ID3D12GraphicsCommandList6_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->IASetVertexBuffers(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList6_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->SOSetTargets(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList6_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->OMSetRenderTargets(NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) +#define ID3D12GraphicsCommandList6_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->ClearDepthStencilView(DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) +#define ID3D12GraphicsCommandList6_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->ClearRenderTargetView(RenderTargetView,ColorRGBA,NumRects,pRects) ) +#define ID3D12GraphicsCommandList6_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewUint(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList6_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewFloat(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList6_DiscardResource(This,pResource,pRegion) \ + ( (This)->DiscardResource(pResource,pRegion) ) +#define ID3D12GraphicsCommandList6_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->BeginQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList6_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->EndQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList6_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->ResolveQueryData(pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) +#define ID3D12GraphicsCommandList6_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->SetPredication(pBuffer,AlignedBufferOffset,Operation) ) +#define ID3D12GraphicsCommandList6_SetMarker(This,Metadata,pData,Size) \ + ( (This)->SetMarker(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList6_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->BeginEvent(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList6_EndEvent(This) \ + ( (This)->EndEvent() ) +#define ID3D12GraphicsCommandList6_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->ExecuteIndirect(pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) +#define ID3D12GraphicsCommandList6_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList6_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT64(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList6_OMSetDepthBounds(This,Min,Max) \ + ( (This)->OMSetDepthBounds(Min,Max) ) +#define ID3D12GraphicsCommandList6_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->SetSamplePositions(NumSamplesPerPixel,NumPixels,pSamplePositions) ) +#define ID3D12GraphicsCommandList6_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->ResolveSubresourceRegion(pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) +#define ID3D12GraphicsCommandList6_SetViewInstanceMask(This,Mask) \ + ( (This)->SetViewInstanceMask(Mask) ) +#define ID3D12GraphicsCommandList6_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->WriteBufferImmediate(Count,pParams,pModes) ) +#define ID3D12GraphicsCommandList6_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->SetProtectedResourceSession(pProtectedResourceSession) ) +#define ID3D12GraphicsCommandList6_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->BeginRenderPass(NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) +#define ID3D12GraphicsCommandList6_EndRenderPass(This) \ + ( (This)->EndRenderPass() ) +#define ID3D12GraphicsCommandList6_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->InitializeMetaCommand(pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList6_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->ExecuteMetaCommand(pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList6_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->BuildRaytracingAccelerationStructure(pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) +#define ID3D12GraphicsCommandList6_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->EmitRaytracingAccelerationStructurePostbuildInfo(pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) +#define ID3D12GraphicsCommandList6_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->CopyRaytracingAccelerationStructure(DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) +#define ID3D12GraphicsCommandList6_SetPipelineState1(This,pStateObject) \ + ( (This)->SetPipelineState1(pStateObject) ) +#define ID3D12GraphicsCommandList6_DispatchRays(This,pDesc) \ + ( (This)->DispatchRays(pDesc) ) +#define ID3D12GraphicsCommandList6_RSSetShadingRate(This,baseShadingRate,combiners) \ + ( (This)->RSSetShadingRate(baseShadingRate,combiners) ) +#define ID3D12GraphicsCommandList6_RSSetShadingRateImage(This,shadingRateImage) \ + ( (This)->RSSetShadingRateImage(shadingRateImage) ) +#define ID3D12GraphicsCommandList6_DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->DispatchMesh(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList7_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12GraphicsCommandList7_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12GraphicsCommandList7_Release(This) \ + ( (This)->Release() ) +#define ID3D12GraphicsCommandList7_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12GraphicsCommandList7_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12GraphicsCommandList7_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12GraphicsCommandList7_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12GraphicsCommandList7_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12GraphicsCommandList7_GetType(This) \ + ( (This)->GetType() ) +#define ID3D12GraphicsCommandList7_Close(This) \ + ( (This)->Close() ) +#define ID3D12GraphicsCommandList7_Reset(This,pAllocator,pInitialState) \ + ( (This)->Reset(pAllocator,pInitialState) ) +#define ID3D12GraphicsCommandList7_ClearState(This,pPipelineState) \ + ( (This)->ClearState(pPipelineState) ) +#define ID3D12GraphicsCommandList7_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->DrawInstanced(VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList7_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->DrawIndexedInstanced(IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList7_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->Dispatch(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList7_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->CopyBufferRegion(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) +#define ID3D12GraphicsCommandList7_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->CopyTextureRegion(pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) +#define ID3D12GraphicsCommandList7_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->CopyResource(pDstResource,pSrcResource) ) +#define ID3D12GraphicsCommandList7_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->CopyTiles(pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) +#define ID3D12GraphicsCommandList7_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->ResolveSubresource(pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) +#define ID3D12GraphicsCommandList7_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->IASetPrimitiveTopology(PrimitiveTopology) ) +#define ID3D12GraphicsCommandList7_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->RSSetViewports(NumViewports,pViewports) ) +#define ID3D12GraphicsCommandList7_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->RSSetScissorRects(NumRects,pRects) ) +#define ID3D12GraphicsCommandList7_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->OMSetBlendFactor(BlendFactor) ) +#define ID3D12GraphicsCommandList7_OMSetStencilRef(This,StencilRef) \ + ( (This)->OMSetStencilRef(StencilRef) ) +#define ID3D12GraphicsCommandList7_SetPipelineState(This,pPipelineState) \ + ( (This)->SetPipelineState(pPipelineState) ) +#define ID3D12GraphicsCommandList7_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->ResourceBarrier(NumBarriers,pBarriers) ) +#define ID3D12GraphicsCommandList7_ExecuteBundle(This,pCommandList) \ + ( (This)->ExecuteBundle(pCommandList) ) +#define ID3D12GraphicsCommandList7_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->SetDescriptorHeaps(NumDescriptorHeaps,ppDescriptorHeaps) ) +#define ID3D12GraphicsCommandList7_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->SetComputeRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList7_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->SetGraphicsRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList7_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetComputeRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList7_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetGraphicsRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList7_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList7_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList7_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList7_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList7_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList7_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList7_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList7_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList7_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList7_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList7_IASetIndexBuffer(This,pView) \ + ( (This)->IASetIndexBuffer(pView) ) +#define ID3D12GraphicsCommandList7_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->IASetVertexBuffers(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList7_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->SOSetTargets(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList7_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->OMSetRenderTargets(NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) +#define ID3D12GraphicsCommandList7_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->ClearDepthStencilView(DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) +#define ID3D12GraphicsCommandList7_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->ClearRenderTargetView(RenderTargetView,ColorRGBA,NumRects,pRects) ) +#define ID3D12GraphicsCommandList7_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewUint(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList7_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewFloat(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList7_DiscardResource(This,pResource,pRegion) \ + ( (This)->DiscardResource(pResource,pRegion) ) +#define ID3D12GraphicsCommandList7_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->BeginQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList7_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->EndQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList7_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->ResolveQueryData(pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) +#define ID3D12GraphicsCommandList7_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->SetPredication(pBuffer,AlignedBufferOffset,Operation) ) +#define ID3D12GraphicsCommandList7_SetMarker(This,Metadata,pData,Size) \ + ( (This)->SetMarker(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList7_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->BeginEvent(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList7_EndEvent(This) \ + ( (This)->EndEvent() ) +#define ID3D12GraphicsCommandList7_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->ExecuteIndirect(pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) +#define ID3D12GraphicsCommandList7_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList7_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT64(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList7_OMSetDepthBounds(This,Min,Max) \ + ( (This)->OMSetDepthBounds(Min,Max) ) +#define ID3D12GraphicsCommandList7_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->SetSamplePositions(NumSamplesPerPixel,NumPixels,pSamplePositions) ) +#define ID3D12GraphicsCommandList7_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->ResolveSubresourceRegion(pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) +#define ID3D12GraphicsCommandList7_SetViewInstanceMask(This,Mask) \ + ( (This)->SetViewInstanceMask(Mask) ) +#define ID3D12GraphicsCommandList7_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->WriteBufferImmediate(Count,pParams,pModes) ) +#define ID3D12GraphicsCommandList7_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->SetProtectedResourceSession(pProtectedResourceSession) ) +#define ID3D12GraphicsCommandList7_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->BeginRenderPass(NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) +#define ID3D12GraphicsCommandList7_EndRenderPass(This) \ + ( (This)->EndRenderPass() ) +#define ID3D12GraphicsCommandList7_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->InitializeMetaCommand(pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList7_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->ExecuteMetaCommand(pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList7_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->BuildRaytracingAccelerationStructure(pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) +#define ID3D12GraphicsCommandList7_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->EmitRaytracingAccelerationStructurePostbuildInfo(pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) +#define ID3D12GraphicsCommandList7_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->CopyRaytracingAccelerationStructure(DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) +#define ID3D12GraphicsCommandList7_SetPipelineState1(This,pStateObject) \ + ( (This)->SetPipelineState1(pStateObject) ) +#define ID3D12GraphicsCommandList7_DispatchRays(This,pDesc) \ + ( (This)->DispatchRays(pDesc) ) +#define ID3D12GraphicsCommandList7_RSSetShadingRate(This,baseShadingRate,combiners) \ + ( (This)->RSSetShadingRate(baseShadingRate,combiners) ) +#define ID3D12GraphicsCommandList7_RSSetShadingRateImage(This,shadingRateImage) \ + ( (This)->RSSetShadingRateImage(shadingRateImage) ) +#define ID3D12GraphicsCommandList7_DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->DispatchMesh(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList7_Barrier(This,NumBarrierGroups,pBarrierGroups) \ + ( (This)->Barrier(NumBarrierGroups,pBarrierGroups) ) +#define ID3D12GraphicsCommandList8_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12GraphicsCommandList8_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12GraphicsCommandList8_Release(This) \ + ( (This)->Release() ) +#define ID3D12GraphicsCommandList8_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12GraphicsCommandList8_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12GraphicsCommandList8_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12GraphicsCommandList8_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12GraphicsCommandList8_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12GraphicsCommandList8_GetType(This) \ + ( (This)->GetType() ) +#define ID3D12GraphicsCommandList8_Close(This) \ + ( (This)->Close() ) +#define ID3D12GraphicsCommandList8_Reset(This,pAllocator,pInitialState) \ + ( (This)->Reset(pAllocator,pInitialState) ) +#define ID3D12GraphicsCommandList8_ClearState(This,pPipelineState) \ + ( (This)->ClearState(pPipelineState) ) +#define ID3D12GraphicsCommandList8_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->DrawInstanced(VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList8_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->DrawIndexedInstanced(IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList8_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->Dispatch(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList8_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->CopyBufferRegion(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) +#define ID3D12GraphicsCommandList8_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->CopyTextureRegion(pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) +#define ID3D12GraphicsCommandList8_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->CopyResource(pDstResource,pSrcResource) ) +#define ID3D12GraphicsCommandList8_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->CopyTiles(pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) +#define ID3D12GraphicsCommandList8_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->ResolveSubresource(pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) +#define ID3D12GraphicsCommandList8_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->IASetPrimitiveTopology(PrimitiveTopology) ) +#define ID3D12GraphicsCommandList8_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->RSSetViewports(NumViewports,pViewports) ) +#define ID3D12GraphicsCommandList8_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->RSSetScissorRects(NumRects,pRects) ) +#define ID3D12GraphicsCommandList8_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->OMSetBlendFactor(BlendFactor) ) +#define ID3D12GraphicsCommandList8_OMSetStencilRef(This,StencilRef) \ + ( (This)->OMSetStencilRef(StencilRef) ) +#define ID3D12GraphicsCommandList8_SetPipelineState(This,pPipelineState) \ + ( (This)->SetPipelineState(pPipelineState) ) +#define ID3D12GraphicsCommandList8_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->ResourceBarrier(NumBarriers,pBarriers) ) +#define ID3D12GraphicsCommandList8_ExecuteBundle(This,pCommandList) \ + ( (This)->ExecuteBundle(pCommandList) ) +#define ID3D12GraphicsCommandList8_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->SetDescriptorHeaps(NumDescriptorHeaps,ppDescriptorHeaps) ) +#define ID3D12GraphicsCommandList8_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->SetComputeRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList8_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->SetGraphicsRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList8_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetComputeRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList8_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetGraphicsRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList8_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList8_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList8_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList8_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList8_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList8_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList8_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList8_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList8_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList8_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList8_IASetIndexBuffer(This,pView) \ + ( (This)->IASetIndexBuffer(pView) ) +#define ID3D12GraphicsCommandList8_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->IASetVertexBuffers(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList8_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->SOSetTargets(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList8_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->OMSetRenderTargets(NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) +#define ID3D12GraphicsCommandList8_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->ClearDepthStencilView(DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) +#define ID3D12GraphicsCommandList8_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->ClearRenderTargetView(RenderTargetView,ColorRGBA,NumRects,pRects) ) +#define ID3D12GraphicsCommandList8_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewUint(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList8_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewFloat(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList8_DiscardResource(This,pResource,pRegion) \ + ( (This)->DiscardResource(pResource,pRegion) ) +#define ID3D12GraphicsCommandList8_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->BeginQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList8_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->EndQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList8_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->ResolveQueryData(pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) +#define ID3D12GraphicsCommandList8_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->SetPredication(pBuffer,AlignedBufferOffset,Operation) ) +#define ID3D12GraphicsCommandList8_SetMarker(This,Metadata,pData,Size) \ + ( (This)->SetMarker(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList8_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->BeginEvent(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList8_EndEvent(This) \ + ( (This)->EndEvent() ) +#define ID3D12GraphicsCommandList8_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->ExecuteIndirect(pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) +#define ID3D12GraphicsCommandList8_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList8_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT64(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList8_OMSetDepthBounds(This,Min,Max) \ + ( (This)->OMSetDepthBounds(Min,Max) ) +#define ID3D12GraphicsCommandList8_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->SetSamplePositions(NumSamplesPerPixel,NumPixels,pSamplePositions) ) +#define ID3D12GraphicsCommandList8_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->ResolveSubresourceRegion(pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) +#define ID3D12GraphicsCommandList8_SetViewInstanceMask(This,Mask) \ + ( (This)->SetViewInstanceMask(Mask) ) +#define ID3D12GraphicsCommandList8_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->WriteBufferImmediate(Count,pParams,pModes) ) +#define ID3D12GraphicsCommandList8_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->SetProtectedResourceSession(pProtectedResourceSession) ) +#define ID3D12GraphicsCommandList8_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->BeginRenderPass(NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) +#define ID3D12GraphicsCommandList8_EndRenderPass(This) \ + ( (This)->EndRenderPass() ) +#define ID3D12GraphicsCommandList8_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->InitializeMetaCommand(pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList8_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->ExecuteMetaCommand(pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList8_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->BuildRaytracingAccelerationStructure(pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) +#define ID3D12GraphicsCommandList8_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->EmitRaytracingAccelerationStructurePostbuildInfo(pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) +#define ID3D12GraphicsCommandList8_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->CopyRaytracingAccelerationStructure(DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) +#define ID3D12GraphicsCommandList8_SetPipelineState1(This,pStateObject) \ + ( (This)->SetPipelineState1(pStateObject) ) +#define ID3D12GraphicsCommandList8_DispatchRays(This,pDesc) \ + ( (This)->DispatchRays(pDesc) ) +#define ID3D12GraphicsCommandList8_RSSetShadingRate(This,baseShadingRate,combiners) \ + ( (This)->RSSetShadingRate(baseShadingRate,combiners) ) +#define ID3D12GraphicsCommandList8_RSSetShadingRateImage(This,shadingRateImage) \ + ( (This)->RSSetShadingRateImage(shadingRateImage) ) +#define ID3D12GraphicsCommandList8_DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->DispatchMesh(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList8_Barrier(This,NumBarrierGroups,pBarrierGroups) \ + ( (This)->Barrier(NumBarrierGroups,pBarrierGroups) ) +#define ID3D12GraphicsCommandList8_OMSetFrontAndBackStencilRef(This,FrontStencilRef,BackStencilRef) \ + ( (This)->OMSetFrontAndBackStencilRef(FrontStencilRef,BackStencilRef) ) +#define ID3D12GraphicsCommandList9_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12GraphicsCommandList9_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12GraphicsCommandList9_Release(This) \ + ( (This)->Release() ) +#define ID3D12GraphicsCommandList9_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12GraphicsCommandList9_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12GraphicsCommandList9_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12GraphicsCommandList9_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12GraphicsCommandList9_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12GraphicsCommandList9_GetType(This) \ + ( (This)->GetType() ) +#define ID3D12GraphicsCommandList9_Close(This) \ + ( (This)->Close() ) +#define ID3D12GraphicsCommandList9_Reset(This,pAllocator,pInitialState) \ + ( (This)->Reset(pAllocator,pInitialState) ) +#define ID3D12GraphicsCommandList9_ClearState(This,pPipelineState) \ + ( (This)->ClearState(pPipelineState) ) +#define ID3D12GraphicsCommandList9_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->DrawInstanced(VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList9_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->DrawIndexedInstanced(IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList9_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->Dispatch(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList9_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->CopyBufferRegion(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) +#define ID3D12GraphicsCommandList9_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->CopyTextureRegion(pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) +#define ID3D12GraphicsCommandList9_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->CopyResource(pDstResource,pSrcResource) ) +#define ID3D12GraphicsCommandList9_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->CopyTiles(pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) +#define ID3D12GraphicsCommandList9_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->ResolveSubresource(pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) +#define ID3D12GraphicsCommandList9_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->IASetPrimitiveTopology(PrimitiveTopology) ) +#define ID3D12GraphicsCommandList9_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->RSSetViewports(NumViewports,pViewports) ) +#define ID3D12GraphicsCommandList9_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->RSSetScissorRects(NumRects,pRects) ) +#define ID3D12GraphicsCommandList9_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->OMSetBlendFactor(BlendFactor) ) +#define ID3D12GraphicsCommandList9_OMSetStencilRef(This,StencilRef) \ + ( (This)->OMSetStencilRef(StencilRef) ) +#define ID3D12GraphicsCommandList9_SetPipelineState(This,pPipelineState) \ + ( (This)->SetPipelineState(pPipelineState) ) +#define ID3D12GraphicsCommandList9_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->ResourceBarrier(NumBarriers,pBarriers) ) +#define ID3D12GraphicsCommandList9_ExecuteBundle(This,pCommandList) \ + ( (This)->ExecuteBundle(pCommandList) ) +#define ID3D12GraphicsCommandList9_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->SetDescriptorHeaps(NumDescriptorHeaps,ppDescriptorHeaps) ) +#define ID3D12GraphicsCommandList9_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->SetComputeRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList9_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->SetGraphicsRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList9_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetComputeRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList9_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetGraphicsRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList9_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList9_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList9_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList9_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList9_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList9_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList9_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList9_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList9_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList9_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList9_IASetIndexBuffer(This,pView) \ + ( (This)->IASetIndexBuffer(pView) ) +#define ID3D12GraphicsCommandList9_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->IASetVertexBuffers(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList9_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->SOSetTargets(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList9_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->OMSetRenderTargets(NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) +#define ID3D12GraphicsCommandList9_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->ClearDepthStencilView(DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) +#define ID3D12GraphicsCommandList9_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->ClearRenderTargetView(RenderTargetView,ColorRGBA,NumRects,pRects) ) +#define ID3D12GraphicsCommandList9_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewUint(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList9_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewFloat(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList9_DiscardResource(This,pResource,pRegion) \ + ( (This)->DiscardResource(pResource,pRegion) ) +#define ID3D12GraphicsCommandList9_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->BeginQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList9_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->EndQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList9_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->ResolveQueryData(pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) +#define ID3D12GraphicsCommandList9_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->SetPredication(pBuffer,AlignedBufferOffset,Operation) ) +#define ID3D12GraphicsCommandList9_SetMarker(This,Metadata,pData,Size) \ + ( (This)->SetMarker(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList9_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->BeginEvent(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList9_EndEvent(This) \ + ( (This)->EndEvent() ) +#define ID3D12GraphicsCommandList9_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->ExecuteIndirect(pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) +#define ID3D12GraphicsCommandList9_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList9_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT64(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList9_OMSetDepthBounds(This,Min,Max) \ + ( (This)->OMSetDepthBounds(Min,Max) ) +#define ID3D12GraphicsCommandList9_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->SetSamplePositions(NumSamplesPerPixel,NumPixels,pSamplePositions) ) +#define ID3D12GraphicsCommandList9_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->ResolveSubresourceRegion(pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) +#define ID3D12GraphicsCommandList9_SetViewInstanceMask(This,Mask) \ + ( (This)->SetViewInstanceMask(Mask) ) +#define ID3D12GraphicsCommandList9_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->WriteBufferImmediate(Count,pParams,pModes) ) +#define ID3D12GraphicsCommandList9_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->SetProtectedResourceSession(pProtectedResourceSession) ) +#define ID3D12GraphicsCommandList9_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->BeginRenderPass(NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) +#define ID3D12GraphicsCommandList9_EndRenderPass(This) \ + ( (This)->EndRenderPass() ) +#define ID3D12GraphicsCommandList9_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->InitializeMetaCommand(pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList9_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->ExecuteMetaCommand(pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList9_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->BuildRaytracingAccelerationStructure(pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) +#define ID3D12GraphicsCommandList9_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->EmitRaytracingAccelerationStructurePostbuildInfo(pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) +#define ID3D12GraphicsCommandList9_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->CopyRaytracingAccelerationStructure(DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) +#define ID3D12GraphicsCommandList9_SetPipelineState1(This,pStateObject) \ + ( (This)->SetPipelineState1(pStateObject) ) +#define ID3D12GraphicsCommandList9_DispatchRays(This,pDesc) \ + ( (This)->DispatchRays(pDesc) ) +#define ID3D12GraphicsCommandList9_RSSetShadingRate(This,baseShadingRate,combiners) \ + ( (This)->RSSetShadingRate(baseShadingRate,combiners) ) +#define ID3D12GraphicsCommandList9_RSSetShadingRateImage(This,shadingRateImage) \ + ( (This)->RSSetShadingRateImage(shadingRateImage) ) +#define ID3D12GraphicsCommandList9_DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->DispatchMesh(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList9_Barrier(This,NumBarrierGroups,pBarrierGroups) \ + ( (This)->Barrier(NumBarrierGroups,pBarrierGroups) ) +#define ID3D12GraphicsCommandList9_OMSetFrontAndBackStencilRef(This,FrontStencilRef,BackStencilRef) \ + ( (This)->OMSetFrontAndBackStencilRef(FrontStencilRef,BackStencilRef) ) +#define ID3D12GraphicsCommandList9_RSSetDepthBias(This,DepthBias,DepthBiasClamp,SlopeScaledDepthBias) \ + ( (This)->RSSetDepthBias(DepthBias,DepthBiasClamp,SlopeScaledDepthBias) ) +#define ID3D12GraphicsCommandList9_IASetIndexBufferStripCutValue(This,IBStripCutValue) \ + ( (This)->IASetIndexBufferStripCutValue(IBStripCutValue) ) +#define ID3D12GraphicsCommandList10_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12GraphicsCommandList10_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12GraphicsCommandList10_Release(This) \ + ( (This)->Release() ) +#define ID3D12GraphicsCommandList10_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->GetPrivateData(guid,pDataSize,pData) ) +#define ID3D12GraphicsCommandList10_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->SetPrivateData(guid,DataSize,pData) ) +#define ID3D12GraphicsCommandList10_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->SetPrivateDataInterface(guid,pData) ) +#define ID3D12GraphicsCommandList10_SetName(This,Name) \ + ( (This)->SetName(Name) ) +#define ID3D12GraphicsCommandList10_GetDevice(This,riid,ppvDevice) \ + ( (This)->GetDevice(riid,ppvDevice) ) +#define ID3D12GraphicsCommandList10_GetType(This) \ + ( (This)->GetType() ) +#define ID3D12GraphicsCommandList10_Close(This) \ + ( (This)->Close() ) +#define ID3D12GraphicsCommandList10_Reset(This,pAllocator,pInitialState) \ + ( (This)->Reset(pAllocator,pInitialState) ) +#define ID3D12GraphicsCommandList10_ClearState(This,pPipelineState) \ + ( (This)->ClearState(pPipelineState) ) +#define ID3D12GraphicsCommandList10_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->DrawInstanced(VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList10_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->DrawIndexedInstanced(IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) +#define ID3D12GraphicsCommandList10_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->Dispatch(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList10_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->CopyBufferRegion(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) +#define ID3D12GraphicsCommandList10_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->CopyTextureRegion(pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) +#define ID3D12GraphicsCommandList10_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->CopyResource(pDstResource,pSrcResource) ) +#define ID3D12GraphicsCommandList10_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->CopyTiles(pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) +#define ID3D12GraphicsCommandList10_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->ResolveSubresource(pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) +#define ID3D12GraphicsCommandList10_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->IASetPrimitiveTopology(PrimitiveTopology) ) +#define ID3D12GraphicsCommandList10_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->RSSetViewports(NumViewports,pViewports) ) +#define ID3D12GraphicsCommandList10_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->RSSetScissorRects(NumRects,pRects) ) +#define ID3D12GraphicsCommandList10_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->OMSetBlendFactor(BlendFactor) ) +#define ID3D12GraphicsCommandList10_OMSetStencilRef(This,StencilRef) \ + ( (This)->OMSetStencilRef(StencilRef) ) +#define ID3D12GraphicsCommandList10_SetPipelineState(This,pPipelineState) \ + ( (This)->SetPipelineState(pPipelineState) ) +#define ID3D12GraphicsCommandList10_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->ResourceBarrier(NumBarriers,pBarriers) ) +#define ID3D12GraphicsCommandList10_ExecuteBundle(This,pCommandList) \ + ( (This)->ExecuteBundle(pCommandList) ) +#define ID3D12GraphicsCommandList10_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->SetDescriptorHeaps(NumDescriptorHeaps,ppDescriptorHeaps) ) +#define ID3D12GraphicsCommandList10_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->SetComputeRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList10_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->SetGraphicsRootSignature(pRootSignature) ) +#define ID3D12GraphicsCommandList10_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetComputeRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList10_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->SetGraphicsRootDescriptorTable(RootParameterIndex,BaseDescriptor) ) +#define ID3D12GraphicsCommandList10_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList10_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstant(RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList10_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetComputeRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList10_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->SetGraphicsRoot32BitConstants(RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) +#define ID3D12GraphicsCommandList10_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList10_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootConstantBufferView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList10_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList10_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootShaderResourceView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList10_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetComputeRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList10_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->SetGraphicsRootUnorderedAccessView(RootParameterIndex,BufferLocation) ) +#define ID3D12GraphicsCommandList10_IASetIndexBuffer(This,pView) \ + ( (This)->IASetIndexBuffer(pView) ) +#define ID3D12GraphicsCommandList10_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->IASetVertexBuffers(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList10_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->SOSetTargets(StartSlot,NumViews,pViews) ) +#define ID3D12GraphicsCommandList10_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->OMSetRenderTargets(NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) +#define ID3D12GraphicsCommandList10_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->ClearDepthStencilView(DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) +#define ID3D12GraphicsCommandList10_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->ClearRenderTargetView(RenderTargetView,ColorRGBA,NumRects,pRects) ) +#define ID3D12GraphicsCommandList10_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewUint(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList10_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->ClearUnorderedAccessViewFloat(ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) +#define ID3D12GraphicsCommandList10_DiscardResource(This,pResource,pRegion) \ + ( (This)->DiscardResource(pResource,pRegion) ) +#define ID3D12GraphicsCommandList10_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->BeginQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList10_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->EndQuery(pQueryHeap,Type,Index) ) +#define ID3D12GraphicsCommandList10_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->ResolveQueryData(pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) +#define ID3D12GraphicsCommandList10_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->SetPredication(pBuffer,AlignedBufferOffset,Operation) ) +#define ID3D12GraphicsCommandList10_SetMarker(This,Metadata,pData,Size) \ + ( (This)->SetMarker(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList10_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->BeginEvent(Metadata,pData,Size) ) +#define ID3D12GraphicsCommandList10_EndEvent(This) \ + ( (This)->EndEvent() ) +#define ID3D12GraphicsCommandList10_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->ExecuteIndirect(pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) +#define ID3D12GraphicsCommandList10_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList10_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->AtomicCopyBufferUINT64(pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) +#define ID3D12GraphicsCommandList10_OMSetDepthBounds(This,Min,Max) \ + ( (This)->OMSetDepthBounds(Min,Max) ) +#define ID3D12GraphicsCommandList10_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->SetSamplePositions(NumSamplesPerPixel,NumPixels,pSamplePositions) ) +#define ID3D12GraphicsCommandList10_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->ResolveSubresourceRegion(pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) +#define ID3D12GraphicsCommandList10_SetViewInstanceMask(This,Mask) \ + ( (This)->SetViewInstanceMask(Mask) ) +#define ID3D12GraphicsCommandList10_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->WriteBufferImmediate(Count,pParams,pModes) ) +#define ID3D12GraphicsCommandList10_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->SetProtectedResourceSession(pProtectedResourceSession) ) +#define ID3D12GraphicsCommandList10_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->BeginRenderPass(NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) +#define ID3D12GraphicsCommandList10_EndRenderPass(This) \ + ( (This)->EndRenderPass() ) +#define ID3D12GraphicsCommandList10_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->InitializeMetaCommand(pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList10_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->ExecuteMetaCommand(pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) +#define ID3D12GraphicsCommandList10_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->BuildRaytracingAccelerationStructure(pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) +#define ID3D12GraphicsCommandList10_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->EmitRaytracingAccelerationStructurePostbuildInfo(pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) +#define ID3D12GraphicsCommandList10_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->CopyRaytracingAccelerationStructure(DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) +#define ID3D12GraphicsCommandList10_SetPipelineState1(This,pStateObject) \ + ( (This)->SetPipelineState1(pStateObject) ) +#define ID3D12GraphicsCommandList10_DispatchRays(This,pDesc) \ + ( (This)->DispatchRays(pDesc) ) +#define ID3D12GraphicsCommandList10_RSSetShadingRate(This,baseShadingRate,combiners) \ + ( (This)->RSSetShadingRate(baseShadingRate,combiners) ) +#define ID3D12GraphicsCommandList10_RSSetShadingRateImage(This,shadingRateImage) \ + ( (This)->RSSetShadingRateImage(shadingRateImage) ) +#define ID3D12GraphicsCommandList10_DispatchMesh(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->DispatchMesh(ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) +#define ID3D12GraphicsCommandList10_Barrier(This,NumBarrierGroups,pBarrierGroups) \ + ( (This)->Barrier(NumBarrierGroups,pBarrierGroups) ) +#define ID3D12GraphicsCommandList10_OMSetFrontAndBackStencilRef(This,FrontStencilRef,BackStencilRef) \ + ( (This)->OMSetFrontAndBackStencilRef(FrontStencilRef,BackStencilRef) ) +#define ID3D12GraphicsCommandList10_RSSetDepthBias(This,DepthBias,DepthBiasClamp,SlopeScaledDepthBias) \ + ( (This)->RSSetDepthBias(DepthBias,DepthBiasClamp,SlopeScaledDepthBias) ) +#define ID3D12GraphicsCommandList10_IASetIndexBufferStripCutValue(This,IBStripCutValue) \ + ( (This)->IASetIndexBufferStripCutValue(IBStripCutValue) ) +#define ID3D12GraphicsCommandList10_SetProgram(This,pDesc) \ + ( (This)->SetProgram(pDesc) ) +#define ID3D12GraphicsCommandList10_DispatchGraph(This,pDesc) \ + ( (This)->DispatchGraph(pDesc) ) +#define ID3D12GBVDiagnostics_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12GBVDiagnostics_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12GBVDiagnostics_Release(This) \ + ( (This)->Release() ) +#define ID3D12GBVDiagnostics_GetGBVEntireSubresourceStatesData(This,pResource,pData,DataSize) \ + ( (This)->GetGBVEntireSubresourceStatesData(pResource,pData,DataSize) ) +#define ID3D12GBVDiagnostics_GetGBVSubresourceState(This,pResource,Subresource,pData) \ + ( (This)->GetGBVSubresourceState(pResource,Subresource,pData) ) +#define ID3D12GBVDiagnostics_GetGBVResourceUniformState(This,pResource,pData) \ + ( (This)->GetGBVResourceUniformState(pResource,pData) ) +#define ID3D12GBVDiagnostics_GetGBVResourceInfo(This,pResource,pResourceDesc,pResourceHash,pSubresourceStatesByteOffset) \ + ( (This)->GetGBVResourceInfo(pResource,pResourceDesc,pResourceHash,pSubresourceStatesByteOffset) ) +#define ID3D12GBVDiagnostics_GBVReserved0(This) \ + ( (This)->GBVReserved0() ) +#define ID3D12GBVDiagnostics_GBVReserved1(This) \ + ( (This)->GBVReserved1() ) +#define ID3D12Debug_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Debug_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Debug_Release(This) \ + ( (This)->Release() ) +#define ID3D12Debug_EnableDebugLayer(This) \ + ( (This)->EnableDebugLayer() ) +#define ID3D12Debug1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Debug1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Debug1_Release(This) \ + ( (This)->Release() ) +#define ID3D12Debug1_EnableDebugLayer(This) \ + ( (This)->EnableDebugLayer() ) +#define ID3D12Debug1_SetEnableGPUBasedValidation(This,Enable) \ + ( (This)->SetEnableGPUBasedValidation(Enable) ) +#define ID3D12Debug1_SetEnableSynchronizedCommandQueueValidation(This,Enable) \ + ( (This)->SetEnableSynchronizedCommandQueueValidation(Enable) ) +#define ID3D12Debug2_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Debug2_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Debug2_Release(This) \ + ( (This)->Release() ) +#define ID3D12Debug2_SetGPUBasedValidationFlags(This,Flags) \ + ( (This)->SetGPUBasedValidationFlags(Flags) ) +#define ID3D12Debug3_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Debug3_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Debug3_Release(This) \ + ( (This)->Release() ) +#define ID3D12Debug3_EnableDebugLayer(This) \ + ( (This)->EnableDebugLayer() ) +#define ID3D12Debug3_SetEnableGPUBasedValidation(This,Enable) \ + ( (This)->SetEnableGPUBasedValidation(Enable) ) +#define ID3D12Debug3_SetEnableSynchronizedCommandQueueValidation(This,Enable) \ + ( (This)->SetEnableSynchronizedCommandQueueValidation(Enable) ) +#define ID3D12Debug3_SetGPUBasedValidationFlags(This,Flags) \ + ( (This)->SetGPUBasedValidationFlags(Flags) ) +#define ID3D12Debug4_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Debug4_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Debug4_Release(This) \ + ( (This)->Release() ) +#define ID3D12Debug4_EnableDebugLayer(This) \ + ( (This)->EnableDebugLayer() ) +#define ID3D12Debug4_SetEnableGPUBasedValidation(This,Enable) \ + ( (This)->SetEnableGPUBasedValidation(Enable) ) +#define ID3D12Debug4_SetEnableSynchronizedCommandQueueValidation(This,Enable) \ + ( (This)->SetEnableSynchronizedCommandQueueValidation(Enable) ) +#define ID3D12Debug4_SetGPUBasedValidationFlags(This,Flags) \ + ( (This)->SetGPUBasedValidationFlags(Flags) ) +#define ID3D12Debug4_DisableDebugLayer(This) \ + ( (This)->DisableDebugLayer() ) +#define ID3D12Debug5_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Debug5_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Debug5_Release(This) \ + ( (This)->Release() ) +#define ID3D12Debug5_EnableDebugLayer(This) \ + ( (This)->EnableDebugLayer() ) +#define ID3D12Debug5_SetEnableGPUBasedValidation(This,Enable) \ + ( (This)->SetEnableGPUBasedValidation(Enable) ) +#define ID3D12Debug5_SetEnableSynchronizedCommandQueueValidation(This,Enable) \ + ( (This)->SetEnableSynchronizedCommandQueueValidation(Enable) ) +#define ID3D12Debug5_SetGPUBasedValidationFlags(This,Flags) \ + ( (This)->SetGPUBasedValidationFlags(Flags) ) +#define ID3D12Debug5_DisableDebugLayer(This) \ + ( (This)->DisableDebugLayer() ) +#define ID3D12Debug5_SetEnableAutoName(This,Enable) \ + ( (This)->SetEnableAutoName(Enable) ) +#define ID3D12Debug6_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12Debug6_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12Debug6_Release(This) \ + ( (This)->Release() ) +#define ID3D12Debug6_EnableDebugLayer(This) \ + ( (This)->EnableDebugLayer() ) +#define ID3D12Debug6_SetEnableGPUBasedValidation(This,Enable) \ + ( (This)->SetEnableGPUBasedValidation(Enable) ) +#define ID3D12Debug6_SetEnableSynchronizedCommandQueueValidation(This,Enable) \ + ( (This)->SetEnableSynchronizedCommandQueueValidation(Enable) ) +#define ID3D12Debug6_SetGPUBasedValidationFlags(This,Flags) \ + ( (This)->SetGPUBasedValidationFlags(Flags) ) +#define ID3D12Debug6_DisableDebugLayer(This) \ + ( (This)->DisableDebugLayer() ) +#define ID3D12Debug6_SetEnableAutoName(This,Enable) \ + ( (This)->SetEnableAutoName(Enable) ) +#define ID3D12Debug6_SetForceLegacyBarrierValidation(This,Enable) \ + ( (This)->SetForceLegacyBarrierValidation(Enable) ) +#define ID3D12DebugDevice1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DebugDevice1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DebugDevice1_Release(This) \ + ( (This)->Release() ) +#define ID3D12DebugDevice1_SetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->SetDebugParameter(Type,pData,DataSize) ) +#define ID3D12DebugDevice1_GetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->GetDebugParameter(Type,pData,DataSize) ) +#define ID3D12DebugDevice1_ReportLiveDeviceObjects(This,Flags) \ + ( (This)->ReportLiveDeviceObjects(Flags) ) +#define ID3D12DebugDevice_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DebugDevice_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DebugDevice_Release(This) \ + ( (This)->Release() ) +#define ID3D12DebugDevice_SetFeatureMask(This,Mask) \ + ( (This)->SetFeatureMask(Mask) ) +#define ID3D12DebugDevice_GetFeatureMask(This) \ + ( (This)->GetFeatureMask() ) +#define ID3D12DebugDevice_ReportLiveDeviceObjects(This,Flags) \ + ( (This)->ReportLiveDeviceObjects(Flags) ) +#define ID3D12DebugDevice2_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DebugDevice2_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DebugDevice2_Release(This) \ + ( (This)->Release() ) +#define ID3D12DebugDevice2_SetFeatureMask(This,Mask) \ + ( (This)->SetFeatureMask(Mask) ) +#define ID3D12DebugDevice2_GetFeatureMask(This) \ + ( (This)->GetFeatureMask() ) +#define ID3D12DebugDevice2_ReportLiveDeviceObjects(This,Flags) \ + ( (This)->ReportLiveDeviceObjects(Flags) ) +#define ID3D12DebugDevice2_SetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->SetDebugParameter(Type,pData,DataSize) ) +#define ID3D12DebugDevice2_GetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->GetDebugParameter(Type,pData,DataSize) ) +#define ID3D12DebugCommandQueue_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DebugCommandQueue_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DebugCommandQueue_Release(This) \ + ( (This)->Release() ) +#define ID3D12DebugCommandQueue_AssertResourceState(This,pResource,Subresource,State) \ + ( (This)->AssertResourceState(pResource,Subresource,State) ) +#define ID3D12DebugCommandQueue1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DebugCommandQueue1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DebugCommandQueue1_Release(This) \ + ( (This)->Release() ) +#define ID3D12DebugCommandQueue1_AssertResourceState(This,pResource,Subresource,State) \ + ( (This)->AssertResourceState(pResource,Subresource,State) ) +#define ID3D12DebugCommandQueue1_AssertResourceAccess(This,pResource,Subresource,Access) \ + ( (This)->AssertResourceAccess(pResource,Subresource,Access) ) +#define ID3D12DebugCommandQueue1_AssertTextureLayout(This,pResource,Subresource,Layout) \ + ( (This)->AssertTextureLayout(pResource,Subresource,Layout) ) +#define ID3D12DebugCommandList1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DebugCommandList1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DebugCommandList1_Release(This) \ + ( (This)->Release() ) +#define ID3D12DebugCommandList1_AssertResourceState(This,pResource,Subresource,State) \ + ( (This)->AssertResourceState(pResource,Subresource,State) ) +#define ID3D12DebugCommandList1_SetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->SetDebugParameter(Type,pData,DataSize) ) +#define ID3D12DebugCommandList1_GetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->GetDebugParameter(Type,pData,DataSize) ) +#define ID3D12DebugCommandList_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DebugCommandList_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DebugCommandList_Release(This) \ + ( (This)->Release() ) +#define ID3D12DebugCommandList_AssertResourceState(This,pResource,Subresource,State) \ + ( (This)->AssertResourceState(pResource,Subresource,State) ) +#define ID3D12DebugCommandList_SetFeatureMask(This,Mask) \ + ( (This)->SetFeatureMask(Mask) ) +#define ID3D12DebugCommandList_GetFeatureMask(This) \ + ( (This)->GetFeatureMask() ) +#define ID3D12DebugCommandList2_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DebugCommandList2_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DebugCommandList2_Release(This) \ + ( (This)->Release() ) +#define ID3D12DebugCommandList2_AssertResourceState(This,pResource,Subresource,State) \ + ( (This)->AssertResourceState(pResource,Subresource,State) ) +#define ID3D12DebugCommandList2_SetFeatureMask(This,Mask) \ + ( (This)->SetFeatureMask(Mask) ) +#define ID3D12DebugCommandList2_GetFeatureMask(This) \ + ( (This)->GetFeatureMask() ) +#define ID3D12DebugCommandList2_SetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->SetDebugParameter(Type,pData,DataSize) ) +#define ID3D12DebugCommandList2_GetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->GetDebugParameter(Type,pData,DataSize) ) +#define ID3D12DebugCommandList3_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12DebugCommandList3_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12DebugCommandList3_Release(This) \ + ( (This)->Release() ) +#define ID3D12DebugCommandList3_AssertResourceState(This,pResource,Subresource,State) \ + ( (This)->AssertResourceState(pResource,Subresource,State) ) +#define ID3D12DebugCommandList3_SetFeatureMask(This,Mask) \ + ( (This)->SetFeatureMask(Mask) ) +#define ID3D12DebugCommandList3_GetFeatureMask(This) \ + ( (This)->GetFeatureMask() ) +#define ID3D12DebugCommandList3_SetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->SetDebugParameter(Type,pData,DataSize) ) +#define ID3D12DebugCommandList3_GetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->GetDebugParameter(Type,pData,DataSize) ) +#define ID3D12DebugCommandList3_AssertResourceAccess(This,pResource,Subresource,Access) \ + ( (This)->AssertResourceAccess(pResource,Subresource,Access) ) +#define ID3D12DebugCommandList3_AssertTextureLayout(This,pResource,Subresource,Layout) \ + ( (This)->AssertTextureLayout(pResource,Subresource,Layout) ) +#define ID3D12SharingContract_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12SharingContract_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12SharingContract_Release(This) \ + ( (This)->Release() ) +#define ID3D12SharingContract_Present(This,pResource,Subresource,window) \ + ( (This)->Present(pResource,Subresource,window) ) +#define ID3D12SharingContract_SharedFenceSignal(This,pFence,FenceValue) \ + ( (This)->SharedFenceSignal(pFence,FenceValue) ) +#define ID3D12SharingContract_BeginCapturableWork(This,guid) \ + ( (This)->BeginCapturableWork(guid) ) +#define ID3D12SharingContract_EndCapturableWork(This,guid) \ + ( (This)->EndCapturableWork(guid) ) +#define ID3D12ManualWriteTrackingResource_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12ManualWriteTrackingResource_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12ManualWriteTrackingResource_Release(This) \ + ( (This)->Release() ) +#define ID3D12ManualWriteTrackingResource_TrackWrite(This,Subresource,pWrittenRange) \ + ( (This)->TrackWrite(Subresource,pWrittenRange) ) +#define ID3D12InfoQueue_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12InfoQueue_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12InfoQueue_Release(This) \ + ( (This)->Release() ) +#define ID3D12InfoQueue_SetMessageCountLimit(This,MessageCountLimit) \ + ( (This)->SetMessageCountLimit(MessageCountLimit) ) +#define ID3D12InfoQueue_ClearStoredMessages(This) \ + ( (This)->ClearStoredMessages() ) +#define ID3D12InfoQueue_GetMessage(This,MessageIndex,pMessage,pMessageByteLength) \ + ( (This)->GetMessage(MessageIndex,pMessage,pMessageByteLength) ) +#define ID3D12InfoQueue_GetNumMessagesAllowedByStorageFilter(This) \ + ( (This)->GetNumMessagesAllowedByStorageFilter() ) +#define ID3D12InfoQueue_GetNumMessagesDeniedByStorageFilter(This) \ + ( (This)->GetNumMessagesDeniedByStorageFilter() ) +#define ID3D12InfoQueue_GetNumStoredMessages(This) \ + ( (This)->GetNumStoredMessages() ) +#define ID3D12InfoQueue_GetNumStoredMessagesAllowedByRetrievalFilter(This) \ + ( (This)->GetNumStoredMessagesAllowedByRetrievalFilter() ) +#define ID3D12InfoQueue_GetNumMessagesDiscardedByMessageCountLimit(This) \ + ( (This)->GetNumMessagesDiscardedByMessageCountLimit() ) +#define ID3D12InfoQueue_GetMessageCountLimit(This) \ + ( (This)->GetMessageCountLimit() ) +#define ID3D12InfoQueue_AddStorageFilterEntries(This,pFilter) \ + ( (This)->AddStorageFilterEntries(pFilter) ) +#define ID3D12InfoQueue_GetStorageFilter(This,pFilter,pFilterByteLength) \ + ( (This)->GetStorageFilter(pFilter,pFilterByteLength) ) +#define ID3D12InfoQueue_ClearStorageFilter(This) \ + ( (This)->ClearStorageFilter() ) +#define ID3D12InfoQueue_PushEmptyStorageFilter(This) \ + ( (This)->PushEmptyStorageFilter() ) +#define ID3D12InfoQueue_PushCopyOfStorageFilter(This) \ + ( (This)->PushCopyOfStorageFilter() ) +#define ID3D12InfoQueue_PushStorageFilter(This,pFilter) \ + ( (This)->PushStorageFilter(pFilter) ) +#define ID3D12InfoQueue_PopStorageFilter(This) \ + ( (This)->PopStorageFilter() ) +#define ID3D12InfoQueue_GetStorageFilterStackSize(This) \ + ( (This)->GetStorageFilterStackSize() ) +#define ID3D12InfoQueue_AddRetrievalFilterEntries(This,pFilter) \ + ( (This)->AddRetrievalFilterEntries(pFilter) ) +#define ID3D12InfoQueue_GetRetrievalFilter(This,pFilter,pFilterByteLength) \ + ( (This)->GetRetrievalFilter(pFilter,pFilterByteLength) ) +#define ID3D12InfoQueue_ClearRetrievalFilter(This) \ + ( (This)->ClearRetrievalFilter() ) +#define ID3D12InfoQueue_PushEmptyRetrievalFilter(This) \ + ( (This)->PushEmptyRetrievalFilter() ) +#define ID3D12InfoQueue_PushCopyOfRetrievalFilter(This) \ + ( (This)->PushCopyOfRetrievalFilter() ) +#define ID3D12InfoQueue_PushRetrievalFilter(This,pFilter) \ + ( (This)->PushRetrievalFilter(pFilter) ) +#define ID3D12InfoQueue_PopRetrievalFilter(This) \ + ( (This)->PopRetrievalFilter() ) +#define ID3D12InfoQueue_GetRetrievalFilterStackSize(This) \ + ( (This)->GetRetrievalFilterStackSize() ) +#define ID3D12InfoQueue_AddMessage(This,Category,Severity,ID,pDescription) \ + ( (This)->AddMessage(Category,Severity,ID,pDescription) ) +#define ID3D12InfoQueue_AddApplicationMessage(This,Severity,pDescription) \ + ( (This)->AddApplicationMessage(Severity,pDescription) ) +#define ID3D12InfoQueue_SetBreakOnCategory(This,Category,bEnable) \ + ( (This)->SetBreakOnCategory(Category,bEnable) ) +#define ID3D12InfoQueue_SetBreakOnSeverity(This,Severity,bEnable) \ + ( (This)->SetBreakOnSeverity(Severity,bEnable) ) +#define ID3D12InfoQueue_SetBreakOnID(This,ID,bEnable) \ + ( (This)->SetBreakOnID(ID,bEnable) ) +#define ID3D12InfoQueue_GetBreakOnCategory(This,Category) \ + ( (This)->GetBreakOnCategory(Category) ) +#define ID3D12InfoQueue_GetBreakOnSeverity(This,Severity) \ + ( (This)->GetBreakOnSeverity(Severity) ) +#define ID3D12InfoQueue_GetBreakOnID(This,ID) \ + ( (This)->GetBreakOnID(ID) ) +#define ID3D12InfoQueue_SetMuteDebugOutput(This,bMute) \ + ( (This)->SetMuteDebugOutput(bMute) ) +#define ID3D12InfoQueue_GetMuteDebugOutput(This) \ + ( (This)->GetMuteDebugOutput() ) +#define ID3D12InfoQueue1_QueryInterface(This,riid,ppvObject) \ + ( (This)->QueryInterface(riid,ppvObject) ) +#define ID3D12InfoQueue1_AddRef(This) \ + ( (This)->AddRef() ) +#define ID3D12InfoQueue1_Release(This) \ + ( (This)->Release() ) +#define ID3D12InfoQueue1_SetMessageCountLimit(This,MessageCountLimit) \ + ( (This)->SetMessageCountLimit(MessageCountLimit) ) +#define ID3D12InfoQueue1_ClearStoredMessages(This) \ + ( (This)->ClearStoredMessages() ) +#define ID3D12InfoQueue1_GetMessage(This,MessageIndex,pMessage,pMessageByteLength) \ + ( (This)->GetMessage(MessageIndex,pMessage,pMessageByteLength) ) +#define ID3D12InfoQueue1_GetNumMessagesAllowedByStorageFilter(This) \ + ( (This)->GetNumMessagesAllowedByStorageFilter() ) +#define ID3D12InfoQueue1_GetNumMessagesDeniedByStorageFilter(This) \ + ( (This)->GetNumMessagesDeniedByStorageFilter() ) +#define ID3D12InfoQueue1_GetNumStoredMessages(This) \ + ( (This)->GetNumStoredMessages() ) +#define ID3D12InfoQueue1_GetNumStoredMessagesAllowedByRetrievalFilter(This) \ + ( (This)->GetNumStoredMessagesAllowedByRetrievalFilter() ) +#define ID3D12InfoQueue1_GetNumMessagesDiscardedByMessageCountLimit(This) \ + ( (This)->GetNumMessagesDiscardedByMessageCountLimit() ) +#define ID3D12InfoQueue1_GetMessageCountLimit(This) \ + ( (This)->GetMessageCountLimit() ) +#define ID3D12InfoQueue1_AddStorageFilterEntries(This,pFilter) \ + ( (This)->AddStorageFilterEntries(pFilter) ) +#define ID3D12InfoQueue1_GetStorageFilter(This,pFilter,pFilterByteLength) \ + ( (This)->GetStorageFilter(pFilter,pFilterByteLength) ) +#define ID3D12InfoQueue1_ClearStorageFilter(This) \ + ( (This)->ClearStorageFilter() ) +#define ID3D12InfoQueue1_PushEmptyStorageFilter(This) \ + ( (This)->PushEmptyStorageFilter() ) +#define ID3D12InfoQueue1_PushCopyOfStorageFilter(This) \ + ( (This)->PushCopyOfStorageFilter() ) +#define ID3D12InfoQueue1_PushStorageFilter(This,pFilter) \ + ( (This)->PushStorageFilter(pFilter) ) +#define ID3D12InfoQueue1_PopStorageFilter(This) \ + ( (This)->PopStorageFilter() ) +#define ID3D12InfoQueue1_GetStorageFilterStackSize(This) \ + ( (This)->GetStorageFilterStackSize() ) +#define ID3D12InfoQueue1_AddRetrievalFilterEntries(This,pFilter) \ + ( (This)->AddRetrievalFilterEntries(pFilter) ) +#define ID3D12InfoQueue1_GetRetrievalFilter(This,pFilter,pFilterByteLength) \ + ( (This)->GetRetrievalFilter(pFilter,pFilterByteLength) ) +#define ID3D12InfoQueue1_ClearRetrievalFilter(This) \ + ( (This)->ClearRetrievalFilter() ) +#define ID3D12InfoQueue1_PushEmptyRetrievalFilter(This) \ + ( (This)->PushEmptyRetrievalFilter() ) +#define ID3D12InfoQueue1_PushCopyOfRetrievalFilter(This) \ + ( (This)->PushCopyOfRetrievalFilter() ) +#define ID3D12InfoQueue1_PushRetrievalFilter(This,pFilter) \ + ( (This)->PushRetrievalFilter(pFilter) ) +#define ID3D12InfoQueue1_PopRetrievalFilter(This) \ + ( (This)->PopRetrievalFilter() ) +#define ID3D12InfoQueue1_GetRetrievalFilterStackSize(This) \ + ( (This)->GetRetrievalFilterStackSize() ) +#define ID3D12InfoQueue1_AddMessage(This,Category,Severity,ID,pDescription) \ + ( (This)->AddMessage(Category,Severity,ID,pDescription) ) +#define ID3D12InfoQueue1_AddApplicationMessage(This,Severity,pDescription) \ + ( (This)->AddApplicationMessage(Severity,pDescription) ) +#define ID3D12InfoQueue1_SetBreakOnCategory(This,Category,bEnable) \ + ( (This)->SetBreakOnCategory(Category,bEnable) ) +#define ID3D12InfoQueue1_SetBreakOnSeverity(This,Severity,bEnable) \ + ( (This)->SetBreakOnSeverity(Severity,bEnable) ) +#define ID3D12InfoQueue1_SetBreakOnID(This,ID,bEnable) \ + ( (This)->SetBreakOnID(ID,bEnable) ) +#define ID3D12InfoQueue1_GetBreakOnCategory(This,Category) \ + ( (This)->GetBreakOnCategory(Category) ) +#define ID3D12InfoQueue1_GetBreakOnSeverity(This,Severity) \ + ( (This)->GetBreakOnSeverity(Severity) ) +#define ID3D12InfoQueue1_GetBreakOnID(This,ID) \ + ( (This)->GetBreakOnID(ID) ) +#define ID3D12InfoQueue1_SetMuteDebugOutput(This,bMute) \ + ( (This)->SetMuteDebugOutput(bMute) ) +#define ID3D12InfoQueue1_GetMuteDebugOutput(This) \ + ( (This)->GetMuteDebugOutput() ) +#define ID3D12InfoQueue1_RegisterMessageCallback(This,CallbackFunc,CallbackFilterFlags,pContext,pCallbackCookie) \ + ( (This)->RegisterMessageCallback(CallbackFunc,CallbackFilterFlags,pContext,pCallbackCookie) ) +#define ID3D12InfoQueue1_UnregisterMessageCallback(This,CallbackCookie) \ + ( (This)->UnregisterMessageCallback(CallbackCookie) ) diff --git a/src/video/directx/gen_xbox_cmacros.cs b/src/video/directx/gen_xbox_cmacros.cs new file mode 100644 index 0000000000000..519f64eebd84c --- /dev/null +++ b/src/video/directx/gen_xbox_cmacros.cs @@ -0,0 +1,91 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* Build and run this any time you update d3d12.h/d3d12sdklayers.h! */ + +using System.IO; + +class Program +{ + static void GenMacros(string[] input, StreamWriter output) + { + for (int i = 0; i < input.Length; i += 1) + { + if (input[i].StartsWith("#define I")) + { + // Strip out the bad ABI calls, use D3D_CALL_RET instead! + if (input[i].Contains("_GetDesc(") || + input[i].Contains("_GetDesc1(") || + input[i].Contains("_GetCPUDescriptorHandleForHeapStart(") || + input[i].Contains("_GetGPUDescriptorHandleForHeapStart(") || + input[i].Contains("_GetResourceAllocationInfo(") || + input[i].Contains("_GetResourceAllocationInfo1(") || + input[i].Contains("_GetResourceAllocationInfo2(") || + input[i].Contains("_GetResourceAllocationInfo3(") || + input[i].Contains("_GetCustomHeapProperties(") || + input[i].Contains("_GetAdapterLuid(") || + input[i].Contains("_GetLUID(") || + input[i].Contains("_GetProgramIdentifier(") || + input[i].Contains("_GetNodeID(") || + input[i].Contains("_GetEntrypointID(")) + { + // May as well skip the next line... + i += 1; + continue; + } + + // The first line is fine as-is. + output.WriteLine(input[i]); + + // The second line, however... + i += 1; + + string notThis; + if (input[i].LastIndexOf("This,") > -1) + { + // Function with arguments + notThis = "This,"; + } + else + { + // Function with no arguments + notThis = "This"; + } + + int lastNotThis = input[i].LastIndexOf(notThis); + string alias = input[i].Substring(0, lastNotThis).Replace("lpVtbl -> ", ""); + string definition = input[i].Substring(lastNotThis).Replace(notThis, ""); + output.WriteLine(alias + definition); + } + } + } + + static void Main(string[] args) + { + using (FileStream SDL_d3d12_xbox_cmacros_h = File.OpenWrite("SDL_d3d12_xbox_cmacros.h")) + using (StreamWriter output = new StreamWriter(SDL_d3d12_xbox_cmacros_h)) + { + output.WriteLine("/* This file is autogenerated, DO NOT MODIFY */"); + GenMacros(File.ReadAllLines("d3d12.h"), output); + GenMacros(File.ReadAllLines("d3d12sdklayers.h"), output); + } + } +} From fe5dcf79be0c00d7220ea0a8fdecf1306d2c90d9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 6 Aug 2024 13:01:04 -0700 Subject: [PATCH 212/253] Reset log prefixes on SDL_Quit() --- src/SDL_log.c | 59 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/src/SDL_log.c b/src/SDL_log.c index 267ade6e6b6a6..2b2680f5fdef7 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -50,9 +50,12 @@ typedef struct SDL_LogLevel struct SDL_LogLevel *next; } SDL_LogLevel; + /* The default log output function */ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message); +static void SDL_ResetLogPrefixes(void); + static SDL_LogLevel *SDL_loglevels; static SDL_bool SDL_forced_priority = SDL_FALSE; static SDL_LogPriority SDL_forced_priority_level; @@ -77,17 +80,7 @@ static const char * const SDL_priority_names[] = { }; SDL_COMPILE_TIME_ASSERT(priority_names, SDL_arraysize(SDL_priority_names) == SDL_NUM_LOG_PRIORITIES); -/* If this list changes, update the documentation for SDL_HINT_LOGGING */ -static const char *SDL_priority_prefixes[] = { - NULL, - "", - "", - "", - "WARNING: ", - "ERROR: ", - "CRITICAL: " -}; -SDL_COMPILE_TIME_ASSERT(priority_prefixes, SDL_arraysize(SDL_priority_prefixes) == SDL_NUM_LOG_PRIORITIES); +static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES]; /* If this list changes, update the documentation for SDL_HINT_LOGGING */ static const char * const SDL_category_names[] = { @@ -130,6 +123,7 @@ void SDL_InitLog(void) void SDL_QuitLog(void) { SDL_ResetLogPriorities(); + SDL_ResetLogPrefixes(); if (log_function_mutex) { SDL_DestroyMutex(log_function_mutex); @@ -315,6 +309,35 @@ void SDL_ResetLogPriorities(void) SDL_forced_priority = SDL_FALSE; } +static void SDL_ResetLogPrefixes(void) +{ + for (int i = 0; i < SDL_arraysize(SDL_priority_prefixes); ++i) { + SDL_priority_prefixes[i] = NULL; + } +} + +static const char *SDL_GetLogPriorityPrefix(SDL_LogPriority priority) +{ + if (priority < SDL_LOG_PRIORITY_VERBOSE || priority >= SDL_NUM_LOG_PRIORITIES) { + return ""; + } + + if (SDL_priority_prefixes[priority]) { + return SDL_priority_prefixes[priority]; + } + + switch (priority) { + case SDL_LOG_PRIORITY_WARN: + return "WARNING: "; + case SDL_LOG_PRIORITY_ERROR: + return "ERROR: "; + case SDL_LOG_PRIORITY_CRITICAL: + return "ERROR: "; + default: + return ""; + } +} + int SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix) { if (priority < SDL_LOG_PRIORITY_VERBOSE || priority >= SDL_NUM_LOG_PRIORITIES) { @@ -548,9 +571,9 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority } #endif /* !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) */ - length = SDL_strlen(SDL_priority_prefixes[priority]) + SDL_strlen(message) + 1 + 1 + 1; + length = SDL_strlen(SDL_GetLogPriorityPrefix(priority)) + SDL_strlen(message) + 1 + 1 + 1; output = SDL_small_alloc(char, length, &isstack); - (void)SDL_snprintf(output, length, "%s%s\r\n", SDL_priority_prefixes[priority], message); + (void)SDL_snprintf(output, length, "%s%s\r\n", SDL_GetLogPriorityPrefix(priority), message); tstr = WIN_UTF8ToString(output); /* Output to debugger */ @@ -588,7 +611,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority */ extern void SDL_NSLog(const char *prefix, const char *text); { - SDL_NSLog(SDL_priority_prefixes[priority], message); + SDL_NSLog(SDL_GetLogPriorityPrefix(priority), message); return; } #elif defined(SDL_PLATFORM_PSP) || defined(SDL_PLATFORM_PS2) @@ -596,7 +619,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority FILE *pFile; pFile = fopen("SDL_Log.txt", "a"); if (pFile) { - (void)fprintf(pFile, "%s%s\n", SDL_priority_prefixes[priority], message); + (void)fprintf(pFile, "%s%s\n", SDL_GetLogPriorityPrefix(priority), message); (void)fclose(pFile); } } @@ -605,7 +628,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority FILE *pFile; pFile = fopen("ux0:/data/SDL_Log.txt", "a"); if (pFile) { - (void)fprintf(pFile, "%s%s\n", SDL_priority_prefixes[priority], message); + (void)fprintf(pFile, "%s%s\n", SDL_GetLogPriorityPrefix(priority), message); (void)fclose(pFile); } } @@ -614,14 +637,14 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority FILE *pFile; pFile = fopen("sdmc:/3ds/SDL_Log.txt", "a"); if (pFile) { - (void)fprintf(pFile, "%s%s\n", SDL_priority_prefixes[priority], message); + (void)fprintf(pFile, "%s%s\n", SDL_GetLogPriorityPrefix(priority), message); (void)fclose(pFile); } } #endif #if defined(HAVE_STDIO_H) && \ !(defined(SDL_PLATFORM_APPLE) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))) - (void)fprintf(stderr, "%s%s\n", SDL_priority_prefixes[priority], message); + (void)fprintf(stderr, "%s%s\n", SDL_GetLogPriorityPrefix(priority), message); #endif } From 27bb5bcef622a3a16ddb86b601f3c55867b024a7 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 7 Aug 2024 06:51:35 +0200 Subject: [PATCH 213/253] sdlprocdump: fix stacktrace --- test/win32/sdlprocdump.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/win32/sdlprocdump.c b/test/win32/sdlprocdump.c index 675d6175f85dc..ce05b7baff4a2 100644 --- a/test/win32/sdlprocdump.c +++ b/test/win32/sdlprocdump.c @@ -241,7 +241,7 @@ static void write_minidump(const char *child_file_path, const LPPROCESS_INFORMAT _splitpath_s(child_file_path, NULL, 0, NULL, 0, child_file_name, sizeof(child_file_name), NULL, 0); GetLocalTime(&system_time); - snprintf(dump_file_path, sizeof(dump_file_path), "minidumps/%s_%04d-%02d-%02d_%d-%02d-%02d.dmp", + snprintf(dump_file_path, sizeof(dump_file_path), "minidumps/%s_%04d-%02d-%02d_%02d-%02d-%02d.dmp", child_file_name, system_time.wYear, system_time.wMonth, system_time.wDay, system_time.wHour, system_time.wMinute, system_time.wSecond); @@ -282,7 +282,7 @@ static void write_minidump(const char *child_file_path, const LPPROCESS_INFORMAT } } -static void print_stacktrace(const LPPROCESS_INFORMATION process_information, PCONTEXT context, LPVOID address) { +static void print_stacktrace(const LPPROCESS_INFORMATION process_information, LPVOID address, PCONTEXT context) { STACKFRAME64 stack_frame; DWORD machine_type; @@ -350,12 +350,11 @@ static void print_stacktrace(const LPPROCESS_INFORMATION process_information, PC process_information->hProcess, /* HANDLE hProcess */ process_information->hThread, /* HANDLE hThread */ &stack_frame, /* LPSTACKFRAME64 StackFrame */ - &context, /* PVOID ContextRecord */ + context, /* PVOID ContextRecord */ NULL, /* PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine */ dyn_dbghelp.pSymFunctionTableAccess64, /* PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine */ dyn_dbghelp.pSymGetModuleBase64, /* PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine */ NULL)) { /* PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress */ - IMAGEHLP_MODULE64 module_info; union { char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(CHAR)]; @@ -571,6 +570,7 @@ int main(int argc, char *argv[]) { printf_message("No support for printing stacktrack for current architecture"); #endif DebugActiveProcessStop(event.dwProcessId); + process_alive = FALSE; } continue_status = DBG_EXCEPTION_NOT_HANDLED; break; @@ -583,7 +583,7 @@ int main(int argc, char *argv[]) { } /* Don't invade process on CI: downloading symbols will cause test timeouts */ if (!dyn_dbghelp.pSymInitialize(process_information.hProcess, NULL, FALSE)) { - printf_windows_message("pSymInitialize failed: no stacktrace"); + printf_windows_message("SymInitialize failed: no stacktrace"); break; } break; From 20a6193eaa3166f420071028d4c0081ed1f21cbe Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 7 Aug 2024 09:55:08 +0200 Subject: [PATCH 214/253] Run test suites and test cases in non-linear order (see libsdl-org#9303) --- include/SDL3/SDL_test_harness.h | 3 +- src/test/SDL_test_harness.c | 96 +++++++++++++++++++++++++++++++-- test/testautomation.c | 16 +++++- 3 files changed, 107 insertions(+), 8 deletions(-) diff --git a/include/SDL3/SDL_test_harness.h b/include/SDL3/SDL_test_harness.h index 263071fbd3928..70adc3585ae5c 100644 --- a/include/SDL3/SDL_test_harness.h +++ b/include/SDL3/SDL_test_harness.h @@ -117,10 +117,11 @@ char *SDLTest_GenerateRunSeed(const int length); * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one. * \param filter Filter specification. NULL disables. Case sensitive. * \param testIterations Number of iterations to run each test case. + * \param randomOrder allow to run suites and tests in random order when there is no filter * * \returns the test run result: 0 when all tests passed, 1 if any tests failed. */ -int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations); +int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations, SDL_bool randomOrder); /* Ends C function definitions when using C++ */ diff --git a/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c index e306e4630d4de..f91d4903e1360 100644 --- a/src/test/SDL_test_harness.c +++ b/src/test/SDL_test_harness.c @@ -365,10 +365,11 @@ static float GetClock(void) * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one. * \param filter Filter specification. NULL disables. Case sensitive. * \param testIterations Number of iterations to run each test case. + * \param randomOrder allow to run suites and tests in random order when there is no filter * * \returns Test run result; 0 when all tests passed, 1 if any tests failed. */ -int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations) +int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations, SDL_bool randomOrder) { int totalNumberOfTests = 0; int failedNumberOfTests = 0; @@ -404,6 +405,9 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user int countSum = 0; const SDLTest_TestCaseReference **failedTests; char generatedSeed[16 + 1]; + int nbSuites = 0; + int i = 0; + int *arraySuites = NULL; /* Sanitize test iterations */ if (testIterations < 1) { @@ -509,11 +513,59 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user SDL_free((void *)failedTests); return 2; } + + randomOrder = SDL_FALSE; + } + + /* Number of test suites */ + while (testSuites[nbSuites]) { + nbSuites++; + } + + arraySuites = SDL_malloc(nbSuites * sizeof(int)); + if (!arraySuites) { + return SDL_OutOfMemory(); + } + for (i = 0; i < nbSuites; i++) { + arraySuites[i] = i; + } + + /* Mix the list of suites to run them in random order */ + { + /* Exclude last test "subsystemsTestSuite" which is said to interfer with other tests */ + nbSuites--; + + if (userExecKey != 0) { + execKey = userExecKey; + } else { + /* dummy values to have random numbers working */ + execKey = SDLTest_GenerateExecKey(runSeed, "random testSuites", "initialisation", 1); + } + + /* Initialize fuzzer */ + SDLTest_FuzzerInit(execKey); + + i = 100; + while (i--) { + int a, b; + int tmp; + a = SDLTest_RandomIntegerInRange(0, nbSuites - 1); + b = SDLTest_RandomIntegerInRange(0, nbSuites - 1); + /* Swap */ + if (randomOrder) { + tmp = arraySuites[b]; + arraySuites[b] = arraySuites[a]; + arraySuites[a] = tmp; + } + } + + /* re-add last lest */ + nbSuites++; } /* Loop over all suites */ - suiteCounter = 0; - while (testSuites[suiteCounter]) { + for (i = 0; i < nbSuites; i++) { + suiteCounter = arraySuites[i];; testSuite = testSuites[suiteCounter]; currentSuiteName = (testSuite->name ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT); suiteCounter++; @@ -527,6 +579,36 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user currentSuiteName); } else { + int nbTestCases = 0; + int *arrayTestCases; + int j; + while (testSuite->testCases[nbTestCases]) { + nbTestCases++; + } + + arrayTestCases = SDL_malloc(nbTestCases * sizeof(int)); + if (!arrayTestCases) { + return SDL_OutOfMemory(); + } + for (j = 0; j < nbTestCases; j++) { + arrayTestCases[j] = j; + } + + /* Mix the list of testCases to run them in random order */ + j = 100; + while (j--) { + int a, b; + int tmp; + a = SDLTest_RandomIntegerInRange(0, nbTestCases - 1); + b = SDLTest_RandomIntegerInRange(0, nbTestCases - 1); + /* Swap */ + if (randomOrder) { + tmp = arrayTestCases[b]; + arrayTestCases[b] = arrayTestCases[a]; + arrayTestCases[a] = tmp; + } + } + /* Reset per-suite counters */ testFailedCount = 0; testPassedCount = 0; @@ -541,8 +623,8 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user currentSuiteName); /* Loop over all test cases */ - testCounter = 0; - while (testSuite->testCases[testCounter]) { + for (j = 0; j < nbTestCases; j++) { + testCounter = arrayTestCases[j]; testCase = testSuite->testCases[testCounter]; currentTestName = (testCase->name ? testCase->name : SDLTEST_INVALID_NAME_FORMAT); testCounter++; @@ -657,9 +739,13 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user SDLTest_LogError(SDLTEST_LOG_SUMMARY_FORMAT, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount); SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Suite", currentSuiteName, COLOR_RED "Failed" COLOR_END); } + + SDL_free(arrayTestCases); } } + SDL_free(arraySuites); + /* Take time - run end */ runEndSeconds = GetClock(); runtime = runEndSeconds - runStartSeconds; diff --git a/test/testautomation.c b/test/testautomation.c index a8de28bf911cf..42dfeef58dd5e 100644 --- a/test/testautomation.c +++ b/test/testautomation.c @@ -75,6 +75,7 @@ int main(int argc, char *argv[]) int i, done; SDL_Event event; int list = 0; + SDL_bool randomOrder = SDL_FALSE; /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO | SDL_INIT_AUDIO); @@ -118,10 +119,21 @@ int main(int argc, char *argv[]) } else if (SDL_strcasecmp(argv[i], "--list") == 0) { consumed = 1; list = 1; + } else if (SDL_strcasecmp(argv[i], "--random-order") == 0) { + consumed = 1; + randomOrder = SDL_TRUE; } + } if (consumed < 0) { - static const char *options[] = { "[--iterations #]", "[--execKey #]", "[--seed string]", "[--filter suite_name|test_name]", "[--list]", NULL }; + static const char *options[] = { + "[--iterations #]", + "[--execKey #]", + "[--seed string]", + "[--filter suite_name|test_name]", + "[--list]", + "[--random-order]", + NULL }; SDLTest_CommonLogUsage(state, argv[0], options); quit(1); } @@ -157,7 +169,7 @@ int main(int argc, char *argv[]) } /* Call Harness */ - result = SDLTest_RunSuites(testSuites, userRunSeed, userExecKey, filter, testIterations); + result = SDLTest_RunSuites(testSuites, userRunSeed, userExecKey, filter, testIterations, randomOrder); /* Empty event queue */ done = 0; From a57c566988e1611f83dd16ff1081cfcf17d600c1 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 7 Aug 2024 10:22:57 +0200 Subject: [PATCH 215/253] Add internal SDL_UpdateTextureFromSurface(), making SDL_CreateTextureFromSurface() lighter --- src/render/SDL_render.c | 158 ++++++++++++++++++++++++++-------------- 1 file changed, 105 insertions(+), 53 deletions(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 5886a286ec5c7..68682c274bf4e 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -1495,10 +1495,111 @@ SDL_Texture *SDL_CreateTexture(SDL_Renderer *renderer, SDL_PixelFormat format, S return texture; } +static int SDL_UpdateTextureFromSurface(SDL_Texture *texture, SDL_Rect *rect, SDL_Surface *surface) +{ + int access; + SDL_bool direct_update; + SDL_PixelFormat tex_format; + SDL_PropertiesID surface_props; + SDL_PropertiesID tex_props; + SDL_Colorspace surface_colorspace = SDL_COLORSPACE_UNKNOWN; + SDL_Colorspace texture_colorspace = SDL_COLORSPACE_UNKNOWN; + + if (texture == NULL || surface == NULL) { + return -1; + } + + tex_props = SDL_GetTextureProperties(texture); + if (!tex_props) { + return -1; + } + + surface_props = SDL_GetSurfaceProperties(surface); + if (!surface_props) { + return -1; + } + + tex_format = SDL_GetNumberProperty(tex_props, SDL_PROP_TEXTURE_FORMAT_NUMBER, 0); + access = SDL_GetNumberProperty(tex_props, SDL_PROP_TEXTURE_ACCESS_NUMBER, 0); + + if (access != SDL_TEXTUREACCESS_STATIC && access != SDL_TEXTUREACCESS_STREAMING) { + return -1; + } + + surface_colorspace = SDL_GetSurfaceColorspace(surface); + texture_colorspace = surface_colorspace; + + if (surface_colorspace == SDL_COLORSPACE_SRGB_LINEAR || + SDL_COLORSPACETRANSFER(surface_colorspace) == SDL_TRANSFER_CHARACTERISTICS_PQ) { + if (SDL_ISPIXELFORMAT_FLOAT(tex_format)) { + texture_colorspace = SDL_COLORSPACE_SRGB_LINEAR; + } else if (SDL_ISPIXELFORMAT_10BIT(tex_format)) { + texture_colorspace = SDL_COLORSPACE_HDR10; + } else { + texture_colorspace = SDL_COLORSPACE_SRGB; + } + } + + if (tex_format == surface->format && texture_colorspace == surface_colorspace) { + if (SDL_ISPIXELFORMAT_ALPHA(surface->format) && SDL_SurfaceHasColorKey(surface)) { + /* Surface and Renderer formats are identical. + * Intermediate conversion is needed to convert color key to alpha (SDL_ConvertColorkeyToAlpha()). */ + direct_update = SDL_FALSE; + } else { + /* Update Texture directly */ + direct_update = SDL_TRUE; + } + } else { + /* Surface and Renderer formats are different, it needs an intermediate conversion. */ + direct_update = SDL_FALSE; + } + + if (direct_update) { + if (SDL_MUSTLOCK(surface)) { + SDL_LockSurface(surface); + SDL_UpdateTexture(texture, rect, surface->pixels, surface->pitch); + SDL_UnlockSurface(surface); + } else { + SDL_UpdateTexture(texture, rect, surface->pixels, surface->pitch); + } + } else { + SDL_Surface *temp = NULL; + + /* Set up a destination surface for the texture update */ + temp = SDL_ConvertSurfaceAndColorspace(surface, tex_format, NULL, texture_colorspace, surface_props); + if (temp) { + SDL_UpdateTexture(texture, NULL, temp->pixels, temp->pitch); + SDL_DestroySurface(temp); + } else { + return -1; + } + } + + { + Uint8 r, g, b, a; + SDL_BlendMode blendMode; + + SDL_GetSurfaceColorMod(surface, &r, &g, &b); + SDL_SetTextureColorMod(texture, r, g, b); + + SDL_GetSurfaceAlphaMod(surface, &a); + SDL_SetTextureAlphaMod(texture, a); + + if (SDL_SurfaceHasColorKey(surface)) { + /* We converted to a texture with alpha format */ + SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND); + } else { + SDL_GetSurfaceBlendMode(surface, &blendMode); + SDL_SetTextureBlendMode(texture, blendMode); + } + } + + return 0; +} + SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface) { SDL_bool needAlpha; - SDL_bool direct_update; int i; SDL_PixelFormat format = SDL_PIXELFORMAT_UNKNOWN; SDL_Palette *palette; @@ -1605,20 +1706,6 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s } } - if (format == surface->format && texture_colorspace == surface_colorspace) { - if (SDL_ISPIXELFORMAT_ALPHA(surface->format) && SDL_SurfaceHasColorKey(surface)) { - /* Surface and Renderer formats are identical. - * Intermediate conversion is needed to convert color key to alpha (SDL_ConvertColorkeyToAlpha()). */ - direct_update = SDL_FALSE; - } else { - /* Update Texture directly */ - direct_update = SDL_TRUE; - } - } else { - /* Surface and Renderer formats are different, it needs an intermediate conversion. */ - direct_update = SDL_FALSE; - } - props = SDL_CreateProperties(); SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER, texture_colorspace); if (surface_colorspace == texture_colorspace) { @@ -1637,46 +1724,11 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s return NULL; } - if (direct_update) { - if (SDL_MUSTLOCK(surface)) { - SDL_LockSurface(surface); - SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch); - SDL_UnlockSurface(surface); - } else { - SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch); - } - } else { - SDL_Surface *temp = NULL; - - /* Set up a destination surface for the texture update */ - temp = SDL_ConvertSurfaceAndColorspace(surface, format, NULL, texture_colorspace, surface->internal->props); - if (temp) { - SDL_UpdateTexture(texture, NULL, temp->pixels, temp->pitch); - SDL_DestroySurface(temp); - } else { - SDL_DestroyTexture(texture); - return NULL; - } + if (SDL_UpdateTextureFromSurface(texture, NULL, surface) < 0) { + SDL_DestroyTexture(texture); + return NULL; } - { - Uint8 r, g, b, a; - SDL_BlendMode blendMode; - - SDL_GetSurfaceColorMod(surface, &r, &g, &b); - SDL_SetTextureColorMod(texture, r, g, b); - - SDL_GetSurfaceAlphaMod(surface, &a); - SDL_SetTextureAlphaMod(texture, a); - - if (SDL_SurfaceHasColorKey(surface)) { - /* We converted to a texture with alpha format */ - SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND); - } else { - SDL_GetSurfaceBlendMode(surface, &blendMode); - SDL_SetTextureBlendMode(texture, blendMode); - } - } return texture; } From 7b97fd3b4458bc7c43f14738eda98d77503851b2 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 7 Aug 2024 11:50:22 +0200 Subject: [PATCH 216/253] SDLDropTarget_Drop: use SDL_strlen instead of strlen --- src/video/windows/SDL_windowswindow.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 019fdd68c7561..0a234ccd9821b 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -1904,7 +1904,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, if (SDL_URIToLocal(token, token) >= 0) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, ". In Drop File, file (%lu of %lu) '%s'\n", - (unsigned long)strlen(token), (unsigned long)bsize, token); + (unsigned long)SDL_strlen(token), (unsigned long)bsize, token); SDL_SendDropFile(target->window, NULL, token); } token = SDL_strtok_r(NULL, "\r\n", &saveptr); @@ -1951,7 +1951,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, while (token != NULL) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, ". In Drop Text, text (%lu of %lu) '%s'\n", - (unsigned long)strlen(token), (unsigned long)bsize, token); + (unsigned long)SDL_strlen(token), (unsigned long)bsize, token); SDL_SendDropText(target->window, (char *)token); token = SDL_strtok_r(NULL, "\r\n", &saveptr); } @@ -1991,7 +1991,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, if (buffer) { buffer = WIN_StringToUTF8(buffer); if (buffer) { - const size_t lbuffer = strlen(buffer); + const size_t lbuffer = SDL_strlen(buffer); SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, ". In Drop Text for StringToUTF8, format %08x '%s', memory (%lu) %p\n", fetc.cfFormat, format_mime, (unsigned long)lbuffer, buffer); @@ -2003,7 +2003,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, while (token != NULL) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, ". In Drop Text, text (%lu of %lu) '%s'\n", - (unsigned long)strlen(token), (unsigned long)lbuffer, token); + (unsigned long)SDL_strlen(token), (unsigned long)lbuffer, token); SDL_SendDropText(target->window, (char *)token); token = SDL_strtok_r(NULL, "\r\n", &saveptr); } @@ -2051,7 +2051,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, while (token != NULL) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, ". In Drop Text, text (%lu of %lu) '%s'\n", - (unsigned long)strlen(token), (unsigned long)bsize, token); + (unsigned long)SDL_strlen(token), (unsigned long)bsize, token); SDL_SendDropText(target->window, (char *)token); token = SDL_strtok_r(NULL, "\r\n", &saveptr); } @@ -2097,7 +2097,7 @@ static STDMETHODIMP SDLDropTarget_Drop(SDLDropTarget *target, char *file = WIN_StringToUTF8(buffer); SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, ". In Drop File, file (%lu of %lu) '%s'\n", - (unsigned long)strlen(file), (unsigned long)bsize, file); + (unsigned long)SDL_strlen(file), (unsigned long)bsize, file); SDL_SendDropFile(target->window, NULL, file); SDL_free(file); } From 2428d906f15dc465a6cdb479836b70fd6e3b1e55 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 7 Aug 2024 19:14:09 +0200 Subject: [PATCH 217/253] Remove extra ';' --- src/test/SDL_test_harness.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c index f91d4903e1360..bbd794a35ecd1 100644 --- a/src/test/SDL_test_harness.c +++ b/src/test/SDL_test_harness.c @@ -565,7 +565,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user /* Loop over all suites */ for (i = 0; i < nbSuites; i++) { - suiteCounter = arraySuites[i];; + suiteCounter = arraySuites[i]; testSuite = testSuites[suiteCounter]; currentSuiteName = (testSuite->name ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT); suiteCounter++; From 66ddabde860282ba92792b2164ae7f2bb92e35e3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 26 Jan 2024 22:53:07 -0800 Subject: [PATCH 218/253] Added an automated test to check creation of minimized and maximized windows --- test/testautomation_video.c | 153 ++++++++++++++++++++++++++++++------ 1 file changed, 129 insertions(+), 24 deletions(-) diff --git a/test/testautomation_video.c b/test/testautomation_video.c index e40254689fd18..e1cb1293de3f5 100644 --- a/test/testautomation_video.c +++ b/test/testautomation_video.c @@ -2238,6 +2238,84 @@ static int video_getSetWindowState(void *arg) return skipFlags != (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED) ? TEST_COMPLETED : TEST_SKIPPED; } +static int video_createMinimized(void *arg) +{ + const char *title = "video_createMinimized Test Window"; + int result; + SDL_Window *window; + int windowedX, windowedY; + int windowedW, windowedH; + + /* Call against new test window */ + window = SDL_CreateWindow(title, 320, 200, SDL_WINDOW_MINIMIZED); + if (!window) { + return TEST_ABORTED; + } + + SDL_GetWindowSize(window, &windowedW, &windowedH); + SDLTest_AssertPass("SDL_GetWindowSize()"); + SDLTest_AssertCheck(windowedW > 0 && windowedH > 0, "Verify return value; expected: 320x200, got: %dx%d", windowedW, windowedH); + + SDL_GetWindowSizeInPixels(window, &windowedW, &windowedH); + SDLTest_AssertPass("SDL_GetWindowSizeInPixels()"); + SDLTest_AssertCheck(windowedW > 0 && windowedH > 0, "Verify return value; expected: > 0, got: %dx%d", windowedW, windowedH); + + SDL_GetWindowPosition(window, &windowedX, &windowedY); + SDLTest_AssertPass("SDL_GetWindowPosition()"); + SDLTest_AssertCheck(windowedX >= 0 && windowedY >= 0, "Verify return value; expected: >= 0, got: %d,%d", windowedX, windowedY); + + if (SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED) { + result = SDL_RestoreWindow(window); + SDLTest_AssertPass("SDL_RestoreWindow()"); + SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); + } else { + SDLTest_Log("Requested minimized window on creation, but that isn't supported on this platform."); + } + + SDL_DestroyWindow(window); + + return TEST_COMPLETED; +} + +static int video_createMaximized(void *arg) +{ + const char *title = "video_createMaximized Test Window"; + int result; + SDL_Window *window; + int windowedX, windowedY; + int windowedW, windowedH; + + /* Call against new test window */ + window = SDL_CreateWindow(title, 320, 200, SDL_WINDOW_MAXIMIZED); + if (!window) { + return TEST_ABORTED; + } + + SDL_GetWindowSize(window, &windowedW, &windowedH); + SDLTest_AssertPass("SDL_GetWindowSize()"); + SDLTest_AssertCheck(windowedW > 0 && windowedH > 0, "Verify return value; expected: 320x200, got: %dx%d", windowedW, windowedH); + + SDL_GetWindowSizeInPixels(window, &windowedW, &windowedH); + SDLTest_AssertPass("SDL_GetWindowSizeInPixels()"); + SDLTest_AssertCheck(windowedW > 0 && windowedH > 0, "Verify return value; expected: > 0, got: %dx%d", windowedW, windowedH); + + SDL_GetWindowPosition(window, &windowedX, &windowedY); + SDLTest_AssertPass("SDL_GetWindowPosition()"); + SDLTest_AssertCheck(windowedX >= 0 && windowedY >= 0, "Verify return value; expected: >= 0, got: %d,%d", windowedX, windowedY); + + if (SDL_GetWindowFlags(window) & SDL_WINDOW_MAXIMIZED) { + result = SDL_RestoreWindow(window); + SDLTest_AssertPass("SDL_RestoreWindow()"); + SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); + } else { + SDLTest_Log("Requested maximized window on creation, but that isn't supported on this platform."); + } + + SDL_DestroyWindow(window); + + return TEST_COMPLETED; +} + /** * Tests window surface functionality */ @@ -2311,92 +2389,119 @@ static int video_getWindowSurface(void *arg) /* ================= Test References ================== */ /* Video test cases */ -static const SDLTest_TestCaseReference videoTest1 = { +static const SDLTest_TestCaseReference videoTestEnableDisableScreensaver = { (SDLTest_TestCaseFp)video_enableDisableScreensaver, "video_enableDisableScreensaver", "Enable and disable screenaver while checking state", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest2 = { +static const SDLTest_TestCaseReference videoTestCreateWindowVariousSizes = { (SDLTest_TestCaseFp)video_createWindowVariousSizes, "video_createWindowVariousSizes", "Create windows with various sizes", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest3 = { +static const SDLTest_TestCaseReference videoTestCreateWindowVariousFlags = { (SDLTest_TestCaseFp)video_createWindowVariousFlags, "video_createWindowVariousFlags", "Create windows using various flags", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest4 = { +static const SDLTest_TestCaseReference videoTestGetWindowFlags = { (SDLTest_TestCaseFp)video_getWindowFlags, "video_getWindowFlags", "Get window flags set during SDL_CreateWindow", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest5 = { +static const SDLTest_TestCaseReference videoTestGetFullscreenDisplayModes = { (SDLTest_TestCaseFp)video_getFullscreenDisplayModes, "video_getFullscreenDisplayModes", "Use SDL_GetFullscreenDisplayModes function to get number of display modes", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest6 = { +static const SDLTest_TestCaseReference videoTestGetClosestDisplayModeCurrentResolution = { (SDLTest_TestCaseFp)video_getClosestDisplayModeCurrentResolution, "video_getClosestDisplayModeCurrentResolution", "Use function to get closes match to requested display mode for current resolution", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest7 = { +static const SDLTest_TestCaseReference videoTestGetClosestDisplayModeRandomResolution = { (SDLTest_TestCaseFp)video_getClosestDisplayModeRandomResolution, "video_getClosestDisplayModeRandomResolution", "Use function to get closes match to requested display mode for random resolution", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest8 = { +static const SDLTest_TestCaseReference videoTestGetWindowDisplayMode = { (SDLTest_TestCaseFp)video_getWindowDisplayMode, "video_getWindowDisplayMode", "Get window display mode", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest9 = { +static const SDLTest_TestCaseReference videoTestGetWindowDisplayModeNegative = { (SDLTest_TestCaseFp)video_getWindowDisplayModeNegative, "video_getWindowDisplayModeNegative", "Get window display mode with invalid input", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest10 = { +static const SDLTest_TestCaseReference videoTestGetSetWindowGrab = { (SDLTest_TestCaseFp)video_getSetWindowGrab, "video_getSetWindowGrab", "Checks input grab positive and negative cases", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest11 = { +static const SDLTest_TestCaseReference videoTestGetWindowID = { (SDLTest_TestCaseFp)video_getWindowId, "video_getWindowId", "Checks SDL_GetWindowID and SDL_GetWindowFromID", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest12 = { +static const SDLTest_TestCaseReference videoTestGetWindowPixelFormat = { (SDLTest_TestCaseFp)video_getWindowPixelFormat, "video_getWindowPixelFormat", "Checks SDL_GetWindowPixelFormat", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest13 = { +static const SDLTest_TestCaseReference videoTestGetSetWindowPosition = { (SDLTest_TestCaseFp)video_getSetWindowPosition, "video_getSetWindowPosition", "Checks SDL_GetWindowPosition and SDL_SetWindowPosition positive and negative cases", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest14 = { +static const SDLTest_TestCaseReference videoTestGetSetWindowSize = { (SDLTest_TestCaseFp)video_getSetWindowSize, "video_getSetWindowSize", "Checks SDL_GetWindowSize and SDL_SetWindowSize positive and negative cases", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest15 = { +static const SDLTest_TestCaseReference videoTestGetSetWindowMinimumSize = { (SDLTest_TestCaseFp)video_getSetWindowMinimumSize, "video_getSetWindowMinimumSize", "Checks SDL_GetWindowMinimumSize and SDL_SetWindowMinimumSize positive and negative cases", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest16 = { +static const SDLTest_TestCaseReference videoTestGetSetWindowMaximumSize = { (SDLTest_TestCaseFp)video_getSetWindowMaximumSize, "video_getSetWindowMaximumSize", "Checks SDL_GetWindowMaximumSize and SDL_SetWindowMaximumSize positive and negative cases", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest17 = { +static const SDLTest_TestCaseReference videoTestGetSetWindowData = { (SDLTest_TestCaseFp)video_getSetWindowData, "video_getSetWindowData", "Checks SDL_SetWindowData and SDL_GetWindowData positive and negative cases", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest18 = { +static const SDLTest_TestCaseReference videoTestSetWindowCenteredOnDisplay = { (SDLTest_TestCaseFp)video_setWindowCenteredOnDisplay, "video_setWindowCenteredOnDisplay", "Checks using SDL_WINDOWPOS_CENTERED_DISPLAY centers the window on a display", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest19 = { +static const SDLTest_TestCaseReference videoTestGetSetWindowState = { (SDLTest_TestCaseFp)video_getSetWindowState, "video_getSetWindowState", "Checks transitioning between windowed, minimized, maximized, and fullscreen states", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest20 = { +static const SDLTest_TestCaseReference videoTestCreateMinimized = { + (SDLTest_TestCaseFp)video_createMinimized, "video_createMinimized", "Checks window state for windows created minimized", TEST_ENABLED +}; + +static const SDLTest_TestCaseReference videoTestCreateMaximized = { + (SDLTest_TestCaseFp)video_createMaximized, "video_createMaximized", "Checks window state for windows created maximized", TEST_ENABLED +}; + +static const SDLTest_TestCaseReference videoTestGetWindowSurface = { (SDLTest_TestCaseFp)video_getWindowSurface, "video_getWindowSurface", "Checks window surface functionality", TEST_ENABLED }; /* Sequence of Video test cases */ static const SDLTest_TestCaseReference *videoTests[] = { - &videoTest1, &videoTest2, &videoTest3, &videoTest4, &videoTest5, &videoTest6, - &videoTest7, &videoTest8, &videoTest9, &videoTest10, &videoTest11, &videoTest12, - &videoTest13, &videoTest14, &videoTest15, &videoTest16, &videoTest17, - &videoTest18, &videoTest19, &videoTest20, NULL + &videoTestEnableDisableScreensaver, + &videoTestCreateWindowVariousSizes, + &videoTestCreateWindowVariousFlags, + &videoTestGetWindowFlags, + &videoTestGetFullscreenDisplayModes, + &videoTestGetClosestDisplayModeCurrentResolution, + &videoTestGetClosestDisplayModeRandomResolution, + &videoTestGetWindowDisplayMode, + &videoTestGetWindowDisplayModeNegative, + &videoTestGetSetWindowGrab, + &videoTestGetWindowID, + &videoTestGetWindowPixelFormat, + &videoTestGetSetWindowPosition, + &videoTestGetSetWindowSize, + &videoTestGetSetWindowMinimumSize, + &videoTestGetSetWindowMaximumSize, + &videoTestGetSetWindowData, + &videoTestSetWindowCenteredOnDisplay, + &videoTestGetSetWindowState, + &videoTestCreateMinimized, + &videoTestCreateMaximized, + &videoTestGetWindowSurface, + NULL }; /* Video test suite (global) */ From 8fdca9c691c90d4ce4379db33ce835bcbe51439e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 10:53:23 -0700 Subject: [PATCH 219/253] Clear intermediate errors if we successfully create a window. --- src/video/SDL_video.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 590606eb1e119..a8421a2730397 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2464,6 +2464,8 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props) /* Make sure window pixel size is up to date */ SDL_CheckWindowPixelSizeChanged(window); + SDL_ClearError(); + return window; } From 001dbc5da8a6cbce92b8722d91c2a9400ae7297f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 06:48:36 -0700 Subject: [PATCH 220/253] Added support for raw mouse and keyboard using GameInput on Windows Fixes https://github.com/libsdl-org/SDL/issues/10442 --- VisualC-GDK/SDL/SDL.vcxproj | 2 + VisualC-GDK/SDL/SDL.vcxproj.filters | 2 + VisualC/SDL/SDL.vcxproj | 2 + VisualC/SDL/SDL.vcxproj.filters | 6 + include/SDL3/SDL_hints.h | 14 + src/video/windows/SDL_windowsevents.c | 8 +- src/video/windows/SDL_windowsgameinput.c | 625 +++++++++++++++++++++++ src/video/windows/SDL_windowsgameinput.h | 29 ++ src/video/windows/SDL_windowsrawinput.c | 26 +- src/video/windows/SDL_windowsvideo.c | 24 +- src/video/windows/SDL_windowsvideo.h | 3 + 11 files changed, 729 insertions(+), 12 deletions(-) create mode 100644 src/video/windows/SDL_windowsgameinput.c create mode 100644 src/video/windows/SDL_windowsgameinput.h diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj index 77fc0785a83a7..8d038f6d3153c 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj +++ b/VisualC-GDK/SDL/SDL.vcxproj @@ -573,6 +573,7 @@ + @@ -850,6 +851,7 @@ + diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters index f3cd8ca92b09f..fbd091f59066e 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj.filters +++ b/VisualC-GDK/SDL/SDL.vcxproj.filters @@ -217,6 +217,7 @@ + @@ -447,6 +448,7 @@ + diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index 4cb8de774c47f..f8111cf344d9d 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -479,6 +479,7 @@ + @@ -708,6 +709,7 @@ + diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters index d58f179c076ba..57b5a527a7050 100644 --- a/VisualC/SDL/SDL.vcxproj.filters +++ b/VisualC/SDL/SDL.vcxproj.filters @@ -684,6 +684,9 @@ video\windows + + video\windows + video\windows @@ -1340,6 +1343,9 @@ video\windows + + video\windows + video\windows diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 7f4391c4ccc9f..d8bbfb47283a1 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3823,6 +3823,20 @@ extern "C" { */ #define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP "SDL_WINDOWS_ENABLE_MESSAGELOOP" +/** + * A variable controlling whether GameInput is used for raw keyboard and mouse on Windows. + * + * The variable can be set to the following values: + * + * - "0": GameInput is not used for raw keyboard and mouse events. + * - "1": GameInput is used for raw keyboard and mouse events, if available. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_WINDOWS_GAMEINPUT "SDL_WINDOWS_GAMEINPUT" + /** * A variable controlling whether raw keyboard events are used on Windows. * diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index c5d36039726af..367f8f027399d 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -2233,6 +2233,10 @@ void WIN_PumpEvents(SDL_VideoDevice *_this) SDL_Window *focusWindow; #endif + if (_this->internal->gameinput_context) { + WIN_UpdateGameInput(_this); + } + if (g_WindowsEnableMessageLoop) { SDL_processing_messages = SDL_TRUE; @@ -2310,7 +2314,9 @@ void WIN_PumpEvents(SDL_VideoDevice *_this) /* Update mouse capture */ WIN_UpdateMouseCapture(); - WIN_CheckKeyboardAndMouseHotplug(_this, SDL_FALSE); + if (!_this->internal->gameinput_context) { + WIN_CheckKeyboardAndMouseHotplug(_this, SDL_FALSE); + } WIN_UpdateIMECandidates(_this); diff --git a/src/video/windows/SDL_windowsgameinput.c b/src/video/windows/SDL_windowsgameinput.c new file mode 100644 index 0000000000000..d92eb27cdd7ed --- /dev/null +++ b/src/video/windows/SDL_windowsgameinput.c @@ -0,0 +1,625 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_internal.h" + +#include "SDL_windowsvideo.h" + +#if defined(__has_include) && __has_include() +#define HAVE_GAMEINPUT_H +#endif + +#ifdef HAVE_GAMEINPUT_H + +#include +#define COBJMACROS +#include + +#include "../../events/SDL_mouse_c.h" +#include "../../events/SDL_keyboard_c.h" +#include "../../events/scancodes_windows.h" + + +#define MAX_GAMEINPUT_BUTTONS 7 // GameInputMouseWheelTiltRight is the highest button + +static const Uint8 GAMEINPUT_button_map[MAX_GAMEINPUT_BUTTONS] = { + SDL_BUTTON_LEFT, + SDL_BUTTON_RIGHT, + SDL_BUTTON_MIDDLE, + SDL_BUTTON_X1, + SDL_BUTTON_X2, + 6, + 7 +}; + +typedef struct GAMEINPUT_Device +{ + IGameInputDevice *pDevice; + const GameInputDeviceInfo *info; + char *name; + Uint32 instance_id; /* generated by SDL */ + SDL_bool registered; + SDL_bool delete_requested; + IGameInputReading *last_mouse_reading; + IGameInputReading *last_keyboard_reading; +} GAMEINPUT_Device; + +struct WIN_GameInputData +{ + void *hGameInputDLL; + IGameInput *pGameInput; + GameInputCallbackToken gameinput_callback_token; + int num_devices; + GAMEINPUT_Device **devices; + GameInputKind enabled_input; + SDL_Mutex *lock; + uint64_t timestamp_offset; +}; + +static int GAMEINPUT_InternalAddOrFind(WIN_GameInputData *data, IGameInputDevice *pDevice) +{ + GAMEINPUT_Device **devicelist = NULL; + GAMEINPUT_Device *device = NULL; + const GameInputDeviceInfo *info; + int retval = -1; + + info = IGameInputDevice_GetDeviceInfo(pDevice); + + SDL_LockMutex(data->lock); + { + for (int i = 0; i < data->num_devices; ++i) { + device = data->devices[i]; + if (device && device->pDevice == pDevice) { + /* we're already added */ + device->delete_requested = SDL_FALSE; + retval = 0; + goto done; + } + } + + device = (GAMEINPUT_Device *)SDL_calloc(1, sizeof(*device)); + if (!device) { + goto done; + } + + devicelist = (GAMEINPUT_Device **)SDL_realloc(data->devices, (data->num_devices + 1) * sizeof(*devicelist)); + if (!devicelist) { + SDL_free(device); + goto done; + } + + if (info->deviceStrings) { + /* In theory we could get the manufacturer and product strings here, but they're NULL for all the devices I've tested */ + } + + if (info->displayName) { + /* This could give us a product string, but it's NULL for all the devices I've tested */ + } + + IGameInputDevice_AddRef(pDevice); + device->pDevice = pDevice; + device->instance_id = SDL_GetNextObjectID(); + device->info = info; + + data->devices = devicelist; + data->devices[data->num_devices++] = device; + + retval = 0; + } +done: + SDL_UnlockMutex(data->lock); + + return retval; +} + +static int GAMEINPUT_InternalRemoveByIndex(WIN_GameInputData *data, int idx) +{ + GAMEINPUT_Device **devicelist = NULL; + GAMEINPUT_Device *device; + int retval = -1; + + SDL_LockMutex(data->lock); + { + if (idx < 0 || idx >= data->num_devices) { + retval = SDL_SetError("GAMEINPUT_InternalRemoveByIndex argument idx %d is out of range", idx); + goto done; + } + + device = data->devices[idx]; + if (device) { + if (device->registered) { + if (device->info->supportedInput & GameInputKindMouse) { + SDL_RemoveMouse(device->instance_id, SDL_TRUE); + } + if (device->info->supportedInput & GameInputKindKeyboard) { + SDL_RemoveKeyboard(device->instance_id, SDL_TRUE); + } + if (device->last_mouse_reading) { + IGameInputReading_Release(device->last_mouse_reading); + device->last_mouse_reading = NULL; + } + if (device->last_keyboard_reading) { + IGameInputReading_Release(device->last_keyboard_reading); + device->last_keyboard_reading = NULL; + } + } + IGameInputDevice_Release(device->pDevice); + SDL_free(device->name); + SDL_free(device); + } + data->devices[idx] = NULL; + + if (data->num_devices == 1) { + /* last element in the list, free the entire list then */ + SDL_free(data->devices); + data->devices = NULL; + } else { + if (idx != data->num_devices - 1) { + size_t bytes = sizeof(*devicelist) * (data->num_devices - idx); + SDL_memmove(&data->devices[idx], &data->devices[idx + 1], bytes); + } + } + + /* decrement the count and return */ + retval = data->num_devices--; + } +done: + SDL_UnlockMutex(data->lock); + + return retval; +} + +static void CALLBACK GAMEINPUT_InternalDeviceCallback( + _In_ GameInputCallbackToken callbackToken, + _In_ void* context, + _In_ IGameInputDevice *pDevice, + _In_ uint64_t timestamp, + _In_ GameInputDeviceStatus currentStatus, + _In_ GameInputDeviceStatus previousStatus) +{ + WIN_GameInputData *data = (WIN_GameInputData *)context; + int idx = 0; + GAMEINPUT_Device *device = NULL; + + if (!pDevice) { + /* This should never happen, but ignore it if it does */ + return; + } + + if (currentStatus & GameInputDeviceConnected) { + GAMEINPUT_InternalAddOrFind(data, pDevice); + } else { + for (idx = 0; idx < data->num_devices; ++idx) { + device = data->devices[idx]; + if (device && device->pDevice == pDevice) { + /* will be deleted on the next Detect call */ + device->delete_requested = SDL_TRUE; + break; + } + } + } +} + +int WIN_InitGameInput(SDL_VideoDevice *_this) +{ + WIN_GameInputData *data; + HRESULT hr; + int retval = -1; + + if (_this->internal->gameinput_context) { + return 0; + } + + data = (WIN_GameInputData *)SDL_calloc(1, sizeof(*data)); + if (!data) { + goto done; + } + _this->internal->gameinput_context = data; + + data->lock = SDL_CreateMutex(); + if (!data->lock) { + goto done; + } + + data->hGameInputDLL = SDL_LoadObject("gameinput.dll"); + if (!data->hGameInputDLL) { + goto done; + } + + typedef HRESULT (WINAPI *GameInputCreate_t)(IGameInput * *gameInput); + GameInputCreate_t GameInputCreateFunc = (GameInputCreate_t)SDL_LoadFunction(data->hGameInputDLL, "GameInputCreate"); + if (!GameInputCreateFunc) { + goto done; + } + + hr = GameInputCreateFunc(&data->pGameInput); + if (FAILED(hr)) { + SDL_SetError("GameInputCreate failure with HRESULT of %08X", hr); + goto done; + } + + hr = IGameInput_RegisterDeviceCallback(data->pGameInput, + NULL, + (GameInputKindMouse | GameInputKindKeyboard), + GameInputDeviceConnected, + GameInputBlockingEnumeration, + data, + GAMEINPUT_InternalDeviceCallback, + &data->gameinput_callback_token); + if (FAILED(hr)) { + SDL_SetError("IGameInput::RegisterDeviceCallback failure with HRESULT of %08X", hr); + goto done; + } + + // Calculate the relative offset between SDL timestamps and GameInput timestamps + Uint64 now = SDL_GetTicksNS(); + uint64_t timestampUS = IGameInput_GetCurrentTimestamp(data->pGameInput); + data->timestamp_offset = (SDL_NS_TO_US(now) - timestampUS); + + retval = 0; + +done: + if (retval < 0) { + WIN_QuitGameInput(_this); + } + return retval; +} + +static void GAMEINPUT_InitialMouseReading(WIN_GameInputData *data, SDL_Window *window, GAMEINPUT_Device *device, IGameInputReading *reading) +{ + GameInputMouseState state; + if (SUCCEEDED(IGameInputReading_GetMouseState(reading, &state))) { + Uint64 timestamp = SDL_US_TO_NS(IGameInputReading_GetTimestamp(reading) + data->timestamp_offset); + SDL_MouseID mouseID = device->instance_id; + + for (int i = 0; i < MAX_GAMEINPUT_BUTTONS; ++i) { + const GameInputMouseButtons mask = (1 << i); + SDL_SendMouseButton(timestamp, window, mouseID, (state.buttons & mask) ? SDL_PRESSED : SDL_RELEASED, GAMEINPUT_button_map[i]); + } + } +} + +static void GAMEINPUT_HandleMouseDelta(WIN_GameInputData *data, SDL_Window *window, GAMEINPUT_Device *device, IGameInputReading *last_reading, IGameInputReading *reading) +{ + GameInputMouseState last; + GameInputMouseState state; + if (SUCCEEDED(IGameInputReading_GetMouseState(last_reading, &last)) && + SUCCEEDED(IGameInputReading_GetMouseState(reading, &state))) { + Uint64 timestamp = SDL_US_TO_NS(IGameInputReading_GetTimestamp(reading) + data->timestamp_offset); + SDL_MouseID mouseID = device->instance_id; + + GameInputMouseState delta; + delta.buttons = (state.buttons ^ last.buttons); + delta.positionX = (state.positionX - last.positionX); + delta.positionY = (state.positionY - last.positionY); + delta.wheelX = (state.wheelX - last.wheelX); + delta.wheelY = (state.wheelY - last.wheelY); + + if (delta.positionX || delta.positionY) { + SDL_SendMouseMotion(timestamp, window, mouseID, SDL_TRUE, (float)delta.positionX, (float)delta.positionY); + } + if (delta.buttons) { + for (int i = 0; i < MAX_GAMEINPUT_BUTTONS; ++i) { + const GameInputMouseButtons mask = (1 << i); + if (delta.buttons & mask) { + SDL_SendMouseButton(timestamp, window, mouseID, (state.buttons & mask) ? SDL_PRESSED : SDL_RELEASED, GAMEINPUT_button_map[i]); + } + } + } + if (delta.wheelX || delta.wheelY) { + float fAmountX = (float)delta.wheelX / WHEEL_DELTA; + float fAmountY = (float)delta.wheelY / WHEEL_DELTA; + SDL_SendMouseWheel(timestamp, SDL_GetMouseFocus(), device->instance_id, fAmountX, fAmountY, SDL_MOUSEWHEEL_NORMAL); + } + } +} + +static SDL_Scancode GetScancodeFromKeyState(const GameInputKeyState *state) +{ + Uint8 index = (Uint8)(state->scanCode & 0xFF); + if ((state->scanCode & 0xFF00) == 0xE000) { + index |= 0x80; + } + return windows_scancode_table[index]; +} + +static SDL_bool KeysHaveScancode(const GameInputKeyState *keys, uint32_t count, SDL_Scancode scancode) +{ + for (uint32_t i = 0; i < count; ++i) { + if (GetScancodeFromKeyState(&keys[i]) == scancode) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static void GAMEINPUT_InitialKeyboardReading(WIN_GameInputData *data, SDL_Window *window, GAMEINPUT_Device *device, IGameInputReading *reading) +{ + Uint64 timestamp = SDL_US_TO_NS(IGameInputReading_GetTimestamp(reading) + data->timestamp_offset); + SDL_KeyboardID keyboardID = device->instance_id; + + uint32_t max_keys = device->info->keyboardInfo->maxSimultaneousKeys; + GameInputKeyState *keys = SDL_stack_alloc(GameInputKeyState, max_keys); + if (!keys) { + return; + } + + uint32_t num_keys = IGameInputReading_GetKeyState(reading, max_keys, keys); + if (!num_keys) { + // FIXME: We probably need to track key state by keyboardID + SDL_ResetKeyboard(); + return; + } + + // Go through and send key up events for any key that's not held down + int num_scancodes; + const Uint8 *keyboard_state = SDL_GetKeyboardState(&num_scancodes); + for (int i = 0; i < num_scancodes; ++i) { + if (keyboard_state[i] && !KeysHaveScancode(keys, num_keys, (SDL_Scancode)i)) { + SDL_SendKeyboardKey(timestamp, keyboardID, keys[i].scanCode, (SDL_Scancode)i, SDL_RELEASED); + } + } + + // Go through and send key down events for any key that's held down + for (uint32_t i = 0; i < num_keys; ++i) { + SDL_SendKeyboardKey(timestamp, keyboardID, keys[i].scanCode, GetScancodeFromKeyState(&keys[i]), SDL_PRESSED); + } +} + +#ifdef DEBUG_KEYS +static void DumpKeys(const char *prefix, GameInputKeyState *keys, uint32_t count) +{ + SDL_Log("%s", prefix); + for (uint32_t i = 0; i < count; ++i) { + char str[5]; + *SDL_UCS4ToUTF8(keys[i].codePoint, str) = '\0'; + SDL_Log(" Key 0x%.2x (%s)\n", keys[i].scanCode, str); + } +} +#endif // DEBUG_KEYS + +static void GAMEINPUT_HandleKeyboardDelta(WIN_GameInputData *data, SDL_Window *window, GAMEINPUT_Device *device, IGameInputReading *last_reading, IGameInputReading *reading) +{ + Uint64 timestamp = SDL_US_TO_NS(IGameInputReading_GetTimestamp(reading) + data->timestamp_offset); + SDL_KeyboardID keyboardID = device->instance_id; + + uint32_t max_keys = device->info->keyboardInfo->maxSimultaneousKeys; + GameInputKeyState *last = SDL_stack_alloc(GameInputKeyState, max_keys); + GameInputKeyState *keys = SDL_stack_alloc(GameInputKeyState, max_keys); + if (!last || !keys) { + return; + } + + uint32_t index_last = 0; + uint32_t index_keys = 0; + uint32_t num_last = IGameInputReading_GetKeyState(last_reading, max_keys, last); + uint32_t num_keys = IGameInputReading_GetKeyState(reading, max_keys, keys); +#ifdef DEBUG_KEYS + SDL_Log("Timestamp: %llu\n", timestamp); + DumpKeys("Last keys:", last, num_last); + DumpKeys("New keys:", keys, num_keys); +#endif + while (index_last < num_last || index_keys < num_keys) { + if (index_last < num_last && index_keys < num_keys) { + if (last[index_last].scanCode == keys[index_keys].scanCode) { + // No change + ++index_last; + ++index_keys; + } else { + // This key was released + SDL_SendKeyboardKey(timestamp, keyboardID, last[index_last].scanCode, GetScancodeFromKeyState(&last[index_last]), SDL_RELEASED); + ++index_last; + } + } else if (index_last < num_last) { + // This key was released + SDL_SendKeyboardKey(timestamp, keyboardID, last[index_last].scanCode, GetScancodeFromKeyState(&last[index_last]), SDL_RELEASED); + ++index_last; + } else { + // This key was pressed + SDL_SendKeyboardKey(timestamp, keyboardID, keys[index_keys].scanCode, GetScancodeFromKeyState(&keys[index_keys]), SDL_PRESSED); + ++index_keys; + } + } +} + +void WIN_UpdateGameInput(SDL_VideoDevice *_this) +{ + WIN_GameInputData *data = _this->internal->gameinput_context; + + SDL_LockMutex(data->lock); + { + // Key events and relative mouse motion both go to the window with keyboard focus + SDL_Window *window = SDL_GetKeyboardFocus(); + + for (int i = 0; i < data->num_devices; ++i) { + GAMEINPUT_Device *device = data->devices[i]; + IGameInputReading *reading; + + if (!device->registered) { + if (device->info->supportedInput & GameInputKindMouse) { + SDL_AddMouse(device->instance_id, device->name, SDL_TRUE); + } + if (device->info->supportedInput & GameInputKindKeyboard) { + SDL_AddKeyboard(device->instance_id, device->name, SDL_TRUE); + } + device->registered = SDL_TRUE; + } + + if (device->delete_requested) { + GAMEINPUT_InternalRemoveByIndex(data, i--); + continue; + } + + if (!(device->info->supportedInput & data->enabled_input)) { + continue; + } + + if (!window) { + continue; + } + + if (data->enabled_input & GameInputKindMouse) { + if (device->last_mouse_reading) { + HRESULT hr; + while (SUCCEEDED(hr = IGameInput_GetNextReading(data->pGameInput, device->last_mouse_reading, GameInputKindMouse, device->pDevice, &reading))) { + GAMEINPUT_HandleMouseDelta(data, window, device, device->last_mouse_reading, reading); + IGameInputReading_Release(device->last_mouse_reading); + device->last_mouse_reading = reading; + } + if (hr != GAMEINPUT_E_READING_NOT_FOUND) { + // The last reading is too old, resynchronize + IGameInputReading_Release(device->last_mouse_reading); + device->last_mouse_reading = NULL; + } + } + if (!device->last_mouse_reading) { + if (SUCCEEDED(IGameInput_GetCurrentReading(data->pGameInput, GameInputKindMouse, device->pDevice, &reading))) { + GAMEINPUT_InitialMouseReading(data, window, device, reading); + device->last_mouse_reading = reading; + } + } + } + + if (data->enabled_input & GameInputKindKeyboard) { + if (window->text_input_active) { + // Reset raw input while text input is active + if (device->last_keyboard_reading) { + IGameInputReading_Release(device->last_keyboard_reading); + device->last_keyboard_reading = NULL; + } + } else { + if (device->last_keyboard_reading) { + HRESULT hr; + while (SUCCEEDED(hr = IGameInput_GetNextReading(data->pGameInput, device->last_keyboard_reading, GameInputKindKeyboard, device->pDevice, &reading))) { + GAMEINPUT_HandleKeyboardDelta(data, window, device, device->last_keyboard_reading, reading); + IGameInputReading_Release(device->last_keyboard_reading); + device->last_keyboard_reading = reading; + } + if (hr != GAMEINPUT_E_READING_NOT_FOUND) { + // The last reading is too old, resynchronize + IGameInputReading_Release(device->last_keyboard_reading); + device->last_keyboard_reading = NULL; + } + } + if (!device->last_keyboard_reading) { + if (SUCCEEDED(IGameInput_GetCurrentReading(data->pGameInput, GameInputKindKeyboard, device->pDevice, &reading))) { + GAMEINPUT_InitialKeyboardReading(data, window, device, reading); + device->last_keyboard_reading = reading; + } + } + } + } + } + } + SDL_UnlockMutex(data->lock); +} + +int WIN_UpdateGameInputEnabled(SDL_VideoDevice *_this) +{ + WIN_GameInputData *data = _this->internal->gameinput_context; + SDL_bool raw_mouse_enabled = _this->internal->raw_mouse_enabled; + SDL_bool raw_keyboard_enabled = _this->internal->raw_keyboard_enabled; + + SDL_LockMutex(data->lock); + { + data->enabled_input = (raw_mouse_enabled ? GameInputKindMouse : 0) | + (raw_keyboard_enabled ? GameInputKindKeyboard : 0); + + // Reset input if not enabled + for (int i = 0; i < data->num_devices; ++i) { + GAMEINPUT_Device *device = data->devices[i]; + + if (device->last_mouse_reading && !raw_mouse_enabled) { + IGameInputReading_Release(device->last_mouse_reading); + device->last_mouse_reading = NULL; + } + + if (device->last_keyboard_reading && !raw_keyboard_enabled) { + IGameInputReading_Release(device->last_keyboard_reading); + device->last_keyboard_reading = NULL; + } + } + } + SDL_UnlockMutex(data->lock); + + return 0; +} + +void WIN_QuitGameInput(SDL_VideoDevice *_this) +{ + WIN_GameInputData *data = _this->internal->gameinput_context; + + if (!data) { + return; + } + + if (data->pGameInput) { + /* free the callback */ + if (data->gameinput_callback_token != GAMEINPUT_INVALID_CALLBACK_TOKEN_VALUE) { + IGameInput_UnregisterCallback(data->pGameInput, data->gameinput_callback_token, /*timeoutInUs:*/ 10000); + data->gameinput_callback_token = GAMEINPUT_INVALID_CALLBACK_TOKEN_VALUE; + } + + /* free the list */ + while (data->num_devices > 0) { + GAMEINPUT_InternalRemoveByIndex(data, 0); + } + + IGameInput_Release(data->pGameInput); + data->pGameInput = NULL; + } + + if (data->hGameInputDLL) { + SDL_UnloadObject(data->hGameInputDLL); + data->hGameInputDLL = NULL; + } + + if (data->lock) { + SDL_DestroyMutex(data->lock); + data->lock = NULL; + } + + SDL_free(data); + _this->internal->gameinput_context = NULL; +} + +#else /* !HAVE_GAMEINPUT_H */ + +int WIN_InitGameInput(SDL_VideoDevice* _this) +{ + return SDL_Unsupported(); +} + +int WIN_UpdateGameInputEnabled(SDL_VideoDevice *_this) +{ + return SDL_Unsupported(); +} + +void WIN_UpdateGameInput(SDL_VideoDevice* _this) +{ + return; +} + +void WIN_QuitGameInput(SDL_VideoDevice* _this) +{ + return; +} + +#endif /* HAVE_GAMEINPUT_H */ diff --git a/src/video/windows/SDL_windowsgameinput.h b/src/video/windows/SDL_windowsgameinput.h new file mode 100644 index 0000000000000..58ef19a367e4c --- /dev/null +++ b/src/video/windows/SDL_windowsgameinput.h @@ -0,0 +1,29 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_internal.h" + +typedef struct WIN_GameInputData WIN_GameInputData; + +extern int WIN_InitGameInput(SDL_VideoDevice *_this); +extern int WIN_UpdateGameInputEnabled(SDL_VideoDevice *_this); +extern void WIN_UpdateGameInput(SDL_VideoDevice *_this); +extern void WIN_QuitGameInput(SDL_VideoDevice *_this); + diff --git a/src/video/windows/SDL_windowsrawinput.c b/src/video/windows/SDL_windowsrawinput.c index b9ed5419c3f75..68fee93e32f65 100644 --- a/src/video/windows/SDL_windowsrawinput.c +++ b/src/video/windows/SDL_windowsrawinput.c @@ -203,14 +203,36 @@ int WIN_SetRawMouseEnabled(SDL_VideoDevice *_this, SDL_bool enabled) { SDL_VideoData *data = _this->internal; data->raw_mouse_enabled = enabled; - return WIN_UpdateRawInputEnabled(_this); + if (data->gameinput_context) { + if (WIN_UpdateGameInputEnabled(_this) < 0) { + data->raw_mouse_enabled = !enabled; + return -1; + } + } else { + if (WIN_UpdateRawInputEnabled(_this) < 0) { + data->raw_mouse_enabled = !enabled; + return -1; + } + } + return 0; } int WIN_SetRawKeyboardEnabled(SDL_VideoDevice *_this, SDL_bool enabled) { SDL_VideoData *data = _this->internal; data->raw_keyboard_enabled = enabled; - return WIN_UpdateRawInputEnabled(_this); + if (data->gameinput_context) { + if (WIN_UpdateGameInputEnabled(_this) < 0) { + data->raw_keyboard_enabled = !enabled; + return -1; + } + } else { + if (WIN_UpdateRawInputEnabled(_this) < 0) { + data->raw_keyboard_enabled = !enabled; + return -1; + } + } + return 0; } #else diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c index ee768c1e1698b..440e21db2dd07 100644 --- a/src/video/windows/SDL_windowsvideo.c +++ b/src/video/windows/SDL_windowsvideo.c @@ -491,6 +491,10 @@ int WIN_VideoInit(SDL_VideoDevice *_this) SDL_Log("DPI awareness: %s", WIN_GetDPIAwareness(_this)); #endif + if (SDL_GetHintBoolean(SDL_HINT_WINDOWS_GAMEINPUT, SDL_TRUE)) { + WIN_InitGameInput(_this); + } + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) /* For Xbox, we just need to create the single display */ { @@ -511,7 +515,9 @@ int WIN_VideoInit(SDL_VideoDevice *_this) WIN_InitKeyboard(_this); WIN_InitMouse(_this); WIN_InitDeviceNotification(); - WIN_CheckKeyboardAndMouseHotplug(_this, SDL_TRUE); + if (!_this->internal->gameinput_context) { + WIN_CheckKeyboardAndMouseHotplug(_this, SDL_TRUE); + } #endif SDL_AddHintCallback(SDL_HINT_WINDOWS_RAW_KEYBOARD, UpdateWindowsRawKeyboard, _this); @@ -530,13 +536,6 @@ void WIN_VideoQuit(SDL_VideoDevice *_this) { SDL_VideoData *data = _this->internal; -#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) - WIN_QuitModes(_this); - WIN_QuitDeviceNotification(); - WIN_QuitKeyboard(_this); - WIN_QuitMouse(_this); -#endif - SDL_DelHintCallback(SDL_HINT_WINDOWS_RAW_KEYBOARD, UpdateWindowsRawKeyboard, _this); SDL_DelHintCallback(SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, UpdateWindowsEnableMessageLoop, NULL); SDL_DelHintCallback(SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS, UpdateWindowsEnableMenuMnemonics, NULL); @@ -544,13 +543,20 @@ void WIN_VideoQuit(SDL_VideoDevice *_this) WIN_SetRawMouseEnabled(_this, SDL_FALSE); WIN_SetRawKeyboardEnabled(_this, SDL_FALSE); + WIN_QuitGameInput(_this); + +#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) + WIN_QuitModes(_this); + WIN_QuitDeviceNotification(); + WIN_QuitKeyboard(_this); + WIN_QuitMouse(_this); -#if !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) if (data->oleinitialized) { OleUninitialize(); data->oleinitialized = SDL_FALSE; } #endif /* !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) */ + if (data->coinitialized) { WIN_CoUninitialize(); data->coinitialized = SDL_FALSE; diff --git a/src/video/windows/SDL_windowsvideo.h b/src/video/windows/SDL_windowsvideo.h index 2265ac01922f4..9ad6a65f58dd3 100644 --- a/src/video/windows/SDL_windowsvideo.h +++ b/src/video/windows/SDL_windowsvideo.h @@ -47,6 +47,7 @@ #include "SDL_windowsclipboard.h" #include "SDL_windowsevents.h" +#include "SDL_windowsgameinput.h" #include "SDL_windowsopengl.h" #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) @@ -437,6 +438,8 @@ struct SDL_VideoData SDL_bool pending_E1_key_sequence; Uint32 raw_input_enabled; + WIN_GameInputData *gameinput_context; + #ifndef SDL_DISABLE_WINDOWS_IME SDL_bool ime_initialized; SDL_bool ime_enabled; From a7e425497b980de9dae0a9dc82d8885779d7dc7d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 06:48:10 -0700 Subject: [PATCH 221/253] Added a FIXME to lock the joystick list and update the GameInput joystick support --- src/joystick/gdk/SDL_gameinputjoystick.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/joystick/gdk/SDL_gameinputjoystick.c b/src/joystick/gdk/SDL_gameinputjoystick.c index 7cceec9d03575..5ab44c4a49561 100644 --- a/src/joystick/gdk/SDL_gameinputjoystick.c +++ b/src/joystick/gdk/SDL_gameinputjoystick.c @@ -56,7 +56,7 @@ typedef struct joystick_hwdata GameInputCallbackToken guide_button_callback_token; } GAMEINPUT_InternalJoystickHwdata; - +// FIXME: We need a lock to protect the device list static GAMEINPUT_InternalList g_GameInputList = { NULL }; static void *g_hGameInputDLL = NULL; static IGameInput *g_pGameInput = NULL; @@ -103,6 +103,7 @@ static int GAMEINPUT_InternalAddOrFind(IGameInputDevice *pDevice) elem = g_GameInputList.devices[idx]; if (elem && elem->device == pDevice) { /* we're already added */ + elem->isDeleteRequested = SDL_FALSE; return 0; } } From 212f7cc355f32a34f9142ddc044cc821b6072c55 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Wed, 7 Aug 2024 19:19:43 +0000 Subject: [PATCH 222/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_hints.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index d8bbfb47283a1..96637815ea1c1 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -3824,12 +3824,14 @@ extern "C" { #define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP "SDL_WINDOWS_ENABLE_MESSAGELOOP" /** - * A variable controlling whether GameInput is used for raw keyboard and mouse on Windows. + * A variable controlling whether GameInput is used for raw keyboard and mouse + * on Windows. * * The variable can be set to the following values: * * - "0": GameInput is not used for raw keyboard and mouse events. - * - "1": GameInput is used for raw keyboard and mouse events, if available. (default) + * - "1": GameInput is used for raw keyboard and mouse events, if available. + * (default) * * This hint should be set before SDL is initialized. * From 91d97a367e9e15bb2067ed0594798dc54c862bb1 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 12:15:00 -0700 Subject: [PATCH 223/253] Fixed crash when the current mouse capture window is destroyed Fixes https://github.com/libsdl-org/SDL/issues/10494 --- src/video/SDL_video.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index a8421a2730397..cc2f70976bb5c 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -4099,6 +4099,9 @@ void SDL_DestroyWindow(SDL_Window *window) if (SDL_GetKeyboardFocus() == window) { SDL_SetKeyboardFocus(NULL); } + if ((window->flags & SDL_WINDOW_MOUSE_CAPTURE)) { + SDL_UpdateMouseCapture(SDL_TRUE); + } if (SDL_GetMouseFocus() == window) { SDL_SetMouseFocus(NULL); } From 9493e6974f70a906950c9d8196c9a9982300f261 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 12:15:48 -0700 Subject: [PATCH 224/253] Validate window pointer before sending events for it If there are bugs it's possible that the window pointer is invalid. Double check it before sending the application events and potentially dereferencing it. This showed up in https://github.com/libsdl-org/SDL/issues/10494 as a window getting mouse focus as it was being destroyed and then crashing later when mouse focus was set to a different window. --- src/events/SDL_windowevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c index 262f3da27c58a..0dd7e4a0f74f4 100644 --- a/src/events/SDL_windowevents.c +++ b/src/events/SDL_windowevents.c @@ -43,7 +43,7 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, { int posted; - if (!window) { + if (!SDL_ObjectValid(window, SDL_OBJECT_TYPE_WINDOW)) { return 0; } if (window->is_destroying && windowevent != SDL_EVENT_WINDOW_DESTROYED) { From 3ec19b2a897fa09ddb58233af90db90bdde0c3bc Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 15:05:08 -0700 Subject: [PATCH 225/253] Removed duplicate call to SDL_AssertJoysticksLocked() --- src/joystick/SDL_joystick.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 419ef5a7fd878..5f0dd4a3d6fc9 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -2321,8 +2321,6 @@ int SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 butto return 0; } - SDL_AssertJoysticksLocked(); - /* Make sure we're not getting garbage or duplicate events */ if (button >= joystick->nbuttons) { return 0; From 5cab979f2110df2f0dbec7867a4a6f565e07e29f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 15:05:38 -0700 Subject: [PATCH 226/253] Added support for the Guide and Share buttons on GameInput controllers --- src/joystick/gdk/SDL_gameinputjoystick.c | 58 +++++++++++++++++------- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/src/joystick/gdk/SDL_gameinputjoystick.c b/src/joystick/gdk/SDL_gameinputjoystick.c index 5ab44c4a49561..01b91df5cb24c 100644 --- a/src/joystick/gdk/SDL_gameinputjoystick.c +++ b/src/joystick/gdk/SDL_gameinputjoystick.c @@ -29,6 +29,10 @@ #define COBJMACROS #include +enum +{ + SDL_GAMEPAD_BUTTON_GAMEINPUT_SHARE = 11 +}; typedef struct GAMEINPUT_InternalDevice { @@ -53,7 +57,7 @@ typedef struct joystick_hwdata GAMEINPUT_InternalDevice *devref; SDL_bool report_sensors; GameInputRumbleParams rumbleParams; - GameInputCallbackToken guide_button_callback_token; + GameInputCallbackToken system_button_callback_token; } GAMEINPUT_InternalJoystickHwdata; // FIXME: We need a lock to protect the device list @@ -374,16 +378,24 @@ static void GAMEINPUT_UpdatePowerInfo(SDL_Joystick *joystick, IGameInputDevice * SDL_SendJoystickPowerInfo(joystick, state, percent); } -#if 0 -static void CALLBACK GAMEINPUT_InternalGuideButtonCallback(GameInputCallbackToken callbackToken, void *context, IGameInputDevice *device, uint64_t timestamp, bool isPressed) +static void CALLBACK GAMEINPUT_InternalSystemButtonCallback( + _In_ GameInputCallbackToken callbackToken, + _In_ void * context, + _In_ IGameInputDevice * device, + _In_ uint64_t timestamp, + _In_ GameInputSystemButtons currentButtons, + _In_ GameInputSystemButtons previousButtons) { SDL_Joystick *joystick = (SDL_Joystick *)context; - SDL_LockJoysticks(); - SDL_SendJoystickButton(0, joystick, SDL_GAMEPAD_BUTTON_GUIDE, isPressed ? SDL_PRESSED : SDL_RELEASED); - SDL_UnlockJoysticks(); + GameInputSystemButtons changedButtons = (previousButtons ^ currentButtons); + if (changedButtons) { + SDL_LockJoysticks(); + SDL_SendJoystickButton(0, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (currentButtons & GameInputSystemButtonGuide) ? SDL_PRESSED : SDL_RELEASED); + SDL_SendJoystickButton(0, joystick, SDL_GAMEPAD_BUTTON_GAMEINPUT_SHARE, (currentButtons & GameInputSystemButtonShare) ? SDL_PRESSED : SDL_RELEASED); + SDL_UnlockJoysticks(); + } } -#endif static int GAMEINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) { @@ -407,18 +419,24 @@ static int GAMEINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) joystick->naxes = 6; joystick->nbuttons = 11; joystick->nhats = 1; + + if (info->supportedSystemButtons != GameInputSystemButtonNone) { + if (info->supportedSystemButtons & GameInputSystemButtonShare) { + ++joystick->nbuttons; + } + +#if 1 // The C macro in GameInput.h version 10.0.26100 refers to a focus policy which I guess has been removed from the final API? +#undef IGameInput_RegisterSystemButtonCallback +#define IGameInput_RegisterSystemButtonCallback(This, device, buttonFilter, context, callbackFunc, callbackToken) ((This)->lpVtbl->RegisterSystemButtonCallback(This, device, buttonFilter, context, callbackFunc, callbackToken)) +#endif + IGameInput_RegisterSystemButtonCallback(g_pGameInput, elem->device, (GameInputSystemButtonGuide | GameInputSystemButtonShare), joystick, GAMEINPUT_InternalSystemButtonCallback, &hwdata->system_button_callback_token); + } } else { joystick->naxes = info->controllerAxisCount; joystick->nbuttons = info->controllerButtonCount; joystick->nhats = info->controllerSwitchCount; } - if (GAMEINPUT_InternalIsGamepad(info)) { -#if 0 /* The actual signature for this function is GameInputClient::RegisterSystemButtonCallback(struct IGameInputDevice *,enum GameInputSystemButtons,void *,void (*)(unsigned __int64,void *,struct IGameInputDevice *,unsigned __int64,enum GameInputSystemButtons,enum GameInputSystemButtons),unsigned __int64 *) */ - IGameInput_RegisterGuideButtonCallback(g_pGameInput, elem->device, joystick, GAMEINPUT_InternalGuideButtonCallback, &hwdata->guide_button_callback_token); -#endif - } - if (info->supportedRumbleMotors & (GameInputRumbleLowFrequency | GameInputRumbleHighFrequency)) { SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN, SDL_TRUE); } @@ -608,8 +626,8 @@ static void GAMEINPUT_JoystickClose(SDL_Joystick* joystick) { GAMEINPUT_InternalJoystickHwdata *hwdata = joystick->hwdata; - if (hwdata->guide_button_callback_token) { - IGameInput_UnregisterCallback(g_pGameInput, hwdata->guide_button_callback_token, 5000); + if (hwdata->system_button_callback_token) { + IGameInput_UnregisterCallback(g_pGameInput, hwdata->system_button_callback_token, 5000); } SDL_free(hwdata); @@ -661,7 +679,15 @@ static SDL_bool GAMEINPUT_JoystickGetGamepadMapping(int device_index, SDL_Gamepa out->back.kind = EMappingKind_Button; out->back.target = SDL_GAMEPAD_BUTTON_BACK; - /* The guide button isn't available, so don't map it */ + if (elem->info->supportedSystemButtons & GameInputSystemButtonGuide) { + out->guide.kind = EMappingKind_Button; + out->guide.target = SDL_GAMEPAD_BUTTON_GUIDE; + } + + if (elem->info->supportedSystemButtons & GameInputSystemButtonShare) { + out->misc1.kind = EMappingKind_Button; + out->misc1.target = SDL_GAMEPAD_BUTTON_GAMEINPUT_SHARE; + } out->start.kind = EMappingKind_Button; out->start.target = SDL_GAMEPAD_BUTTON_START; From 28ef6bcc38d0404c0322ad8d4554eb366f9e5197 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 15:33:26 -0700 Subject: [PATCH 227/253] Use the correct timestamp from the GameInput controller reading --- src/joystick/gdk/SDL_gameinputjoystick.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/joystick/gdk/SDL_gameinputjoystick.c b/src/joystick/gdk/SDL_gameinputjoystick.c index 01b91df5cb24c..34b113b73b7f2 100644 --- a/src/joystick/gdk/SDL_gameinputjoystick.c +++ b/src/joystick/gdk/SDL_gameinputjoystick.c @@ -65,6 +65,7 @@ static GAMEINPUT_InternalList g_GameInputList = { NULL }; static void *g_hGameInputDLL = NULL; static IGameInput *g_pGameInput = NULL; static GameInputCallbackToken g_GameInputCallbackToken = GAMEINPUT_INVALID_CALLBACK_TOKEN_VALUE; +static Uint64 g_GameInputTimestampOffset; static SDL_bool GAMEINPUT_InternalIsGamepad(const GameInputDeviceInfo *info) @@ -257,6 +258,11 @@ static int GAMEINPUT_JoystickInit(void) return SDL_SetError("IGameInput::RegisterDeviceCallback failure with HRESULT of %08X", hR); } + // Calculate the relative offset between SDL timestamps and GameInput timestamps + Uint64 now = SDL_GetTicksNS(); + uint64_t timestampUS = IGameInput_GetCurrentTimestamp(g_pGameInput); + g_GameInputTimestampOffset = (SDL_NS_TO_US(now) - timestampUS); + GAMEINPUT_JoystickDetect(); return 0; @@ -382,7 +388,7 @@ static void CALLBACK GAMEINPUT_InternalSystemButtonCallback( _In_ GameInputCallbackToken callbackToken, _In_ void * context, _In_ IGameInputDevice * device, - _In_ uint64_t timestamp, + _In_ uint64_t timestampUS, _In_ GameInputSystemButtons currentButtons, _In_ GameInputSystemButtons previousButtons) { @@ -390,9 +396,15 @@ static void CALLBACK GAMEINPUT_InternalSystemButtonCallback( GameInputSystemButtons changedButtons = (previousButtons ^ currentButtons); if (changedButtons) { + Uint64 timestamp = SDL_US_TO_NS(timestampUS + g_GameInputTimestampOffset); + SDL_LockJoysticks(); - SDL_SendJoystickButton(0, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (currentButtons & GameInputSystemButtonGuide) ? SDL_PRESSED : SDL_RELEASED); - SDL_SendJoystickButton(0, joystick, SDL_GAMEPAD_BUTTON_GAMEINPUT_SHARE, (currentButtons & GameInputSystemButtonShare) ? SDL_PRESSED : SDL_RELEASED); + if (changedButtons & GameInputSystemButtonGuide) { + SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (currentButtons & GameInputSystemButtonGuide) ? SDL_PRESSED : SDL_RELEASED); + } + if (changedButtons & GameInputSystemButtonShare) { + SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GAMEINPUT_SHARE, (currentButtons & GameInputSystemButtonShare) ? SDL_PRESSED : SDL_RELEASED); + } SDL_UnlockJoysticks(); } } @@ -506,7 +518,7 @@ static void GAMEINPUT_JoystickUpdate(SDL_Joystick *joystick) IGameInputDevice *device = hwdata->devref->device; const GameInputDeviceInfo *info = hwdata->devref->info; IGameInputReading *reading = NULL; - Uint64 timestamp = SDL_GetTicksNS(); + Uint64 timestamp; GameInputGamepadState state; HRESULT hR; @@ -516,7 +528,7 @@ static void GAMEINPUT_JoystickUpdate(SDL_Joystick *joystick) return; } - /* FIXME: See if we can get the delta between the reading timestamp and current time and apply the offset to timestamp */ + timestamp = SDL_US_TO_NS(IGameInputReading_GetTimestamp(reading) + g_GameInputTimestampOffset); if (GAMEINPUT_InternalIsGamepad(info)) { static WORD s_XInputButtons[] = { From ae076bdc2a7e667a2775c3fba2d7ed539dd8a01d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 15:53:40 -0700 Subject: [PATCH 228/253] Take the joystick lock when processing GameInput device callbacks --- src/joystick/gdk/SDL_gameinputjoystick.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/joystick/gdk/SDL_gameinputjoystick.c b/src/joystick/gdk/SDL_gameinputjoystick.c index 34b113b73b7f2..60b70a1764060 100644 --- a/src/joystick/gdk/SDL_gameinputjoystick.c +++ b/src/joystick/gdk/SDL_gameinputjoystick.c @@ -60,7 +60,6 @@ typedef struct joystick_hwdata GameInputCallbackToken system_button_callback_token; } GAMEINPUT_InternalJoystickHwdata; -// FIXME: We need a lock to protect the device list static GAMEINPUT_InternalList g_GameInputList = { NULL }; static void *g_hGameInputDLL = NULL; static IGameInput *g_pGameInput = NULL; @@ -90,6 +89,8 @@ static int GAMEINPUT_InternalAddOrFind(IGameInputDevice *pDevice) char tmp[4]; int idx = 0; + SDL_AssertJoysticksLocked(); + info = IGameInputDevice_GetDeviceInfo(pDevice); if (info->capabilities & GameInputDeviceCapabilityWireless) { bus = SDL_HARDWARE_BUS_BLUETOOTH; @@ -157,6 +158,8 @@ static int GAMEINPUT_InternalRemoveByIndex(int idx) GAMEINPUT_InternalDevice *elem; int bytes = 0; + SDL_AssertJoysticksLocked(); + if (idx < 0 || idx >= g_GameInputList.count) { return SDL_SetError("GAMEINPUT_InternalRemoveByIndex argument idx %d is out of range", idx); } @@ -187,6 +190,7 @@ static int GAMEINPUT_InternalRemoveByIndex(int idx) static GAMEINPUT_InternalDevice *GAMEINPUT_InternalFindByIndex(int idx) { /* We're guaranteed that the index is in range when this is called */ + SDL_AssertJoysticksLocked(); return g_GameInputList.devices[idx]; } @@ -206,6 +210,8 @@ static void CALLBACK GAMEINPUT_InternalJoystickDeviceCallback( return; } + SDL_LockJoysticks(); + if (currentStatus & GameInputDeviceConnected) { GAMEINPUT_InternalAddOrFind(device); } else { @@ -218,6 +224,8 @@ static void CALLBACK GAMEINPUT_InternalJoystickDeviceCallback( } } } + + SDL_UnlockJoysticks(); } static void GAMEINPUT_JoystickDetect(void); @@ -270,6 +278,8 @@ static int GAMEINPUT_JoystickInit(void) static int GAMEINPUT_JoystickGetCount(void) { + SDL_AssertJoysticksLocked(); + return g_GameInputList.count; } @@ -278,6 +288,8 @@ static void GAMEINPUT_JoystickDetect(void) int idx; GAMEINPUT_InternalDevice *elem = NULL; + SDL_AssertJoysticksLocked(); + for (idx = 0; idx < g_GameInputList.count; ++idx) { elem = g_GameInputList.devices[idx]; if (!elem) { @@ -301,6 +313,8 @@ static SDL_bool GAMEINPUT_JoystickIsDevicePresent(Uint16 vendor_id, Uint16 produ int idx = 0; GAMEINPUT_InternalDevice *elem = NULL; + SDL_AssertJoysticksLocked(); + if (vendor_id == USB_VENDOR_MICROSOFT && product_id == USB_PRODUCT_XBOX_ONE_XBOXGIP_CONTROLLER) { /* The Xbox One controller shows up as a hardcoded raw input VID/PID, which we definitely handle */ From a38cd7a067e2a7e6be07e98e925759f36d019912 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 16:57:53 -0700 Subject: [PATCH 229/253] Added checks for GameInput.h to the build system --- CMakeLists.txt | 29 ++++++++++++++----- include/build_config/SDL_build_config.h.cmake | 24 ++++++++------- .../build_config/SDL_build_config_windows.h | 7 ++++- .../build_config/SDL_build_config_wingdk.h | 14 ++------- include/build_config/SDL_build_config_xbox.h | 14 +-------- src/video/windows/SDL_windowsgameinput.c | 4 --- 6 files changed, 43 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca5e5f07408c7..083cbd696c70f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1870,14 +1870,23 @@ elseif(WINDOWS) #include #include int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_H) - check_c_source_compiles(" - #define COBJMACROS - #include - __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics2 *s2; - int main(int argc, char **argv) { return 0; }" HAVE_WINDOWS_GAMING_INPUT_H) endif() # headers needed elsewhere + check_c_source_compiles(" + #define COBJMACROS + #include + static __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics2 *s2; + int main(int argc, char **argv) { return 0; }" HAVE_WINDOWS_GAMING_INPUT_H + ) + check_c_source_compiles(" + #include + #define COBJMACROS + #include + // Requires Windows SDK version 10.0.26100.0 or newer + static GameInputSystemButtons s = GameInputSystemButtonNone; + int main(int argc, char **argv) { return 0; }" HAVE_GAMEINPUT_H + ) check_include_file(dxgi1_6.h HAVE_DXGI1_6_H) check_include_file(tpcshrd.h HAVE_TPCSHRD_H) check_include_file(roapi.h HAVE_ROAPI_H) @@ -2084,9 +2093,13 @@ elseif(WINDOWS) set(SDL_JOYSTICK_XINPUT 1) set(HAVE_XINPUT TRUE) endif() - if(HAVE_WINDOWS_GAMING_INPUT_H) - set(SDL_JOYSTICK_WGI 1) - endif() + endif() + if(HAVE_WINDOWS_GAMING_INPUT_H) + set(SDL_JOYSTICK_WGI 1) + endif() + if(HAVE_GAMEINPUT_H) + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/joystick/gdk/*.c") + set(SDL_JOYSTICK_GAMEINPUT 1) endif() set(HAVE_SDL_JOYSTICK TRUE) diff --git a/include/build_config/SDL_build_config.h.cmake b/include/build_config/SDL_build_config.h.cmake index 1e0cdc9db550b..74e4479ab9385 100644 --- a/include/build_config/SDL_build_config.h.cmake +++ b/include/build_config/SDL_build_config.h.cmake @@ -232,6 +232,7 @@ #cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@ #cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@ #cmakedefine HAVE_WINDOWS_GAMING_INPUT_H @HAVE_WINDOWS_GAMING_INPUT_H@ +#cmakedefine HAVE_GAMEINPUT_H @HAVE_GAMEINPUT_H@ #cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@ #cmakedefine HAVE_DXGI1_6_H @HAVE_DXGI1_6_H@ @@ -294,25 +295,26 @@ #cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@ #cmakedefine SDL_INPUT_FBSDKBIO @SDL_INPUT_FBSDKBIO@ #cmakedefine SDL_INPUT_WSCONS @SDL_INPUT_WSCONS@ +#cmakedefine SDL_HAVE_MACHINE_JOYSTICK_H @SDL_HAVE_MACHINE_JOYSTICK_H@ #cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@ -#cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@ -#cmakedefine SDL_JOYSTICK_WGI @SDL_JOYSTICK_WGI@ #cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@ -#cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@ #cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@ +#cmakedefine SDL_JOYSTICK_EMSCRIPTEN @SDL_JOYSTICK_EMSCRIPTEN@ +#cmakedefine SDL_JOYSTICK_GAMEINPUT @SDL_JOYSTICK_GAMEINPUT@ +#cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@ +#cmakedefine SDL_JOYSTICK_HIDAPI @SDL_JOYSTICK_HIDAPI@ #cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@ -#cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@ #cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@ -#cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@ -#cmakedefine SDL_HAVE_MACHINE_JOYSTICK_H @SDL_HAVE_MACHINE_JOYSTICK_H@ -#cmakedefine SDL_JOYSTICK_HIDAPI @SDL_JOYSTICK_HIDAPI@ +#cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@ +#cmakedefine SDL_JOYSTICK_N3DS @SDL_JOYSTICK_N3DS@ +#cmakedefine SDL_JOYSTICK_PS2 @SDL_JOYSTICK_PS2@ +#cmakedefine SDL_JOYSTICK_PSP @SDL_JOYSTICK_PSP@ #cmakedefine SDL_JOYSTICK_RAWINPUT @SDL_JOYSTICK_RAWINPUT@ -#cmakedefine SDL_JOYSTICK_EMSCRIPTEN @SDL_JOYSTICK_EMSCRIPTEN@ +#cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@ #cmakedefine SDL_JOYSTICK_VIRTUAL @SDL_JOYSTICK_VIRTUAL@ #cmakedefine SDL_JOYSTICK_VITA @SDL_JOYSTICK_VITA@ -#cmakedefine SDL_JOYSTICK_PSP @SDL_JOYSTICK_PSP@ -#cmakedefine SDL_JOYSTICK_PS2 @SDL_JOYSTICK_PS2@ -#cmakedefine SDL_JOYSTICK_N3DS @SDL_JOYSTICK_N3DS@ +#cmakedefine SDL_JOYSTICK_WGI @SDL_JOYSTICK_WGI@ +#cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@ #cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@ #cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@ #cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@ diff --git a/include/build_config/SDL_build_config_windows.h b/include/build_config/SDL_build_config_windows.h index 6feab76aa82a2..9158ddbf3ed3c 100644 --- a/include/build_config/SDL_build_config_windows.h +++ b/include/build_config/SDL_build_config_windows.h @@ -100,6 +100,9 @@ typedef unsigned int uintptr_t; #define HAVE_AUDIOCLIENT_H 1 #define HAVE_TPCSHRD_H 1 #define HAVE_SENSORSAPI_H 1 +#if defined(__has_include) && __has_include() +#define HAVE_GAMEINPUT_H 1 +#endif #if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) #elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) # if !__has_include() @@ -233,7 +236,9 @@ typedef unsigned int uintptr_t; /* Enable various input drivers */ #define SDL_JOYSTICK_DINPUT 1 -/*#define SDL_JOYSTICK_GAMEINPUT 1*/ +#ifdef HAVE_GAMEINPUT_H +#define SDL_JOYSTICK_GAMEINPUT 1 +#endif #define SDL_JOYSTICK_HIDAPI 1 #ifndef SDL_PLATFORM_WINRT #define SDL_JOYSTICK_RAWINPUT 1 diff --git a/include/build_config/SDL_build_config_wingdk.h b/include/build_config/SDL_build_config_wingdk.h index e46c4593f9332..859b606e8ae2f 100644 --- a/include/build_config/SDL_build_config_wingdk.h +++ b/include/build_config/SDL_build_config_wingdk.h @@ -47,6 +47,7 @@ #define HAVE_AUDIOCLIENT_H 1 #define HAVE_TPCSHRD_H 1 #define HAVE_SENSORSAPI_H 1 +#define HAVE_GAMEINPUT_H 1 #if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) #elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) # if !__has_include() @@ -164,25 +165,14 @@ /* Enable various input drivers */ #define SDL_JOYSTICK_DINPUT 1 +#define SDL_JOYSTICK_GAMEINPUT 1 #define SDL_JOYSTICK_HIDAPI 1 #define SDL_JOYSTICK_RAWINPUT 1 #define SDL_JOYSTICK_VIRTUAL 1 -#ifdef HAVE_WINDOWS_GAMING_INPUT_H #define SDL_JOYSTICK_WGI 1 -#endif #define SDL_JOYSTICK_XINPUT 1 #define SDL_HAPTIC_DINPUT 1 -/* Native GameInput: */ -/*#define SDL_JOYSTICK_GAMEINPUT 1*/ -#if defined(SDL_JOYSTICK_GAMEINPUT) && (defined(SDL_JOYSTICK_XINPUT) || defined(SDL_JOYSTICK_DINPUT)) -#error "GameInput cannot co-exist, choose one." -#endif /* defined(SDL_JOYSTICK_GAMEINPUT) && (defined(SDL_JOYSTICK_XINPUT) || defined(SDL_JOYSTICK_DINPUT)) */ -#if defined(SDL_JOYSTICK_GAMEINPUT) && SDL_JOYSTICK_GAMEINPUT -/* TODO: Implement proper haptics for GameInput! */ -#define SDL_HAPTIC_DUMMY 1 -#endif /* defined(SDL_JOYSTICK_GAMEINPUT) && SDL_JOYSTICK_GAMEINPUT */ - /* Enable the sensor driver */ #ifdef HAVE_SENSORSAPI_H #define SDL_SENSOR_WINDOWS 1 diff --git a/include/build_config/SDL_build_config_xbox.h b/include/build_config/SDL_build_config_xbox.h index 7bba464324931..0ff0ded83b9e2 100644 --- a/include/build_config/SDL_build_config_xbox.h +++ b/include/build_config/SDL_build_config_xbox.h @@ -46,6 +46,7 @@ #define HAVE_AUDIOCLIENT_H 1 /*#define HAVE_TPCSHRD_H 1*/ /*#define HAVE_SENSORSAPI_H 1*/ +#define HAVE_GAMEINPUT_H 1 #if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) #elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) # if !__has_include() @@ -162,25 +163,12 @@ #define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable various input drivers */ -/*#define SDL_JOYSTICK_DINPUT 1*/ -/*#define SDL_JOYSTICK_HIDAPI 1*/ -/*#define SDL_JOYSTICK_RAWINPUT 1*/ #define SDL_JOYSTICK_VIRTUAL 1 -#ifdef HAVE_WINDOWS_GAMING_INPUT_H -#define SDL_JOYSTICK_WGI 1 -#endif /* This is XInputOnGameInput for GDK platforms: */ /*#define SDL_JOYSTICK_XINPUT 1*/ /* Native GameInput: */ #define SDL_JOYSTICK_GAMEINPUT 1 -#if defined(SDL_JOYSTICK_GAMEINPUT) && (defined(SDL_JOYSTICK_XINPUT) || defined(SDL_JOYSTICK_DINPUT)) -#error "GameInput cannot co-exist, choose one." -#endif /* defined(SDL_JOYSTICK_GAMEINPUT) && (defined(SDL_JOYSTICK_XINPUT) || defined(SDL_JOYSTICK_DINPUT)) */ -#if defined(SDL_JOYSTICK_GAMEINPUT) && SDL_JOYSTICK_GAMEINPUT -/* TODO: Implement proper haptics for GameInput! */ #define SDL_HAPTIC_DUMMY 1 -#endif /* defined(SDL_JOYSTICK_GAMEINPUT) && SDL_JOYSTICK_GAMEINPUT */ -/*#define SDL_HAPTIC_DINPUT 1*/ /* Enable the sensor driver */ #ifdef HAVE_SENSORSAPI_H diff --git a/src/video/windows/SDL_windowsgameinput.c b/src/video/windows/SDL_windowsgameinput.c index d92eb27cdd7ed..e36eb7efd2f8d 100644 --- a/src/video/windows/SDL_windowsgameinput.c +++ b/src/video/windows/SDL_windowsgameinput.c @@ -22,10 +22,6 @@ #include "SDL_windowsvideo.h" -#if defined(__has_include) && __has_include() -#define HAVE_GAMEINPUT_H -#endif - #ifdef HAVE_GAMEINPUT_H #include From 889a78891307c0655e2e4282e889569590d17764 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 17:14:22 -0700 Subject: [PATCH 230/253] Fixed build warnings --- src/joystick/gdk/SDL_gameinputjoystick.c | 4 ++-- src/video/windows/SDL_windowsgameinput.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/joystick/gdk/SDL_gameinputjoystick.c b/src/joystick/gdk/SDL_gameinputjoystick.c index 60b70a1764060..16e05cc3cff1a 100644 --- a/src/joystick/gdk/SDL_gameinputjoystick.c +++ b/src/joystick/gdk/SDL_gameinputjoystick.c @@ -603,7 +603,7 @@ static void GAMEINPUT_JoystickUpdate(SDL_Joystick *joystick) uint32_t i; uint32_t button_count = IGameInputReading_GetControllerButtonState(reading, info->controllerButtonCount, button_state); for (i = 0; i < button_count; ++i) { - SDL_SendJoystickButton(timestamp, joystick, i, button_state[i]); + SDL_SendJoystickButton(timestamp, joystick, (Uint8)i, button_state[i]); } SDL_stack_free(button_state); } @@ -613,7 +613,7 @@ static void GAMEINPUT_JoystickUpdate(SDL_Joystick *joystick) uint32_t i; uint32_t axis_count = IGameInputReading_GetControllerAxisState(reading, info->controllerAxisCount, axis_state); for (i = 0; i < axis_count; ++i) { - SDL_SendJoystickAxis(timestamp, joystick, i, CONVERT_AXIS(axis_state[i])); + SDL_SendJoystickAxis(timestamp, joystick, (Uint8)i, CONVERT_AXIS(axis_state[i])); } SDL_stack_free(axis_state); } diff --git a/src/video/windows/SDL_windowsgameinput.c b/src/video/windows/SDL_windowsgameinput.c index e36eb7efd2f8d..6441d100175da 100644 --- a/src/video/windows/SDL_windowsgameinput.c +++ b/src/video/windows/SDL_windowsgameinput.c @@ -313,7 +313,7 @@ static void GAMEINPUT_HandleMouseDelta(WIN_GameInputData *data, SDL_Window *wind } if (delta.buttons) { for (int i = 0; i < MAX_GAMEINPUT_BUTTONS; ++i) { - const GameInputMouseButtons mask = (1 << i); + const GameInputMouseButtons mask = (1 << i); if (delta.buttons & mask) { SDL_SendMouseButton(timestamp, window, mouseID, (state.buttons & mask) ? SDL_PRESSED : SDL_RELEASED, GAMEINPUT_button_map[i]); } From 4c3f9159e9507b2e3dd817ec5c47b1ea4fe265bd Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 17:39:15 -0700 Subject: [PATCH 231/253] Allow building with older versions of GameInput.h --- CMakeLists.txt | 2 -- src/joystick/gdk/SDL_gameinputjoystick.c | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 083cbd696c70f..9ffcd9e620245 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1883,8 +1883,6 @@ elseif(WINDOWS) #include #define COBJMACROS #include - // Requires Windows SDK version 10.0.26100.0 or newer - static GameInputSystemButtons s = GameInputSystemButtonNone; int main(int argc, char **argv) { return 0; }" HAVE_GAMEINPUT_H ) check_include_file(dxgi1_6.h HAVE_DXGI1_6_H) diff --git a/src/joystick/gdk/SDL_gameinputjoystick.c b/src/joystick/gdk/SDL_gameinputjoystick.c index 16e05cc3cff1a..31810b0b9a1f9 100644 --- a/src/joystick/gdk/SDL_gameinputjoystick.c +++ b/src/joystick/gdk/SDL_gameinputjoystick.c @@ -398,6 +398,8 @@ static void GAMEINPUT_UpdatePowerInfo(SDL_Joystick *joystick, IGameInputDevice * SDL_SendJoystickPowerInfo(joystick, state, percent); } +#ifdef IGameInput_RegisterSystemButtonCallback + static void CALLBACK GAMEINPUT_InternalSystemButtonCallback( _In_ GameInputCallbackToken callbackToken, _In_ void * context, @@ -423,6 +425,8 @@ static void CALLBACK GAMEINPUT_InternalSystemButtonCallback( } } +#endif // IGameInput_RegisterSystemButtonCallback + static int GAMEINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) { GAMEINPUT_InternalDevice *elem = GAMEINPUT_InternalFindByIndex(device_index); @@ -446,6 +450,7 @@ static int GAMEINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) joystick->nbuttons = 11; joystick->nhats = 1; +#ifdef IGameInput_RegisterSystemButtonCallback if (info->supportedSystemButtons != GameInputSystemButtonNone) { if (info->supportedSystemButtons & GameInputSystemButtonShare) { ++joystick->nbuttons; @@ -457,6 +462,7 @@ static int GAMEINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) #endif IGameInput_RegisterSystemButtonCallback(g_pGameInput, elem->device, (GameInputSystemButtonGuide | GameInputSystemButtonShare), joystick, GAMEINPUT_InternalSystemButtonCallback, &hwdata->system_button_callback_token); } +#endif // IGameInput_RegisterSystemButtonCallback } else { joystick->naxes = info->controllerAxisCount; joystick->nbuttons = info->controllerButtonCount; @@ -705,6 +711,7 @@ static SDL_bool GAMEINPUT_JoystickGetGamepadMapping(int device_index, SDL_Gamepa out->back.kind = EMappingKind_Button; out->back.target = SDL_GAMEPAD_BUTTON_BACK; +#ifdef IGameInput_RegisterSystemButtonCallback if (elem->info->supportedSystemButtons & GameInputSystemButtonGuide) { out->guide.kind = EMappingKind_Button; out->guide.target = SDL_GAMEPAD_BUTTON_GUIDE; @@ -714,6 +721,7 @@ static SDL_bool GAMEINPUT_JoystickGetGamepadMapping(int device_index, SDL_Gamepa out->misc1.kind = EMappingKind_Button; out->misc1.target = SDL_GAMEPAD_BUTTON_GAMEINPUT_SHARE; } +#endif out->start.kind = EMappingKind_Button; out->start.target = SDL_GAMEPAD_BUTTON_START; From b5b868044fedc83959626fc433aa1a74e2c60200 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 17:52:05 -0700 Subject: [PATCH 232/253] Include GameInput.h as gameinput.h for compatibility with non-MSVC toolchains --- CMakeLists.txt | 2 +- src/joystick/gdk/SDL_gameinputjoystick.c | 2 +- src/video/windows/SDL_windowsgameinput.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ffcd9e620245..dd8ce5dba838c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1882,7 +1882,7 @@ elseif(WINDOWS) check_c_source_compiles(" #include #define COBJMACROS - #include + #include int main(int argc, char **argv) { return 0; }" HAVE_GAMEINPUT_H ) check_include_file(dxgi1_6.h HAVE_DXGI1_6_H) diff --git a/src/joystick/gdk/SDL_gameinputjoystick.c b/src/joystick/gdk/SDL_gameinputjoystick.c index 31810b0b9a1f9..f203bb7a7bead 100644 --- a/src/joystick/gdk/SDL_gameinputjoystick.c +++ b/src/joystick/gdk/SDL_gameinputjoystick.c @@ -27,7 +27,7 @@ #include #define COBJMACROS -#include +#include enum { diff --git a/src/video/windows/SDL_windowsgameinput.c b/src/video/windows/SDL_windowsgameinput.c index 6441d100175da..2cdb3e8029574 100644 --- a/src/video/windows/SDL_windowsgameinput.c +++ b/src/video/windows/SDL_windowsgameinput.c @@ -26,7 +26,7 @@ #include #define COBJMACROS -#include +#include #include "../../events/SDL_mouse_c.h" #include "../../events/SDL_keyboard_c.h" From bd7d4a3752273d3038d34c456d5f8d4c6c25e344 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 8 Aug 2024 10:21:42 +0200 Subject: [PATCH 233/253] Add comment about randomOrder and random seed --- src/test/SDL_test_harness.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c index bbd794a35ecd1..518253a170825 100644 --- a/src/test/SDL_test_harness.c +++ b/src/test/SDL_test_harness.c @@ -551,6 +551,13 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user int tmp; a = SDLTest_RandomIntegerInRange(0, nbSuites - 1); b = SDLTest_RandomIntegerInRange(0, nbSuites - 1); + /* + * NB: prevent swapping here to make sure the tests start with the same + * random seed (whether they are run in order or not). + * So we consume same number of SDLTest_RandomIntegerInRange() in all cases. + * + * If some random value were used at initialization before the tests start, the --seed wouldn't do the same with or without randomOrder. + */ /* Swap */ if (randomOrder) { tmp = arraySuites[b]; @@ -602,6 +609,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user a = SDLTest_RandomIntegerInRange(0, nbTestCases - 1); b = SDLTest_RandomIntegerInRange(0, nbTestCases - 1); /* Swap */ + /* See previous note */ if (randomOrder) { tmp = arrayTestCases[b]; arrayTestCases[b] = arrayTestCases[a]; From 125ce7137987ec91b931b4fb97d9c3c7af88c377 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 7 Aug 2024 23:49:02 +0200 Subject: [PATCH 234/253] SDL_Log: avoid sending text to the debug stream twice When debugging a GUI application in Visual Studio, text printed with fprintf(stderr) will also be sent to the debug stream. When buiding SDL with SDL_LIBC=ON, this patch makes logging skip OutputDebugString and rely on fprintf(stderr) to send the text to the debugger. --- src/SDL_log.c | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/src/SDL_log.c b/src/SDL_log.c index 2b2680f5fdef7..000c90e642105 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -510,9 +510,14 @@ void SDL_LogMessageV(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_S } } -#if defined(SDL_PLATFORM_WIN32) && !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) -/* Flag tracking the attachment of the console: 0=unattached, 1=attached to a console, 2=attached to a file, -1=error */ -static int consoleAttached = 0; +#if defined(SDL_PLATFORM_WIN32) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) +enum { + CONSOLE_UNATTACHED = 0, + CONSOLE_ATTACHED_CONSOLE = 1, + CONSOLE_ATTACHED_FILE = 2, + CONSOLE_ATTACHED_MSVC = 3, + CONSOLE_ATTACHED_ERROR = -1, +} consoleAttached = CONSOLE_UNATTACHED; /* Handle to stderr output of console. */ static HANDLE stderrHandle = NULL; @@ -530,58 +535,68 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority LPTSTR tstr; SDL_bool isstack; -#if !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) +#if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) BOOL attachResult; DWORD attachError; - DWORD charsWritten; DWORD consoleMode; +#if !defined(HAVE_STDIO_H) + DWORD charsWritten; +#endif /* Maybe attach console and get stderr handle */ - if (consoleAttached == 0) { + if (consoleAttached == CONSOLE_UNATTACHED) { attachResult = AttachConsole(ATTACH_PARENT_PROCESS); if (!attachResult) { attachError = GetLastError(); if (attachError == ERROR_INVALID_HANDLE) { /* This is expected when running from Visual Studio */ /*OutputDebugString(TEXT("Parent process has no console\r\n"));*/ - consoleAttached = -1; + consoleAttached = CONSOLE_ATTACHED_MSVC; } else if (attachError == ERROR_GEN_FAILURE) { OutputDebugString(TEXT("Could not attach to console of parent process\r\n")); - consoleAttached = -1; + consoleAttached = CONSOLE_ATTACHED_ERROR; } else if (attachError == ERROR_ACCESS_DENIED) { /* Already attached */ - consoleAttached = 1; + consoleAttached = CONSOLE_ATTACHED_CONSOLE; } else { OutputDebugString(TEXT("Error attaching console\r\n")); - consoleAttached = -1; + consoleAttached = CONSOLE_ATTACHED_ERROR; } } else { /* Newly attached */ - consoleAttached = 1; + consoleAttached = CONSOLE_ATTACHED_CONSOLE; } - if (consoleAttached == 1) { + if (consoleAttached == CONSOLE_ATTACHED_CONSOLE) { stderrHandle = GetStdHandle(STD_ERROR_HANDLE); if (GetConsoleMode(stderrHandle, &consoleMode) == 0) { /* WriteConsole fails if the output is redirected to a file. Must use WriteFile instead. */ - consoleAttached = 2; + consoleAttached = CONSOLE_ATTACHED_FILE; } } } #endif /* !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) */ - length = SDL_strlen(SDL_GetLogPriorityPrefix(priority)) + SDL_strlen(message) + 1 + 1 + 1; output = SDL_small_alloc(char, length, &isstack); (void)SDL_snprintf(output, length, "%s%s\r\n", SDL_GetLogPriorityPrefix(priority), message); tstr = WIN_UTF8ToString(output); + +#if defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) + /* When running in MSVC and using stdio, rely on forwarding of stderr to the debug stream */ + if (consoleAttached != CONSOLE_ATTACHED_MSVC) { + /* Output to debugger */ + OutputDebugString(tstr); + } +#else /* Output to debugger */ OutputDebugString(tstr); +#endif #if !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) /* Screen output to stderr, if console was attached. */ - if (consoleAttached == 1) { + if (consoleAttached == CONSOLE_ATTACHED_CONSOLE) { if (!WriteConsole(stderrHandle, tstr, (DWORD)SDL_tcslen(tstr), &charsWritten, NULL)) { OutputDebugString(TEXT("Error calling WriteConsole\r\n")); if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY) { @@ -589,7 +604,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority } } - } else if (consoleAttached == 2) { + } else if (consoleAttached == CONSOLE_ATTACHED_FILE) { if (!WriteFile(stderrHandle, output, (DWORD)SDL_strlen(output), &charsWritten, NULL)) { OutputDebugString(TEXT("Error calling WriteFile\r\n")); } From 5cd69232982b043dc3272ed338145a9d8ac32d8b Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 7 Aug 2024 23:54:29 +0200 Subject: [PATCH 235/253] Assert a valid window pointer instead of dismissing an invalid pointer Throwing an assertion and breaking the program should allow developers to catch wrong usage of the API faster. Follow-up of 9493e6974f70a906950c9d8196c9a9982300f261 --- src/events/SDL_windowevents.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c index 0dd7e4a0f74f4..529be7f60381b 100644 --- a/src/events/SDL_windowevents.c +++ b/src/events/SDL_windowevents.c @@ -43,9 +43,11 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, { int posted; - if (!SDL_ObjectValid(window, SDL_OBJECT_TYPE_WINDOW)) { + if (!window) { return 0; } + SDL_assert(SDL_ObjectValid(window, SDL_OBJECT_TYPE_WINDOW)); + if (window->is_destroying && windowevent != SDL_EVENT_WINDOW_DESTROYED) { return 0; } From 6e6c2b8e7d49d388c81734210e00969b4808d0c5 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 8 Aug 2024 00:25:27 +0200 Subject: [PATCH 236/253] cmake: build SDL with /W3 on MSVC The Visual Studio projects also did this. --- cmake/PreseedMSVCCache.cmake | 1 + cmake/sdlcompilers.cmake | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/cmake/PreseedMSVCCache.cmake b/cmake/PreseedMSVCCache.cmake index a4095275e9ce8..d0b5ebfe4b21d 100644 --- a/cmake/PreseedMSVCCache.cmake +++ b/cmake/PreseedMSVCCache.cmake @@ -1,5 +1,6 @@ if(MSVC) function(SDL_Preseed_CMakeCache) + set(COMPILER_SUPPORTS_W3 "1" CACHE INTERNAL "Test /W3") set(COMPILER_SUPPORTS_FDIAGNOSTICS_COLOR_ALWAYS "" CACHE INTERNAL "Test COMPILER_SUPPORTS_FDIAGNOSTICS_COLOR_ALWAYS") set(HAVE_ALLOCA_H "" CACHE INTERNAL "Have include alloca.h") set(HAVE_AUDIOCLIENT_H "1" CACHE INTERNAL "Have include audioclient.h") diff --git a/cmake/sdlcompilers.cmake b/cmake/sdlcompilers.cmake index 9db746021b253..fc352e19c86e1 100644 --- a/cmake/sdlcompilers.cmake +++ b/cmake/sdlcompilers.cmake @@ -30,6 +30,14 @@ function(SDL_AddCommonCompilerFlags TARGET) option(SDL_WERROR "Enable -Werror" OFF) get_property(TARGET_TYPE TARGET "${TARGET}" PROPERTY TYPE) + if(MSVC) + cmake_push_check_state() + check_c_compiler_flag("/W3" COMPILER_SUPPORTS_W3) + if(COMPILER_SUPPORTS_W3) + target_compile_options(${TARGET} PRIVATE "/W3") + endif() + cmake_pop_check_state() + endif() if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC) if(MINGW) From 8714de9f462dde792b6272116df5633f3e209996 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 8 Aug 2024 00:42:57 +0200 Subject: [PATCH 237/253] SDL_GetAudioStreamAvailable and SDL_GetAudioStreamAvailable return error codes --- include/SDL3/SDL_audio.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index f25959c3b09fc..d15bbaa6f5145 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -1309,7 +1309,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamData(SDL_AudioStream *stream, * clamped. * * \param stream the audio stream to query. - * \returns the number of converted/resampled bytes available. + * \returns the number of converted/resampled bytes available or a negative + * error code on failure; call SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * @@ -1341,7 +1342,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamAvailable(SDL_AudioStream *str * clamped. * * \param stream the audio stream to query. - * \returns the number of bytes queued. + * \returns the number of bytes queued or a negative error code on failure; + * call SDL_GetError() for more information. * * \threadsafety It is safe to call this function from any thread. * From 00b59c96f189507431fcbd357e2904489b895bb3 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 8 Aug 2024 00:43:44 +0200 Subject: [PATCH 238/253] Fix /W3 warnings in examples --- examples/audio/03-load-wav/load-wav.c | 2 +- examples/game/01-snake/main.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/audio/03-load-wav/load-wav.c b/examples/audio/03-load-wav/load-wav.c index d8d74cd516450..6467ce7e4aa30 100644 --- a/examples/audio/03-load-wav/load-wav.c +++ b/examples/audio/03-load-wav/load-wav.c @@ -80,7 +80,7 @@ int SDL_AppIterate(void *appstate) We're being lazy here, but if there's less than the entire wav file left to play, just shove a whole copy of it into the queue, so we always have _tons_ of data queued for playback. */ - if (SDL_GetAudioStreamAvailable(stream) < wav_data_len) { + if (SDL_GetAudioStreamAvailable(stream) < (int)wav_data_len) { /* feed more data to the stream. It will queue at the end, and trickle out as the hardware needs more data. */ SDL_PutAudioStreamData(stream, wav_data, wav_data_len); } diff --git a/examples/game/01-snake/main.c b/examples/game/01-snake/main.c index 37c873bcfb47a..d09f008cb2ec9 100644 --- a/examples/game/01-snake/main.c +++ b/examples/game/01-snake/main.c @@ -72,8 +72,8 @@ static int handle_key_event_(SnakeContext *ctx, SDL_Scancode key_code) static void set_rect_xy_(SDL_FRect *r, short x, short y) { - r->x = x * SNAKE_BLOCK_SIZE_IN_PIXELS; - r->y = y * SNAKE_BLOCK_SIZE_IN_PIXELS; + r->x = (float)(x * SNAKE_BLOCK_SIZE_IN_PIXELS); + r->y = (float)(y * SNAKE_BLOCK_SIZE_IN_PIXELS); } int SDL_AppIterate(void *appstate) From 058781f514f775d8c0cb21892f118a3229a32637 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Aug 2024 09:14:38 -0700 Subject: [PATCH 239/253] Include GameInput.h as gameinput.h for compatibility with non-MSVC toolchains --- include/build_config/SDL_build_config_windows.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/build_config/SDL_build_config_windows.h b/include/build_config/SDL_build_config_windows.h index 9158ddbf3ed3c..6834afc59577c 100644 --- a/include/build_config/SDL_build_config_windows.h +++ b/include/build_config/SDL_build_config_windows.h @@ -100,7 +100,7 @@ typedef unsigned int uintptr_t; #define HAVE_AUDIOCLIENT_H 1 #define HAVE_TPCSHRD_H 1 #define HAVE_SENSORSAPI_H 1 -#if defined(__has_include) && __has_include() +#if defined(__has_include) && __has_include() #define HAVE_GAMEINPUT_H 1 #endif #if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) From 1a57ea7fba9eda1e57f19f174f35201840234553 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2024 18:13:00 -0700 Subject: [PATCH 240/253] kmsdrm: free the connector when looking for available devices Fixes https://github.com/libsdl-org/SDL/issues/10499 --- src/video/kmsdrm/SDL_kmsdrmvideo.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index 513043b2d19b8..6dea7c12fdda3 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -96,7 +96,7 @@ static int get_driindex(void) SDL_strlcpy(device + kmsdrm_dri_pathsize, kmsdrm_dri_devname, sizeof(device) - kmsdrm_dri_devnamesize); - while((res = readdir(folder)) != NULL) { + while((res = readdir(folder)) != NULL && available < 0) { if (SDL_memcmp(res->d_name, kmsdrm_dri_devname, kmsdrm_dri_devnamesize) == 0) { SDL_strlcpy(device + kmsdrm_dri_pathsize + kmsdrm_dri_devnamesize, @@ -122,7 +122,7 @@ static int get_driindex(void) resources->count_encoders > 0 && resources->count_crtcs > 0) { available = -ENOENT; - for (i = 0; i < resources->count_connectors; i++) { + for (i = 0; i < resources->count_connectors && available < 0; i++) { drmModeConnector *conn = KMSDRM_drmModeGetConnector( drm_fd, resources->connectors[i]); @@ -133,20 +133,21 @@ static int get_driindex(void) if (conn->connection == DRM_MODE_CONNECTED && conn->count_modes) { + SDL_bool access_denied = SDL_FALSE; if (SDL_GetHintBoolean( SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER, SDL_TRUE)) { /* Skip this device if we can't obtain * DRM master */ KMSDRM_drmSetMaster(drm_fd); - if (KMSDRM_drmAuthMagic(drm_fd, 0) == - -EACCES) { - continue; + if (KMSDRM_drmAuthMagic(drm_fd, 0) == -EACCES) { + access_denied = SDL_TRUE; } } - available = devindex; - break; + if (!access_denied) { + available = devindex; + } } KMSDRM_drmModeFreeConnector(conn); @@ -157,11 +158,10 @@ static int get_driindex(void) SDL_KMSDRM_UnloadSymbols(); } close(drm_fd); + } else { + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, + "Failed to open KMSDRM device %s, errno: %d\n", device, errno); } - - SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, - "Failed to open KMSDRM device %s, errno: %d\n", device, - errno); } } From ae8065e1ec42b91289cd7210753e0a1184a0bda1 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 6 Aug 2024 12:36:26 -0400 Subject: [PATCH 241/253] Use more stringent criteria for entering warp emulation mode Require more than one warp to the window center within a certain timespan (currently 30ms, but can be tweaked) to better avoid erroneously entering warp emulation mode. This also correctly resets the warp emulation mode activation if the window loses and regains focus. --- include/SDL3/SDL_hints.h | 8 +++--- src/events/SDL_mouse.c | 61 ++++++++++++++++++++++++++++------------ src/events/SDL_mouse_c.h | 2 ++ src/video/SDL_video.c | 6 ++++ 4 files changed, 55 insertions(+), 22 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 96637815ea1c1..1c20b7a0f6403 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2309,7 +2309,8 @@ extern "C" { * A variable controlling whether warping a hidden mouse cursor will activate * relative mouse mode. * - * When this hint is set and the mouse cursor is hidden, SDL will emulate + * When this hint is set, the mouse cursor is hidden, and multiple warps to + * the window center occur within a short time period, SDL will emulate * mouse warps using relative mouse mode. This can provide smoother and more * reliable mouse motion for some older games, which continuously calculate * the distance travelled by the mouse pointer and warp it back to the center @@ -2318,9 +2319,8 @@ extern "C" { * Note that relative mouse mode may have different mouse acceleration * behavior than pointer warps. * - * If your game or application needs to warp the mouse cursor while hidden for - * other purposes, such as drawing a software cursor, it should disable this - * hint. + * If your application needs to repeatedly warp the hidden mouse cursor at a + * high-frequency for other purposes, it should disable this hint. * * The variable can be set to the following values: * diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 7842f2a636283..06ff779562a6f 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -33,6 +33,8 @@ /* #define DEBUG_MOUSE */ +#define WARP_EMULATION_THRESHOLD_NS SDL_MS_TO_NS(30) + typedef struct SDL_MouseInstance { SDL_MouseID instance_id; @@ -1271,22 +1273,53 @@ void SDL_PerformWarpMouseInWindow(SDL_Window *window, float x, float y, SDL_bool } } -static void SDL_EnableWarpEmulation(SDL_Mouse *mouse) +void SDL_DisableMouseWarpEmulation() +{ + SDL_Mouse *mouse = SDL_GetMouse(); + + if (mouse->warp_emulation_active) { + SDL_SetRelativeMouseMode(SDL_FALSE); + } + + mouse->warp_emulation_prohibited = SDL_TRUE; +} + +static void SDL_MaybeEnableWarpEmulation(SDL_Window *window, float x, float y) { - if (!mouse->cursor_shown && mouse->warp_emulation_hint && !mouse->warp_emulation_prohibited) { - if (SDL_SetRelativeMouseMode(SDL_TRUE) == 0) { - mouse->warp_emulation_active = SDL_TRUE; + SDL_Mouse *mouse = SDL_GetMouse(); + + if (!mouse->warp_emulation_prohibited && mouse->warp_emulation_hint && !mouse->cursor_shown && !mouse->warp_emulation_active) { + if (!window) { + window = mouse->focus; } - /* Disable attempts at enabling warp emulation until further notice. */ - mouse->warp_emulation_prohibited = SDL_TRUE; + if (window) { + const float cx = window->w / 2.f; + const float cy = window->h / 2.f; + if (x >= SDL_floorf(cx) && x <= SDL_ceilf(cx) && + y >= SDL_floorf(cy) && y <= SDL_ceilf(cy)) { + + /* Require two consecutive warps to the center within a certain timespan to enter warp emulation mode. */ + const Uint64 now = SDL_GetTicksNS(); + if (now - mouse->last_center_warp_time_ns < WARP_EMULATION_THRESHOLD_NS) { + if (SDL_SetRelativeMouseMode(SDL_TRUE) == 0) { + mouse->warp_emulation_active = SDL_TRUE; + } + } + + mouse->last_center_warp_time_ns = now; + return; + } + } + + mouse->last_center_warp_time_ns = 0; } } void SDL_WarpMouseInWindow(SDL_Window *window, float x, float y) { SDL_Mouse *mouse = SDL_GetMouse(); - SDL_EnableWarpEmulation(mouse); + SDL_MaybeEnableWarpEmulation(window, x, y); SDL_PerformWarpMouseInWindow(window, x, y, mouse->warp_emulation_active); } @@ -1317,16 +1350,9 @@ int SDL_SetRelativeMouseMode(SDL_bool enabled) SDL_Mouse *mouse = SDL_GetMouse(); SDL_Window *focusWindow = SDL_GetKeyboardFocus(); - if (enabled) { - if (mouse->warp_emulation_active) { - mouse->warp_emulation_active = SDL_FALSE; - } - - /* If the app has used relative mode before, it probably shouldn't - * also be emulating it using repeated mouse warps, so disable - * mouse warp emulation by default. - */ - mouse->warp_emulation_prohibited = SDL_TRUE; + if (!enabled) { + /* If warps were being emulated, reset the flag. */ + mouse->warp_emulation_active = SDL_FALSE; } if (enabled == mouse->relative_mode) { @@ -1701,7 +1727,6 @@ int SDL_ShowCursor(void) if (mouse->warp_emulation_active) { SDL_SetRelativeMouseMode(SDL_FALSE); mouse->warp_emulation_active = SDL_FALSE; - mouse->warp_emulation_prohibited = SDL_FALSE; } if (!mouse->cursor_shown) { diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h index fd6456f91fe10..3b8d89a432a36 100644 --- a/src/events/SDL_mouse_c.h +++ b/src/events/SDL_mouse_c.h @@ -97,6 +97,7 @@ typedef struct SDL_bool warp_emulation_hint; SDL_bool warp_emulation_active; SDL_bool warp_emulation_prohibited; + Uint64 last_center_warp_time_ns; int relative_mode_clip_interval; SDL_bool enable_normal_speed_scale; float normal_speed_scale; @@ -183,6 +184,7 @@ extern void SDL_PerformWarpMouseInWindow(SDL_Window *window, float x, float y, S extern int SDL_SetRelativeMouseMode(SDL_bool enabled); extern SDL_bool SDL_GetRelativeMouseMode(void); extern void SDL_UpdateRelativeMouseMode(void); +extern void SDL_DisableMouseWarpEmulation(void); /* TODO RECONNECT: Set mouse state to "zero" */ #if 0 diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index cc2f70976bb5c..f4fc4d286fc6f 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -3786,6 +3786,12 @@ int SDL_SetWindowRelativeMouseMode(SDL_Window *window, SDL_bool enabled) { CHECK_WINDOW_MAGIC(window, -1); + /* If the app toggles relative mode directly, it probably shouldn't + * also be emulating it using repeated mouse warps, so disable + * mouse warp emulation by default. + */ + SDL_DisableMouseWarpEmulation(); + if (enabled == SDL_GetWindowRelativeMouseMode(window)) { return 0; } From d2bdfd7792d9c9c8ecb9c42e0ea175632faa7413 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Thu, 8 Aug 2024 17:56:53 +0000 Subject: [PATCH 242/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_hints.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 1c20b7a0f6403..575b81487014e 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2310,8 +2310,8 @@ extern "C" { * relative mouse mode. * * When this hint is set, the mouse cursor is hidden, and multiple warps to - * the window center occur within a short time period, SDL will emulate - * mouse warps using relative mouse mode. This can provide smoother and more + * the window center occur within a short time period, SDL will emulate mouse + * warps using relative mouse mode. This can provide smoother and more * reliable mouse motion for some older games, which continuously calculate * the distance travelled by the mouse pointer and warp it back to the center * of the window, rather than using relative mouse motion. From 74504e0965b8e71330599efed3ea237e23e871c1 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Aug 2024 13:24:43 -0700 Subject: [PATCH 243/253] cocoa: removed relative mode handling on focus change This is now being done at a higher level, so we don't want to duplicate it here. Fixes the mouse cursor staying hidden if you enable relative mode, alt-tab away and then alt-tab back. --- src/video/cocoa/SDL_cocoamouse.m | 27 ++++++++++----------------- src/video/cocoa/SDL_cocoawindow.m | 12 +----------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index acb733f670825..647c469c24bc9 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -316,11 +316,19 @@ static int Cocoa_WarpMouse(SDL_Window *window, float x, float y) static int Cocoa_SetRelativeMouseMode(SDL_bool enabled) { - SDL_Window *window = SDL_GetKeyboardFocus(); CGError result; - SDL_CocoaWindowData *data; + if (enabled) { + SDL_Window *window = SDL_GetKeyboardFocus(); if (window) { + /* We will re-apply the relative mode when the window finishes being moved, + * if it is being moved right now. + */ + SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal; + if ([data.listener isMovingOrFocusClickPending]) { + return 0; + } + /* make sure the mouse isn't at the corner of the window, as this can confuse things if macOS thinks a window resize is happening on the first click. */ const CGPoint point = CGPointMake((float)(window->x + (window->w / 2)), (float)(window->y + (window->h / 2))); Cocoa_HandleMouseWarp(point.x, point.y); @@ -336,21 +344,6 @@ static int Cocoa_SetRelativeMouseMode(SDL_bool enabled) return SDL_SetError("CGAssociateMouseAndMouseCursorPosition() failed"); } - /* We will re-apply the non-relative mode when the window gets focus, if it - * doesn't have focus right now. - */ - if (!window) { - return 0; - } - - /* We will re-apply the non-relative mode when the window finishes being moved, - * if it is being moved right now. - */ - data = (__bridge SDL_CocoaWindowData *)window->internal; - if ([data.listener isMovingOrFocusClickPending]) { - return 0; - } - /* The hide/unhide calls are redundant most of the time, but they fix * https://bugzilla.libsdl.org/show_bug.cgi?id=2550 */ diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index cbd01c90822c0..a457a5a53f200 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1166,18 +1166,13 @@ - (void)windowDidDeminiaturize:(NSNotification *)aNotification - (void)windowDidBecomeKey:(NSNotification *)aNotification { SDL_Window *window = _data.window; - SDL_Mouse *mouse = SDL_GetMouse(); /* We're going to get keyboard events, since we're key. */ /* This needs to be done before restoring the relative mouse mode. */ Cocoa_SetKeyboardFocus(_data.keyboard_focus ? _data.keyboard_focus : window); - if (mouse->relative_mode && !mouse->relative_mode_warp && ![self isMovingOrFocusClickPending]) { - mouse->SetRelativeMouseMode(SDL_TRUE); - } - /* If we just gained focus we need the updated mouse position */ - if (!mouse->relative_mode) { + if (!(window->flags & SDL_WINDOW_MOUSE_RELATIVE_MODE)) { NSPoint point; float x, y; @@ -1205,11 +1200,6 @@ - (void)windowDidBecomeKey:(NSNotification *)aNotification - (void)windowDidResignKey:(NSNotification *)aNotification { - SDL_Mouse *mouse = SDL_GetMouse(); - if (mouse->relative_mode && !mouse->relative_mode_warp) { - mouse->SetRelativeMouseMode(SDL_FALSE); - } - /* Some other window will get mouse events, since we're not key. */ if (SDL_GetMouseFocus() == _data.window) { SDL_SetMouseFocus(NULL); From 4cc3410dce50cefce98d3cf3cf1bc8eca83b862a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Aug 2024 14:36:44 -0700 Subject: [PATCH 244/253] Added SDL_GetAudioFormatName() Fixes https://github.com/libsdl-org/SDL/issues/10489 --- include/SDL3/SDL_audio.h | 12 ++++++ src/audio/SDL_audio.c | 19 +++++++++ src/dynapi/SDL_dynapi.sym | 1 + src/dynapi/SDL_dynapi_overrides.h | 1 + src/dynapi/SDL_dynapi_procs.h | 1 + test/testautomation_audio.c | 64 +++++++++++++++++++++++++++++++ 6 files changed, 98 insertions(+) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index d15bbaa6f5145..ba50d0f3da919 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -1996,6 +1996,18 @@ extern SDL_DECLSPEC int SDLCALL SDL_ConvertAudioSamples(const SDL_AudioSpec *src Uint8 **dst_data, int *dst_len); +/** + * Get the human readable name of an audio format. + * + * \param format the audio format to query. + * \returns the human readable name of the specified audio format or + * "SDL_AUDIO_UNKNOWN" if the format isn't recognized. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + */ +extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioFormatName(SDL_AudioFormat format); /** * Get the appropriate memset value for silencing an audio format. diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index b27df57058439..cb907807a0933 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -2173,6 +2173,25 @@ const SDL_AudioFormat *SDL_ClosestAudioFormats(SDL_AudioFormat format) return &format_list[0][NUM_FORMATS]; // not found; return what looks like a list with only a zero in it. } +const char *SDL_GetAudioFormatName(SDL_AudioFormat format) +{ + switch (format) { +#define CASE(X) \ + case X: return #X; + CASE(SDL_AUDIO_U8) + CASE(SDL_AUDIO_S8) + CASE(SDL_AUDIO_S16LE) + CASE(SDL_AUDIO_S16BE) + CASE(SDL_AUDIO_S32LE) + CASE(SDL_AUDIO_S32BE) + CASE(SDL_AUDIO_F32LE) + CASE(SDL_AUDIO_F32BE) +#undef CASE + default: + return "SDL_AUDIO_UNKNOWN"; + } +} + int SDL_GetSilenceValueForFormat(SDL_AudioFormat format) { return (format == SDL_AUDIO_U8) ? 0x80 : 0x00; diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index e9cc39f89228f..7d4b9c23fb508 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -167,6 +167,7 @@ SDL3_0.0.0 { SDL_GetAudioDeviceGain; SDL_GetAudioDeviceName; SDL_GetAudioDriver; + SDL_GetAudioFormatName; SDL_GetAudioPlaybackDevices; SDL_GetAudioRecordingDevices; SDL_GetAudioStreamAvailable; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index cc28c71b32761..5212a3b107c79 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -192,6 +192,7 @@ #define SDL_GetAudioDeviceGain SDL_GetAudioDeviceGain_REAL #define SDL_GetAudioDeviceName SDL_GetAudioDeviceName_REAL #define SDL_GetAudioDriver SDL_GetAudioDriver_REAL +#define SDL_GetAudioFormatName SDL_GetAudioFormatName_REAL #define SDL_GetAudioPlaybackDevices SDL_GetAudioPlaybackDevices_REAL #define SDL_GetAudioRecordingDevices SDL_GetAudioRecordingDevices_REAL #define SDL_GetAudioStreamAvailable SDL_GetAudioStreamAvailable_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 480b38d1c10d9..2deddd0213f27 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -212,6 +212,7 @@ SDL_DYNAPI_PROC(int,SDL_GetAudioDeviceFormat,(SDL_AudioDeviceID a, SDL_AudioSpec SDL_DYNAPI_PROC(float,SDL_GetAudioDeviceGain,(SDL_AudioDeviceID a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetAudioDeviceName,(SDL_AudioDeviceID a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetAudioDriver,(int a),(a),return) +SDL_DYNAPI_PROC(const char*,SDL_GetAudioFormatName,(SDL_AudioFormat a),(a),return) SDL_DYNAPI_PROC(SDL_AudioDeviceID*,SDL_GetAudioPlaybackDevices,(int *a),(a),return) SDL_DYNAPI_PROC(SDL_AudioDeviceID*,SDL_GetAudioRecordingDevices,(int *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetAudioStreamAvailable,(SDL_AudioStream *a),(a),return) diff --git a/test/testautomation_audio.c b/test/testautomation_audio.c index 8ff197492d7be..3b09c68ae2d5c 100644 --- a/test/testautomation_audio.c +++ b/test/testautomation_audio.c @@ -467,7 +467,14 @@ static const char *g_audioFormatsVerbose[] = { "SDL_AUDIO_S32LE", "SDL_AUDIO_S32BE", "SDL_AUDIO_F32LE", "SDL_AUDIO_F32BE" }; +static SDL_AudioFormat g_invalidAudioFormats[] = { + (SDL_AudioFormat)SDL_DEFINE_AUDIO_FORMAT(SDL_AUDIO_MASK_SIGNED, SDL_AUDIO_MASK_BIG_ENDIAN, SDL_AUDIO_MASK_FLOAT, SDL_AUDIO_MASK_BITSIZE) +}; +static const char *g_invalidAudioFormatsVerbose[] = { + "SDL_AUDIO_UNKNOWN" +}; static const int g_numAudioFormats = SDL_arraysize(g_audioFormats); +static const int g_numInvalidAudioFormats = SDL_arraysize(g_invalidAudioFormats); static Uint8 g_audioChannels[] = { 1, 2, 4, 6 }; static const int g_numAudioChannels = SDL_arraysize(g_audioChannels); static int g_audioFrequencies[] = { 11025, 22050, 44100, 48000 }; @@ -483,6 +490,58 @@ SDL_COMPILE_TIME_ASSERT(SDL_AUDIO_S32BE_FORMAT, SDL_AUDIO_S32BE == (SDL_AUDIO_S3 SDL_COMPILE_TIME_ASSERT(SDL_AUDIO_F32LE_FORMAT, SDL_AUDIO_F32LE == (SDL_AUDIO_BITSIZE(32) | SDL_AUDIO_MASK_FLOAT | SDL_AUDIO_MASK_SIGNED)); SDL_COMPILE_TIME_ASSERT(SDL_AUDIO_F32BE_FORMAT, SDL_AUDIO_F32BE == (SDL_AUDIO_F32LE | SDL_AUDIO_MASK_BIG_ENDIAN)); +/** + * Call to SDL_GetAudioFormatName + * + * \sa SDL_GetAudioFormatName + */ +static int audio_getAudioFormatName(void *arg) +{ + const char *error; + int i; + SDL_AudioFormat format; + const char *result; + + /* audio formats */ + for (i = 0; i < g_numAudioFormats; i++) { + format = g_audioFormats[i]; + SDLTest_Log("Audio Format: %s (%d)", g_audioFormatsVerbose[i], format); + + /* Get name of format */ + result = SDL_GetAudioFormatName(format); + SDLTest_AssertPass("Call to SDL_GetAudioFormatName()"); + SDLTest_AssertCheck(result != NULL, "Verify result is not NULL"); + if (result != NULL) { + SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty"); + SDLTest_AssertCheck(SDL_strcmp(result, g_audioFormatsVerbose[i]) == 0, + "Verify result text; expected: %s, got %s", g_audioFormatsVerbose[i], result); + } + } + + /* Negative cases */ + + /* Invalid Formats */ + SDL_ClearError(); + SDLTest_AssertPass("Call to SDL_ClearError()"); + for (i = 0; i < g_numInvalidAudioFormats; i++) { + format = g_invalidAudioFormats[i]; + result = SDL_GetAudioFormatName(format); + SDLTest_AssertPass("Call to SDL_GetAudioFormatName(%d)", format); + SDLTest_AssertCheck(result != NULL, "Verify result is not NULL"); + if (result != NULL) { + SDLTest_AssertCheck(result[0] != '\0', + "Verify result is non-empty; got: %s", result); + SDLTest_AssertCheck(SDL_strcmp(result, g_invalidAudioFormatsVerbose[i]) == 0, + "Validate name is UNKNOWN, expected: '%s', got: '%s'", g_invalidAudioFormatsVerbose[i], result); + } + error = SDL_GetError(); + SDLTest_AssertPass("Call to SDL_GetError()"); + SDLTest_AssertCheck(error == NULL || error[0] == '\0', "Validate that error message is empty"); + } + + return TEST_COMPLETED; +} + /** * Builds various audio conversion structures * @@ -1386,6 +1445,10 @@ static int audio_formatChange(void *arg) /* ================= Test Case References ================== */ /* Audio test cases */ +static const SDLTest_TestCaseReference audioTestGetAudioFormatName = { + audio_getAudioFormatName, "audio_getAudioFormatName", "Call to SDL_GetAudioFormatName", TEST_ENABLED +}; + static const SDLTest_TestCaseReference audioTest1 = { audio_enumerateAndNameAudioDevices, "audio_enumerateAndNameAudioDevices", "Enumerate and name available audio devices (playback and recording)", TEST_ENABLED }; @@ -1462,6 +1525,7 @@ static const SDLTest_TestCaseReference audioTest18 = { /* Sequence of Audio test cases */ static const SDLTest_TestCaseReference *audioTests[] = { + &audioTestGetAudioFormatName, &audioTest1, &audioTest2, &audioTest3, &audioTest4, &audioTest5, &audioTest6, &audioTest7, &audioTest8, &audioTest9, &audioTest10, &audioTest11, &audioTest12, &audioTest13, &audioTest14, &audioTest15, &audioTest16, From e1571d704deffa8b0be640da5068bab51a0ac420 Mon Sep 17 00:00:00 2001 From: KaJe Date: Fri, 9 Aug 2024 01:46:12 -0700 Subject: [PATCH 245/253] Add Cammus C12 VID & PID to wheel device list. Add Cammus C12 in the SDL wheel list to enable wheel detection for them. --- src/joystick/SDL_joystick.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 5f0dd4a3d6fc9..10f75b6d24319 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -391,6 +391,7 @@ static Uint32 initial_wheel_devices[] = { MAKE_VIDPID(0x2433, 0xf303), /* Asetek SimSports La Prima Wheelbase */ MAKE_VIDPID(0x2433, 0xf306), /* Asetek SimSports Tony Kannan Wheelbase */ MAKE_VIDPID(0x3416, 0x0301), /* Cammus C5 Wheelbase */ + MAKE_VIDPID(0x3416, 0x0302), /* Cammus C12 Wheelbase */ MAKE_VIDPID(0x346e, 0x0000), /* Moza R16/R21 Wheelbase */ MAKE_VIDPID(0x346e, 0x0002), /* Moza R9 Wheelbase */ MAKE_VIDPID(0x346e, 0x0004), /* Moza R5 Wheelbase */ From 0acf8343bb1af8bd185d7767dd622e428885e6e4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 9 Aug 2024 08:08:32 -0700 Subject: [PATCH 246/253] Fixed crash if pipewire doesn't detect any devices and doesn't end up being used. Fixes https://github.com/libsdl-org/SDL/issues/10511 --- src/audio/pipewire/SDL_pipewire.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/audio/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c index c22269c8c0770..251b324a38336 100644 --- a/src/audio/pipewire/SDL_pipewire.c +++ b/src/audio/pipewire/SDL_pipewire.c @@ -1269,6 +1269,7 @@ static SDL_bool PIPEWIRE_PREFERRED_Init(SDL_AudioDriverImpl *impl) PIPEWIRE_pw_thread_loop_unlock(hotplug_loop); if (no_devices || !pipewire_core_version_at_least(1, 0, 0)) { + hotplug_loop_destroy(); PIPEWIRE_Deinitialize(); return SDL_FALSE; } From c2085dad8f5fa69dc60c3d648b339a4e71abe989 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 9 Aug 2024 09:19:32 -0700 Subject: [PATCH 247/253] Added SDL_HINT_JOYSTICK_GAMEINPUT --- include/SDL3/SDL_hints.h | 15 +++++++++++++ src/joystick/gdk/SDL_gameinputjoystick.c | 27 +++++++++++++----------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 575b81487014e..983efe23c7b52 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -1226,6 +1226,21 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED "SDL_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED" +/** + * A variable controlling whether GameInput should be used for + * controller handling on Windows. + * + * The variable can be set to the following values: + * + * - "0": GameInput is not used. + * - "1": GameInput is used. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_JOYSTICK_GAMEINPUT "SDL_JOYSTICK_GAMEINPUT" + /** * A variable containing a list of devices known to have a GameCube form * factor. diff --git a/src/joystick/gdk/SDL_gameinputjoystick.c b/src/joystick/gdk/SDL_gameinputjoystick.c index f203bb7a7bead..63b233a11d442 100644 --- a/src/joystick/gdk/SDL_gameinputjoystick.c +++ b/src/joystick/gdk/SDL_gameinputjoystick.c @@ -234,6 +234,10 @@ static int GAMEINPUT_JoystickInit(void) { HRESULT hR; + if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_GAMEINPUT, SDL_TRUE)) { + return 0; + } + if (!g_hGameInputDLL) { g_hGameInputDLL = SDL_LoadObject("gameinput.dll"); if (!g_hGameInputDLL) { @@ -310,22 +314,21 @@ static void GAMEINPUT_JoystickDetect(void) static SDL_bool GAMEINPUT_JoystickIsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name) { - int idx = 0; - GAMEINPUT_InternalDevice *elem = NULL; - SDL_AssertJoysticksLocked(); - if (vendor_id == USB_VENDOR_MICROSOFT && - product_id == USB_PRODUCT_XBOX_ONE_XBOXGIP_CONTROLLER) { - /* The Xbox One controller shows up as a hardcoded raw input VID/PID, which we definitely handle */ - return SDL_TRUE; - } - - for (idx = 0; idx < g_GameInputList.count; ++idx) { - elem = g_GameInputList.devices[idx]; - if (elem && vendor_id == elem->info->vendorId && product_id == elem->info->productId) { + if (g_pGameInput) { + if (vendor_id == USB_VENDOR_MICROSOFT && + product_id == USB_PRODUCT_XBOX_ONE_XBOXGIP_CONTROLLER) { + /* The Xbox One controller shows up as a hardcoded raw input VID/PID, which we definitely handle */ return SDL_TRUE; } + + for (int i = 0; i < g_GameInputList.count; ++i) { + GAMEINPUT_InternalDevice *elem = g_GameInputList.devices[i]; + if (elem && vendor_id == elem->info->vendorId && product_id == elem->info->productId) { + return SDL_TRUE; + } + } } return SDL_FALSE; } From 78b1e0e299c6ff305ffd4c8676aa656c3219fd12 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Fri, 9 Aug 2024 16:57:18 +0000 Subject: [PATCH 248/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_hints.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 983efe23c7b52..57893a383f80d 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -1227,8 +1227,8 @@ extern "C" { #define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED "SDL_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED" /** - * A variable controlling whether GameInput should be used for - * controller handling on Windows. + * A variable controlling whether GameInput should be used for controller + * handling on Windows. * * The variable can be set to the following values: * From 2b853121fe5b88e7e937a3da05a9708d4fa27db6 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 9 Aug 2024 13:26:49 -0700 Subject: [PATCH 249/253] Allow environment hint overrides before hints are initialized Fixes https://github.com/libsdl-org/SDL/issues/10514 --- src/SDL_hints.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/SDL_hints.c b/src/SDL_hints.c index 48b3e6ac795e6..8a79ee16b70d0 100644 --- a/src/SDL_hints.c +++ b/src/SDL_hints.c @@ -196,23 +196,21 @@ const char *SDL_GetHint(const char *name) return NULL; } - const SDL_PropertiesID hints = GetHintProperties(SDL_FALSE); - if (!hints) { - return NULL; - } - const char *retval = SDL_getenv(name); - SDL_LockProperties(hints); + const SDL_PropertiesID hints = GetHintProperties(SDL_FALSE); + if (hints) { + SDL_LockProperties(hints); - SDL_Hint *hint = SDL_GetPointerProperty(hints, name, NULL); - if (hint) { - if (!retval || hint->priority == SDL_HINT_OVERRIDE) { - retval = SDL_GetPersistentString(hint->value); + SDL_Hint *hint = SDL_GetPointerProperty(hints, name, NULL); + if (hint) { + if (!retval || hint->priority == SDL_HINT_OVERRIDE) { + retval = SDL_GetPersistentString(hint->value); + } } - } - SDL_UnlockProperties(hints); + SDL_UnlockProperties(hints); + } return retval; } From a9d70dbacb1ac26ee33ca6de93749619518a3c55 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 26 May 2024 11:38:40 -0400 Subject: [PATCH 250/253] pen: Rework public API. This changes the API in various ways, and updates the backends for this. Overall, this is a massive simplification of the API, as most future backends can't support the previously-offered API. This also removes the testautomation pen code (not only did these interfaces change completely, it also did something no other test did: mock the internal API), and replaces testpen.c with a different implementation (the existing code was fine, it was just easier to start from scratch than update it). --- .../testautomation/testautomation.vcxproj | 6 - .../SDLTest/SDLTest.xcodeproj/project.pbxproj | 2 - include/SDL3/SDL_events.h | 137 +- include/SDL3/SDL_pen.h | 260 +-- src/dynapi/SDL_dynapi.sym | 8 - src/dynapi/SDL_dynapi_overrides.h | 8 - src/dynapi/SDL_dynapi_procs.h | 8 - src/events/SDL_categories.c | 29 +- src/events/SDL_categories_c.h | 4 +- src/events/SDL_events.c | 65 +- src/events/SDL_events_c.h | 1 + src/events/SDL_mouse.c | 9 +- src/events/SDL_pen.c | 1336 ++++-------- src/events/SDL_pen_c.h | 347 +-- src/video/SDL_video.c | 9 + src/video/wayland/SDL_waylandevents.c | 567 ++--- src/video/wayland/SDL_waylandevents_c.h | 47 +- src/video/wayland/SDL_waylandvideo.c | 2 +- src/video/wayland/SDL_waylandvideo.h | 3 +- src/video/x11/SDL_x11events.c | 3 - src/video/x11/SDL_x11pen.c | 756 ++----- src/video/x11/SDL_x11pen.h | 45 +- src/video/x11/SDL_x11video.c | 3 +- src/video/x11/SDL_x11video.h | 9 +- src/video/x11/SDL_x11xinput2.c | 101 +- test/testautomation.c | 3 - test/testautomation_pen.c | 1940 ----------------- test/testautomation_suites.h | 1 - test/testpen.c | 676 ++---- 29 files changed, 1334 insertions(+), 5051 deletions(-) delete mode 100644 test/testautomation_pen.c diff --git a/VisualC/tests/testautomation/testautomation.vcxproj b/VisualC/tests/testautomation/testautomation.vcxproj index af345542d0083..8dd3dfc44151b 100644 --- a/VisualC/tests/testautomation/testautomation.vcxproj +++ b/VisualC/tests/testautomation/testautomation.vcxproj @@ -212,12 +212,6 @@ - - $(ProjectDir)\..\..\..\src;%(AdditionalIncludeDirectories) - $(ProjectDir)\..\..\..\src;%(AdditionalIncludeDirectories) - $(ProjectDir)\..\..\..\src;%(AdditionalIncludeDirectories) - $(ProjectDir)\..\..\..\src;%(AdditionalIncludeDirectories) - diff --git a/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj b/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj index a3b389edca9c0..b1b49715a5521 100644 --- a/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj +++ b/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj @@ -1274,7 +1274,6 @@ 4537749212091504002F0F45 /* testshape.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testshape.app; sourceTree = BUILT_PRODUCTS_DIR; }; 453774A4120915E3002F0F45 /* testshape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testshape.c; sourceTree = ""; }; 66E88E8A203B778F0004D44E /* testyuv_cvt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testyuv_cvt.c; sourceTree = ""; }; - A1A859442BC72FC20045DD6C /* testautomation_pen.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_pen.c; sourceTree = ""; }; A1A859482BC72FC20045DD6C /* testautomation_properties.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_properties.c; sourceTree = ""; }; A1A859492BC72FC20045DD6C /* testautomation_subsystems.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_subsystems.c; sourceTree = ""; }; A1A8594A2BC72FC20045DD6C /* testautomation_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testautomation_log.c; sourceTree = ""; }; @@ -1804,7 +1803,6 @@ F35E56B62983130A00A43A5F /* testautomation_main.c */, F35E56BA2983130B00A43A5F /* testautomation_math.c */, F35E56CD2983130F00A43A5F /* testautomation_mouse.c */, - A1A859442BC72FC20045DD6C /* testautomation_pen.c */, F35E56C02983130C00A43A5F /* testautomation_pixels.c */, F35E56C32983130D00A43A5F /* testautomation_platform.c */, A1A859482BC72FC20045DD6C /* testautomation_properties.c */, diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index 1bf311f819d32..57b412df27713 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -151,8 +151,6 @@ typedef enum SDL_EventType in an event watcher, the window handle is still valid and can still be used to retrieve any userdata associated with the window. Otherwise, the handle has already been destroyed and all resources associated with it are invalid */ - SDL_EVENT_WINDOW_PEN_ENTER, /**< Window has gained focus of the pressure-sensitive pen with ID "data1" */ - SDL_EVENT_WINDOW_PEN_LEAVE, /**< Window has lost focus of the pressure-sensitive pen with ID "data1" */ SDL_EVENT_WINDOW_HDR_STATE_CHANGED, /**< Window HDR properties have changed */ SDL_EVENT_WINDOW_FIRST = SDL_EVENT_WINDOW_SHOWN, SDL_EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_HDR_STATE_CHANGED, @@ -227,11 +225,14 @@ typedef enum SDL_EventType SDL_EVENT_SENSOR_UPDATE = 0x1200, /**< A sensor was updated */ /* Pressure-sensitive pen events */ - SDL_EVENT_PEN_DOWN = 0x1300, /**< Pressure-sensitive pen touched drawing surface */ + SDL_EVENT_PEN_PROXIMITY_IN = 0x1300, /**< Pressure-sensitive pen has become available */ + SDL_EVENT_PEN_PROXIMITY_OUT, /**< Pressure-sensitive pen has become unavailable */ + SDL_EVENT_PEN_DOWN, /**< Pressure-sensitive pen touched drawing surface */ SDL_EVENT_PEN_UP, /**< Pressure-sensitive pen stopped touching drawing surface */ - SDL_EVENT_PEN_MOTION, /**< Pressure-sensitive pen moved, or angle/pressure changed */ SDL_EVENT_PEN_BUTTON_DOWN, /**< Pressure-sensitive pen button pressed */ SDL_EVENT_PEN_BUTTON_UP, /**< Pressure-sensitive pen button released */ + SDL_EVENT_PEN_MOTION, /**< Pressure-sensitive pen is moving on the tablet */ + SDL_EVENT_PEN_AXIS, /**< Pressure-sensitive pen angle/pressure/etc changed */ /* Camera hotplug events */ SDL_EVENT_CAMERA_DEVICE_ADDED = 0x1400, /**< A new camera device is available */ @@ -426,7 +427,7 @@ typedef struct SDL_MouseMotionEvent Uint32 reserved; Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ SDL_WindowID windowID; /**< The window with mouse focus, if any */ - SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */ + SDL_MouseID which; /**< The mouse instance id or SDL_TOUCH_MOUSEID */ SDL_MouseButtonFlags state; /**< The current button state */ float x; /**< X coordinate, relative to window */ float y; /**< Y coordinate, relative to window */ @@ -445,7 +446,7 @@ typedef struct SDL_MouseButtonEvent Uint32 reserved; Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ SDL_WindowID windowID; /**< The window with mouse focus, if any */ - SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */ + SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID */ Uint8 button; /**< The mouse button index */ Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */ @@ -465,7 +466,7 @@ typedef struct SDL_MouseWheelEvent Uint32 reserved; Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ SDL_WindowID windowID; /**< The window with mouse focus, if any */ - SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID, or SDL_PEN_MOUSEID */ + SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID */ float x; /**< The amount scrolled horizontally, positive to the right and negative to the left */ float y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */ SDL_MouseWheelDirection direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */ @@ -714,67 +715,119 @@ typedef struct SDL_TouchFingerEvent SDL_WindowID windowID; /**< The window underneath the finger, if any */ } SDL_TouchFingerEvent; - /** - * Pressure-sensitive pen touched or stopped touching surface (event.ptip.*) + * Pressure-sensitive pen proximity event structure (event.pmotion.*) + * + * When a pen becomes visible to the system (it is close enough to a tablet, + * etc), SDL will send an SDL_EVENT_PEN_PROXIMITY_IN event with the new + * pen's ID. This ID is valid until the pen leaves proximity again (has + * been removed from the tablet's area, the tablet has been unplugged, etc). + * If the same pen reenters proximity again, it will be given a new ID. + * + * Note that "proximity" means "close enough for the tablet to know the tool + * is there." The pen touching and lifting off from the tablet while not + * leaving the area are handled by SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP. * * \since This struct is available since SDL 3.0.0. */ -typedef struct SDL_PenTipEvent +typedef struct SDL_PenProximityEvent { - SDL_EventType type; /**< SDL_EVENT_PEN_DOWN or SDL_EVENT_PEN_UP */ + SDL_EventType type; /**< SDL_EVENT_PEN_PROXIMITY_IN or SDL_EVENT_PEN_PROXIMITY_OUT */ Uint32 reserved; - Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ - SDL_WindowID windowID; /**< The window with pen focus, if any */ + Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ + SDL_WindowID windowID; /**< The window with mouse focus, if any */ SDL_PenID which; /**< The pen instance id */ - Uint8 tip; /**< SDL_PEN_TIP_INK when using a regular pen tip, or SDL_PEN_TIP_ERASER if the pen is being used as an eraser (e.g., flipped to use the eraser tip) */ - Uint8 state; /**< SDL_PRESSED on SDL_EVENT_PEN_DOWN and SDL_RELEASED on SDL_EVENT_PEN_UP */ - Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */ - float x; /**< X coordinate, relative to window */ - float y; /**< Y coordinate, relative to window */ - float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per SDL_PenAxis) */ -} SDL_PenTipEvent; +} SDL_PenProximityEvent; /** - * Pressure-sensitive pen motion / pressure / angle event structure - * (event.pmotion.*) + * Pressure-sensitive pen motion event structure (event.pmotion.*) + * + * Depending on the hardware, you may get motion events when the + * pen is not touching a tablet, for tracking a pen even when it + * isn't drawing. You should listen for SDL_EVENT_PEN_DOWN and + * SDL_EVENT_PEN_UP events, or check `pen_state & SDL_PEN_INPUT_DOWN` + * to decide if a pen is "drawing" when dealing with pen motion. * * \since This struct is available since SDL 3.0.0. */ typedef struct SDL_PenMotionEvent { - SDL_EventType type; /**< SDL_EVENT_PEN_MOTION */ + SDL_EventType type; /**< SDL_EVENT_PEN_MOTION */ + Uint32 reserved; + Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ + SDL_WindowID windowID; /**< The window with mouse focus, if any */ + SDL_PenID which; /**< The pen instance id */ + SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */ + float x; /**< X position of pen on tablet */ + float y; /**< Y position of pen on tablet */ +} SDL_PenMotionEvent; + +/** + * Pressure-sensitive pen touched event structure (event.ptouch.*) + * + * These events come when a pen touches a surface (a tablet, etc), + * or lifts off from one. + * + * \since This struct is available since SDL 3.0.0. + */ +typedef struct SDL_PenTouchEvent +{ + SDL_EventType type; /**< SDL_EVENT_PEN_DOWN or SDL_EVENT_PEN_UP */ Uint32 reserved; Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ SDL_WindowID windowID; /**< The window with pen focus, if any */ SDL_PenID which; /**< The pen instance id */ - Uint8 padding1; - Uint8 padding2; - Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */ - float x; /**< X coordinate, relative to window */ - float y; /**< Y coordinate, relative to window */ - float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per SDL_PenAxis) */ -} SDL_PenMotionEvent; + SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */ + float x; /**< X position of pen on tablet */ + float y; /**< Y position of pen on tablet */ + Uint8 eraser; /**< Non-zero if eraser end is used (not all pens support this). */ + Uint8 state; /**< SDL_PRESSED (pen is touching) or SDL_RELEASED (pen is lifted off) */ +} SDL_PenTouchEvent; /** * Pressure-sensitive pen button event structure (event.pbutton.*) * + * This is for buttons on the pen itself that the user might click. + * The pen itself pressing down to draw triggers a SDL_EVENT_PEN_DOWN + * event instead. + * * \since This struct is available since SDL 3.0.0. */ typedef struct SDL_PenButtonEvent { - SDL_EventType type; /**< SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP */ + SDL_EventType type; /**< SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP */ + Uint32 reserved; + Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ + SDL_WindowID windowID; /**< The window with mouse focus, if any */ + SDL_PenID which; /**< The pen instance id */ + SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */ + float x; /**< X position of pen on tablet */ + float y; /**< Y position of pen on tablet */ + Uint8 button; /**< The pen button index (first button is 1). */ + Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ +} SDL_PenButtonEvent; + +/** + * Pressure-sensitive pen pressure / angle event structure + * (event.paxis.*) + * + * You might get some of these events even if the pen isn't touching the tablet. + * + * \since This struct is available since SDL 3.0.0. + */ +typedef struct SDL_PenAxisEvent +{ + SDL_EventType type; /**< SDL_EVENT_PEN_AXIS */ Uint32 reserved; Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ SDL_WindowID windowID; /**< The window with pen focus, if any */ SDL_PenID which; /**< The pen instance id */ - Uint8 button; /**< The pen button index (1 represents the pen tip for compatibility with mouse events) */ - Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ - Uint16 pen_state; /**< Pen button masks (where SDL_BUTTON(1) is the first button, SDL_BUTTON(2) is the second button etc.), SDL_PEN_DOWN_MASK is set if the pen is touching the surface, and SDL_PEN_ERASER_MASK is set if the pen is (used as) an eraser. */ - float x; /**< X coordinate, relative to window */ - float y; /**< Y coordinate, relative to window */ - float axes[SDL_PEN_NUM_AXES]; /**< Pen axes such as pressure and tilt (ordered as per SDL_PenAxis) */ -} SDL_PenButtonEvent; + SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */ + float x; /**< X position of pen on tablet */ + float y; /**< Y position of pen on tablet */ + SDL_PenAxis axis; /**< Axis that has changed */ + float value; /**< New value of axis */ +} SDL_PenAxisEvent; /** * An event used to drop text or request a file open by the system @@ -894,9 +947,11 @@ typedef union SDL_Event SDL_QuitEvent quit; /**< Quit request event data */ SDL_UserEvent user; /**< Custom event data */ SDL_TouchFingerEvent tfinger; /**< Touch finger event data */ - SDL_PenTipEvent ptip; /**< Pen tip touching or leaving drawing surface */ - SDL_PenMotionEvent pmotion; /**< Pen change in position, pressure, or angle */ - SDL_PenButtonEvent pbutton; /**< Pen button press */ + SDL_PenProximityEvent pproximity; /**< Pen proximity event data */ + SDL_PenTouchEvent ptouch; /**< Pen tip touching event data */ + SDL_PenMotionEvent pmotion; /**< Pen motion event data */ + SDL_PenButtonEvent pbutton; /**< Pen button event data */ + SDL_PenAxisEvent paxis; /**< Pen axis event data */ SDL_DropEvent drop; /**< Drag and drop event data */ SDL_ClipboardEvent clipboard; /**< Clipboard event data */ diff --git a/include/SDL3/SDL_pen.h b/include/SDL3/SDL_pen.h index c02c0081f2b7e..02b22b07fb90a 100644 --- a/include/SDL3/SDL_pen.h +++ b/include/SDL3/SDL_pen.h @@ -22,259 +22,85 @@ /** * # CategoryPen * - * Include file for SDL pen event handling. + * SDL pen event handling. * - * This file describes operations for pressure-sensitive pen (stylus and/or + * SDL provides an API for pressure-sensitive pen (stylus and/or * eraser) handling, e.g., for input and drawing tablets or suitably equipped * mobile / tablet devices. * - * To get started with pens: + * To get started with pens, simply handle SDL_EVENT_PEN_* events. When a pen + * starts providing input, SDL will assign it a unique SDL_PenID, which will + * remain for the life of the process, as long as the pen stays connected. * - * - Listen to SDL_PenMotionEvent and SDL_PenButtonEvent - * - To avoid treating pen events as mouse events, ignore SDL_MouseMotionEvent - * and SDL_MouseButtonEvent whenever `which` == SDL_PEN_MOUSEID. - * - * We primarily identify pens by SDL_PenID. The implementation makes a best - * effort to relate each SDL_PenID to the same physical device during a - * session. Formerly valid SDL_PenID values remain valid even if a device - * disappears. - * - * For identifying pens across sessions, the API provides the type SDL_GUID . + * Pens may provide more than simple touch input; they might have other axes, + * such as pressure, tilt, rotation, etc. */ #ifndef SDL_pen_h_ #define SDL_pen_h_ #include -#include -#include -#include /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif -typedef Uint32 SDL_PenID; /**< SDL_PenIDs identify pens uniquely within a session */ - -#define SDL_PEN_INVALID ((SDL_PenID)0) /**< Reserved invalid SDL_PenID is valid */ - -#define SDL_PEN_MOUSEID ((SDL_MouseID)-2) /**< Device ID for mouse events triggered by pen events */ - -#define SDL_PEN_INFO_UNKNOWN (-1) /**< Marks unknown information when querying the pen */ - /** - * Pen axis indices + * SDL pen instance IDs. * - * Below are the valid indices to the "axis" array from SDL_PenMotionEvent and - * SDL_PenButtonEvent. The axis indices form a contiguous range of ints from 0 - * to SDL_PEN_AXIS_LAST, inclusive. All "axis[]" entries are either normalised - * to 0..1 or report a (positive or negative) angle in degrees, with 0.0 - * representing the centre. Not all pens/backends support all axes: - * unsupported entries are always "0.0f". + * Zero is used to signify an invalid/null device. * - * To convert angles for tilt and rotation into vector representation, use - * SDL_sinf on the XTILT, YTILT, or ROTATION component, for example: - * - * `SDL_sinf(xtilt * SDL_PI_F / 180.0)`. - * - * \since This enum is available since SDL 3.0.0 - */ -typedef enum SDL_PenAxis -{ - SDL_PEN_AXIS_PRESSURE = 0, /**< Pen pressure. Unidirectional: 0..1.0 */ - SDL_PEN_AXIS_XTILT, /**< Pen horizontal tilt angle. Bidirectional: -90.0..90.0 (left-to-right). - The physical max/min tilt may be smaller than -90.0 / 90.0, cf. SDL_PenCapabilityInfo */ - SDL_PEN_AXIS_YTILT, /**< Pen vertical tilt angle. Bidirectional: -90.0..90.0 (top-to-down). - The physical max/min tilt may be smaller than -90.0 / 90.0, cf. SDL_PenCapabilityInfo */ - SDL_PEN_AXIS_DISTANCE, /**< Pen distance to drawing surface. Unidirectional: 0.0..1.0 */ - SDL_PEN_AXIS_ROTATION, /**< Pen barrel rotation. Bidirectional: -180..179.9 (clockwise, 0 is facing up, -180.0 is facing down). */ - SDL_PEN_AXIS_SLIDER, /**< Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0..1.0 */ - SDL_PEN_NUM_AXES, /**< Last valid axis index */ - SDL_PEN_AXIS_LAST = SDL_PEN_NUM_AXES - 1 /**< Last axis index plus 1 */ -} SDL_PenAxis; - -/* Pen flags. These share a bitmask space with SDL_BUTTON_LEFT and friends. */ -#define SDL_PEN_FLAG_DOWN_BIT_INDEX 13 /* Bit for storing that pen is touching the surface */ -#define SDL_PEN_FLAG_INK_BIT_INDEX 14 /* Bit for storing has-non-eraser-capability status */ -#define SDL_PEN_FLAG_ERASER_BIT_INDEX 15 /* Bit for storing is-eraser or has-eraser-capability property */ -#define SDL_PEN_FLAG_AXIS_BIT_OFFSET 16 /* Bit for storing has-axis-0 property */ - -#define SDL_PEN_CAPABILITY(capbit) (1ul << (capbit)) -#define SDL_PEN_AXIS_CAPABILITY(axis) SDL_PEN_CAPABILITY((axis) + SDL_PEN_FLAG_AXIS_BIT_OFFSET) - -/* Pen tips */ -#define SDL_PEN_TIP_INK SDL_PEN_FLAG_INK_BIT_INDEX /**< Regular pen tip (for drawing) touched the surface */ -#define SDL_PEN_TIP_ERASER SDL_PEN_FLAG_ERASER_BIT_INDEX /**< Eraser pen tip touched the surface */ - -/** - * Pen capabilities reported by SDL_GetPenCapabilities. + * These show up in pen events when SDL sees input from them. They remain + * consistent as long as SDL can recognize a tool to be the same pen; but if + * a pen physically leaves the area and returns, it might get a new ID. * * \since This datatype is available since SDL 3.0.0. */ -typedef Uint32 SDL_PenCapabilityFlags; - -#define SDL_PEN_DOWN_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_DOWN_BIT_INDEX) /**< Pen tip is currently touching the drawing surface. */ -#define SDL_PEN_INK_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_INK_BIT_INDEX) /**< Pen has a regular drawing tip (SDL_GetPenCapabilities). For events (SDL_PenButtonEvent, SDL_PenMotionEvent, SDL_GetPenStatus) this flag is mutually exclusive with SDL_PEN_ERASER_MASK . */ -#define SDL_PEN_ERASER_MASK SDL_PEN_CAPABILITY(SDL_PEN_FLAG_ERASER_BIT_INDEX) /**< Pen has an eraser tip (SDL_GetPenCapabilities) or is being used as eraser (SDL_PenButtonEvent , SDL_PenMotionEvent , SDL_GetPenStatus) */ -#define SDL_PEN_AXIS_PRESSURE_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_PRESSURE) /**< Pen provides pressure information in axis SDL_PEN_AXIS_PRESSURE */ -#define SDL_PEN_AXIS_XTILT_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_XTILT) /**< Pen provides horizontal tilt information in axis SDL_PEN_AXIS_XTILT */ -#define SDL_PEN_AXIS_YTILT_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_YTILT) /**< Pen provides vertical tilt information in axis SDL_PEN_AXIS_YTILT */ -#define SDL_PEN_AXIS_DISTANCE_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_DISTANCE) /**< Pen provides distance to drawing tablet in SDL_PEN_AXIS_DISTANCE */ -#define SDL_PEN_AXIS_ROTATION_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_ROTATION) /**< Pen provides barrel rotation information in axis SDL_PEN_AXIS_ROTATION */ -#define SDL_PEN_AXIS_SLIDER_MASK SDL_PEN_AXIS_CAPABILITY(SDL_PEN_AXIS_SLIDER) /**< Pen provides slider / finger wheel or similar in axis SDL_PEN_AXIS_SLIDER */ -#define SDL_PEN_AXIS_BIDIRECTIONAL_MASKS (SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK) - -/** - * Pen types - * - * Some pens identify as a particular type of drawing device (e.g., an - * airbrush or a pencil). - * - * \since This enum is available since SDL 3.0.0 - */ -typedef enum SDL_PenSubtype -{ - SDL_PEN_TYPE_UNKNOWN = 0, - SDL_PEN_TYPE_ERASER = 1, /**< Eraser */ - SDL_PEN_TYPE_PEN, /**< Generic pen; this is the default. */ - SDL_PEN_TYPE_PENCIL, /**< Pencil */ - SDL_PEN_TYPE_BRUSH, /**< Brush-like device */ - SDL_PEN_TYPE_AIRBRUSH, /**< Airbrush device that "sprays" ink */ - SDL_PEN_TYPE_LAST = SDL_PEN_TYPE_AIRBRUSH /**< Last valid pen type */ -} SDL_PenSubtype; - +typedef Uint32 SDL_PenID; -/* Function prototypes */ /** - * Retrieves all pens that are connected to the system. - * - * Yields an array of SDL_PenID values. These identify and track pens - * throughout a session. To track pens across sessions (program restart), use - * SDL_GUID . - * - * \param count the number of pens in the array (number of array elements - * minus 1, i.e., not counting the terminator 0). - * \returns a 0 terminated array of SDL_PenID values, or NULL on failure. The - * array must be freed with SDL_free(). On a NULL return, - * SDL_GetError() is set. - * - * \since This function is available since SDL 3.0.0. - */ -extern SDL_DECLSPEC SDL_PenID * SDLCALL SDL_GetPens(int *count); - -/** - * Retrieves the pen's current status. - * - * If the pen is detached (cf. SDL_PenConnected), this operation may return - * default values. + * Pen input flags, as reported by various pen events' `pen_state` field. * - * \param instance_id the pen to query. - * \param x out-mode parameter for pen x coordinate. May be NULL. - * \param y out-mode parameter for pen y coordinate. May be NULL. - * \param axes out-mode parameter for axis information. May be null. The axes - * are in the same order as SDL_PenAxis. - * \param num_axes maximum number of axes to write to "axes". - * \returns a bit mask with the current pen button states (SDL_BUTTON_LMASK - * etc.), possibly SDL_PEN_DOWN_MASK, and exactly one of - * SDL_PEN_INK_MASK or SDL_PEN_ERASER_MASK , or 0 on error (see - * SDL_GetError()). - * - * \since This function is available since SDL 3.0.0. - */ -extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetPenStatus(SDL_PenID instance_id, float *x, float *y, float *axes, size_t num_axes); - -/** - * Retrieves an SDL_PenID for the given SDL_GUID. - * - * \param guid a pen GUID. - * \returns a valid SDL_PenID, or SDL_PEN_INVALID if there is no matching - * SDL_PenID. - * - * \since This function is available since SDL 3.0.0. - */ -extern SDL_DECLSPEC SDL_PenID SDLCALL SDL_GetPenFromGUID(SDL_GUID guid); - -/** - * Retrieves the SDL_GUID for a given SDL_PenID. - * - * \param instance_id the pen to query. - * \returns the corresponding pen GUID; persistent across multiple sessions. - * If "instance_id" is SDL_PEN_INVALID, returns an all-zeroes GUID. - * - * \since This function is available since SDL 3.0.0. + * \since This datatype is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_GetPenGUID(SDL_PenID instance_id); +typedef Uint32 SDL_PenInputFlags; +#define SDL_PEN_INPUT_DOWN (1u << 0) /**< & to see if pen is pressed down */ +#define SDL_PEN_INPUT_BUTTON_1 (1u << 1) /**< & to see if button 1 is pressed */ +#define SDL_PEN_INPUT_BUTTON_2 (1u << 2) /**< & to see if button 2 is pressed */ +#define SDL_PEN_INPUT_BUTTON_3 (1u << 3) /**< & to see if button 3 is pressed */ +#define SDL_PEN_INPUT_BUTTON_4 (1u << 4) /**< & to see if button 4 is pressed */ +#define SDL_PEN_INPUT_BUTTON_5 (1u << 5) /**< & to see if button 5 is pressed */ +#define SDL_PEN_INPUT_ERASER_TIP (1u << 30) /**< & to see if eraser tip is used */ /** - * Checks whether a pen is still attached. + * Pen axis indices. * - * If a pen is detached, it will not show up for SDL_GetPens(). Other - * operations will still be available but may return default values. + * These are the valid values for the `axis` field in SDL_PenAxisEvent. + * All axes are either normalised to 0..1 or report a (positive or negative) angle + * in degrees, with 0.0 representing the centre. Not all pens/backends support all + * axes: unsupported axes are always zero. * - * \param instance_id a pen ID. - * \returns SDL_TRUE if "instance_id" is valid and the corresponding pen is - * attached, or SDL_FALSE otherwise. - * - * \since This function is available since SDL 3.0.0. - */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PenConnected(SDL_PenID instance_id); - -/** - * Retrieves a human-readable description for a SDL_PenID. - * - * \param instance_id the pen to query. - * \returns a string that contains the name of the pen, intended for human - * consumption. The string might or might not be localised, depending - * on platform settings. It is not guaranteed to be unique; use - * SDL_GetPenGUID() for (best-effort) unique identifiers. The pointer - * is managed by the SDL pen subsystem and must not be deallocated. - * The pointer remains valid until SDL is shut down. Returns NULL on - * error (cf. SDL_GetError()). + * To convert angles for tilt and rotation into vector representation, use + * SDL_sinf on the XTILT, YTILT, or ROTATION component, for example: * - * \since This function is available since SDL 3.0.0. - */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetPenName(SDL_PenID instance_id); - -/** - * Pen capabilities, as reported by SDL_GetPenCapabilities() + * `SDL_sinf(xtilt * SDL_PI_F / 180.0)`. * - * \since This struct is available since SDL 3.0.0. + * \since This enum is available since SDL 3.0.0 */ -typedef struct SDL_PenCapabilityInfo +typedef enum SDL_PenAxis { - float max_tilt; /**< Physical maximum tilt angle, for XTILT and YTILT, or SDL_PEN_INFO_UNKNOWN . Pens cannot typically tilt all the way to 90 degrees, so this value is usually less than 90.0. */ - Uint32 wacom_id; /**< For Wacom devices: wacom tool type ID, otherwise 0 (useful e.g. with libwacom) */ - Sint8 num_buttons; /**< Number of pen buttons (not counting the pen tip), or SDL_PEN_INFO_UNKNOWN */ -} SDL_PenCapabilityInfo; - -/** - * Retrieves capability flags for a given SDL_PenID. - * - * \param instance_id the pen to query. - * \param capabilities detail information about pen capabilities, such as the - * number of buttons. - * \returns a set of capability flags, cf. SDL_PEN_CAPABILITIES. - * - * \since This function is available since SDL 3.0.0. - */ -extern SDL_DECLSPEC SDL_PenCapabilityFlags SDLCALL SDL_GetPenCapabilities(SDL_PenID instance_id, SDL_PenCapabilityInfo *capabilities); - -/** - * Retrieves the pen type for a given SDL_PenID. - * - * \param instance_id the pen to query. - * \returns the corresponding pen type (cf. SDL_PenSubtype) or 0 on error. - * Note that the pen type does not dictate whether the pen tip is - * SDL_PEN_TIP_INK or SDL_PEN_TIP_ERASER; to determine whether a pen - * is being used for drawing or in eraser mode, check either the pen - * tip on SDL_EVENT_PEN_DOWN, or the flag SDL_PEN_ERASER_MASK in the - * pen state. - * - * \since This function is available since SDL 3.0.0. - */ -extern SDL_DECLSPEC SDL_PenSubtype SDLCALL SDL_GetPenType(SDL_PenID instance_id); + SDL_PEN_AXIS_PRESSURE, /**< Pen pressure. Unidirectional: 0 to 1.0 */ + SDL_PEN_AXIS_XTILT, /**< Pen horizontal tilt angle. Bidirectional: -90.0 to 90.0 (left-to-right). + The physical max/min tilt may be smaller than -90.0 / 90.0, check SDL_PenCapabilityInfo */ + SDL_PEN_AXIS_YTILT, /**< Pen vertical tilt angle. Bidirectional: -90.0 to 90.0 (top-to-down). + The physical max/min tilt may be smaller than -90.0 / 90.0 check SDL_PenCapabilityInfo */ + SDL_PEN_AXIS_DISTANCE, /**< Pen distance to drawing surface. Unidirectional: 0.0 to 1.0 */ + SDL_PEN_AXIS_ROTATION, /**< Pen barrel rotation. Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down). */ + SDL_PEN_AXIS_SLIDER, /**< Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0 to 1.0 */ + SDL_PEN_NUM_AXES /**< Total known pen axis types in this version of SDL. This number may grow in future releases! */ +} SDL_PenAxis; /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 7d4b9c23fb508..7eb3c21f9a96f 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -355,13 +355,6 @@ SDL3_0.0.0 { SDL_GetNumberProperty; SDL_GetOriginalMemoryFunctions; SDL_GetPathInfo; - SDL_GetPenCapabilities; - SDL_GetPenFromGUID; - SDL_GetPenGUID; - SDL_GetPenName; - SDL_GetPenStatus; - SDL_GetPenType; - SDL_GetPens; SDL_GetPerformanceCounter; SDL_GetPerformanceFrequency; SDL_GetPixelFormatDetails; @@ -611,7 +604,6 @@ SDL3_0.0.0 { SDL_PauseAudioStreamDevice; SDL_PauseHaptic; SDL_PeepEvents; - SDL_PenConnected; SDL_PlayHapticRumble; SDL_PollEvent; SDL_PremultiplyAlpha; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 5212a3b107c79..9567b41143683 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -380,13 +380,6 @@ #define SDL_GetNumberProperty SDL_GetNumberProperty_REAL #define SDL_GetOriginalMemoryFunctions SDL_GetOriginalMemoryFunctions_REAL #define SDL_GetPathInfo SDL_GetPathInfo_REAL -#define SDL_GetPenCapabilities SDL_GetPenCapabilities_REAL -#define SDL_GetPenFromGUID SDL_GetPenFromGUID_REAL -#define SDL_GetPenGUID SDL_GetPenGUID_REAL -#define SDL_GetPenName SDL_GetPenName_REAL -#define SDL_GetPenStatus SDL_GetPenStatus_REAL -#define SDL_GetPenType SDL_GetPenType_REAL -#define SDL_GetPens SDL_GetPens_REAL #define SDL_GetPerformanceCounter SDL_GetPerformanceCounter_REAL #define SDL_GetPerformanceFrequency SDL_GetPerformanceFrequency_REAL #define SDL_GetPixelFormatDetails SDL_GetPixelFormatDetails_REAL @@ -636,7 +629,6 @@ #define SDL_PauseAudioStreamDevice SDL_PauseAudioStreamDevice_REAL #define SDL_PauseHaptic SDL_PauseHaptic_REAL #define SDL_PeepEvents SDL_PeepEvents_REAL -#define SDL_PenConnected SDL_PenConnected_REAL #define SDL_PlayHapticRumble SDL_PlayHapticRumble_REAL #define SDL_PollEvent SDL_PollEvent_REAL #define SDL_PremultiplyAlpha SDL_PremultiplyAlpha_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 2deddd0213f27..471bb8432b516 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -400,13 +400,6 @@ SDL_DYNAPI_PROC(int,SDL_GetNumVideoDrivers,(void),(),return) SDL_DYNAPI_PROC(Sint64,SDL_GetNumberProperty,(SDL_PropertiesID a, const char *b, Sint64 c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_GetOriginalMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),) SDL_DYNAPI_PROC(int,SDL_GetPathInfo,(const char *a, SDL_PathInfo *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_PenCapabilityFlags,SDL_GetPenCapabilities,(SDL_PenID a, SDL_PenCapabilityInfo *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_PenID,SDL_GetPenFromGUID,(SDL_GUID a),(a),return) -SDL_DYNAPI_PROC(SDL_GUID,SDL_GetPenGUID,(SDL_PenID a),(a),return) -SDL_DYNAPI_PROC(const char*,SDL_GetPenName,(SDL_PenID a),(a),return) -SDL_DYNAPI_PROC(Uint32,SDL_GetPenStatus,(SDL_PenID a, float *b, float *c, float *d, size_t e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_PenSubtype,SDL_GetPenType,(SDL_PenID a),(a),return) -SDL_DYNAPI_PROC(SDL_PenID*,SDL_GetPens,(int *a),(a),return) SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceCounter,(void),(),return) SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceFrequency,(void),(),return) SDL_DYNAPI_PROC(const SDL_PixelFormatDetails*,SDL_GetPixelFormatDetails,(SDL_PixelFormat a),(a),return) @@ -647,7 +640,6 @@ SDL_DYNAPI_PROC(int,SDL_PauseAudioDevice,(SDL_AudioDeviceID a),(a),return) SDL_DYNAPI_PROC(int,SDL_PauseAudioStreamDevice,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(int,SDL_PauseHaptic,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_PeepEvents,(SDL_Event *a, int b, SDL_EventAction c, Uint32 d, Uint32 e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_PenConnected,(SDL_PenID a),(a),return) SDL_DYNAPI_PROC(int,SDL_PlayHapticRumble,(SDL_Haptic *a, float b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_bool,SDL_PollEvent,(SDL_Event *a),(a),return) SDL_DYNAPI_PROC(int,SDL_PremultiplyAlpha,(int a, int b, SDL_PixelFormat c, const void *d, int e, SDL_PixelFormat f, void *g, int h, SDL_bool i),(a,b,c,d,e,f,g,h,i),return) diff --git a/src/events/SDL_categories.c b/src/events/SDL_categories.c index cd57c632f988f..657efdf409204 100644 --- a/src/events/SDL_categories.c +++ b/src/events/SDL_categories.c @@ -153,17 +153,24 @@ SDL_EventCategory SDL_GetEventCategory(Uint32 type) case SDL_EVENT_SENSOR_UPDATE: return SDL_EVENTCATEGORY_SENSOR; + case SDL_EVENT_PEN_PROXIMITY_IN: + case SDL_EVENT_PEN_PROXIMITY_OUT: + return SDL_EVENTCATEGORY_PPROXIMITY; + case SDL_EVENT_PEN_DOWN: case SDL_EVENT_PEN_UP: - return SDL_EVENTCATEGORY_PTIP; - - case SDL_EVENT_PEN_MOTION: - return SDL_EVENTCATEGORY_PMOTION; + return SDL_EVENTCATEGORY_PTOUCH; case SDL_EVENT_PEN_BUTTON_DOWN: case SDL_EVENT_PEN_BUTTON_UP: return SDL_EVENTCATEGORY_PBUTTON; + case SDL_EVENT_PEN_MOTION: + return SDL_EVENTCATEGORY_PMOTION; + + case SDL_EVENT_PEN_AXIS: + return SDL_EVENTCATEGORY_PAXIS; + case SDL_EVENT_CAMERA_DEVICE_ADDED: case SDL_EVENT_CAMERA_DEVICE_REMOVED: case SDL_EVENT_CAMERA_DEVICE_APPROVED: @@ -207,15 +214,21 @@ SDL_Window *SDL_GetWindowFromEvent(const SDL_Event *event) case SDL_EVENTCATEGORY_TFINGER: windowID = event->tfinger.windowID; break; - case SDL_EVENTCATEGORY_PTIP: - windowID = event->ptip.windowID; + case SDL_EVENTCATEGORY_PPROXIMITY: + windowID = event->pproximity.windowID; break; - case SDL_EVENTCATEGORY_PMOTION: - windowID = event->pmotion.windowID; + case SDL_EVENTCATEGORY_PTOUCH: + windowID = event->ptouch.windowID; break; case SDL_EVENTCATEGORY_PBUTTON: windowID = event->pbutton.windowID; break; + case SDL_EVENTCATEGORY_PMOTION: + windowID = event->pmotion.windowID; + break; + case SDL_EVENTCATEGORY_PAXIS: + windowID = event->paxis.windowID; + break; case SDL_EVENTCATEGORY_DROP: windowID = event->drop.windowID; break; diff --git a/src/events/SDL_categories_c.h b/src/events/SDL_categories_c.h index b184311fbf26e..6eba1e95f3d54 100644 --- a/src/events/SDL_categories_c.h +++ b/src/events/SDL_categories_c.h @@ -54,9 +54,11 @@ typedef enum SDL_EventCategory SDL_EVENTCATEGORY_QUIT, SDL_EVENTCATEGORY_USER, SDL_EVENTCATEGORY_TFINGER, - SDL_EVENTCATEGORY_PTIP, + SDL_EVENTCATEGORY_PPROXIMITY, + SDL_EVENTCATEGORY_PTOUCH, SDL_EVENTCATEGORY_PMOTION, SDL_EVENTCATEGORY_PBUTTON, + SDL_EVENTCATEGORY_PAXIS, SDL_EVENTCATEGORY_DROP, SDL_EVENTCATEGORY_CLIPBOARD, } SDL_EventCategory; diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index 41be580dced35..d4793653adaef 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -378,6 +378,9 @@ static void SDLCALL SDL_EventLoggingChanged(void *userdata, const char *name, co static void SDL_LogEvent(const SDL_Event *event) { + static const char *pen_axisnames[] = { "PRESSURE", "XTILT", "YTILT", "DISTANCE", "ROTATION", "SLIDER" }; + SDL_COMPILE_TIME_ASSERT(pen_axisnames_array_matches, SDL_arraysize(pen_axisnames) == SDL_PEN_NUM_AXES); + char name[64]; char details[128]; @@ -385,6 +388,7 @@ static void SDL_LogEvent(const SDL_Event *event) if ((SDL_EventLoggingVerbosity < 2) && ((event->type == SDL_EVENT_MOUSE_MOTION) || (event->type == SDL_EVENT_FINGER_MOTION) || + (event->type == SDL_EVENT_PEN_AXIS) || (event->type == SDL_EVENT_PEN_MOTION) || (event->type == SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION) || (event->type == SDL_EVENT_GAMEPAD_SENSOR_UPDATE) || @@ -482,8 +486,6 @@ static void SDL_LogEvent(const SDL_Event *event) SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_RESTORED); SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_MOUSE_ENTER); SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_MOUSE_LEAVE); - SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_PEN_ENTER); - SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_PEN_LEAVE); SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_FOCUS_GAINED); SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_FOCUS_LOST); SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_CLOSE_REQUESTED); @@ -699,45 +701,44 @@ static void SDL_LogEvent(const SDL_Event *event) break; #undef PRINT_FINGER_EVENT -#define PRINT_PTIP_EVENT(event) \ - (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u tip=%u state=%s x=%g y=%g)", \ - (uint)event->ptip.timestamp, (uint)event->ptip.windowID, \ - (uint)event->ptip.which, (uint)event->ptip.tip, \ - event->ptip.state == SDL_PRESSED ? "down" : "up", \ - event->ptip.x, event->ptip.y) +#define PRINT_PTOUCH_EVENT(event) \ + (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u pen_state=%u x=%g y=%g eraser=%s state=%s)", \ + (uint)event->ptouch.timestamp, (uint)event->ptouch.windowID, (uint)event->ptouch.which, (uint)event->ptouch.pen_state, event->ptouch.x, event->ptouch.y, \ + event->ptouch.eraser ? "yes" : "no", event->ptouch.state == SDL_PRESSED ? "down" : "up"); SDL_EVENT_CASE(SDL_EVENT_PEN_DOWN) - PRINT_PTIP_EVENT(event); + PRINT_PTOUCH_EVENT(event); break; SDL_EVENT_CASE(SDL_EVENT_PEN_UP) - PRINT_PTIP_EVENT(event); + PRINT_PTOUCH_EVENT(event); + break; +#undef PRINT_PTOUCH_EVENT + +#define PRINT_PPROXIMITY_EVENT(event) \ + (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u)", \ + (uint)event->pproximity.timestamp, (uint)event->pproximity.windowID, (uint)event->pproximity.which); + SDL_EVENT_CASE(SDL_EVENT_PEN_PROXIMITY_IN) + PRINT_PPROXIMITY_EVENT(event); + break; + SDL_EVENT_CASE(SDL_EVENT_PEN_PROXIMITY_OUT) + PRINT_PPROXIMITY_EVENT(event); + break; +#undef PRINT_PPROXIMITY_EVENT + + SDL_EVENT_CASE(SDL_EVENT_PEN_AXIS) + (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u pen_state=%u x=%g y=%g axis=%s value=%g)", + (uint)event->paxis.timestamp, (uint)event->paxis.windowID, (uint)event->paxis.which, (uint)event->paxis.pen_state, event->paxis.x, event->paxis.y, + ((event->paxis.axis >= 0) && (event->paxis.axis < SDL_arraysize(pen_axisnames))) ? pen_axisnames[event->paxis.axis] : "[UNKNOWN]", event->paxis.value); break; -#undef PRINT_PTIP_EVENT SDL_EVENT_CASE(SDL_EVENT_PEN_MOTION) - (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u state=%08x x=%g y=%g [%g, %g, %g, %g, %g, %g])", - (uint)event->pmotion.timestamp, (uint)event->pmotion.windowID, - (uint)event->pmotion.which, (uint)event->pmotion.pen_state, - event->pmotion.x, event->pmotion.y, - event->pmotion.axes[SDL_PEN_AXIS_PRESSURE], - event->pmotion.axes[SDL_PEN_AXIS_XTILT], - event->pmotion.axes[SDL_PEN_AXIS_YTILT], - event->pmotion.axes[SDL_PEN_AXIS_DISTANCE], - event->pmotion.axes[SDL_PEN_AXIS_ROTATION], - event->pmotion.axes[SDL_PEN_AXIS_SLIDER]); + (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u pen_state=%u x=%g y=%g)", + (uint)event->pmotion.timestamp, (uint)event->pmotion.windowID, (uint)event->pmotion.which, (uint)event->pmotion.pen_state, event->pmotion.x, event->pmotion.y); break; #define PRINT_PBUTTON_EVENT(event) \ - (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u tip=%u state=%s x=%g y=%g axes=[%g, %g, %g, %g, %g, %g])", \ - (uint)event->pbutton.timestamp, (uint)event->pbutton.windowID, \ - (uint)event->pbutton.which, (uint)event->pbutton.button, \ - event->pbutton.state == SDL_PRESSED ? "pressed" : "released", \ - event->pbutton.x, event->pbutton.y, \ - event->pbutton.axes[SDL_PEN_AXIS_PRESSURE], \ - event->pbutton.axes[SDL_PEN_AXIS_XTILT], \ - event->pbutton.axes[SDL_PEN_AXIS_YTILT], \ - event->pbutton.axes[SDL_PEN_AXIS_DISTANCE], \ - event->pbutton.axes[SDL_PEN_AXIS_ROTATION], \ - event->pbutton.axes[SDL_PEN_AXIS_SLIDER]) + (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u pen_state=%u x=%g y=%g button=%u state=%s)", \ + (uint)event->pbutton.timestamp, (uint)event->pbutton.windowID, (uint)event->pbutton.which, (uint)event->pbutton.pen_state, event->pbutton.x, event->pbutton.y, \ + (uint)event->pbutton.button, event->pbutton.state == SDL_PRESSED ? "down" : "up"); SDL_EVENT_CASE(SDL_EVENT_PEN_BUTTON_DOWN) PRINT_PBUTTON_EVENT(event); break; diff --git a/src/events/SDL_events_c.h b/src/events/SDL_events_c.h index 32e00cb1f611c..ba37401ea40aa 100644 --- a/src/events/SDL_events_c.h +++ b/src/events/SDL_events_c.h @@ -33,6 +33,7 @@ #include "SDL_keyboard_c.h" #include "SDL_mouse_c.h" #include "SDL_touch_c.h" +#include "SDL_pen_c.h" #include "SDL_windowevents_c.h" /* Start and stop the event processing loop */ diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 06ff779562a6f..5af1906f9ee70 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -26,7 +26,6 @@ #include "../video/SDL_sysvideo.h" #include "SDL_events_c.h" #include "SDL_mouse_c.h" -#include "SDL_pen_c.h" #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) #include "../core/windows/SDL_windows.h" // For GetDoubleClickTime() #endif @@ -254,6 +253,7 @@ int SDL_PreInitMouse(void) mouse->was_touch_mouse_events = SDL_FALSE; /* no touch to mouse movement event pending */ mouse->cursor_shown = SDL_TRUE; + return 0; } @@ -272,8 +272,6 @@ void SDL_PostInitMouse(void) SDL_DestroySurface(surface); } } - - SDL_PenInit(); } SDL_bool SDL_IsMouse(Uint16 vendor, Uint16 product) @@ -741,7 +739,7 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_ float xrel = 0.0f; float yrel = 0.0f; - if ((!mouse->relative_mode || mouse->warp_emulation_active) && mouseID != SDL_TOUCH_MOUSEID && mouseID != SDL_PEN_MOUSEID) { + if ((!mouse->relative_mode || mouse->warp_emulation_active) && mouseID != SDL_TOUCH_MOUSEID) { /* We're not in relative mode, so all mouse events are global mouse events */ mouseID = SDL_GLOBAL_MOUSE_ID; } @@ -935,7 +933,7 @@ static int SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_ Uint32 buttonstate; SDL_MouseInputSource *source; - if (!mouse->relative_mode && mouseID != SDL_TOUCH_MOUSEID && mouseID != SDL_PEN_MOUSEID) { + if (!mouse->relative_mode && mouseID != SDL_TOUCH_MOUSEID) { /* We're not in relative mode, so all mouse events are global mouse events */ mouseID = SDL_GLOBAL_MOUSE_ID; } @@ -1101,7 +1099,6 @@ void SDL_QuitMouse(void) } SDL_SetRelativeMouseMode(SDL_FALSE); SDL_ShowCursor(); - SDL_PenQuit(); if (mouse->def_cursor) { SDL_SetDefaultCursor(NULL); diff --git a/src/events/SDL_pen.c b/src/events/SDL_pen.c index ac33ee4cffa12..df5860fc36e46 100644 --- a/src/events/SDL_pen.c +++ b/src/events/SDL_pen.c @@ -26,1088 +26,484 @@ #include "SDL_events_c.h" #include "SDL_pen_c.h" -#define PEN_MOUSE_EMULATE 0 /* pen behaves like mouse */ -#define PEN_MOUSE_STATELESS 1 /* pen does not update mouse state */ -#define PEN_MOUSE_DISABLED 2 /* pen does not send mouse events */ - -/* flags that are not SDL_PEN_FLAG_ */ -#define PEN_FLAGS_CAPABILITIES (~(SDL_PEN_FLAG_NEW | SDL_PEN_FLAG_DETACHED | SDL_PEN_FLAG_STALE)) - -#define PEN_GET_PUBLIC_STATUS_MASK(pen) (((pen)->header.flags & (SDL_PEN_ERASER_MASK | SDL_PEN_DOWN_MASK))) - -static int pen_mouse_emulation_mode = PEN_MOUSE_EMULATE; /* SDL_HINT_PEN_NOT_MOUSE */ - -static int pen_delay_mouse_button_mode = 1; /* SDL_HINT_PEN_DELAY_MOUSE_BUTTON */ - -#ifndef SDL_THREADS_DISABLED -static SDL_Mutex *SDL_pen_access_lock; -# define SDL_LOCK_PENS() SDL_LockMutex(SDL_pen_access_lock) -# define SDL_UNLOCK_PENS() SDL_UnlockMutex(SDL_pen_access_lock) -#else -# define SDL_LOCK_PENS() -# define SDL_UNLOCK_PENS() -#endif - -static struct -{ - SDL_Pen *pens; /* if "sorted" is SDL_TRUE: - sorted by: (is-attached, id): - - first all attached pens, in ascending ID order - - then all detached pens, in ascending ID order */ - size_t pens_allocated; /* # entries allocated to "pens" */ - size_t pens_known; /* <= pens_allocated; this includes detached pens */ - size_t pens_attached; /* <= pens_known; all attached pens are at the beginning of "pens" */ - SDL_bool sorted; /* This is SDL_FALSE in the period between SDL_PenGCMark() and SDL_PenGCSWeep() */ -} pen_handler; - -static SDL_PenID pen_invalid = { SDL_PEN_INVALID }; - -static SDL_GUID pen_guid_zero = { { 0 } }; - -#define SDL_LOAD_LOCK_PEN(penvar, instance_id, err_return) \ - SDL_Pen *penvar; \ - if (instance_id == SDL_PEN_INVALID) { \ - SDL_SetError("Invalid SDL_PenID"); \ - return (err_return); \ - } \ - SDL_LOCK_PENS();\ - penvar = SDL_GetPenPtr(instance_id); \ - if (!(penvar)) { \ - SDL_SetError("Stale SDL_PenID"); \ - SDL_UNLOCK_PENS(); \ - return (err_return); \ +typedef struct SDL_Pen +{ + SDL_PenID instance_id; + char *name; + SDL_PenInfo info; + float axes[SDL_PEN_NUM_AXES]; + float x; + float y; + SDL_PenInputFlags input_state; + void *driverdata; +} SDL_Pen; + +// we assume there's usually 0-1 pens in most cases and this list doesn't +// usually change after startup, so a simple array with a RWlock is fine for now. +static SDL_RWLock *pen_device_rwlock = NULL; +static SDL_Pen *pen_devices SDL_GUARDED_BY(pen_device_rwlock) = NULL; +static int pen_device_count SDL_GUARDED_BY(pen_device_rwlock) = 0; + +// You must hold pen_device_rwlock before calling this, and retval is only safe while lock is held! +// If SDL isn't initialized, grabbing the NULL lock is a no-op and there will be zero devices, so +// locking and calling this in that case will do the right thing. +static SDL_Pen *FindPenByInstanceId(SDL_PenID instance_id) SDL_REQUIRES_SHARED(pen_device_rwlock) +{ + if (instance_id) { + for (int i = 0; i < pen_device_count; i++) { + if (pen_devices[i].instance_id == instance_id) { + return &pen_devices[i]; + } + } } - -static int SDL_GUIDCompare(SDL_GUID lhs, SDL_GUID rhs) -{ - return SDL_memcmp(lhs.data, rhs.data, sizeof(lhs.data)); + SDL_SetError("Invalid pen instance ID"); + return NULL; } -static int SDLCALL pen_compare(const void *lhs, const void *rhs) +SDL_PenID SDL_FindPenByHandle(void *handle) { - int left_inactive = (((const SDL_Pen *)lhs)->header.flags & SDL_PEN_FLAG_DETACHED); - int right_inactive = (((const SDL_Pen *)rhs)->header.flags & SDL_PEN_FLAG_DETACHED); - if (left_inactive && !right_inactive) { - return 1; - } - if (!left_inactive && right_inactive) { - return -1; + SDL_PenID retval = 0; + SDL_LockRWLockForReading(pen_device_rwlock); + for (int i = 0; i < pen_device_count; i++) { + if (pen_devices[i].driverdata == handle) { + retval = pen_devices[i].instance_id; + break; + } } - return ((const SDL_Pen *)lhs)->header.id - ((const SDL_Pen *)rhs)->header.id; + SDL_UnlockRWLock(pen_device_rwlock); + return retval; } -static int SDLCALL pen_header_compare(const void *lhs, const void *rhs) +SDL_PenID SDL_FindPenByCallback(SDL_bool (*callback)(void *handle, void *userdata), void *userdata) { - const SDL_PenHeader *l = (const SDL_PenHeader *)lhs; - const SDL_PenHeader *r = (const SDL_PenHeader *)rhs; - int l_detached = l->flags & SDL_PEN_FLAG_DETACHED; - int r_detached = r->flags & SDL_PEN_FLAG_DETACHED; - - if (l_detached != r_detached) { - if (l_detached) { - return -1; + SDL_PenID retval = 0; + SDL_LockRWLockForReading(pen_device_rwlock); + for (int i = 0; i < pen_device_count; i++) { + if (callback(pen_devices[i].driverdata, userdata)) { + retval = pen_devices[i].instance_id; + break; } - return 1; } - - return l->id - r->id; + SDL_UnlockRWLock(pen_device_rwlock); + return retval; } -SDL_Pen *SDL_GetPenPtr(Uint32 instance_id) -{ - unsigned int i; - - if (!pen_handler.pens) { - return NULL; - } - if (pen_handler.sorted) { - SDL_PenHeader key; - SDL_Pen *pen; - SDL_zero(key); - key.id = instance_id; - - pen = (SDL_Pen *)SDL_bsearch(&key, pen_handler.pens, pen_handler.pens_known, sizeof(SDL_Pen), pen_header_compare); - if (pen) { - return pen; - } - /* If the pen is not active, fall through */ - } - - /* fall back to linear search */ - for (i = 0; i < pen_handler.pens_known; ++i) { - if (pen_handler.pens[i].header.id == instance_id) { - return &pen_handler.pens[i]; - } - } - return NULL; -} +// public API ... -SDL_PenID *SDL_GetPens(int *count) +int SDL_InitPen(void) { - int i; - int pens_nr = (int)pen_handler.pens_attached; - SDL_PenID *pens = (SDL_PenID *)SDL_calloc(pens_nr + 1, sizeof(SDL_PenID)); - if (!pens) { /* OOM */ - return pens; - } - - for (i = 0; i < pens_nr; ++i) { - pens[i] = pen_handler.pens[i].header.id; - } - - if (count) { - *count = pens_nr; + SDL_assert(pen_device_rwlock == NULL); + SDL_assert(pen_devices == NULL); + SDL_assert(pen_device_count == 0); + pen_device_rwlock = SDL_CreateRWLock(); + if (!pen_device_rwlock) { + return -1; } - return pens; + return 0; } -SDL_PenID SDL_GetPenFromGUID(SDL_GUID guid) +void SDL_QuitPen(void) { - unsigned int i; - /* Must do linear search */ - SDL_LOCK_PENS(); - for (i = 0; i < pen_handler.pens_known; ++i) { - SDL_Pen *pen = &pen_handler.pens[i]; - - if (0 == SDL_GUIDCompare(guid, pen->guid)) { - SDL_UNLOCK_PENS(); - return pen->header.id; - } - } - SDL_UNLOCK_PENS(); - return pen_invalid; + SDL_DestroyRWLock(pen_device_rwlock); + pen_device_rwlock = 0; + SDL_free(pen_devices); + pen_devices = NULL; + pen_device_count = 0; } -SDL_bool SDL_PenConnected(SDL_PenID instance_id) +#if 0 // not a public API at the moment. +SDL_PenID *SDL_GetPens(int *count) { - SDL_Pen *pen; - SDL_bool result; - - if (instance_id == SDL_PEN_INVALID) { - return SDL_FALSE; + SDL_LockRWLockForReading(pen_device_rwlock); + const int num_devices = pen_device_count; + SDL_PenID *retval = (SDL_PenID *) SDL_malloc((num_devices + 1) * sizeof (SDL_PenID)); + if (retval) { + for (int i = 0; i < num_devices; i++) { + retval[i] = pen_devices[i].instance_id; + } + retval[num_devices] = 0; // null-terminated. } + SDL_UnlockRWLock(pen_device_rwlock); - SDL_LOCK_PENS(); - pen = SDL_GetPenPtr(instance_id); - if (!pen) { - SDL_UNLOCK_PENS(); - return SDL_FALSE; + if (count) { + *count = retval ? num_devices : 0; } - result = (pen->header.flags & SDL_PEN_FLAG_DETACHED) ? SDL_FALSE : SDL_TRUE; - SDL_UNLOCK_PENS(); - return result; -} - -SDL_GUID SDL_GetPenGUID(SDL_PenID instance_id) -{ - SDL_GUID result; - SDL_LOAD_LOCK_PEN(pen, instance_id, pen_guid_zero); - result = pen->guid; - SDL_UNLOCK_PENS(); - return result; + return retval; } const char *SDL_GetPenName(SDL_PenID instance_id) { - const char *result; - SDL_LOAD_LOCK_PEN(pen, instance_id, NULL); - result = SDL_GetPersistentString(pen->name); - SDL_UNLOCK_PENS(); - return result; -} - -SDL_PenSubtype SDL_GetPenType(SDL_PenID instance_id) -{ - SDL_PenSubtype result; - SDL_LOAD_LOCK_PEN(pen, instance_id, SDL_PEN_TYPE_UNKNOWN); - result = pen->type; - SDL_UNLOCK_PENS(); + SDL_LockRWLockForReading(pen_device_rwlock); + const SDL_Pen *pen = FindPenByInstanceId(instance_id); + const char *result = pen ? SDL_GetPersistentString(pen->name) : NULL; + SDL_UnlockRWLock(pen_device_rwlock); return result; } -SDL_PenCapabilityFlags SDL_GetPenCapabilities(SDL_PenID instance_id, SDL_PenCapabilityInfo *info) +int SDL_GetPenInfo(SDL_PenID instance_id, SDL_PenInfo *info) { - Uint32 result; - SDL_LOAD_LOCK_PEN(pen, instance_id, 0u); + SDL_LockRWLockForReading(pen_device_rwlock); + const SDL_Pen *pen = FindPenByInstanceId(instance_id); + const int retval = pen ? 0 : -1; if (info) { - *info = pen->info; - } - result = pen->header.flags & PEN_FLAGS_CAPABILITIES; - SDL_UNLOCK_PENS(); - return result; -} - -Uint32 SDL_GetPenStatus(SDL_PenID instance_id, float *x, float *y, float *axes, size_t num_axes) -{ - Uint32 result; - SDL_LOAD_LOCK_PEN(pen, instance_id, 0u); - - if (x) { - *x = pen->last.x; - } - if (y) { - *y = pen->last.y; - } - if (axes && num_axes) { - size_t axes_to_copy = SDL_min(num_axes, SDL_PEN_NUM_AXES); - SDL_memcpy(axes, pen->last.axes, sizeof(float) * axes_to_copy); + if (retval == 0) { + SDL_copyp(info, &pen->info); + } else { + SDL_zerop(info); + } } - result = pen->last.buttons | (pen->header.flags & (SDL_PEN_INK_MASK | SDL_PEN_ERASER_MASK | SDL_PEN_DOWN_MASK)); - SDL_UNLOCK_PENS(); - return result; + SDL_UnlockRWLock(pen_device_rwlock); + return retval; } -/* Backend functionality */ - -/* Sort all pens. Only safe during SDL_LOCK_PENS. */ -static void pen_sort(void) +SDL_PenInputFlags SDL_GetPenStatus(SDL_PenID instance_id, float *axes, int num_axes) { - SDL_qsort(pen_handler.pens, - pen_handler.pens_known, - sizeof(SDL_Pen), - pen_compare); - pen_handler.sorted = SDL_TRUE; -} - -SDL_Pen *SDL_PenModifyBegin(Uint32 instance_id) -{ - SDL_PenID id = { 0 }; - const size_t alloc_growth_constant = 1; /* Expect few pens */ - SDL_Pen *pen; - - id = instance_id; - - if (id == SDL_PEN_INVALID) { - SDL_SetError("Invalid SDL_PenID"); - return NULL; + if (num_axes < 0) { + num_axes = 0; } - SDL_LOCK_PENS(); - pen = SDL_GetPenPtr(id); - - if (!pen) { - if (!pen_handler.pens || pen_handler.pens_known == pen_handler.pens_allocated) { - size_t pens_to_allocate = pen_handler.pens_allocated + alloc_growth_constant; - SDL_Pen *pens; - if (pen_handler.pens) { - pens = (SDL_Pen *)SDL_realloc(pen_handler.pens, sizeof(SDL_Pen) * pens_to_allocate); - SDL_memset(pens + pen_handler.pens_known, 0, - sizeof(SDL_Pen) * (pens_to_allocate - pen_handler.pens_allocated)); - } else { - pens = (SDL_Pen *)SDL_calloc(sizeof(SDL_Pen), pens_to_allocate); + SDL_LockRWLockForReading(pen_device_rwlock); + const SDL_Pen *pen = FindPenByInstanceId(instance_id); + SDL_PenInputFlags retval = 0; + if (pen) { + retval = pen->input_state; + if (axes && num_axes) { + SDL_memcpy(axes, pen->axes, SDL_min(num_axes, SDL_PEN_NUM_AXES) * sizeof (*axes)); + // zero out axes we don't know about, in case the caller built with newer SDL headers that support more of them. + if (num_axes > SDL_PEN_NUM_AXES) { + SDL_memset(&axes[SDL_PEN_NUM_AXES], '\0', (num_axes - SDL_PEN_NUM_AXES) * sizeof (*axes)); } - pen_handler.pens = pens; - pen_handler.pens_allocated = pens_to_allocate; } - pen = &pen_handler.pens[pen_handler.pens_known]; - pen_handler.pens_known += 1; - - /* Default pen initialization */ - pen->header.id = id; - pen->header.flags = SDL_PEN_FLAG_NEW; - pen->info.num_buttons = SDL_PEN_INFO_UNKNOWN; - pen->info.max_tilt = SDL_PEN_INFO_UNKNOWN; - pen->type = SDL_PEN_TYPE_PEN; - pen->name = (char *)SDL_calloc(1, SDL_PEN_MAX_NAME); /* Never deallocated */ } - return pen; + SDL_UnlockRWLock(pen_device_rwlock); + return retval; } -void SDL_PenModifyAddCapabilities(SDL_Pen *pen, Uint32 capabilities) +SDL_bool SDL_PenConnected(SDL_PenID instance_id) { - if (capabilities & SDL_PEN_ERASER_MASK) { - pen->header.flags &= ~SDL_PEN_INK_MASK; - } else if (capabilities & SDL_PEN_INK_MASK) { - pen->header.flags &= ~SDL_PEN_ERASER_MASK; - } - pen->header.flags |= (capabilities & PEN_FLAGS_CAPABILITIES); + SDL_LockRWLockForReading(pen_device_rwlock); + const SDL_Pen *pen = FindPenByInstanceId(instance_id); + const SDL_bool retval = (pen != NULL); + SDL_UnlockRWLock(pen_device_rwlock); + return retval; } +#endif -static void pen_hotplug_attach(SDL_Pen *pen) +SDL_PenCapabilityFlags SDL_GetPenCapabilityFromAxis(SDL_PenAxis axis) { - if (!pen->header.window) { - /* Attach to default window */ - const SDL_Mouse *mouse = SDL_GetMouse(); - SDL_SendPenWindowEvent(0, pen->header.id, mouse->focus); + // the initial capability bits happen to match up, but as + // more features show up later, the bits may no longer be contiguous! + if ((axis >= SDL_PEN_AXIS_PRESSURE) && (axis <= SDL_PEN_AXIS_SLIDER)) { + return ((SDL_PenCapabilityFlags) 1u) << ((SDL_PenCapabilityFlags) axis); } + return 0; // oh well. } -static void pen_hotplug_detach(SDL_Pen *pen) +SDL_PenID SDL_AddPenDevice(Uint64 timestamp, const char *name, const SDL_PenInfo *info, void *handle) { - SDL_SendPenWindowEvent(0, pen->header.id, NULL); -} - -void SDL_PenModifyEnd(SDL_Pen *pen, SDL_bool attach) -{ - SDL_bool is_new = pen->header.flags & SDL_PEN_FLAG_NEW; - SDL_bool was_attached = !(pen->header.flags & (SDL_PEN_FLAG_DETACHED | SDL_PEN_FLAG_NEW)); - SDL_bool broke_sort_order = SDL_FALSE; - - if (pen->type == SDL_PEN_TYPE_NONE) { - /* remove pen */ - if (!is_new) { - if (!(pen->header.flags & SDL_PEN_FLAG_ERROR)) { - SDL_Log("Error: attempt to remove known pen %lu", (unsigned long) pen->header.id); - pen->header.flags |= SDL_PEN_FLAG_ERROR; - } - - /* Treat as detached pen of unknown type instead */ - pen->type = SDL_PEN_TYPE_PEN; - attach = SDL_FALSE; - } else { - pen_handler.pens_known -= 1; - SDL_free(pen->name); - SDL_memset(pen, 0, sizeof(SDL_Pen)); - SDL_UNLOCK_PENS(); - return; - } - } - - pen->header.flags &= ~(SDL_PEN_FLAG_NEW | SDL_PEN_FLAG_STALE | SDL_PEN_FLAG_DETACHED); - if (attach == SDL_FALSE) { - pen->header.flags |= SDL_PEN_FLAG_DETACHED; - if (was_attached) { - broke_sort_order = SDL_TRUE; - if (!is_new) { - pen_handler.pens_attached -= 1; - } - pen_hotplug_detach(pen); - } - } else if (!was_attached || is_new) { - broke_sort_order = SDL_TRUE; - pen_handler.pens_attached += 1; - pen_hotplug_attach(pen); - } - - if (is_new) { - /* default: name */ - if (!pen->name[0]) { - SDL_snprintf(pen->name, SDL_PEN_MAX_NAME, - "%s %lu", - pen->type == SDL_PEN_TYPE_ERASER ? "Eraser" : "Pen", - (unsigned long) pen->header.id); - } - - /* default: enabled axes */ - if (!(pen->header.flags & (SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK))) { - pen->info.max_tilt = 0; /* no tilt => no max_tilt */ - } - - /* sanity-check GUID */ - if (0 == SDL_GUIDCompare(pen->guid, pen_guid_zero)) { - SDL_Log("Error: pen %lu: has GUID 0", (unsigned long) pen->header.id); - } + SDL_assert(handle != NULL); // just allocate a Uint8 so you have a unique pointer if not needed! + SDL_assert(SDL_FindPenByHandle(handle) == 0); // Backends shouldn't double-add pens! + SDL_assert(pen_device_rwlock != NULL); // subsystem should be initialized by now! - /* pen or eraser? */ - if (pen->type == SDL_PEN_TYPE_ERASER || pen->header.flags & SDL_PEN_ERASER_MASK) { - pen->header.flags = (pen->header.flags & ~SDL_PEN_INK_MASK) | SDL_PEN_ERASER_MASK; - pen->type = SDL_PEN_TYPE_ERASER; - } else { - pen->header.flags = (pen->header.flags & ~SDL_PEN_ERASER_MASK) | SDL_PEN_INK_MASK; - } - - broke_sort_order = SDL_TRUE; - } - if (broke_sort_order && pen_handler.sorted) { - /* Maintain sortedness invariant */ - pen_sort(); + char *namecpy = SDL_strdup(name ? name : "Unnamed pen"); + if (!namecpy) { + return 0; } - SDL_UNLOCK_PENS(); -} -void SDL_PenGCMark(void) -{ - unsigned int i; - SDL_LOCK_PENS(); - for (i = 0; i < pen_handler.pens_known; ++i) { - SDL_Pen *pen = &pen_handler.pens[i]; - pen->header.flags |= SDL_PEN_FLAG_STALE; - } - pen_handler.sorted = SDL_FALSE; - SDL_UNLOCK_PENS(); -} + SDL_PenID retval = 0; -void SDL_PenGCSweep(void *context, void (*free_deviceinfo)(Uint32, void *, void *)) -{ - unsigned int i; - pen_handler.pens_attached = 0; + SDL_LockRWLockForWriting(pen_device_rwlock); - SDL_LOCK_PENS(); - /* We don't actually free the SDL_Pen entries, so that we can still answer queries about - formerly active SDL_PenIDs later. */ - for (i = 0; i < pen_handler.pens_known; ++i) { - SDL_Pen *pen = &pen_handler.pens[i]; + SDL_Pen *pen = NULL; + void *ptr = SDL_realloc(pen_devices, (pen_device_count + 1) * sizeof (*pen)); + if (ptr) { + retval = (SDL_PenID) SDL_GetNextObjectID(); + pen_devices = (SDL_Pen *) ptr; + pen = &pen_devices[pen_device_count]; + pen_device_count++; - if (pen->header.flags & SDL_PEN_FLAG_STALE) { - pen->header.flags |= SDL_PEN_FLAG_DETACHED; - pen_hotplug_detach(pen); - if (pen->deviceinfo) { - free_deviceinfo(pen->header.id, pen->deviceinfo, context); - pen->deviceinfo = NULL; - } - } else { - pen_handler.pens_attached += 1; + SDL_zerop(pen); + pen->instance_id = retval; + pen->name = namecpy; + if (info) { + SDL_copyp(&pen->info, info); } - - pen->header.flags &= ~SDL_PEN_FLAG_STALE; + pen->driverdata = handle; + // axes and input state defaults to zero. } - pen_sort(); - /* We could test for changes in the above and send a hotplugging event here */ - SDL_UNLOCK_PENS(); -} - -static void pen_relative_coordinates(SDL_Window *window, SDL_bool window_relative, float *x, float *y) -{ - int win_x, win_y; + SDL_UnlockRWLock(pen_device_rwlock); - if (window_relative) { - return; + if (!pen) { + SDL_free(namecpy); } - SDL_GetWindowPosition(window, &win_x, &win_y); - *x -= win_x; - *y -= win_y; -} - -/* Initialises timestamp, windowID, which, pen_state, x, y, and axes */ -static void event_setup(const SDL_Pen *pen, const SDL_Window *window, Uint64 timestamp, const SDL_PenStatusInfo *status, SDL_Event *event) -{ - Uint16 last_buttons = pen->last.buttons; - if (timestamp == 0) { - /* Generate timestamp ourselves, if needed, so that we report the same timestamp - for the pen event and for any emulated mouse event */ - timestamp = SDL_GetTicksNS(); + if (retval && SDL_EventEnabled(SDL_EVENT_PEN_PROXIMITY_IN)) { + SDL_Event event; + SDL_zero(event); + event.pproximity.type = SDL_EVENT_PEN_PROXIMITY_IN; + event.pproximity.timestamp = timestamp; + event.pproximity.which = retval; + SDL_PushEvent(&event); } - /* This code assumes that all of the SDL_Pen*Event structures have the same layout for these fields. - * This is checked by testautomation_pen.c, pen_memoryLayout(). */ - event->pmotion.timestamp = timestamp; - event->pmotion.windowID = window ? window->id : 0; - event->pmotion.which = pen->header.id; - event->pmotion.pen_state = last_buttons | PEN_GET_PUBLIC_STATUS_MASK(pen); - event->pmotion.x = status->x; - event->pmotion.y = status->y; - SDL_memcpy(event->pmotion.axes, status->axes, SDL_PEN_NUM_AXES * sizeof(float)); + return retval; } - -int SDL_SendPenMotion(Uint64 timestamp, - SDL_PenID instance_id, - SDL_bool window_relative, - const SDL_PenStatusInfo *status) +void SDL_RemovePenDevice(Uint64 timestamp, SDL_PenID instance_id) { - int i; - SDL_Pen *pen = SDL_GetPenPtr(instance_id); - SDL_Event event; - SDL_bool posted = SDL_FALSE; - float x = status->x; - float y = status->y; - float last_x = pen->last.x; - float last_y = pen->last.y; - /* Suppress mouse updates for axis changes or sub-pixel movement: */ - SDL_bool send_mouse_update; - SDL_bool axes_changed = SDL_FALSE; - SDL_Window *window; - - if (!pen) { - return SDL_FALSE; - } - window = pen->header.window; - if (!window) { - return SDL_FALSE; + if (!instance_id) { + return; } - pen_relative_coordinates(window, window_relative, &x, &y); - - /* Check if the event actually modifies any cached axis or location, update as neeed */ - if (x != last_x || y != last_y) { - axes_changed = SDL_TRUE; - pen->last.x = status->x; - pen->last.y = status->y; - } - for (i = 0; i < SDL_PEN_NUM_AXES; ++i) { - if ((pen->header.flags & SDL_PEN_AXIS_CAPABILITY(i)) && (status->axes[i] != pen->last.axes[i])) { - axes_changed = SDL_TRUE; - pen->last.axes[i] = status->axes[i]; + SDL_LockRWLockForWriting(pen_device_rwlock); + SDL_Pen *pen = FindPenByInstanceId(instance_id); + if (pen) { + SDL_free(pen->name); + // we don't free `pen`, it's just part of simple array. Shuffle it out. + const int idx = ((int) (pen - pen_devices)); + SDL_assert((idx >= 0) && (idx < pen_device_count)); + if ( idx < (pen_device_count - 1) ) { + SDL_memmove(&pen_devices[idx], &pen_devices[idx + 1], sizeof (*pen) * ((pen_device_count - idx) - 1)); } - } - if (!axes_changed) { - /* No-op event */ - return SDL_FALSE; - } - - send_mouse_update = (x != last_x) || (y != last_y); - - if (!(SDL_MousePositionInWindow(window, x, y))) { - return SDL_FALSE; - } - if (SDL_EventEnabled(SDL_EVENT_PEN_MOTION)) { - event_setup(pen, window, timestamp, status, &event); - event.pmotion.type = SDL_EVENT_PEN_MOTION; - - posted = SDL_PushEvent(&event) > 0; + SDL_assert(pen_device_count > 0); + pen_device_count--; - if (!posted) { - return SDL_FALSE; + if (pen_device_count) { + void *ptr = SDL_realloc(pen_devices, sizeof (*pen) * pen_device_count); // shrink it down. + if (ptr) { + pen_devices = (SDL_Pen *) ptr; + } + } else { + SDL_free(pen_devices); + pen_devices = NULL; } } + SDL_UnlockRWLock(pen_device_rwlock); - if (send_mouse_update) { - switch (pen_mouse_emulation_mode) { - case PEN_MOUSE_EMULATE: - return (SDL_SendMouseMotion(0, window, SDL_PEN_MOUSEID, SDL_FALSE, x, y)) || posted; - - case PEN_MOUSE_STATELESS: - /* Report mouse event but don't update mouse state */ - if (SDL_EventEnabled(SDL_EVENT_MOUSE_MOTION)) { - event.motion.windowID = window->id; - event.motion.timestamp = timestamp; - event.motion.which = SDL_PEN_MOUSEID; - event.motion.type = SDL_EVENT_MOUSE_MOTION; - event.motion.state = pen->last.buttons | PEN_GET_PUBLIC_STATUS_MASK(pen); - event.motion.x = x; - event.motion.y = y; - event.motion.xrel = last_x - x; - event.motion.yrel = last_y - y; - return (SDL_PushEvent(&event) > 0) || posted; - } - break; - - default: - break; - } + if (pen && SDL_EventEnabled(SDL_EVENT_PEN_PROXIMITY_OUT)) { + SDL_Event event; + SDL_zero(event); + event.pproximity.type = SDL_EVENT_PEN_PROXIMITY_OUT; + event.pproximity.timestamp = timestamp; + event.pproximity.which = instance_id; + SDL_PushEvent(&event); } - return posted; } -int SDL_SendPenTipEvent(Uint64 timestamp, SDL_PenID instance_id, Uint8 state) +// This presumably is happening during video quit, so we don't send PROXIMITY_OUT events here. +void SDL_RemoveAllPenDevices(void (*callback)(SDL_PenID instance_id, void *handle, void *userdata), void *userdata) { - SDL_Pen *pen = SDL_GetPenPtr(instance_id); - SDL_Event event; - SDL_bool posted = SDL_FALSE; - SDL_PenStatusInfo *last = &pen->last; - Uint8 mouse_button = SDL_BUTTON_LEFT; - SDL_Window *window; - - if (!pen) { - return SDL_FALSE; - } - window = pen->header.window; - - if ((state == SDL_PRESSED) && !(window && SDL_MousePositionInWindow(window, last->x, last->y))) { - return SDL_FALSE; - } - - if (state == SDL_PRESSED) { - event.pbutton.type = SDL_EVENT_PEN_DOWN; - pen->header.flags |= SDL_PEN_DOWN_MASK; - } else { - event.pbutton.type = SDL_EVENT_PEN_UP; - pen->header.flags &= ~SDL_PEN_DOWN_MASK; - } - - if (SDL_EventEnabled(event.ptip.type)) { - event_setup(pen, window, timestamp, &pen->last, &event); - - /* Used as eraser? Report eraser event, otherwise ink event */ - event.ptip.tip = (pen->header.flags & SDL_PEN_ERASER_MASK) ? SDL_PEN_TIP_ERASER : SDL_PEN_TIP_INK; - event.ptip.state = state == SDL_PRESSED ? SDL_PRESSED : SDL_RELEASED; - - posted = SDL_PushEvent(&event) > 0; - - if (!posted) { - return SDL_FALSE; + SDL_LockRWLockForWriting(pen_device_rwlock); + if (pen_device_count > 0) { + SDL_assert(pen_devices != NULL); + for (int i = 0; i < pen_device_count; i++) { + callback(pen_devices[i].instance_id, pen_devices[i].driverdata, userdata); + SDL_free(pen_devices[i].name); } } - - /* Mouse emulation */ - if (pen_delay_mouse_button_mode) { - /* Send button events when pen touches / leaves surface */ - mouse_button = pen->last_mouse_button; - if (mouse_button == 0) { - mouse_button = SDL_BUTTON_LEFT; /* No current button? Instead report left mouse button */ - } - /* A button may get released while drawing, but SDL_SendPenButton doesn't reset last_mouse_button - while touching the surface, so release and reset last_mouse_button on pen tip release */ - if (pen->last.buttons == 0 && state == SDL_RELEASED) { - pen->last_mouse_button = 0; + SDL_free(pen_devices); + pen_devices = NULL; + SDL_UnlockRWLock(pen_device_rwlock); +} + +int SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, Uint8 state, Uint8 eraser) +{ + SDL_bool push_event = SDL_FALSE; + SDL_PenInputFlags input_state = 0; + float x = 0.0f; + float y = 0.0f; + + // note that this locks for _reading_ because the lock protects the + // pen_devices array from being reallocated from under us, not the data in it; + // we assume only one thread (in the backend) is modifying an individual pen at + // a time, so it can update input state cleanly here. + SDL_LockRWLockForReading(pen_device_rwlock); + SDL_Pen *pen = FindPenByInstanceId(instance_id); + if (pen) { + input_state = pen->input_state; + x = pen->x; + y = pen->y; + + if (state && ((input_state & SDL_PEN_INPUT_DOWN) == 0)) { + input_state |= SDL_PEN_INPUT_DOWN; + push_event = SDL_TRUE; + } else if (!state && (input_state & SDL_PEN_INPUT_DOWN)) { + input_state &= ~SDL_PEN_INPUT_DOWN; + push_event = SDL_TRUE; } - } - - switch (pen_mouse_emulation_mode) { - case PEN_MOUSE_EMULATE: - return (SDL_SendMouseButton(timestamp, window, SDL_PEN_MOUSEID, state, mouse_button)) || posted; - case PEN_MOUSE_STATELESS: - /* Report mouse event without updating mouse state */ - event.button.type = state == SDL_PRESSED ? SDL_EVENT_MOUSE_BUTTON_DOWN : SDL_EVENT_MOUSE_BUTTON_UP; - if (SDL_EventEnabled(event.button.type)) { - event.button.windowID = window ? window->id : 0; - event.button.timestamp = timestamp; - event.button.which = SDL_PEN_MOUSEID; - - event.button.state = state; - event.button.button = mouse_button; - event.button.clicks = 1; - event.button.x = last->x; - event.button.y = last->y; - return (SDL_PushEvent(&event) > 0) || posted; + if (eraser && ((input_state & SDL_PEN_INPUT_ERASER_TIP) == 0)) { + input_state |= SDL_PEN_INPUT_ERASER_TIP; + push_event = SDL_TRUE; + } else if (!state && (input_state & SDL_PEN_INPUT_ERASER_TIP)) { + input_state &= ~SDL_PEN_INPUT_ERASER_TIP; + push_event = SDL_TRUE; } - break; - default: - break; + pen->input_state = input_state; // we could do an SDL_AtomicSet here if we run into trouble... + } + SDL_UnlockRWLock(pen_device_rwlock); + + int posted = 0; + if (push_event) { + const SDL_EventType evtype = state ? SDL_EVENT_PEN_DOWN : SDL_EVENT_PEN_UP; + if (push_event && SDL_EventEnabled(evtype)) { + SDL_Event event; + SDL_zero(event); + event.ptouch.type = evtype; + event.ptouch.timestamp = timestamp; + event.ptouch.windowID = window ? window->id : 0; + event.ptouch.which = instance_id; + event.ptouch.pen_state = input_state; + event.ptouch.x = x; + event.ptouch.y = y; + event.ptouch.eraser = eraser ? 1 : 0; + event.ptouch.state = state ? SDL_PRESSED : SDL_RELEASED; + posted = (SDL_PushEvent(&event) > 0); + } } + return posted; } -int SDL_SendPenButton(Uint64 timestamp, - SDL_PenID instance_id, - Uint8 state, Uint8 button) -{ - SDL_Pen *pen = SDL_GetPenPtr(instance_id); - SDL_Event event; - SDL_bool posted = SDL_FALSE; - SDL_PenStatusInfo *last = &pen->last; - Uint8 mouse_button = button + 1; /* For mouse emulation, PEN_DOWN counts as button 1, so the first actual button is mouse button 2 */ - SDL_Window *window; - - if (!pen) { - return SDL_FALSE; - } - window = pen->header.window; - - if ((state == SDL_PRESSED) && !(window && SDL_MousePositionInWindow(window, last->x, last->y))) { - return SDL_FALSE; - } - - if (state == SDL_PRESSED) { - event.pbutton.type = SDL_EVENT_PEN_BUTTON_DOWN; - pen->last.buttons |= (1 << (button - 1)); - } else { - event.pbutton.type = SDL_EVENT_PEN_BUTTON_UP; - pen->last.buttons &= ~(1 << (button - 1)); - } - - if (SDL_EventEnabled(event.pbutton.type)) { - event_setup(pen, window, timestamp, &pen->last, &event); - - event.pbutton.button = button; - event.pbutton.state = state == SDL_PRESSED ? SDL_PRESSED : SDL_RELEASED; - - posted = SDL_PushEvent(&event) > 0; - - if (!posted) { - return SDL_FALSE; +int SDL_SendPenAxis(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, SDL_PenAxis axis, float value) +{ + SDL_assert((axis >= 0) && (axis < SDL_PEN_NUM_AXES)); // fix the backend if this triggers. + + SDL_bool push_event = SDL_FALSE; + SDL_PenInputFlags input_state = 0; + float x = 0.0f; + float y = 0.0f; + + // note that this locks for _reading_ because the lock protects the + // pen_devices array from being reallocated from under us, not the data in it; + // we assume only one thread (in the backend) is modifying an individual pen at + // a time, so it can update input state cleanly here. + SDL_LockRWLockForReading(pen_device_rwlock); + SDL_Pen *pen = FindPenByInstanceId(instance_id); + if (pen) { + if (pen->axes[axis] != value) { + pen->axes[axis] = value; // we could do an SDL_AtomicSet here if we run into trouble... + input_state = pen->input_state; + x = pen->x; + y = pen->y; + push_event = SDL_TRUE; } } + SDL_UnlockRWLock(pen_device_rwlock); - /* Mouse emulation */ - if (pen_delay_mouse_button_mode) { - /* Can only change active mouse button while not touching the surface */ - if (!(pen->header.flags & SDL_PEN_DOWN_MASK)) { - if (state == SDL_RELEASED) { - pen->last_mouse_button = 0; - } else { - pen->last_mouse_button = mouse_button; - } - } - /* Defer emulation event */ - return SDL_TRUE; + int posted = 0; + if (push_event && SDL_EventEnabled(SDL_EVENT_PEN_AXIS)) { + SDL_Event event; + SDL_zero(event); + event.paxis.type = SDL_EVENT_PEN_AXIS; + event.paxis.timestamp = timestamp; + event.paxis.windowID = window ? window->id : 0; + event.paxis.which = instance_id; + event.paxis.pen_state = input_state; + event.paxis.x = x; + event.paxis.y = y; + event.paxis.axis = axis; + event.paxis.value = value; + posted = (SDL_PushEvent(&event) > 0); } - switch (pen_mouse_emulation_mode) { - case PEN_MOUSE_EMULATE: - return (SDL_SendMouseButton(timestamp, window, SDL_PEN_MOUSEID, state, mouse_button)) || posted; - - case PEN_MOUSE_STATELESS: - /* Report mouse event without updating mouse state */ - event.button.type = state == SDL_PRESSED ? SDL_EVENT_MOUSE_BUTTON_DOWN : SDL_EVENT_MOUSE_BUTTON_UP; - if (SDL_EventEnabled(event.button.type)) { - event.button.windowID = window ? window->id : 0; - event.button.timestamp = timestamp; - event.button.which = SDL_PEN_MOUSEID; - - event.button.state = state; - event.button.button = mouse_button; - event.button.clicks = 1; - event.button.x = last->x; - event.button.y = last->y; - return (SDL_PushEvent(&event) > 0) || posted; - } - break; - - default: - break; - } return posted; } -int SDL_SendPenWindowEvent(Uint64 timestamp, SDL_PenID instance_id, SDL_Window *window) +int SDL_SendPenMotion(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, float x, float y) { - SDL_EventType event_id = window ? SDL_EVENT_WINDOW_PEN_ENTER : SDL_EVENT_WINDOW_PEN_LEAVE; - SDL_Event event = { 0 }; - SDL_Pen *pen = SDL_GetPenPtr(instance_id); - SDL_bool posted; - - if (!pen) { - return SDL_FALSE; - } + SDL_bool push_event = SDL_FALSE; + SDL_PenInputFlags input_state = 0; - if (pen->header.window == window) { /* (TRIVIAL-EVENT) Nothing new to report */ - return SDL_FALSE; - } - - if (timestamp == 0) { - /* Generate timestamp ourselves, if needed, so that we report the same timestamp - for the pen event and for any emulated mouse event */ - timestamp = SDL_GetTicksNS(); - } - - event.window.type = event_id; - /* If window == NULL and not (TRIVIAL-EVENT), then pen->header.window != NULL */ - event.window.timestamp = timestamp; - event.window.windowID = window ? window->id : pen->header.window->id; - event.window.data1 = instance_id; - posted = (SDL_PushEvent(&event) > 0); - - /* Update after assembling event */ - pen->header.window = window; - - switch (pen_mouse_emulation_mode) { - case PEN_MOUSE_EMULATE: - SDL_SetMouseFocus(event_id == SDL_EVENT_WINDOW_PEN_ENTER ? window : NULL); - break; - - case PEN_MOUSE_STATELESS: - /* Send event without going through mouse API */ - if (event_id == SDL_EVENT_WINDOW_PEN_ENTER) { - event.window.type = SDL_EVENT_WINDOW_MOUSE_ENTER; - } else { - event.window.type = SDL_EVENT_WINDOW_MOUSE_LEAVE; + // note that this locks for _reading_ because the lock protects the + // pen_devices array from being reallocated from under us, not the data in it; + // we assume only one thread (in the backend) is modifying an individual pen at + // a time, so it can update input state cleanly here. + SDL_LockRWLockForReading(pen_device_rwlock); + SDL_Pen *pen = FindPenByInstanceId(instance_id); + if (pen) { + if ((pen->x != x) || (pen->y != y)) { + pen->x = x; // we could do an SDL_AtomicSet here if we run into trouble... + pen->y = y; // we could do an SDL_AtomicSet here if we run into trouble... + input_state = pen->input_state; + push_event = SDL_TRUE; } - posted = posted || (SDL_PushEvent(&event) > 0); - break; - - default: - break; - } - - return posted; -} - -static void SDLCALL SDL_PenUpdateHint(void *userdata, const char *name, const char *oldvalue, const char *newvalue) -{ - int *var = (int *)userdata; - if (newvalue == NULL) { - return; } + SDL_UnlockRWLock(pen_device_rwlock); - if (0 == SDL_strcmp("2", newvalue)) { - *var = 2; - } else if (0 == SDL_strcmp("1", newvalue)) { - *var = 1; - } else if (0 == SDL_strcmp("0", newvalue)) { - *var = 0; - } else { - SDL_Log("Unexpected value for pen hint: '%s'", newvalue); + int posted = 0; + if (push_event && SDL_EventEnabled(SDL_EVENT_PEN_MOTION)) { + SDL_Event event; + SDL_zero(event); + event.pmotion.type = SDL_EVENT_PEN_MOTION; + event.pmotion.timestamp = timestamp; + event.pmotion.windowID = window ? window->id : 0; + event.pmotion.which = instance_id; + event.pmotion.pen_state = input_state; + event.pmotion.x = x; + event.pmotion.y = y; + posted = (SDL_PushEvent(&event) > 0); } -} - -void SDL_PenInit(void) -{ -#if (SDL_PEN_DEBUG_NOID | SDL_PEN_DEBUG_NONWACOM | SDL_PEN_DEBUG_UNKNOWN_WACOM) - printf("[pen] Debugging enabled: noid=%d nonwacom=%d unknown-wacom=%d\n", - SDL_PEN_DEBUG_NOID, SDL_PEN_DEBUG_NONWACOM, SDL_PEN_DEBUG_UNKNOWN_WACOM); -#endif - SDL_AddHintCallback(SDL_HINT_PEN_NOT_MOUSE, - SDL_PenUpdateHint, &pen_mouse_emulation_mode); - SDL_AddHintCallback(SDL_HINT_PEN_DELAY_MOUSE_BUTTON, - SDL_PenUpdateHint, &pen_delay_mouse_button_mode); -#ifndef SDL_THREADS_DISABLED - SDL_pen_access_lock = SDL_CreateMutex(); -#endif + return posted; } -void SDL_PenQuit(void) -{ - unsigned int i; - - SDL_DelHintCallback(SDL_HINT_PEN_NOT_MOUSE, - SDL_PenUpdateHint, &pen_mouse_emulation_mode); - - SDL_DelHintCallback(SDL_HINT_PEN_DELAY_MOUSE_BUTTON, - SDL_PenUpdateHint, &pen_delay_mouse_button_mode); -#ifndef SDL_THREADS_DISABLED - SDL_DestroyMutex(SDL_pen_access_lock); - SDL_pen_access_lock = NULL; -#endif - - if (pen_handler.pens) { - for (i = 0; i < pen_handler.pens_known; ++i) { - SDL_free(pen_handler.pens[i].name); +int SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, Uint8 state, Uint8 button) +{ + if ((button < 1) || (button > 5)) { + return 0; // clamp for now. + } + SDL_bool push_event = SDL_FALSE; + SDL_PenInputFlags input_state = 0; + float x = 0.0f; + float y = 0.0f; + + // note that this locks for _reading_ because the lock protects the + // pen_devices array from being reallocated from under us, not the data in it; + // we assume only one thread (in the backend) is modifying an individual pen at + // a time, so it can update input state cleanly here. + SDL_LockRWLockForReading(pen_device_rwlock); + SDL_Pen *pen = FindPenByInstanceId(instance_id); + if (pen) { + input_state = pen->input_state; + const Uint32 flag = (Uint32) (1u << button); + const Uint8 current = (input_state & flag) ? 1 : 0; + x = pen->x; + y = pen->y; + if (state && !current) { + input_state |= flag; + push_event = SDL_TRUE; + } else if (!state && current) { + input_state &= ~flag; + push_event = SDL_TRUE; } - SDL_free(pen_handler.pens); - /* Reset static pen information */ - SDL_memset(&pen_handler, 0, sizeof(pen_handler)); - } -} - -SDL_bool SDL_PenPerformHitTest(void) -{ - return pen_mouse_emulation_mode == PEN_MOUSE_EMULATE; -} - -/* Vendor-specific bits */ - -/* Default pen names */ -#define PEN_NAME_AES 0 -#define PEN_NAME_ART 1 -#define PEN_NAME_AIRBRUSH 2 -#define PEN_NAME_GENERAL 3 -#define PEN_NAME_GRIP 4 -#define PEN_NAME_INKING 5 -#define PEN_NAME_PRO 6 -#define PEN_NAME_PRO2 7 -#define PEN_NAME_PRO3 8 -#define PEN_NAME_PRO3D 9 -#define PEN_NAME_PRO_SLIM 10 -#define PEN_NAME_STROKE 11 - -#define PEN_NAME_LAST PEN_NAME_STROKE -#define PEN_NUM_NAMES (PEN_NAME_LAST + 1) - -static const char *default_pen_names[] = { - /* PEN_NAME_AES */ - "AES Pen", - /* PEN_NAME_ART */ - "Art Pen", - /* PEN_NAME_AIRBRUSH */ - "Airbrush Pen", - /* PEN_NAME_GENERAL */ - "Pen", - /* PEN_NAME_GRIP */ - "Grip Pen", - /* PEN_NAME_INKING */ - "Inking Pen", - /* PEN_NAME_PRO */ - "Pro Pen", - /* PEN_NAME_PRO2 */ - "Pro Pen 2", - /* PEN_NAME_PRO3 */ - "Pro Pen 3", - /* PEN_NAME_PRO3D */ - "Pro Pen 3D", - /* PEN_NAME_PRO_SLIM */ - "Pro Pen Slim", - /* PEN_NAME_STROKE */ - "Stroke Pen" -}; -SDL_COMPILE_TIME_ASSERT(default_pen_names, SDL_arraysize(default_pen_names) == PEN_NUM_NAMES); - -#define PEN_SPEC_TYPE_SHIFT 0 -#define PEN_SPEC_TYPE_MASK 0x0000000fu -#define PEN_SPEC_BUTTONS_SHIFT 4 -#define PEN_SPEC_BUTTONS_MASK 0x000000f0u -#define PEN_SPEC_NAME_SHIFT 8 -#define PEN_SPEC_NAME_MASK 0x00000f00u -#define PEN_SPEC_AXES_SHIFT 0 -#define PEN_SPEC_AXES_MASK 0xffff0000u - -#define PEN_WACOM_ID_INVALID 0xffffffffu /* Generic "invalid ID" marker */ - -#define PEN_SPEC(name, buttons, type, axes) (0 | (PEN_SPEC_NAME_MASK & ((name) << PEN_SPEC_NAME_SHIFT)) | (PEN_SPEC_BUTTONS_MASK & ((buttons) << PEN_SPEC_BUTTONS_SHIFT)) | (PEN_SPEC_TYPE_MASK & ((type) << PEN_SPEC_TYPE_SHIFT)) | (PEN_SPEC_AXES_MASK & ((axes) << PEN_SPEC_AXES_SHIFT))) - -/* Returns a suitable pen name string from default_pen_names on success, otherwise NULL. */ -static const char *pen_wacom_identify_tool(Uint32 requested_wacom_id, int *num_buttons, int *tool_type, int *axes) -{ - int i; - - /* List of known Wacom pens, extracted from libwacom.stylus and wacom_wac.c in the Linux kernel. - Could be complemented by dlopen()ing libwacom, in the future (if new pens get added). */ - struct - { - /* Compress properties to 8 bytes per device in order to keep memory cost well below 1k. - Could be compressed further with more complex code. */ - Uint32 wacom_id; /* Must be != PEN_WACOM_ID_INVALID */ - Uint32 properties; - } tools[] = { - { 0x0001, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0011, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0019, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0021, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0031, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0039, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0049, PEN_SPEC(PEN_NAME_GENERAL, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0071, PEN_SPEC(PEN_NAME_GENERAL, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0200, PEN_SPEC(PEN_NAME_PRO3, 3, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0221, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0231, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0271, PEN_SPEC(PEN_NAME_GENERAL, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0421, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0431, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0621, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0631, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK) }, - { 0x0801, PEN_SPEC(PEN_NAME_INKING, 0, SDL_PEN_TYPE_PENCIL, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0802, PEN_SPEC(PEN_NAME_GRIP, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0804, PEN_SPEC(PEN_NAME_ART, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK | SDL_PEN_AXIS_ROTATION_MASK) }, - { 0x080a, PEN_SPEC(PEN_NAME_GRIP, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x080c, PEN_SPEC(PEN_NAME_ART, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0812, PEN_SPEC(PEN_NAME_INKING, 0, SDL_PEN_TYPE_PENCIL, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0813, PEN_SPEC(PEN_NAME_GENERAL, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x081b, PEN_SPEC(PEN_NAME_GENERAL, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0822, PEN_SPEC(PEN_NAME_GENERAL, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0823, PEN_SPEC(PEN_NAME_GRIP, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x082a, PEN_SPEC(PEN_NAME_GENERAL, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x082b, PEN_SPEC(PEN_NAME_GRIP, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0832, PEN_SPEC(PEN_NAME_STROKE, 0, SDL_PEN_TYPE_BRUSH, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0842, PEN_SPEC(PEN_NAME_PRO2, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x084a, PEN_SPEC(PEN_NAME_PRO2, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0852, PEN_SPEC(PEN_NAME_GRIP, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x085a, PEN_SPEC(PEN_NAME_GRIP, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0862, PEN_SPEC(PEN_NAME_GENERAL, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0885, PEN_SPEC(PEN_NAME_ART, 0, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK | SDL_PEN_AXIS_ROTATION_MASK) }, - { 0x08e2, PEN_SPEC(PEN_NAME_GENERAL, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0902, PEN_SPEC(PEN_NAME_AIRBRUSH, 1, SDL_PEN_TYPE_AIRBRUSH, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK | SDL_PEN_AXIS_SLIDER_MASK) }, - { 0x090a, PEN_SPEC(PEN_NAME_AIRBRUSH, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0912, PEN_SPEC(PEN_NAME_AIRBRUSH, 1, SDL_PEN_TYPE_AIRBRUSH, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK | SDL_PEN_AXIS_SLIDER_MASK) }, - { 0x0913, PEN_SPEC(PEN_NAME_AIRBRUSH, 1, SDL_PEN_TYPE_AIRBRUSH, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x091a, PEN_SPEC(PEN_NAME_AIRBRUSH, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x091b, PEN_SPEC(PEN_NAME_AIRBRUSH, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x0d12, PEN_SPEC(PEN_NAME_AIRBRUSH, 1, SDL_PEN_TYPE_AIRBRUSH, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK | SDL_PEN_AXIS_SLIDER_MASK) }, - { 0x0d1a, PEN_SPEC(PEN_NAME_AIRBRUSH, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x8051, PEN_SPEC(PEN_NAME_AES, 0, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK) }, - { 0x805b, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK) }, - { 0x806b, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK) }, - { 0x807b, PEN_SPEC(PEN_NAME_GENERAL, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK) }, - { 0x826b, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK) }, - { 0x846b, PEN_SPEC(PEN_NAME_AES, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK) }, - { 0x2802, PEN_SPEC(PEN_NAME_INKING, 0, SDL_PEN_TYPE_PENCIL, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x4200, PEN_SPEC(PEN_NAME_PRO3, 3, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x4802, PEN_SPEC(PEN_NAME_GENERAL, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x480a, PEN_SPEC(PEN_NAME_GENERAL, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x8842, PEN_SPEC(PEN_NAME_PRO3D, 3, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x10802, PEN_SPEC(PEN_NAME_GRIP, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x10804, PEN_SPEC(PEN_NAME_ART, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK | SDL_PEN_AXIS_ROTATION_MASK) }, - { 0x1080a, PEN_SPEC(PEN_NAME_GRIP, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x1080c, PEN_SPEC(PEN_NAME_ART, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x10842, PEN_SPEC(PEN_NAME_PRO_SLIM, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x1084a, PEN_SPEC(PEN_NAME_PRO_SLIM, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x10902, PEN_SPEC(PEN_NAME_AIRBRUSH, 1, SDL_PEN_TYPE_AIRBRUSH, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK | SDL_PEN_AXIS_SLIDER_MASK) }, - { 0x1090a, PEN_SPEC(PEN_NAME_AIRBRUSH, 1, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x12802, PEN_SPEC(PEN_NAME_INKING, 0, SDL_PEN_TYPE_PENCIL, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x14802, PEN_SPEC(PEN_NAME_GENERAL, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x1480a, PEN_SPEC(PEN_NAME_GENERAL, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x16802, PEN_SPEC(PEN_NAME_PRO, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x1680a, PEN_SPEC(PEN_NAME_PRO, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x18802, PEN_SPEC(PEN_NAME_GENERAL, 2, SDL_PEN_TYPE_PEN, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0x1880a, PEN_SPEC(PEN_NAME_GENERAL, 2, SDL_PEN_TYPE_ERASER, SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK) }, - { 0, 0 } - }; - - /* The list of pens is sorted, so we could do binary search, but this call should be pretty rare. */ - for (i = 0; tools[i].wacom_id; ++i) { - if (tools[i].wacom_id == requested_wacom_id) { - Uint32 properties = tools[i].properties; - int name_index = (properties & PEN_SPEC_NAME_MASK) >> PEN_SPEC_NAME_SHIFT; - - *num_buttons = (properties & PEN_SPEC_BUTTONS_MASK) >> PEN_SPEC_BUTTONS_SHIFT; - *tool_type = (properties & PEN_SPEC_TYPE_MASK) >> PEN_SPEC_TYPE_SHIFT; - *axes = (properties & PEN_SPEC_AXES_MASK) >> PEN_SPEC_AXES_SHIFT; - - return default_pen_names[name_index]; + pen->input_state = input_state; // we could do an SDL_AtomicSet here if we run into trouble... + } + SDL_UnlockRWLock(pen_device_rwlock); + + int posted = 0; + if (push_event) { + const SDL_EventType evtype = state ? SDL_EVENT_PEN_BUTTON_DOWN : SDL_EVENT_PEN_BUTTON_UP; + if (push_event && SDL_EventEnabled(evtype)) { + SDL_Event event; + SDL_zero(event); + event.pbutton.type = evtype; + event.pbutton.timestamp = timestamp; + event.pbutton.windowID = window ? window->id : 0; + event.pbutton.which = instance_id; + event.pbutton.pen_state = input_state; + event.pbutton.x = x; + event.pbutton.y = y; + event.pbutton.button = button; + event.pbutton.state = state ? SDL_PRESSED : SDL_RELEASED; + posted = (SDL_PushEvent(&event) > 0); } } - return NULL; -} - -void SDL_PenUpdateGUIDForGeneric(SDL_GUID *guid, Uint32 upper, Uint32 lower) -{ - int i; - - for (i = 0; i < 4; ++i) { - guid->data[8 + i] = (lower >> (i * 8)) & 0xff; - } - - for (i = 0; i < 4; ++i) { - guid->data[12 + i] = (upper >> (i * 8)) & 0xff; - } -} - -void SDL_PenUpdateGUIDForType(SDL_GUID *guid, SDL_PenSubtype pentype) -{ - guid->data[7] = pentype; -} -void SDL_PenUpdateGUIDForWacom(SDL_GUID *guid, Uint32 wacom_devicetype_id, Uint32 wacom_serial_id) -{ - int i; - - for (i = 0; i < 4; ++i) { - guid->data[0 + i] = (wacom_serial_id >> (i * 8)) & 0xff; - } - - for (i = 0; i < 3; ++i) { /* 24 bit values */ - guid->data[4 + i] = (wacom_devicetype_id >> (i * 8)) & 0xff; - } + return posted; } -int SDL_PenModifyForWacomID(SDL_Pen *pen, Uint32 wacom_devicetype_id, Uint32 *axis_flags) -{ - const char *name = NULL; - int num_buttons = 0; - int tool_type = 0; - int axes = 0; - -#if SDL_PEN_DEBUG_UNKNOWN_WACOM - wacom_devicetype_id = PEN_WACOM_ID_INVALID; /* force detection to fail */ -#endif - -#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_FREEBSD) || defined(SDL_PLATFORM_NETBSD) || defined(SDL_PLATFORM_OPENBSD) - /* According to Ping Cheng, the curent Wacom for Linux maintainer, device IDs on Linux - squeeze a "0" nibble after the 3rd (least significant) nibble. - This may also affect the *BSDs, so they are heuristically included here. - On those platforms, we first try the "patched" ID: */ - if (0 == (wacom_devicetype_id & 0x0000f000u)) { - const Uint32 lower_mask = 0xfffu; - int wacom_devicetype_alt_id = ((wacom_devicetype_id & ~lower_mask) >> 4) | (wacom_devicetype_id & lower_mask); - - name = pen_wacom_identify_tool(wacom_devicetype_alt_id, &num_buttons, &tool_type, &axes); - if (name) { - wacom_devicetype_id = wacom_devicetype_alt_id; - } - } -#endif - if (name == NULL) { - name = pen_wacom_identify_tool(wacom_devicetype_id, &num_buttons, &tool_type, &axes); - } - - if (!name) { - *axis_flags = 0; - return SDL_FALSE; - } - - *axis_flags = axes; - - /* Override defaults */ - if (pen->info.num_buttons == SDL_PEN_INFO_UNKNOWN) { - pen->info.num_buttons = (Sint8)SDL_min(num_buttons, SDL_MAX_SINT8); - } - if (pen->type == SDL_PEN_TYPE_PEN) { - pen->type = (SDL_PenSubtype)tool_type; - } - if (pen->info.max_tilt == SDL_PEN_INFO_UNKNOWN) { - /* supposedly: 64 degrees left, 63 right, as reported by the Wacom X11 driver */ - pen->info.max_tilt = 64.0f; - } - pen->info.wacom_id = wacom_devicetype_id; - if (0 == pen->name[0]) { - SDL_snprintf(pen->name, SDL_PEN_MAX_NAME, - "Wacom %s%s", name, (tool_type == SDL_PEN_TYPE_ERASER) ? " Eraser" : ""); - } - return SDL_TRUE; -} diff --git a/src/events/SDL_pen_c.h b/src/events/SDL_pen_c.h index a82b345dbf00a..50f5e9b30fa52 100644 --- a/src/events/SDL_pen_c.h +++ b/src/events/SDL_pen_c.h @@ -27,316 +27,71 @@ #include "../../include/SDL3/SDL_pen.h" #include "SDL_mouse_c.h" -/* For testing alternate code paths: */ -#define SDL_PEN_DEBUG_NOID 0 /* Pretend that pen device does not supply ID / ID is some default value \ - affects: SDL_x11pen.c \ - SDL_waylandevents.c */ -#define SDL_PEN_DEBUG_NONWACOM 0 /* Pretend that no attached device is a Wacom device \ - affects: SDL_x11pen.c \ - SDL_waylandevents.c */ -#define SDL_PEN_DEBUG_UNKNOWN_WACOM 0 /* Pretend that any attached Wacom device is of an unknown make \ - affects: SDL_PenModifyFromWacomID() */ -#define SDL_PEN_DEBUG_NOSERIAL_WACOM 0 /* Pretend that any attached Wacom device has serial number 0 \ - affects: SDL_x11pen.c \ - SDL_waylandevents.c */ - -#define SDL_PEN_TYPE_NONE 0 /**< Pen type for non-pens (use to cancel pen registration) */ - -#define SDL_PEN_MAX_NAME 64 - -#define SDL_PEN_FLAG_ERROR (1ul << 28) /* Printed an internal API usage error about this pen (used to prevent spamming) */ -#define SDL_PEN_FLAG_NEW (1ul << 29) /* Pen was registered in most recent call to SDL_PenRegisterBegin() */ -#define SDL_PEN_FLAG_DETACHED (1ul << 30) /* Detached (not re-registered before last SDL_PenGCSweep()) */ -#define SDL_PEN_FLAG_STALE (1ul << 31) /* Not re-registered since last SDL_PenGCMark() */ - -typedef struct SDL_PenStatusInfo +typedef Uint32 SDL_PenCapabilityFlags; +#define SDL_PEN_CAPABILITY_PRESSURE (1u << 0) /**< Provides pressure information on SDL_PEN_AXIS_PRESSURE. */ +#define SDL_PEN_CAPABILITY_XTILT (1u << 1) /**< Provides horizontal tilt information on SDL_PEN_AXIS_XTILT. */ +#define SDL_PEN_CAPABILITY_YTILT (1u << 2) /**< Provides vertical tilt information on SDL_PEN_AXIS_YTILT. */ +#define SDL_PEN_CAPABILITY_DISTANCE (1u << 3) /**< Provides distance to drawing tablet on SDL_PEN_AXIS_DISTANCE. */ +#define SDL_PEN_CAPABILITY_ROTATION (1u << 4) /**< Provides barrel rotation info on SDL_PEN_AXIS_ROTATION. */ +#define SDL_PEN_CAPABILITY_SLIDER (1u << 5) /**< Provides slider/finger wheel/etc on SDL_PEN_AXIS_SLIDER. */ +#define SDL_PEN_CAPABILITY_ERASER (1u << 6) /**< Pen also has an eraser tip. */ + +typedef enum SDL_PenSubtype { - float x, y; - float axes[SDL_PEN_NUM_AXES]; - Uint16 buttons; /* SDL_BUTTON(1) | SDL_BUTTON(2) | ... | SDL_PEN_DOWN_MASK */ -} SDL_PenStatusInfo; - -typedef struct + SDL_PEN_TYPE_UNKNOWN, /**< Unknown pen device */ + SDL_PEN_TYPE_ERASER, /**< Eraser */ + SDL_PEN_TYPE_PEN, /**< Generic pen; this is the default. */ + SDL_PEN_TYPE_PENCIL, /**< Pencil */ + SDL_PEN_TYPE_BRUSH, /**< Brush-like device */ + SDL_PEN_TYPE_AIRBRUSH /**< Airbrush device that "sprays" ink */ +} SDL_PenSubtype; + +typedef struct SDL_PenInfo { - SDL_PenID id; /* id determines sort order unless SDL_PEN_FLAG_DETACHED is set */ - Uint32 flags; /* SDL_PEN_FLAG_* | SDK_PEN_DOWN_MASK | SDL_PEN_INK_MASK | SDL_PEN_ERASER_MASK | SDL_PEN_AXIS_* */ - SDL_Window *window; /* Current SDL window for this pen, or NULL */ -} SDL_PenHeader; - -/** - * Internal (backend driver-independent) pen representation - * - * Implementation-specific backend drivers may read and write most of this structure, and - * are expected to initialise parts of it when registering a new pen. They must not write - * to the "header" section. - */ -typedef struct SDL_Pen -{ - /* Backend driver MUST NOT not write to: */ - SDL_PenHeader header; - - SDL_PenStatusInfo last; /* Last reported status, normally read-only for backend */ - - /* Backend: MUST initialise this block when pen is first registered: */ - SDL_GUID guid; /* GUID, MUST be set by backend. - MUST be unique (no other pen ID with same GUID). - SHOULD be persistent across sessions. */ - - /* Backend: SHOULD initialise this block when pen is first registered if it can - Otherwise: Set to sane default values during SDL_PenModifyEnd() */ - SDL_PenCapabilityInfo info; /* Detail information about the pen (buttons, tilt) */ - SDL_PenSubtype type; - Uint8 last_mouse_button; /* For mouse button emulation: last emulated button */ - char *name; /* Preallocated; set via SDL_strlcpy(pen->name, src, SDL_PEN_MAX_NAME) */ - /* We hand this exact pointer to client code, so it must not be modified after - creation. */ - - void *deviceinfo; /* implementation-specific information */ -} SDL_Pen; - -/* ---- API for backend driver only ---- */ - -/** - * (Only for backend driver) Look up a pen by pen ID - * - * \param instance_id A Uint32 pen identifier (driver-dependent meaning). Must not be 0 = SDL_PEN_INVALID. - * The same ID is exposed to clients as SDL_PenID. - * - * The pen pointer is only valid until the next call to SDL_PenModifyEnd() or SDL_PenGCSweep() - * - * \return pen, if it exists, or NULL - */ -extern SDL_Pen *SDL_GetPenPtr(Uint32 instance_id); - -/** - * (Only for backend driver) Start registering a new pen or updating an existing pen. - * - * Acquires the pen mutex, which is held until the next call to SDL_PenModifyEnd() . - * - * If the PenID already exists, returns the existing entry. Otherwise initialise fresh SDL_Pen. - * For new pens, sets SDL_PEN_FLAG_NEW. - * - * Usage: - * - SDL_PenModifyStart() - * - update pen object, in any order: - * - SDL_PenModifyAddCapabilities() - * - pen->guid (MUST be set for new pens, e.g. via ::SDL_PenUpdateGUIDForGeneric and related operations) - * - pen->info.num_buttons - * - pen->info.max_tilt - * - pen->type - * - pen->name - * - pen->deviceinfo (backend-specific) - * - SDL_PenModifyEnd() - * - * For new pens, sets defaults for: - * - num_buttons (SDL_PEN_INFO_UNKNOWN) - * - max_tilt (SDL_PEN_INFO_UNKNOWN) - * - pen_type (SDL_PEN_TYPE_PEN) - * - Zeroes all other (non-header) fields - * - * \param instance_id Pen ID to allocate (must not be 0 = SDL_PEN_ID_INVALID) - * \returns SDL_Pen pointer; only valid until the call to SDL_PenModifyEnd() - */ -extern SDL_Pen *SDL_PenModifyBegin(Uint32 instance_id); - -/** - * (Only for backend driver) Add capabilities to a pen (cf. SDL_PenModifyBegin()). - * - * Adds capabilities to a pen obtained via SDL_PenModifyBegin(). Can be called more than once. - * - * \param pen The pen to update - * \param capabilities Capabilities flags, out of: SDL_PEN_AXIS_*, SDL_PEN_ERASER_MASK, SDL_PEN_INK_MASK - * Setting SDL_PEN_ERASER_MASK will clear SDL_PEN_INK_MASK, and vice versa. - */ -extern void SDL_PenModifyAddCapabilities(SDL_Pen *pen, Uint32 capabilities); - -/** - * Set up a pen structure for a Wacom device. - * - * Some backends (e.g., XInput2, Wayland) can only partially identify the capabilities of a given - * pen but can identify Wacom pens and obtain their Wacom-specific device type identifiers. - * This function partly automates device setup in those cases. - * - * This function does NOT set up the pen's GUID. Use ::SD_PenModifyGUIDForWacom instead. - * - * This function does NOT call SDL_PenModifyAddCapabilities() ifself, since some backends may - * not have access to all pen axes (e.g., Xinput2). - * - * \param pen The pen to initialise - * \param wacom_devicetype_id The Wacom-specific device type identifier - * \param[out] axis_flags The set of physically supported axes for this pen, suitable for passing to - * SDL_PenModifyAddCapabilities() - * - * \returns SDL_TRUE if the device ID could be identified, otherwise SDL_FALSE - */ -extern int SDL_PenModifyForWacomID(SDL_Pen *pen, Uint32 wacom_devicetype_id, Uint32 *axis_flags); - -/** - * Updates a GUID for a generic pen device. - * - * Assumes that the GUID has been pre-initialised (typically to 0). - * Idempotent, and commutative with ::SDL_PenUpdateGUIDForWacom and ::SDL_PenUpdateGUIDForType - * - * \param[out] guid The GUID to update - * \param upper Upper half of the device ID (assume lower entropy than "lower"; pass 0 if not available) - * \param lower Lower half of the device ID (assume higher entropy than "upper") - */ -extern void SDL_PenUpdateGUIDForGeneric(SDL_GUID *guid, Uint32 upper, Uint32 lower); + SDL_PenCapabilityFlags capabilities; /**< bitflags of device capabilities */ + float max_tilt; /**< Physical maximum tilt angle, for XTILT and YTILT, or -1.0f if unknown. Pens cannot typically tilt all the way to 90 degrees, so this value is usually less than 90.0. */ + Uint32 wacom_id; /**< For Wacom devices: wacom tool type ID, otherwise 0 (useful e.g. with libwacom) */ + int num_buttons; /**< Number of pen buttons (not counting the pen tip), or -1 if unknown. */ + SDL_PenSubtype subtype; /**< type of pen device */ +} SDL_PenInfo; -/** - * Updates a GUID based on a pen type - * - * Assumes that the GUID has been pre-initialised (typically to 0). - * Idempotent, and commutative with ::SDL_PenUpdateGUIDForWacom and ::SDL_PenUpdateGUIDForGeneric - * - * \param[out] guid The GUID to update - * \param pentype The pen type to insert - */ -extern void SDL_PenUpdateGUIDForType(SDL_GUID *guid, SDL_PenSubtype pentype); +// Backend calls this when a new pen device is hotplugged, plus once for each pen already connected at startup. +// Note that name and info are copied but currently unused; this is placeholder for a potentially more robust API later. +// Both are allowed to be NULL. +extern SDL_PenID SDL_AddPenDevice(Uint64 timestamp, const char *name, const SDL_PenInfo *info, void *handle); -/** - * Updates a GUID for a Wacom pen device. - * - * Assumes that the GUID has been pre-initialised (typically to 0). - * Idempotent, and commutative with ::SDL_PenUpdateGUIDForType and ::SDL_PenUpdateGUIDForGeneric - * - * This update is identical to the one written by ::SDL_PenModifyFromWacomID . - * - * \param[out] guid The GUID to update - * \param wacom_devicetype_id The Wacom-specific device type identifier - * \param wacom_serial_id The Wacom-specific serial number - */ -extern void SDL_PenUpdateGUIDForWacom(SDL_GUID *guid, Uint32 wacom_devicetype_id, Uint32 wacom_serial_id); +// Backend calls this when an existing pen device is disconnected during runtime. They must free their own stuff separately. +extern void SDL_RemovePenDevice(Uint64 timestamp, SDL_PenID instance_id); -/** - * (Only for backend driver) Finish updating a pen. - * - * Releases the pen mutex acquired by SDL_PenModifyBegin() . - * - * If pen->type == SDL_PEN_TYPE_NONE, removes the pen entirely (only - * for new pens). This allows backends to start registering a - * potential pen device and to abort if the device turns out to not be - * a pen. - * - * For new pens, this call will also set the following: - * - name (default name, if not yet set) - * - * \param pen The pen to register. That pointer is no longer valid after this call. - * \param attach Whether the pen should be attached (SDL_TRUE) or detached (SDL_FALSE). - * - * If the pen is detached or removed, it is the caller's responsibility to free - * and null "deviceinfo". - */ -extern void SDL_PenModifyEnd(SDL_Pen *pen, SDL_bool attach); +// Backend can call this to remove all pens, probably during shutdown, with a callback to let them free their own handle. +extern void SDL_RemoveAllPenDevices(void (*callback)(SDL_PenID instance_id, void *handle, void *userdata), void *userdata); -/** - * (Only for backend driver) Mark all current pens for garbage collection. - * - * Must not be called while the pen mutex is held (by SDL_PenModifyBegin() ). - * - * SDL_PenGCMark() / SDL_PenGCSweep() provide a simple mechanism for - * detaching all known pens that are not discoverable. This allows - * backends to use the same code for pen discovery and for - * hotplugging: - * - * - SDL_PenGCMark() and start backend-specific discovery - * - for each discovered pen: SDL_PenModifyBegin() + SDL_PenModifyEnd() (this will retain existing state) - * - SDL_PenGCSweep() (will now detach all pens that were not re-registered). - */ -extern void SDL_PenGCMark(void); +// Backend calls this when a pen's button changes, to generate events and update state. +extern int SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, Uint8 state, Uint8 eraser); -/** - * (Only for backend driver) Detach pens that haven't been reported attached since the last call to SDL_PenGCMark(). - * - * Must not be called while the pen mutex is held (by SDL_PenModifyBegin() ). - * - * See SDL_PenGCMark() for details. - * - * \param context Extra parameter to pass through to "free_deviceinfo" - * \param free_deviceinfo Operation to call on any non-NULL "backend.deviceinfo". - * - * \sa SDL_PenGCMark() - */ -extern void SDL_PenGCSweep(void *context, void (*free_deviceinfo)(Uint32 instance_id, void *deviceinfo, void *context)); +// Backend calls this when a pen moves on the tablet, to generate events and update state. +extern int SDL_SendPenMotion(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, float x, float y); -/** - * (Only for backend driver) Send a pen motion event. - * - * Suppresses pen motion events that do not change the current pen state. - * May also send a mouse motion event, if mouse emulation is enabled and the pen position has - * changed sufficiently for the motion to be visible to mouse event listeners. - * - * \param timestamp Event timestamp in nanoseconds, or 0 to ask SDL to use SDL_GetTicksNS() . - * While 0 is safe to report, your backends may be able to report more precise - * timing information. - * Keep in mind that you should never report timestamps that are greater than - * SDL_GetTicksNS() . In particular, SDL_GetTicksNS() reports nanoseconds since the start - * of the SDL session, and your backend may use a different starting point as "timestamp zero". - * \param instance_id Pen - * \param window_relative Coordinates are already window-relative - * \param status Coordinates and axes (buttons are ignored) - * - * \returns SDL_TRUE if at least one event was sent - */ -extern int SDL_SendPenMotion(Uint64 timestamp, SDL_PenID instance_id, SDL_bool window_relative, const SDL_PenStatusInfo *status); +// Backend calls this when a pen's axis changes, to generate events and update state. +extern int SDL_SendPenAxis(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, SDL_PenAxis axis, float value); -/** - * (Only for backend driver) Send a pen button event - * - * \param timestamp Event timestamp in nanoseconds, or 0 to ask SDL to use SDL_GetTicksNS() . - * See SDL_SendPenMotion() for a discussion about how to handle timestamps. - * \param instance_id Pen - * \param state SDL_PRESSED or SDL_RELEASED - * \param button Button number: 1 (first physical button) etc. - * - * \returns SDL_TRUE if at least one event was sent - */ -extern int SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, Uint8 state, Uint8 button); +// Backend calls this when a pen's button changes, to generate events and update state. +extern int SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, Uint8 state, Uint8 button); -/** - * (Only for backend driver) Send a pen tip event (touching or no longer touching the surface) - * - * Note: the backend should perform hit testing on window decoration elements to allow the pen - * to e.g. resize/move the window, just as for mouse events, unless ::SDL_SendPenTipEvent is false. - * - * \param timestamp Event timestamp in nanoseconds, or 0 to ask SDL to use SDL_GetTicksNS() . - * See SDL_SendPenMotion() for a discussion about how to handle timestamps. - * \param instance_id Pen - * \param state SDL_PRESSED (for PEN_DOWN) or SDL_RELEASED (for PEN_UP) - * - * \returns SDL_TRUE if at least one event was sent - */ -extern int SDL_SendPenTipEvent(Uint64 timestamp, SDL_PenID instance_id, Uint8 state); +// Backend can optionally use this to find the SDL_PenID for the `handle` that was passed to SDL_AddPenDevice. +extern SDL_PenID SDL_FindPenByHandle(void *handle); -/** - * (Only for backend driver) Check if a PEN_DOWN event should perform hit box testing. - * - * \returns SDL_TRUE if and only if the backend should perform hit testing - */ -extern SDL_bool SDL_PenPerformHitTest(void); +// Backend can optionally use this to find a SDL_PenID, selected by a callback examining all devices. Zero if not found. +extern SDL_PenID SDL_FindPenByCallback(SDL_bool (*callback)(void *handle, void *userdata), void *userdata); -/** - * (Only for backend driver) Send a pen window event. - * - * Tracks when a pen has entered/left a window. - * Don't call this when reporting new pens or removing known pens; those cases are handled automatically. - * - * \param timestamp Event timestamp in nanoseconds, or 0 to ask SDL to use SDL_GetTicksNS() . - * See SDL_SendPenMotion() for a discussion about how to handle timestamps. - * \param instance_id Pen - * \param window Window to enter, or NULL to exit - */ -extern int SDL_SendPenWindowEvent(Uint64 timestamp, SDL_PenID instance_id, SDL_Window *window); +// Backend can use this to map an axis to a capability bit. +SDL_PenCapabilityFlags SDL_GetPenCapabilityFromAxis(SDL_PenAxis axis); -/** - * Initialises the pen subsystem. - */ -extern void SDL_PenInit(void); +// Higher-level SDL video subsystem code calls this when starting up. Backends shouldn't. +extern int SDL_InitPen(void); -/** - * De-initialises the pen subsystem. - */ -extern void SDL_PenQuit(void); +// Higher-level SDL video subsystem code calls this when shutting down. Backends shouldn't. +extern void SDL_QuitPen(void); #endif /* SDL_pen_c_h_ */ diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index f4fc4d286fc6f..188715c570dba 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -563,6 +563,7 @@ int SDL_VideoInit(const char *driver_name) SDL_bool init_keyboard = SDL_FALSE; SDL_bool init_mouse = SDL_FALSE; SDL_bool init_touch = SDL_FALSE; + SDL_bool init_pen = SDL_FALSE; int i = 0; /* Check to make sure we don't overwrite '_this' */ @@ -589,6 +590,10 @@ int SDL_VideoInit(const char *driver_name) goto pre_driver_error; } init_touch = SDL_TRUE; + if (SDL_InitPen() < 0) { + goto pre_driver_error; + } + init_pen = SDL_TRUE; /* Select the proper video driver */ video = NULL; @@ -673,6 +678,9 @@ int SDL_VideoInit(const char *driver_name) pre_driver_error: SDL_assert(_this == NULL); + if (init_pen) { + SDL_QuitPen(); + } if (init_touch) { SDL_QuitTouch(); } @@ -4217,6 +4225,7 @@ void SDL_VideoQuit(void) } /* Halt event processing before doing anything else */ + SDL_QuitPen(); SDL_QuitTouch(); SDL_QuitMouse(); SDL_QuitKeyboard(); diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 70a79586eb721..3ec8d90ce38c2 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -2364,421 +2364,255 @@ void Wayland_create_text_input(SDL_VideoData *d) } } -static SDL_PenID Wayland_get_penid(void *data, struct zwp_tablet_tool_v2 *tool) -{ - struct SDL_WaylandTool *sdltool = data; - return sdltool->penid; -} -/* For registering pens */ -static SDL_Pen *Wayland_get_current_pen(void *data, struct zwp_tablet_tool_v2 *tool) -{ - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; +// Pen/Tablet support... - if (!input->current_pen.builder) { - /* Starting new pen or updating one? */ - SDL_PenID penid = sdltool->penid; - - if (penid == 0) { - /* Found completely new pen? */ - penid = ++input->num_pens; - sdltool->penid = penid; - } - input->current_pen.builder = SDL_GetPenPtr(penid); - if (!input->current_pen.builder) { - /* Must register as new pen */ - input->current_pen.builder = SDL_PenModifyBegin(penid); - } - } - return input->current_pen.builder; -} +typedef struct SDL_WaylandPenTool // a stylus, etc, on a tablet. +{ + SDL_PenID instance_id; + SDL_PenInfo info; + SDL_Window *tool_focus; + struct zwp_tablet_tool_v2 *wltool; + float x; + float y; + SDL_bool frame_motion_set; + float frame_axes[SDL_PEN_NUM_AXES]; + Uint32 frame_axes_set; + int frame_pen_down; + int frame_buttons[3]; +} SDL_WaylandPenTool; static void tablet_tool_handle_type(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t type) { - SDL_Pen *pen = Wayland_get_current_pen(data, tool); - + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; switch (type) { - case ZWP_TABLET_TOOL_V2_TYPE_ERASER: - pen->type = SDL_PEN_TYPE_ERASER; - break; - - case ZWP_TABLET_TOOL_V2_TYPE_PEN: - pen->type = SDL_PEN_TYPE_PEN; - break; - - case ZWP_TABLET_TOOL_V2_TYPE_PENCIL: - pen->type = SDL_PEN_TYPE_PENCIL; - break; - - case ZWP_TABLET_TOOL_V2_TYPE_AIRBRUSH: - pen->type = SDL_PEN_TYPE_AIRBRUSH; - break; - - case ZWP_TABLET_TOOL_V2_TYPE_BRUSH: - pen->type = SDL_PEN_TYPE_BRUSH; - break; - - case ZWP_TABLET_TOOL_V2_TYPE_FINGER: - case ZWP_TABLET_TOOL_V2_TYPE_MOUSE: - case ZWP_TABLET_TOOL_V2_TYPE_LENS: - default: - pen->type = SDL_PEN_TYPE_NONE; /* Mark for deregistration */ + #define CASE(typ) case ZWP_TABLET_TOOL_V2_TYPE_##typ: sdltool->info.subtype = SDL_PEN_TYPE_##typ; return + CASE(ERASER); + CASE(PEN); + CASE(PENCIL); + CASE(AIRBRUSH); + CASE(BRUSH); + #undef CASE + default: sdltool->info.subtype = SDL_PEN_TYPE_UNKNOWN; // we'll decline to add this when the `done` event comes through. } - - SDL_PenUpdateGUIDForType(&pen->guid, pen->type); } static void tablet_tool_handle_hardware_serial(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t serial_hi, uint32_t serial_lo) { -#if !(SDL_PEN_DEBUG_NOID) - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - - if (!input->current_pen.builder_guid_complete) { - SDL_Pen *pen = Wayland_get_current_pen(data, tool); - SDL_PenUpdateGUIDForGeneric(&pen->guid, serial_hi, serial_lo); - if (serial_hi || serial_lo) { - input->current_pen.builder_guid_complete = SDL_TRUE; - } - } -#endif + // don't care about this atm. } static void tablet_tool_handle_hardware_id_wacom(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t id_hi, uint32_t id_lo) { -#if !(SDL_PEN_DEBUG_NOID | SDL_PEN_DEBUG_NONWACOM) - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - SDL_Pen *pen = Wayland_get_current_pen(data, tool); - Uint32 axis_flags; - -#if SDL_PEN_DEBUG_NOSERIAL_WACOM /* Check: have we disabled pen serial ID decoding for testing? */ - id_hi = 0; -#endif - - SDL_PenUpdateGUIDForWacom(&pen->guid, id_lo, id_hi); - if (id_hi) { /* Have a serial number? */ - input->current_pen.builder_guid_complete = SDL_TRUE; - } - - if (SDL_PenModifyForWacomID(pen, id_lo, &axis_flags)) { - SDL_PenModifyAddCapabilities(pen, axis_flags); - } -#endif + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; + sdltool->info.wacom_id = id_lo; } static void tablet_tool_handle_capability(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t capability) { - SDL_Pen *pen = Wayland_get_current_pen(data, tool); - + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; switch (capability) { - case ZWP_TABLET_TOOL_V2_CAPABILITY_TILT: - SDL_PenModifyAddCapabilities(pen, SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK); - break; - - case ZWP_TABLET_TOOL_V2_CAPABILITY_PRESSURE: - SDL_PenModifyAddCapabilities(pen, SDL_PEN_AXIS_PRESSURE_MASK); - break; - - case ZWP_TABLET_TOOL_V2_CAPABILITY_DISTANCE: - SDL_PenModifyAddCapabilities(pen, SDL_PEN_AXIS_DISTANCE_MASK); - break; - - case ZWP_TABLET_TOOL_V2_CAPABILITY_ROTATION: - SDL_PenModifyAddCapabilities(pen, SDL_PEN_AXIS_ROTATION_MASK); - break; - - case ZWP_TABLET_TOOL_V2_CAPABILITY_SLIDER: - SDL_PenModifyAddCapabilities(pen, SDL_PEN_AXIS_SLIDER_MASK); - break; - - case ZWP_TABLET_TOOL_V2_CAPABILITY_WHEEL: - /* Presumably for tools other than pens? */ - break; - - default: - break; + #define CASE(wltyp,sdltyp) case ZWP_TABLET_TOOL_V2_CAPABILITY_##wltyp: sdltool->info.capabilities |= sdltyp; return + CASE(TILT, SDL_PEN_CAPABILITY_XTILT | SDL_PEN_CAPABILITY_YTILT); + CASE(PRESSURE, SDL_PEN_CAPABILITY_PRESSURE); + CASE(DISTANCE, SDL_PEN_CAPABILITY_DISTANCE); + CASE(ROTATION, SDL_PEN_CAPABILITY_ROTATION); + CASE(SLIDER, SDL_PEN_CAPABILITY_SLIDER); + #undef CASE + default: break; // unsupported here. } } -static void Wayland_tool_builder_reset(struct SDL_WaylandTabletInput *input) -{ - input->current_pen.builder = NULL; - input->current_pen.builder_guid_complete = SDL_FALSE; -} - static void tablet_tool_handle_done(void *data, struct zwp_tablet_tool_v2 *tool) { - SDL_Pen *pen = Wayland_get_current_pen(data, tool); - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - - if (!input->current_pen.builder_guid_complete) { - /* No complete GUID? Use tablet and tool device index */ - SDL_PenUpdateGUIDForGeneric(&pen->guid, input->id, sdltool->penid); - } - - SDL_PenModifyEnd(pen, SDL_TRUE); - - Wayland_tool_builder_reset(input); -} - -static void Wayland_tool_destroy(struct zwp_tablet_tool_v2 *tool) -{ - if (tool) { - struct SDL_WaylandTool *waypen = zwp_tablet_tool_v2_get_user_data(tool); - if (waypen) { - SDL_free(waypen); - } - zwp_tablet_tool_v2_destroy(tool); - } } -static void tablet_object_list_remove(struct SDL_WaylandTabletObjectListNode *head, void *object); - static void tablet_tool_handle_removed(void *data, struct zwp_tablet_tool_v2 *tool) { - struct SDL_WaylandTool *waypen = zwp_tablet_tool_v2_get_user_data(tool); - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - SDL_Pen *pen = Wayland_get_current_pen(data, tool); - if (pen) { - SDL_PenModifyEnd(pen, SDL_FALSE); - Wayland_tool_builder_reset(waypen->tablet); - Wayland_tool_destroy(tool); - } else { - zwp_tablet_tool_v2_destroy(tool); + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; + if (sdltool->instance_id) { + SDL_RemovePenDevice(0, sdltool->instance_id); } - - tablet_object_list_remove(input->tools, tool); + zwp_tablet_tool_v2_destroy(tool); + SDL_free(sdltool); } static void tablet_tool_handle_proximity_in(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t serial, struct zwp_tablet_v2 *tablet, struct wl_surface *surface) { - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - SDL_WindowData *window; - SDL_PenID penid = Wayland_get_penid(data, tool); + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; + SDL_WindowData *windowdata = surface ? Wayland_GetWindowDataForOwnedSurface(surface) : NULL; + sdltool->tool_focus = windowdata ? windowdata->sdlwindow : NULL; - if (!surface) { - return; + SDL_assert(sdltool->instance_id == 0); // shouldn't be added at this point. + if (sdltool->info.subtype != SDL_PEN_TYPE_UNKNOWN) { // don't tell SDL about it if we don't know its role. + sdltool->instance_id = SDL_AddPenDevice(0, NULL, &sdltool->info, sdltool); } - window = Wayland_GetWindowDataForOwnedSurface(surface); - - if (window) { - input->tool_focus = window; - input->tool_prox_serial = serial; - - if (penid) { - SDL_SendPenWindowEvent(0, penid, window->sdlwindow); - } else { - SDL_SetMouseFocus(window->sdlwindow); - } - SDL_SetCursor(NULL); - } + // According to the docs, this should be followed by a motion event, where we'll send our SDL events. } static void tablet_tool_handle_proximity_out(void *data, struct zwp_tablet_tool_v2 *tool) { - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - SDL_PenID penid = Wayland_get_penid(data, tool); - if (input->tool_focus) { - if (penid) { - SDL_SendPenWindowEvent(0, penid, NULL); - } else { - SDL_SetMouseFocus(NULL); - } - input->tool_focus = NULL; + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; + sdltool->tool_focus = NULL; + + if (sdltool->instance_id) { + SDL_RemovePenDevice(0, sdltool->instance_id); + sdltool->instance_id = 0; } } static void tablet_tool_handle_down(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t serial) { - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - - input->current_pen.buttons_pressed |= SDL_PEN_DOWN_MASK; - - input->current_pen.serial = serial; + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; + sdltool->frame_pen_down = 1; } static void tablet_tool_handle_up(void *data, struct zwp_tablet_tool_v2 *tool) { - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - input->current_pen.buttons_released |= SDL_PEN_DOWN_MASK; + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; + sdltool->frame_pen_down = 0; } static void tablet_tool_handle_motion(void *data, struct zwp_tablet_tool_v2 *tool, wl_fixed_t sx_w, wl_fixed_t sy_w) { - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - SDL_WindowData *window = input->tool_focus; - SDL_PenID penid = Wayland_get_penid(data, tool); - - input->sx_w = sx_w; - input->sy_w = sy_w; - - if (input->tool_focus) { + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; + SDL_Window *window = sdltool->tool_focus; + if (window) { + const SDL_WindowData *windowdata = window->internal; const float sx_f = (float)wl_fixed_to_double(sx_w); const float sy_f = (float)wl_fixed_to_double(sy_w); - const float sx = sx_f * window->pointer_scale.x; - const float sy = sy_f * window->pointer_scale.y; - - if (penid != SDL_PEN_INVALID) { - input->current_pen.update_status.x = sx; - input->current_pen.update_status.y = sy; - input->current_pen.update_window = window; - } else { - /* Plain mouse event */ - SDL_SendMouseMotion(0, window->sdlwindow, SDL_GLOBAL_MOUSE_ID, SDL_FALSE, sx, sy); - } + const float sx = sx_f * windowdata->pointer_scale.x; + const float sy = sy_f * windowdata->pointer_scale.y; + sdltool->x = sx; + sdltool->y = sy; + sdltool->frame_motion_set = SDL_TRUE; } } static void tablet_tool_handle_pressure(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t pressure) { - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - input->current_pen.update_status.axes[SDL_PEN_AXIS_PRESSURE] = pressure / 65535.0f; + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; + sdltool->frame_axes[SDL_PEN_AXIS_PRESSURE] = ((float) pressure) / 65535.0f; + sdltool->frame_axes_set |= (1u << SDL_PEN_AXIS_PRESSURE); if (pressure) { - input->current_pen.update_status.axes[SDL_PEN_AXIS_DISTANCE] = 0.0f; + sdltool->frame_axes[SDL_PEN_AXIS_DISTANCE] = 0.0f; + sdltool->frame_axes_set |= (1u << SDL_PEN_AXIS_DISTANCE); } } static void tablet_tool_handle_distance(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t distance) { - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - input->current_pen.update_status.axes[SDL_PEN_AXIS_DISTANCE] = distance / 65535.0f; + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; + sdltool->frame_axes[SDL_PEN_AXIS_DISTANCE] = ((float) distance) / 65535.0f; + sdltool->frame_axes_set |= (1u << SDL_PEN_AXIS_DISTANCE); if (distance) { - input->current_pen.update_status.axes[SDL_PEN_AXIS_PRESSURE] = 0.0f; + sdltool->frame_axes[SDL_PEN_AXIS_PRESSURE] = 0.0f; + sdltool->frame_axes_set |= (1u << SDL_PEN_AXIS_PRESSURE); } } static void tablet_tool_handle_tilt(void *data, struct zwp_tablet_tool_v2 *tool, wl_fixed_t xtilt, wl_fixed_t ytilt) { - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - - input->current_pen.update_status.axes[SDL_PEN_AXIS_XTILT] = (float)(wl_fixed_to_double(xtilt)); - input->current_pen.update_status.axes[SDL_PEN_AXIS_YTILT] = (float)(wl_fixed_to_double(ytilt)); + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; + sdltool->frame_axes[SDL_PEN_AXIS_XTILT] = (float)(wl_fixed_to_double(xtilt)); + sdltool->frame_axes[SDL_PEN_AXIS_YTILT] = (float)(wl_fixed_to_double(ytilt)); + sdltool->frame_axes_set |= (1u << SDL_PEN_AXIS_XTILT) | (1u << SDL_PEN_AXIS_YTILT); } static void tablet_tool_handle_button(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t serial, uint32_t button, uint32_t state) { - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - Uint16 mask = 0; - SDL_bool pressed = state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED ? SDL_TRUE : SDL_FALSE; - - /* record event serial number to report it later in tablet_tool_handle_frame() */ - input->current_pen.serial = serial; + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; + int sdlbutton; switch (button) { /* see %{_includedir}/linux/input-event-codes.h */ case 0x14b: /* BTN_STYLUS */ - mask = SDL_BUTTON_LMASK; + sdlbutton = 1; break; case 0x14c: /* BTN_STYLUS2 */ - mask = SDL_BUTTON_MMASK; + sdlbutton = 2; break; case 0x149: /* BTN_STYLUS3 */ - mask = SDL_BUTTON_RMASK; + sdlbutton = 3; break; + default: + return; // don't care about this button, I guess. } - if (pressed) { - input->current_pen.buttons_pressed |= mask; - } else { - input->current_pen.buttons_released |= mask; - } + SDL_assert((sdlbutton >= 1) && (sdlbutton <= SDL_arraysize(sdltool->frame_buttons))); + sdltool->frame_buttons[sdlbutton-1] = (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED) ? 1 : 0; } static void tablet_tool_handle_rotation(void *data, struct zwp_tablet_tool_v2 *tool, wl_fixed_t degrees) { - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - float rotation = (float)(wl_fixed_to_double(degrees)); - - /* map to -180.0f ... 179.0f range: */ - input->current_pen.update_status.axes[SDL_PEN_AXIS_ROTATION] = rotation > 180.0f ? rotation - 360.0f : rotation; + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; + const float rotation = (float)(wl_fixed_to_double(degrees)); + sdltool->frame_axes[SDL_PEN_AXIS_ROTATION] = (rotation > 180.0f) ? (rotation - 360.0f) : rotation; // map to -180.0f ... 179.0f range + sdltool->frame_axes_set |= (1u << SDL_PEN_AXIS_ROTATION); } static void tablet_tool_handle_slider(void *data, struct zwp_tablet_tool_v2 *tool, int32_t position) { - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - input->current_pen.update_status.axes[SDL_PEN_AXIS_SLIDER] = position / 65535.f; + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; + sdltool->frame_axes[SDL_PEN_AXIS_SLIDER] = position / 65535.f; + sdltool->frame_axes_set |= (1u << SDL_PEN_AXIS_SLIDER); } static void tablet_tool_handle_wheel(void *data, struct zwp_tablet_tool_v2 *tool, int32_t degrees, int32_t clicks) { - /* not supported at the moment */ + // not supported at the moment } static void tablet_tool_handle_frame(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t time) { - struct SDL_WaylandTool *sdltool = data; - struct SDL_WaylandTabletInput *input = sdltool->tablet; - SDL_PenID penid = Wayland_get_penid(data, tool); - SDL_WindowData *window = input->current_pen.update_window; - SDL_PenStatusInfo *status = &input->current_pen.update_status; - int button; - int button_mask; - Uint64 timestamp = Wayland_GetEventTimestamp(SDL_MS_TO_NS(time)); + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) data; - if (penid == 0 || !window) { /* Not a pen, or event reported out of focus */ - return; + if (!sdltool->instance_id) { + return; // Not a pen we report on. } - /* window == input->tool_focus */ - /* All newly released buttons + PEN_UP event */ - button_mask = input->current_pen.buttons_released; - if (button_mask & SDL_PEN_DOWN_MASK) { - /* Perform hit test, if appropriate */ - if (!SDL_PenPerformHitTest() - || !ProcessHitTest(window, input->sdlWaylandInput->seat, input->sx_w, input->sy_w, input->current_pen.serial)) { - SDL_SendPenTipEvent(timestamp, penid, SDL_RELEASED); - } - } - button_mask &= ~SDL_PEN_DOWN_MASK; + const Uint64 timestamp = Wayland_GetEventTimestamp(SDL_MS_TO_NS(time)); + const SDL_PenID instance_id = sdltool->instance_id; + const SDL_Window *window = sdltool->tool_focus; - for (button = 1; button_mask; ++button, button_mask >>= 1) { - if (button_mask & 1) { - SDL_SendPenButton(timestamp, penid, SDL_RELEASED, button); + // I don't know if this is necessary (or makes sense), but send motion before pen downs, but after pen ups, so you don't get unexpected lines drawn. + if (sdltool->frame_motion_set && (sdltool->frame_pen_down != -1)) { + if (sdltool->frame_pen_down) { + SDL_SendPenMotion(timestamp, instance_id, window, sdltool->x, sdltool->y); + SDL_SendPenTouch(timestamp, instance_id, window, SDL_PRESSED, 0); // !!! FIXME: how do we know what tip is in use? + } else { + SDL_SendPenTouch(timestamp, instance_id, window, SDL_RELEASED, 0); // !!! FIXME: how do we know what tip is in use? + SDL_SendPenMotion(timestamp, instance_id, window, sdltool->x, sdltool->y); + } + } else { + if (sdltool->frame_pen_down != -1) { + SDL_SendPenTouch(timestamp, instance_id, window, sdltool->frame_pen_down ? SDL_PRESSED : SDL_RELEASED, 0); // !!! FIXME: how do we know what tip is in use? } - } - /* All newly pressed buttons + PEN_DOWN event */ - button_mask = input->current_pen.buttons_pressed; - if (button_mask & SDL_PEN_DOWN_MASK) { - /* Perform hit test, if appropriate */ - if (!SDL_PenPerformHitTest() - || !ProcessHitTest(window, input->sdlWaylandInput->seat, input->sx_w, input->sy_w, input->current_pen.serial)) { - SDL_SendPenTipEvent(timestamp, penid, SDL_PRESSED); - } + if (sdltool->frame_motion_set) { + SDL_SendPenMotion(timestamp, instance_id, window, sdltool->x, sdltool->y); + } } - button_mask &= ~SDL_PEN_DOWN_MASK; - for (button = 1; button_mask; ++button, button_mask >>= 1) { - if (button_mask & 1) { - SDL_SendPenButton(timestamp, penid, SDL_PRESSED, button); + for (SDL_PenAxis i = 0; i < SDL_PEN_NUM_AXES; i++) { + if (sdltool->frame_axes_set & (1u << i)) { + SDL_SendPenAxis(timestamp, instance_id, window, i, sdltool->frame_axes[i]); } } - SDL_SendPenMotion(timestamp, penid, SDL_TRUE, status); - - /* Wayland_UpdateImplicitGrabSerial will ignore serial 0, so it is safe to call with the default value */ - Wayland_UpdateImplicitGrabSerial(input->sdlWaylandInput, input->current_pen.serial); + for (int i = 0; i < SDL_arraysize(sdltool->frame_buttons); i++) { + const int state = sdltool->frame_buttons[i]; + if (state != -1) { + SDL_SendPenButton(timestamp, instance_id, window, state ? SDL_PRESSED : SDL_RELEASED, (Uint8) (i + 1)); + sdltool->frame_buttons[i] = -1; + } + } - /* Reset masks for next tool frame */ - input->current_pen.buttons_pressed = 0; - input->current_pen.buttons_released = 0; - input->current_pen.serial = 0; + // reset for next frame. + sdltool->frame_pen_down = -1; + sdltool->frame_motion_set = SDL_FALSE; + sdltool->frame_axes_set = 0; } static const struct zwp_tablet_tool_v2_listener tablet_tool_listener = { @@ -2803,92 +2637,34 @@ static const struct zwp_tablet_tool_v2_listener tablet_tool_listener = { tablet_tool_handle_frame }; -static struct SDL_WaylandTabletObjectListNode *tablet_object_list_new_node(void *object) -{ - struct SDL_WaylandTabletObjectListNode *node; - - node = SDL_calloc(1, sizeof(*node)); - if (!node) { - return NULL; - } - - node->next = NULL; - node->object = object; - - return node; -} - -static void tablet_object_list_append(struct SDL_WaylandTabletObjectListNode *head, void *object) -{ - if (!head->object) { - head->object = object; - return; - } - - while (head->next) { - head = head->next; - } - - head->next = tablet_object_list_new_node(object); -} - -static void tablet_object_list_destroy(struct SDL_WaylandTabletObjectListNode *head, void (*deleter)(void *object)) -{ - while (head) { - struct SDL_WaylandTabletObjectListNode *next = head->next; - if (head->object) { - (*deleter)(head->object); - } - SDL_free(head); - head = next; - } -} - -void tablet_object_list_remove(struct SDL_WaylandTabletObjectListNode *head, void *object) -{ - struct SDL_WaylandTabletObjectListNode **head_p = &head; - while (*head_p && (*head_p)->object != object) { - head_p = &((*head_p)->next); - } - - if (*head_p) { - struct SDL_WaylandTabletObjectListNode *object_head = *head_p; - - if (object_head == head) { - /* Must not remove head node */ - head->object = NULL; - } else { - *head_p = object_head->next; - SDL_free(object_head); - } - } -} static void tablet_seat_handle_tablet_added(void *data, struct zwp_tablet_seat_v2 *seat, struct zwp_tablet_v2 *tablet) { - struct SDL_WaylandTabletInput *input = data; - - tablet_object_list_append(input->tablets, tablet); + // don't care atm. } static void tablet_seat_handle_tool_added(void *data, struct zwp_tablet_seat_v2 *seat, struct zwp_tablet_tool_v2 *tool) { - struct SDL_WaylandTabletInput *input = data; - struct SDL_WaylandTool *sdltool = SDL_calloc(1, sizeof(struct SDL_WaylandTool)); + SDL_WaylandPenTool *sdltool = SDL_calloc(1, sizeof(*sdltool)); - zwp_tablet_tool_v2_add_listener(tool, &tablet_tool_listener, sdltool); - zwp_tablet_tool_v2_set_user_data(tool, sdltool); - - sdltool->tablet = input; + if (sdltool) { // if allocation failed, oh well, we won't report this device. + sdltool->wltool = tool; + sdltool->info.max_tilt = -1.0f; + sdltool->info.num_buttons = -1; + sdltool->frame_pen_down = -1; + for (int i = 0; i < SDL_arraysize(sdltool->frame_buttons); i++) { + sdltool->frame_buttons[i] = -1; + } - tablet_object_list_append(input->tools, tool); + // this will send a bunch of zwp_tablet_tool_v2 events right up front to tell + // us device details, with a "done" event to let us know we have everything. + zwp_tablet_tool_v2_add_listener(tool, &tablet_tool_listener, sdltool); + } } static void tablet_seat_handle_pad_added(void *data, struct zwp_tablet_seat_v2 *seat, struct zwp_tablet_pad_v2 *pad) { - struct SDL_WaylandTabletInput *input = data; - - tablet_object_list_append(input->pads, pad); + // we don't care atm. } static const struct zwp_tablet_seat_v2_listener tablet_seat_listener = { @@ -2897,44 +2673,39 @@ static const struct zwp_tablet_seat_v2_listener tablet_seat_listener = { tablet_seat_handle_pad_added }; -void Wayland_input_add_tablet(struct SDL_WaylandInput *input, struct SDL_WaylandTabletManager *tablet_manager) +void Wayland_input_init_tablet_support(struct SDL_WaylandInput *input, struct zwp_tablet_manager_v2 *tablet_manager) { - struct SDL_WaylandTabletInput *tablet_input; - static Uint32 num_tablets = 0; - if (!tablet_manager || !input->seat) { return; } - tablet_input = SDL_calloc(1, sizeof(*tablet_input)); + SDL_WaylandTabletInput *tablet_input = SDL_calloc(1, sizeof(*tablet_input)); if (!tablet_input) { return; } - input->tablet = tablet_input; - - tablet_input->sdlWaylandInput = input; - tablet_input->seat = zwp_tablet_manager_v2_get_tablet_seat((struct zwp_tablet_manager_v2 *)tablet_manager, input->seat); + tablet_input->input = input; + tablet_input->seat = zwp_tablet_manager_v2_get_tablet_seat(tablet_manager, input->seat); - tablet_input->tablets = tablet_object_list_new_node(NULL); - tablet_input->tools = tablet_object_list_new_node(NULL); - tablet_input->pads = tablet_object_list_new_node(NULL); - tablet_input->id = num_tablets++; - - zwp_tablet_seat_v2_add_listener((struct zwp_tablet_seat_v2 *)tablet_input->seat, &tablet_seat_listener, tablet_input); + zwp_tablet_seat_v2_add_listener(tablet_input->seat, &tablet_seat_listener, tablet_input); } -#define TABLET_OBJECT_LIST_DELETER(fun) (void (*)(void *)) fun -void Wayland_input_destroy_tablet(struct SDL_WaylandInput *input) +static void Wayland_remove_all_pens_callback(SDL_PenID instance_id, void *handle, void *userdata) { - tablet_object_list_destroy(input->tablet->pads, TABLET_OBJECT_LIST_DELETER(zwp_tablet_pad_v2_destroy)); - tablet_object_list_destroy(input->tablet->tools, TABLET_OBJECT_LIST_DELETER(Wayland_tool_destroy)); - tablet_object_list_destroy(input->tablet->tablets, TABLET_OBJECT_LIST_DELETER(zwp_tablet_v2_destroy)); + SDL_WaylandPenTool *sdltool = (SDL_WaylandPenTool *) handle; + zwp_tablet_tool_v2_destroy(sdltool->wltool); + SDL_free(sdltool); +} - zwp_tablet_seat_v2_destroy(input->tablet->seat); +void Wayland_input_quit_tablet_support(struct SDL_WaylandInput *input) +{ + SDL_RemoveAllPenDevices(Wayland_remove_all_pens_callback, NULL); - SDL_free(input->tablet); - input->tablet = NULL; + if (input && input->tablet_input) { + zwp_tablet_seat_v2_destroy(input->tablet_input->seat); + SDL_free(input->tablet_input); + input->tablet_input = NULL; + } } void Wayland_input_initialize_seat(SDL_VideoData *d) @@ -2957,7 +2728,7 @@ void Wayland_input_initialize_seat(SDL_VideoData *d) wl_seat_set_user_data(input->seat, input); if (d->tablet_manager) { - Wayland_input_add_tablet(input, d->tablet_manager); + Wayland_input_init_tablet_support(d->input, d->tablet_manager); } WAYLAND_wl_display_flush(d->display); @@ -3049,8 +2820,8 @@ void Wayland_display_destroy_input(SDL_VideoData *d) } } - if (input->tablet) { - Wayland_input_destroy_tablet(input); + if (input->tablet_input) { + Wayland_input_quit_tablet_support(input); } if (input->seat) { diff --git a/src/video/wayland/SDL_waylandevents_c.h b/src/video/wayland/SDL_waylandevents_c.h index a65216f0c6848..fb6e72e67a161 100644 --- a/src/video/wayland/SDL_waylandevents_c.h +++ b/src/video/wayland/SDL_waylandevents_c.h @@ -41,41 +41,11 @@ enum SDL_WaylandAxisEvent struct SDL_WaylandTabletSeat; -struct SDL_WaylandTabletObjectListNode +typedef struct SDL_WaylandTabletInput { - void *object; - struct SDL_WaylandTabletObjectListNode *next; -}; - -struct SDL_WaylandTabletInput -{ - struct SDL_WaylandInput *sdlWaylandInput; + struct SDL_WaylandInput *input; struct zwp_tablet_seat_v2 *seat; - - struct SDL_WaylandTabletObjectListNode *tablets; - struct SDL_WaylandTabletObjectListNode *tools; - struct SDL_WaylandTabletObjectListNode *pads; - - Uint32 id; - Uint32 num_pens; /* next pen ID is num_pens+1 */ - struct SDL_WaylandCurrentPen - { - SDL_Pen *builder; /* pen that is being defined or receiving updates, if any */ - SDL_bool builder_guid_complete; /* have complete/precise GUID information */ - SDL_PenStatusInfo update_status; /* collects pen update information before sending event */ - Uint16 buttons_pressed; /* Mask of newly pressed buttons, plus SDL_PEN_DOWN_MASK for PEN_DOWN */ - Uint16 buttons_released; /* Mask of newly pressed buttons, plus SDL_PEN_DOWN_MASK for PEN_UP */ - Uint32 serial; /* Most recent serial event number observed, or 0 */ - SDL_WindowData *update_window; /* NULL while no event is in progress, otherwise the affected window */ - } current_pen; - - SDL_WindowData *tool_focus; - uint32_t tool_prox_serial; - - /* Last motion end location (kept separate from sx_w, sy_w for the mouse pointer) */ - wl_fixed_t sx_w; - wl_fixed_t sy_w; -}; +} SDL_WaylandTabletInput; typedef struct { @@ -169,7 +139,7 @@ struct SDL_WaylandInput SDL_WaylandKeyboardRepeat keyboard_repeat; - struct SDL_WaylandTabletInput *tablet; + SDL_WaylandTabletInput *tablet_input; SDL_bool keyboard_is_virtual; @@ -178,11 +148,6 @@ struct SDL_WaylandInput SDL_Keymod locked_modifiers; }; -struct SDL_WaylandTool -{ - SDL_PenID penid; - struct SDL_WaylandTabletInput *tablet; -}; extern Uint64 Wayland_GetTouchTimestamp(struct SDL_WaylandInput *input, Uint32 wl_timestamp_ms); @@ -209,8 +174,8 @@ extern int Wayland_input_unconfine_pointer(struct SDL_WaylandInput *input, SDL_W extern int Wayland_input_grab_keyboard(SDL_Window *window, struct SDL_WaylandInput *input); extern int Wayland_input_ungrab_keyboard(SDL_Window *window); -extern void Wayland_input_add_tablet(struct SDL_WaylandInput *input, struct SDL_WaylandTabletManager *tablet_manager); -extern void Wayland_input_destroy_tablet(struct SDL_WaylandInput *input); +extern void Wayland_input_init_tablet_support(struct SDL_WaylandInput *input, struct zwp_tablet_manager_v2 *tablet_manager); +extern void Wayland_input_quit_tablet_support(struct SDL_WaylandInput *input); extern void Wayland_RegisterTimestampListeners(struct SDL_WaylandInput *input); extern void Wayland_CreateCursorShapeDevice(struct SDL_WaylandInput *input); diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 3aa9b8705e18d..1fae5d6e79e68 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -1167,7 +1167,7 @@ static void display_handle_global(void *data, struct wl_registry *registry, uint d->decoration_manager = wl_registry_bind(d->registry, id, &zxdg_decoration_manager_v1_interface, 1); } else if (SDL_strcmp(interface, "zwp_tablet_manager_v2") == 0) { d->tablet_manager = wl_registry_bind(d->registry, id, &zwp_tablet_manager_v2_interface, 1); - Wayland_input_add_tablet(d->input, d->tablet_manager); + Wayland_input_init_tablet_support(d->input, d->tablet_manager); } else if (SDL_strcmp(interface, "zxdg_output_manager_v1") == 0) { version = SDL_min(version, 3); /* Versions 1 through 3 are supported. */ d->xdg_output_manager = wl_registry_bind(d->registry, id, &zxdg_output_manager_v1_interface, version); diff --git a/src/video/wayland/SDL_waylandvideo.h b/src/video/wayland/SDL_waylandvideo.h index 6802fcf0a44b1..51b821aa1cd16 100644 --- a/src/video/wayland/SDL_waylandvideo.h +++ b/src/video/wayland/SDL_waylandvideo.h @@ -33,7 +33,6 @@ struct xkb_context; struct SDL_WaylandInput; -struct SDL_WaylandTabletManager; typedef struct { @@ -84,10 +83,10 @@ struct SDL_VideoData struct wp_alpha_modifier_v1 *wp_alpha_modifier_v1; struct kde_output_order_v1 *kde_output_order; struct frog_color_management_factory_v1 *frog_color_management_factory_v1; + struct zwp_tablet_manager_v2 *tablet_manager; struct xkb_context *xkb_context; struct SDL_WaylandInput *input; - struct SDL_WaylandTabletManager *tablet_manager; struct wl_list output_list; struct wl_list output_order; diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 94ebf47ce8b94..4f6aab611e19e 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -1996,9 +1996,6 @@ void X11_PumpEvents(SDL_VideoDevice *_this) } if (data->xinput_hierarchy_changed) { -#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 - X11_InitPen(_this); -#endif X11_Xinput2UpdateDevices(_this, SDL_FALSE); data->xinput_hierarchy_changed = SDL_FALSE; } diff --git a/src/video/x11/SDL_x11pen.c b/src/video/x11/SDL_x11pen.c index acb5170b61979..0c3f92e0afb3b 100644 --- a/src/video/x11/SDL_x11pen.c +++ b/src/video/x11/SDL_x11pen.c @@ -28,101 +28,79 @@ #include "SDL_x11video.h" #include "SDL_x11xinput2.h" -#define PEN_ERASER_ID_MAXLEN 256 /* Max # characters of device name to scan */ -#define PEN_ERASER_NAME_TAG "eraser" /* String constant to identify erasers */ - -#define DEBUG_PEN (SDL_PEN_DEBUG_NOID | SDL_PEN_DEBUG_NONWACOM | SDL_PEN_DEBUG_UNKNOWN_WACOM | SDL_PEN_DEBUG_NOSERIAL_WACOM) +/* Does this device have a valuator for pressure sensitivity? */ +static SDL_bool X11_XInput2DeviceIsPen(SDL_VideoDevice *_this, const XIDeviceInfo *dev) +{ + const SDL_VideoData *data = (SDL_VideoData *)_this->internal; + for (int i = 0; i < dev->num_classes; i++) { + const XIAnyClassInfo *classinfo = dev->classes[i]; + if (classinfo->type == XIValuatorClass) { + const XIValuatorClassInfo *val_classinfo = (const XIValuatorClassInfo *)classinfo; + if (val_classinfo->label == data->pen_atom_abs_pressure) { + return SDL_TRUE; + } + } + } -#define SDL_PEN_AXIS_VALUATOR_MISSING -1 + return SDL_FALSE; +} -/* X11-specific information attached to each pen */ -typedef struct xinput2_pen -{ - float axis_min[SDL_PEN_NUM_AXES]; - float axis_max[SDL_PEN_NUM_AXES]; - float slider_bias; /* shift value to add to PEN_AXIS_SLIDER (before normalisation) */ - float rotation_bias; /* rotation to add to PEN_AXIS_ROTATION (after normalisation) */ - Sint8 valuator_for_axis[SDL_PEN_NUM_AXES]; /* SDL_PEN_AXIS_VALUATOR_MISSING if not supported */ -} xinput2_pen; - -/* X11 atoms */ -static struct +/* Heuristically determines if device is an eraser */ +static SDL_bool X11_XInput2PenIsEraser(SDL_VideoDevice *_this, int deviceid, char *devicename) { - int initialized; /* initialised to 0 */ - Atom device_product_id; - Atom abs_pressure; - Atom abs_tilt_x; - Atom abs_tilt_y; - Atom wacom_serial_ids; - Atom wacom_tool_type; -} pen_atoms; + #define PEN_ERASER_NAME_TAG "eraser" /* String constant to identify erasers */ + SDL_VideoData *data = (SDL_VideoData *)_this->internal; -/* - * Mapping from X11 device IDs to pen IDs - * - * In X11, the same device ID may represent any number of pens. We - * thus cannot directly use device IDs as pen IDs. - */ -static struct -{ - int num_pens_known; /* Number of currently known pens (based on their GUID); used to give pen ID to new pens */ - int num_entries; /* Number of X11 device IDs that correspond to pens */ + if (data->pen_atom_wacom_tool_type != None) { + Atom type_return; + int format_return; + unsigned long num_items_return; + unsigned long bytes_after_return; + unsigned char *tooltype_name_info = NULL; - struct pen_device_id_mapping - { - Uint32 deviceid; - Uint32 pen_id; - } * entries; /* Current pen to device ID mappings */ -} pen_map; + /* Try Wacom-specific method */ + if (Success == X11_XIGetProperty(data->display, deviceid, + data->pen_atom_wacom_tool_type, + 0, 32, False, + AnyPropertyType, &type_return, &format_return, + &num_items_return, &bytes_after_return, + &tooltype_name_info) && + tooltype_name_info != NULL && num_items_return > 0) { -typedef enum -{ - SDL_PEN_VENDOR_UNKNOWN = 0, - SDL_PEN_VENDOR_WACOM -} sdl_pen_vendor; + SDL_bool result = SDL_FALSE; + char *tooltype_name = NULL; -/* Information to identify pens during discovery */ -typedef struct -{ - sdl_pen_vendor vendor; - SDL_GUID guid; - SDL_PenSubtype heuristic_type; /* Distinguish pen+eraser devices with shared bus ID */ - Uint32 devicetype_id, serial; /* used by PEN_VENDOR_WACOM */ - Uint32 deviceid; -} pen_identity; - -int X11_PenIDFromDeviceID(int deviceid) -{ - int i; - for (i = 0; i < pen_map.num_entries; ++i) { - if (pen_map.entries[i].deviceid == deviceid) { - return pen_map.entries[i].pen_id; + if (type_return == XA_ATOM) { + /* Atom instead of string? Un-intern */ + Atom atom = *((Atom *)tooltype_name_info); + if (atom != None) { + tooltype_name = X11_XGetAtomName(data->display, atom); + } + } else if (type_return == XA_STRING && format_return == 8) { + tooltype_name = (char *)tooltype_name_info; + } + + if (tooltype_name) { + if (0 == SDL_strcasecmp(tooltype_name, PEN_ERASER_NAME_TAG)) { + result = SDL_TRUE; + } + X11_XFree(tooltype_name_info); + + return result; + } } } - return SDL_PEN_INVALID; -} -static void pen_atoms_ensure_initialized(SDL_VideoDevice *_this) -{ - SDL_VideoData *data = (SDL_VideoData *)_this->internal; + /* Non-Wacom device? */ - if (pen_atoms.initialized) { - return; - } - /* Create atoms if they don't exist yet to pre-empt hotplugging updates */ - pen_atoms.device_product_id = X11_XInternAtom(data->display, "Device Product ID", False); - pen_atoms.wacom_serial_ids = X11_XInternAtom(data->display, "Wacom Serial IDs", False); - pen_atoms.wacom_tool_type = X11_XInternAtom(data->display, "Wacom Tool Type", False); - pen_atoms.abs_pressure = X11_XInternAtom(data->display, "Abs Pressure", False); - pen_atoms.abs_tilt_x = X11_XInternAtom(data->display, "Abs Tilt X", False); - pen_atoms.abs_tilt_y = X11_XInternAtom(data->display, "Abs Tilt Y", False); - - pen_atoms.initialized = 1; + /* We assume that a device is an eraser if its name contains the string "eraser". + * Unfortunately there doesn't seem to be a clean way to distinguish these cases (as of 2022-03). */ + return (SDL_strcasestr(devicename, PEN_ERASER_NAME_TAG)) ? SDL_TRUE : SDL_FALSE; } -/* Read out an integer property and store into a preallocated Sint32 array, extending 8 and 16 bit values suitably. - Returns number of Sint32s written (<= max_words), or 0 on error. */ -static size_t xinput2_pen_get_int_property(SDL_VideoDevice *_this, int deviceid, Atom property, Sint32 *dest, size_t max_words) +// Read out an integer property and store into a preallocated Sint32 array, extending 8 and 16 bit values suitably. +// Returns number of Sint32s written (<= max_words), or 0 on error. +static size_t X11_XInput2PenGetIntProperty(SDL_VideoDevice *_this, int deviceid, Atom property, Sint32 *dest, size_t max_words) { const SDL_VideoData *data = (SDL_VideoData *)_this->internal; Atom type_return; @@ -165,498 +143,249 @@ static size_t xinput2_pen_get_int_property(SDL_VideoDevice *_this, int deviceid, X11_XFree(output); return to_copy; } - return 0; /* type mismatch */ -} - -/* 32 bit vendor + device ID from evdev */ -static Uint32 xinput2_pen_evdevid(SDL_VideoDevice *_this, int deviceid) -{ -#if !(SDL_PEN_DEBUG_NOID) - Sint32 ids[2]; - - pen_atoms_ensure_initialized(_this); - - if (2 != xinput2_pen_get_int_property(_this, deviceid, pen_atoms.device_product_id, ids, 2)) { - return 0; - } - return ((ids[0] << 16) | (ids[1] & 0xffff)); -#else /* Testing: pretend that we have no ID (not sure if this can happen IRL) */ - return 0; -#endif -} - -/* Gets reasonably-unique GUID for the device */ -static void xinput2_pen_update_generic_guid(SDL_VideoDevice *_this, pen_identity *pident, int deviceid) -{ - Uint32 evdevid = xinput2_pen_evdevid(_this, deviceid); /* also initialises pen_atoms */ - if (!evdevid) { - /* Fallback: if no evdevid is available; try to at least distinguish devices within the - current session. This is a poor GUID and our last resort. */ - evdevid = deviceid; - } - SDL_PenUpdateGUIDForGeneric(&pident->guid, 0, evdevid); + return 0; // type mismatch } -/* Identify Wacom devices (if SDL_TRUE is returned) and extract their device type and serial IDs */ -static SDL_bool xinput2_wacom_deviceid(SDL_VideoDevice *_this, int deviceid, Uint32 *wacom_devicetype_id, Uint32 *wacom_serial) +// Identify Wacom devices (if SDL_TRUE is returned) and extract their device type and serial IDs +static SDL_bool X11_XInput2PenWacomDeviceID(SDL_VideoDevice *_this, int deviceid, Uint32 *wacom_devicetype_id, Uint32 *wacom_serial) { -#if !(SDL_PEN_DEBUG_NONWACOM) /* Can be disabled for testing */ + SDL_VideoData *data = (SDL_VideoData *)_this->internal; Sint32 serial_id_buf[3]; int result; - pen_atoms_ensure_initialized(_this); - - if ((result = xinput2_pen_get_int_property(_this, deviceid, pen_atoms.wacom_serial_ids, serial_id_buf, 3)) == 3) { + if ((result = X11_XInput2PenGetIntProperty(_this, deviceid, data->pen_atom_wacom_serial_ids, serial_id_buf, 3)) == 3) { *wacom_devicetype_id = serial_id_buf[2]; *wacom_serial = serial_id_buf[1]; -#if SDL_PEN_DEBUG_NOSERIAL_WACOM /* Disabled for testing? */ - *wacom_serial = 0; -#endif return SDL_TRUE; } -#endif + + *wacom_devicetype_id = *wacom_serial = 0; return SDL_FALSE; } -/* Heuristically determines if device is an eraser */ -static SDL_bool xinput2_pen_is_eraser(SDL_VideoDevice *_this, int deviceid, char *devicename) -{ - SDL_VideoData *data = (SDL_VideoData *)_this->internal; - char dev_name[PEN_ERASER_ID_MAXLEN]; - int k; - - pen_atoms_ensure_initialized(_this); - - if (pen_atoms.wacom_tool_type != None) { - Atom type_return; - int format_return; - unsigned long num_items_return; - unsigned long bytes_after_return; - unsigned char *tooltype_name_info = NULL; - - /* Try Wacom-specific method */ - if (Success == X11_XIGetProperty(data->display, deviceid, - pen_atoms.wacom_tool_type, - 0, 32, False, - AnyPropertyType, &type_return, &format_return, - &num_items_return, &bytes_after_return, - &tooltype_name_info) && - tooltype_name_info != NULL && num_items_return > 0) { - - SDL_bool result = SDL_FALSE; - char *tooltype_name = NULL; - - if (type_return == XA_ATOM) { - /* Atom instead of string? Un-intern */ - Atom atom = *((Atom *)tooltype_name_info); - if (atom != None) { - tooltype_name = X11_XGetAtomName(data->display, atom); - } - } else if (type_return == XA_STRING && format_return == 8) { - tooltype_name = (char *)tooltype_name_info; - } - - if (tooltype_name) { - if (0 == SDL_strcasecmp(tooltype_name, PEN_ERASER_NAME_TAG)) { - result = SDL_TRUE; - } - X11_XFree(tooltype_name_info); - return result; - } - } - } - /* Non-Wacom device? */ - - /* We assume that a device is an eraser if its name contains the string "eraser". - * Unfortunately there doesn't seem to be a clean way to distinguish these cases (as of 2022-03). */ +typedef struct FindPenByDeviceIDData +{ + int x11_deviceid; + void *handle; +} FindPenByDeviceIDData; - SDL_strlcpy(dev_name, devicename, PEN_ERASER_ID_MAXLEN); - /* lowercase device name string so we can use strstr() */ - for (k = 0; dev_name[k]; ++k) { - dev_name[k] = SDL_tolower(dev_name[k]); +static SDL_bool FindPenByDeviceID(void *handle, void *userdata) +{ + const X11_PenHandle *x11_handle = (const X11_PenHandle *) handle; + FindPenByDeviceIDData *data = (FindPenByDeviceIDData *) userdata; + if (x11_handle->x11_deviceid != data->x11_deviceid) { + return SDL_FALSE; } - - return (SDL_strstr(dev_name, PEN_ERASER_NAME_TAG)) ? SDL_TRUE : SDL_FALSE; + data->handle = handle; + return SDL_TRUE; } -/* Gets GUID and other identifying information for the device using the best known method */ -static pen_identity xinput2_identify_pen(SDL_VideoDevice *_this, int deviceid, char *name) +X11_PenHandle *X11_FindPenByDeviceID(int deviceid) { - pen_identity pident; - - pident.devicetype_id = 0ul; - pident.serial = 0ul; - pident.deviceid = deviceid; - pident.heuristic_type = SDL_PEN_TYPE_PEN; - SDL_memset(pident.guid.data, 0, sizeof(pident.guid.data)); + FindPenByDeviceIDData data; + data.x11_deviceid = deviceid; + data.handle = NULL; + SDL_FindPenByCallback(FindPenByDeviceID, &data); + return (X11_PenHandle *) data.handle; +} - if (xinput2_pen_is_eraser(_this, deviceid, name)) { - pident.heuristic_type = SDL_PEN_TYPE_ERASER; +static X11_PenHandle *X11_MaybeAddPen(SDL_VideoDevice *_this, const XIDeviceInfo *dev) +{ + SDL_VideoData *data = (SDL_VideoData *)_this->internal; + SDL_PenCapabilityFlags capabilities = 0; + X11_PenHandle *handle = NULL; + + if ((dev->use != XISlavePointer && (dev->use != XIFloatingSlave)) || dev->enabled == 0 || !X11_XInput2DeviceIsPen(_this, dev)) { + return NULL; // Only track physical devices that are enabled and look like pens + } else if ((handle = X11_FindPenByDeviceID(dev->deviceid)) != 0) { + return handle; // already have this pen, skip it. + } else if ((handle = SDL_calloc(1, sizeof (*handle))) == NULL) { + return NULL; // oh well. } - if (xinput2_wacom_deviceid(_this, deviceid, &pident.devicetype_id, &pident.serial)) { - pident.vendor = SDL_PEN_VENDOR_WACOM; - SDL_PenUpdateGUIDForWacom(&pident.guid, pident.devicetype_id, pident.serial); - -#if DEBUG_PEN - printf("[pen] Pen %d reports Wacom device_id %x\n", - deviceid, pident.devicetype_id); -#endif - - } else { - pident.vendor = SDL_PEN_VENDOR_UNKNOWN; + for (int i = 0; i < SDL_arraysize(handle->valuator_for_axis); i++) { + handle->valuator_for_axis[i] = SDL_X11_PEN_AXIS_VALUATOR_MISSING; // until proven otherwise } - if (!pident.serial) { - /* If the pen has a serial number, we can move it across tablets and retain its identity. - Otherwise, we use the evdev ID as part of its GUID, which may mean that we identify it with the tablet. */ - xinput2_pen_update_generic_guid(_this, &pident, deviceid); - } - SDL_PenUpdateGUIDForType(&pident.guid, pident.heuristic_type); - return pident; -} -static void xinput2_pen_free_deviceinfo(Uint32 deviceid, void *x11_peninfo, void *context) -{ - SDL_free(x11_peninfo); -} + int total_buttons = 0; + for (int i = 0; i < dev->num_classes; i++) { + const XIAnyClassInfo *classinfo = dev->classes[i]; + if (classinfo->type == XIButtonClass) { + const XIButtonClassInfo *button_classinfo = (const XIButtonClassInfo *)classinfo; + total_buttons += button_classinfo->num_buttons; + } else if (classinfo->type == XIValuatorClass) { + const XIValuatorClassInfo *val_classinfo = (const XIValuatorClassInfo *)classinfo; + const Sint8 valuator_nr = val_classinfo->number; + const Atom vname = val_classinfo->label; + const float min = (float)val_classinfo->min; + const float max = (float)val_classinfo->max; + SDL_bool use_this_axis = SDL_TRUE; + SDL_PenAxis axis = SDL_PEN_NUM_AXES; + + // afaict, SDL_PEN_AXIS_DISTANCE is never reported by XInput2 (Wayland can offer it, though) + if (vname == data->pen_atom_abs_pressure) { + axis = SDL_PEN_AXIS_PRESSURE; + } else if (vname == data->pen_atom_abs_tilt_x) { + axis = SDL_PEN_AXIS_XTILT; + } else if (vname == data->pen_atom_abs_tilt_y) { + axis = SDL_PEN_AXIS_YTILT; + } else { + use_this_axis = SDL_FALSE; + } -static void xinput2_merge_deviceinfo(xinput2_pen *dest, xinput2_pen *src) -{ - *dest = *src; -} + // !!! FIXME: there are wacom-specific hacks for getting SDL_PEN_AXIS_(ROTATION|SLIDER) on some devices, but for simplicity, we're skipping all that for now. -/** - * Fill in vendor-specific device information, if available - * - * For Wacom pens: identify number of buttons and extra axis (if present) - * - * \param _this global state - * \param dev The device to analyse - * \param pen The pen to initialise - * \param pident Pen identity information - * \param[out] valuator_5 Meaning of the valuator with offset 5, if any - * (written only if known and if the device has a 6th axis, - * e.g., for the Wacom Art Pen and Wacom Airbrush Pen) - * \param[out] axes Bitmask of all possibly supported axes - * - * This function identifies Wacom device types through a Wacom-specific device ID. - * It then fills in pen details from an internal database. - * If the device seems to be a Wacom pen/eraser but can't be identified, the function - * leaves "axes" untouched and sets the other outputs to common defaults. - * - * There is no explicit support for other vendors, though vendors that - * emulate the Wacom API might be supported. - * - * Unsupported devices will keep the default settings. - */ -static void xinput2_vendor_peninfo(SDL_VideoDevice *_this, const XIDeviceInfo *dev, SDL_Pen *pen, pen_identity pident, int *valuator_5, Uint32 *axes) -{ - switch (pident.vendor) { - case SDL_PEN_VENDOR_WACOM: - { - if (SDL_PenModifyForWacomID(pen, pident.devicetype_id, axes)) { - if (*axes & SDL_PEN_AXIS_SLIDER_MASK) { - /* Air Brush Pen or eraser */ - *valuator_5 = SDL_PEN_AXIS_SLIDER; - } else if (*axes & SDL_PEN_AXIS_ROTATION_MASK) { - /* Art Pen or eraser, or 6D Art Pen */ - *valuator_5 = SDL_PEN_AXIS_ROTATION; + if (use_this_axis) { + capabilities |= SDL_GetPenCapabilityFromAxis(axis); + handle->valuator_for_axis[axis] = valuator_nr; + handle->axis_min[axis] = min; + handle->axis_max[axis] = max; } - return; - } else { -#if DEBUG_PEN - printf("[pen] Could not identify wacom pen %d with device id %x, using default settings\n", - pident.deviceid, pident.devicetype_id); -#endif - break; } } - default: -#if DEBUG_PEN - printf("[pen] Pen %d is not from a known vendor\n", pident.deviceid); -#endif - break; + // We have a pen if and only if the device measures pressure. + // We checked this in X11_XInput2DeviceIsPen, so just assert it here. + SDL_assert(capabilities & SDL_PEN_CAPABILITY_PRESSURE); + + const SDL_bool is_eraser = X11_XInput2PenIsEraser(_this, dev->deviceid, dev->name); + Uint32 wacom_devicetype_id = 0; + Uint32 wacom_serial = 0; + X11_XInput2PenWacomDeviceID(_this, dev->deviceid, &wacom_devicetype_id, &wacom_serial); + + SDL_PenInfo peninfo; + SDL_zero(peninfo); + peninfo.capabilities = capabilities; + peninfo.max_tilt = -1; + peninfo.wacom_id = wacom_devicetype_id; + peninfo.num_buttons = total_buttons; + peninfo.subtype = is_eraser ? SDL_PEN_TYPE_ERASER : SDL_PEN_TYPE_PEN; + if (is_eraser) { + peninfo.capabilities |= SDL_PEN_CAPABILITY_ERASER; } - /* Fall back to default heuristics for identifying device type */ + handle->is_eraser = is_eraser; + handle->x11_deviceid = dev->deviceid; - SDL_strlcpy(pen->name, dev->name, SDL_PEN_MAX_NAME); + handle->pen = SDL_AddPenDevice(0, dev->name, &peninfo, handle); + if (!handle->pen) { + SDL_free(handle); + return NULL; + } - pen->type = pident.heuristic_type; + return handle; } -/* Does this device have a valuator for pressure sensitivity? */ -static SDL_bool xinput2_device_is_pen(SDL_VideoDevice *_this, const XIDeviceInfo *dev) +X11_PenHandle *X11_MaybeAddPenByDeviceID(SDL_VideoDevice *_this, int deviceid) { - int classct; - - pen_atoms_ensure_initialized(_this); - - for (classct = 0; classct < dev->num_classes; ++classct) { - const XIAnyClassInfo *classinfo = dev->classes[classct]; - - switch (classinfo->type) { - case XIValuatorClass: - { - XIValuatorClassInfo *val_classinfo = (XIValuatorClassInfo *)classinfo; - Atom vname = val_classinfo->label; + SDL_VideoData *data = (SDL_VideoData *)_this->internal; + int num_device_info = 0; + XIDeviceInfo *device_info = X11_XIQueryDevice(data->display, deviceid, &num_device_info); + if (device_info) { + SDL_assert(num_device_info == 1); + return X11_MaybeAddPen(_this, device_info); + } + return NULL; +} - if (vname == pen_atoms.abs_pressure) { - return SDL_TRUE; - } - } - } +void X11_RemovePenByDeviceID(int deviceid) +{ + X11_PenHandle *handle = X11_FindPenByDeviceID(deviceid); + if (handle) { + SDL_RemovePenDevice(0, handle->pen); + SDL_free(handle); } - return SDL_FALSE; } void X11_InitPen(SDL_VideoDevice *_this) { SDL_VideoData *data = (SDL_VideoData *)_this->internal; - int i; - XIDeviceInfo *device_info; - int num_device_info; - device_info = X11_XIQueryDevice(data->display, XIAllDevices, &num_device_info); - if (!device_info) { - return; + #define LOOKUP_PEN_ATOM(X) X11_XInternAtom(data->display, X, False) + data->pen_atom_device_product_id = LOOKUP_PEN_ATOM("Device Product ID"); + data->pen_atom_wacom_serial_ids = LOOKUP_PEN_ATOM("Wacom Serial IDs"); + data->pen_atom_wacom_tool_type = LOOKUP_PEN_ATOM("Wacom Tool Type"); + data->pen_atom_abs_pressure = LOOKUP_PEN_ATOM("Abs Pressure"); + data->pen_atom_abs_tilt_x = LOOKUP_PEN_ATOM("Abs Tilt X"); + data->pen_atom_abs_tilt_y = LOOKUP_PEN_ATOM("Abs Tilt Y"); + #undef LOOKUP_PEN_ATOM + + // Do an initial check on devices. After this, we'll add/remove individual pens when XI_HierarchyChanged events alert us. + int num_device_info = 0; + XIDeviceInfo *device_info = X11_XIQueryDevice(data->display, XIAllDevices, &num_device_info); + if (device_info) { + for (int i = 0; i < num_device_info; i++) { + X11_MaybeAddPen(_this, &device_info[i]); + } + X11_XIFreeDeviceInfo(device_info); } +} - /* Reset the device id -> pen map */ - if (pen_map.entries) { - SDL_free(pen_map.entries); - pen_map.entries = NULL; - pen_map.num_entries = 0; - } +static void X11_FreePenHandle(SDL_PenID instance_id, void *handle, void *userdata) +{ + SDL_free(handle); +} - SDL_PenGCMark(); - - for (i = 0; i < num_device_info; ++i) { - const XIDeviceInfo *dev = &device_info[i]; - int classct; - xinput2_pen pen_device; - Uint32 capabilities = 0; - Uint32 axis_mask = ~0; /* Permitted axes (default: all) */ - int valuator_5_axis = -1; /* For Wacom devices, the 6th valuator (offset 5) has a model-specific meaning */ - pen_identity pident; - SDL_PenID pen_id; - SDL_Pen *pen; - int old_num_pens_known = pen_map.num_pens_known; - int k; +void X11_QuitPen(SDL_VideoDevice *_this) +{ + SDL_RemoveAllPenDevices(X11_FreePenHandle, NULL); +} - /* Only track physical devices that are enabled and look like pens */ - if (dev->use != XISlavePointer || dev->enabled == 0 || !xinput2_device_is_pen(_this, dev)) { +static void X11_XInput2NormalizePenAxes(const X11_PenHandle *pen, float *coords) +{ + /* Normalise axes */ + for (int axis = 0; axis < SDL_PEN_NUM_AXES; ++axis) { + const int valuator = pen->valuator_for_axis[axis]; + if (valuator == SDL_X11_PEN_AXIS_VALUATOR_MISSING) { continue; } - pen_device.slider_bias = 0.0f; - pen_device.rotation_bias = 0.0f; - for (k = 0; k < SDL_PEN_NUM_AXES; ++k) { - pen_device.valuator_for_axis[k] = SDL_PEN_AXIS_VALUATOR_MISSING; - } - - pident = xinput2_identify_pen(_this, dev->deviceid, dev->name); - - pen_id = SDL_GetPenFromGUID(pident.guid); - if (pen_id == SDL_PEN_INVALID) { - /* We have never met this pen */ - pen_id = ++pen_map.num_pens_known; /* start at 1 */ - } - pen = SDL_PenModifyBegin(pen_id); - - /* Complement XF86 driver information with vendor-specific details */ - xinput2_vendor_peninfo(_this, dev, pen, pident, &valuator_5_axis, &axis_mask); - - for (classct = 0; classct < dev->num_classes; ++classct) { - const XIAnyClassInfo *classinfo = dev->classes[classct]; - - switch (classinfo->type) { - case XIValuatorClass: - { - XIValuatorClassInfo *val_classinfo = (XIValuatorClassInfo *)classinfo; - Sint8 valuator_nr = val_classinfo->number; - Atom vname = val_classinfo->label; - int axis = -1; - - float min = (float)val_classinfo->min; - float max = (float)val_classinfo->max; - - if (vname == pen_atoms.abs_pressure) { - axis = SDL_PEN_AXIS_PRESSURE; - } else if (vname == pen_atoms.abs_tilt_x) { - axis = SDL_PEN_AXIS_XTILT; - } else if (vname == pen_atoms.abs_tilt_y) { - axis = SDL_PEN_AXIS_YTILT; - } - - if (axis == -1 && valuator_nr == 5) { - /* Wacom model-specific axis support */ - /* The meaning of the various axes is highly underspecitied in Xinput2. - * As of 2023-08-26, Wacom seems to be the only vendor to support these axes, so the code below - * captures the de-facto standard. */ - axis = valuator_5_axis; - - switch (axis) { - case SDL_PEN_AXIS_SLIDER: - /* cf. xinput2_wacom_peninfo for how this axis is used. - In all current cases, our API wants this value in 0..1, but the xf86 driver - starts at a negative offset, so we normalise here. */ - pen_device.slider_bias = -min; - max -= min; - min = 0.0f; - break; - - case SDL_PEN_AXIS_ROTATION: - /* The "0" value points to the left, rather than up, so we must - rotate 90 degrees counter-clockwise to have 0 point to the top. */ - - pen_device.rotation_bias = -90.0f; - break; - - default: - break; - } - } - - if (axis >= 0) { - capabilities |= SDL_PEN_AXIS_CAPABILITY(axis); + float value = coords[axis]; + const float min = pen->axis_min[axis]; + const float max = pen->axis_max[axis]; - pen_device.valuator_for_axis[axis] = valuator_nr; - pen_device.axis_min[axis] = min; - pen_device.axis_max[axis] = max; - } - break; - } - default: - break; - } + if (axis == SDL_PEN_AXIS_SLIDER) { + value += pen->slider_bias; } - /* We have a pen if and only if the device measures pressure */ - if (capabilities & SDL_PEN_AXIS_PRESSURE_MASK) { - xinput2_pen *xinput2_deviceinfo; - Uint64 guid_a, guid_b; - - /* Done collecting data, write to pen */ - SDL_PenModifyAddCapabilities(pen, capabilities); - pen->guid = pident.guid; - - if (pen->deviceinfo) { - /* Updating a known pen */ - xinput2_deviceinfo = (xinput2_pen *)pen->deviceinfo; - xinput2_merge_deviceinfo(xinput2_deviceinfo, &pen_device); + // min ... 0 ... max + if (min < 0.0) { + // Normalise so that 0 remains 0.0 + if (value < 0) { + value = value / (-min); } else { - /* Registering a new pen */ - xinput2_deviceinfo = SDL_malloc(sizeof(xinput2_pen)); - SDL_memcpy(xinput2_deviceinfo, &pen_device, sizeof(xinput2_pen)); - } - pen->deviceinfo = xinput2_deviceinfo; - -#if DEBUG_PEN - printf("[pen] pen %d [%04x] valuators pressure=%d, xtilt=%d, ytilt=%d [%s]\n", - pen->header.id, pen->header.flags, - pen_device.valuator_for_axis[SDL_PEN_AXIS_PRESSURE], - pen_device.valuator_for_axis[SDL_PEN_AXIS_XTILT], - pen_device.valuator_for_axis[SDL_PEN_AXIS_YTILT], - pen->name); -#endif - SDL_memcpy(&guid_a, &pen->guid.data[0], 8); - SDL_memcpy(&guid_b, &pen->guid.data[8], 8); - if (!(guid_a | guid_b)) { -#if DEBUG_PEN - printf("[pen] (pen eliminated due to zero GUID)\n"); -#endif - pen->type = SDL_PEN_TYPE_NONE; + if (max == 0.0f) { + value = 0.0f; + } else { + value = value / max; + } } - } else { - /* Not a pen, mark for deletion */ - pen->type = SDL_PEN_TYPE_NONE; - } - SDL_PenModifyEnd(pen, SDL_TRUE); - - if (pen->type != SDL_PEN_TYPE_NONE) { - const int map_pos = pen_map.num_entries; - - /* We found a pen: add mapping */ - if (pen_map.entries == NULL) { - pen_map.entries = SDL_calloc(sizeof(struct pen_device_id_mapping), 1); - pen_map.num_entries = 1; + // 0 ... min ... max + // including 0.0 = min + if (max == 0.0f) { + value = 0.0f; } else { - pen_map.num_entries += 1; - pen_map.entries = SDL_realloc(pen_map.entries, - pen_map.num_entries * (sizeof(struct pen_device_id_mapping))); + value = (value - min) / max; } - pen_map.entries[map_pos].deviceid = dev->deviceid; - pen_map.entries[map_pos].pen_id = pen_id; - } else { - /* Revert pen number allocation */ - pen_map.num_pens_known = old_num_pens_known; } - } - X11_XIFreeDeviceInfo(device_info); - - SDL_PenGCSweep(NULL, xinput2_pen_free_deviceinfo); -} - -static void xinput2_normalize_pen_axes(const SDL_Pen *peninfo, - const xinput2_pen *xpen, - /* inout-mode paramters: */ - float *coords) -{ - int axis; - - /* Normalise axes */ - for (axis = 0; axis < SDL_PEN_NUM_AXES; ++axis) { - int valuator = xpen->valuator_for_axis[axis]; - if (valuator != SDL_PEN_AXIS_VALUATOR_MISSING) { - float value = coords[axis]; - float min = xpen->axis_min[axis]; - float max = xpen->axis_max[axis]; - - if (axis == SDL_PEN_AXIS_SLIDER) { - value += xpen->slider_bias; - } - /* min ... 0 ... max */ - if (min < 0.0) { - /* Normalise so that 0 remains 0.0 */ - if (value < 0) { - value = value / (-min); - } else { - if (max == 0.0) { - value = 0.0f; - } else { - value = value / max; - } - } - } else { - /* 0 ... min ... max */ - /* including 0.0 = min */ - if (max == 0.0) { - value = 0.0f; - } else { - value = (value - min) / max; - } - } - - switch (axis) { + switch (axis) { case SDL_PEN_AXIS_XTILT: case SDL_PEN_AXIS_YTILT: - if (peninfo->info.max_tilt > 0.0f) { - value *= peninfo->info.max_tilt; /* normalise to physical max */ - } + //if (peninfo->info.max_tilt > 0.0f) { + // value *= peninfo->info.max_tilt; // normalize to physical max + //} break; case SDL_PEN_AXIS_ROTATION: - /* normalised to -1..1, so let's convert to degrees */ + // normalised to -1..1, so let's convert to degrees value *= 180.0f; - value += xpen->rotation_bias; + value += pen->rotation_bias; - /* handle simple over/underflow */ + // handle simple over/underflow if (value >= 180.0f) { value -= 360.0f; } else if (value < -180.0f) { @@ -666,31 +395,26 @@ static void xinput2_normalize_pen_axes(const SDL_Pen *peninfo, default: break; - } - coords[axis] = value; } + + coords[axis] = value; } } -void X11_PenAxesFromValuators(const SDL_Pen *peninfo, +void X11_PenAxesFromValuators(const X11_PenHandle *pen, const double *input_values, const unsigned char *mask, const int mask_len, - /* out-mode parameters: */ float axis_values[SDL_PEN_NUM_AXES]) { - const xinput2_pen *pen = (xinput2_pen *)peninfo->deviceinfo; - int i; - - for (i = 0; i < SDL_PEN_NUM_AXES; ++i) { + for (int i = 0; i < SDL_PEN_NUM_AXES; i++) { const int valuator = pen->valuator_for_axis[i]; - if (valuator == SDL_PEN_AXIS_VALUATOR_MISSING || valuator >= mask_len * 8 || !(XIMaskIsSet(mask, valuator))) { + if ((valuator == SDL_X11_PEN_AXIS_VALUATOR_MISSING) || (valuator >= mask_len * 8) || !(XIMaskIsSet(mask, valuator))) { axis_values[i] = 0.0f; } else { axis_values[i] = (float)input_values[valuator]; } } - xinput2_normalize_pen_axes(peninfo, pen, axis_values); + X11_XInput2NormalizePenAxes(pen, axis_values); } -#endif /* SDL_VIDEO_DRIVER_X11_XINPUT2 */ +#endif // SDL_VIDEO_DRIVER_X11_XINPUT2 -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/x11/SDL_x11pen.h b/src/video/x11/SDL_x11pen.h index ebb7847d803a2..71a60739970f0 100644 --- a/src/video/x11/SDL_x11pen.h +++ b/src/video/x11/SDL_x11pen.h @@ -23,32 +23,51 @@ #ifndef SDL_x11pen_h_ #define SDL_x11pen_h_ +// Pressure-sensitive pen support for X11. + #ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 #include "SDL_x11video.h" #include "../../events/SDL_pen_c.h" -/* Pressure-sensitive pen */ - -/* Forward definition for SDL_x11video.h */ +// Forward definition for SDL_x11video.h struct SDL_VideoData; -/* Function definitions */ +#define SDL_X11_PEN_AXIS_VALUATOR_MISSING -1 + +typedef struct X11_PenHandle +{ + SDL_PenID pen; + SDL_bool is_eraser; + int x11_deviceid; + int valuator_for_axis[SDL_PEN_NUM_AXES]; + float slider_bias; // shift value to add to PEN_AXIS_SLIDER (before normalisation) + float rotation_bias; // rotation to add to PEN_AXIS_ROTATION (after normalisation) + float axis_min[SDL_PEN_NUM_AXES]; + float axis_max[SDL_PEN_NUM_AXES]; +} X11_PenHandle; -/* Detect XINPUT2 devices that are pens / erasers, or update the list after hotplugging */ +// Prep pen support (never fails; pens simply won't be added if there's a problem). extern void X11_InitPen(SDL_VideoDevice *_this); -/* Converts XINPUT2 valuators into pen axis information, including normalisation */ -extern void X11_PenAxesFromValuators(const SDL_Pen *pen, +// Clean up pen support. +extern void X11_QuitPen(SDL_VideoDevice *_this); + +// Converts XINPUT2 valuators into pen axis information, including normalisation. +extern void X11_PenAxesFromValuators(const X11_PenHandle *pen, const double *input_values, const unsigned char *mask, const int mask_len, - /* out-mode parameters: */ float axis_values[SDL_PEN_NUM_AXES]); -/* Map X11 device ID to pen ID */ -extern int X11_PenIDFromDeviceID(int deviceid); +// Add a pen (if this function's further checks validate it). +extern X11_PenHandle *X11_MaybeAddPenByDeviceID(SDL_VideoDevice *_this, int deviceid); + +// Remove a pen. It's okay if deviceid is bogus or not a pen, we'll check it. +extern void X11_RemovePenByDeviceID(int deviceid); + +// Map X11 device ID to pen ID. +extern X11_PenHandle *X11_FindPenByDeviceID(int deviceid); -#endif /* SDL_VIDEO_DRIVER_X11_XINPUT2 */ +#endif // SDL_VIDEO_DRIVER_X11_XINPUT2 -#endif /* SDL_x11pen_h_ */ +#endif // SDL_x11pen_h_ -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index e255f3ce4d7fe..860f486fce253 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -456,9 +456,7 @@ int X11_VideoInit(SDL_VideoDevice *_this) X11_InitTouch(_this); -#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 X11_InitPen(_this); -#endif return 0; } @@ -485,6 +483,7 @@ void X11_VideoQuit(SDL_VideoDevice *_this) X11_QuitKeyboard(_this); X11_QuitMouse(_this); X11_QuitTouch(_this); + X11_QuitPen(_this); X11_QuitClipboard(_this); X11_QuitXsettings(_this); } diff --git a/src/video/x11/SDL_x11video.h b/src/video/x11/SDL_x11video.h index f8e567c777cc2..328ac0c8e4e80 100644 --- a/src/video/x11/SDL_x11video.h +++ b/src/video/x11/SDL_x11video.h @@ -104,6 +104,14 @@ struct SDL_VideoData Atom XdndSelection; Atom XKLAVIER_STATE; + /* Pen atoms (these have names that don't map well to C symbols) */ + Atom pen_atom_device_product_id; + Atom pen_atom_abs_pressure; + Atom pen_atom_abs_tilt_x; + Atom pen_atom_abs_tilt_y; + Atom pen_atom_wacom_serial_ids; + Atom pen_atom_wacom_tool_type; + SDL_Scancode key_layout[256]; SDL_bool selection_waiting; SDL_bool selection_incr_waiting; @@ -141,7 +149,6 @@ struct SDL_VideoData SDL_bool steam_keyboard_open; SDL_bool is_xwayland; - }; extern SDL_bool X11_UseDirectColorVisuals(void); diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c index df96499fdea5d..5470747d6ba62 100644 --- a/src/video/x11/SDL_x11xinput2.c +++ b/src/video/x11/SDL_x11xinput2.c @@ -274,18 +274,6 @@ static SDL_XInput2DeviceInfo *xinput2_get_device_info(SDL_VideoData *videodata, return devinfo; } - -static void xinput2_pen_ensure_window(SDL_VideoDevice *_this, const SDL_Pen *pen, Window window) -{ - /* When "flipping" a Wacom eraser pen, we get an XI_DeviceChanged event - * with the newly-activated pen, but this event is global for the display. - * We won't get a window until the pen starts triggering motion or - * button events, so we instead hook the pen to its window at that point. */ - const SDL_WindowData *windowdata = X11_FindWindow(_this, window); - if (windowdata) { - SDL_SendPenWindowEvent(0, pen->header.id, windowdata->window); - } -} #endif void X11_HandleXinput2Event(SDL_VideoDevice *_this, XGenericEventCookie *cookie) @@ -303,6 +291,14 @@ void X11_HandleXinput2Event(SDL_VideoDevice *_this, XGenericEventCookie *cookie) const XIHierarchyEvent *hierev = (const XIHierarchyEvent *)cookie->data; int i; for (i = 0; i < hierev->num_info; i++) { + // pen stuff... + if ((hierev->info[i].flags & (XISlaveRemoved | XIDeviceDisabled)) != 0) { + X11_RemovePenByDeviceID(hierev->info[i].deviceid); // it's okay if this thing isn't actually a pen, it'll handle it. + } else if ((hierev->info[i].flags & (XISlaveAdded | XIDeviceEnabled)) != 0) { + X11_MaybeAddPenByDeviceID(_this, hierev->info[i].deviceid); // this will do more checks to make sure this is valid. + } + + // not pen stuff... if (hierev->info[i].flags & XISlaveRemoved) { xinput2_remove_device_info(videodata, hierev->info[i].deviceid); } @@ -310,29 +306,14 @@ void X11_HandleXinput2Event(SDL_VideoDevice *_this, XGenericEventCookie *cookie) videodata->xinput_hierarchy_changed = SDL_TRUE; } break; - case XI_PropertyEvent: - case XI_DeviceChanged: - { - // FIXME: We shouldn't rescan all devices for pen changes every time a property or active slave changes - X11_InitPen(_this); - } break; - - case XI_Enter: - case XI_Leave: - { - const XIEnterEvent *enterev = (const XIEnterEvent *)cookie->data; - const SDL_WindowData *windowdata = X11_FindWindow(_this, enterev->event); - const SDL_Pen *pen = SDL_GetPenPtr(X11_PenIDFromDeviceID(enterev->sourceid)); - SDL_Window *window = (windowdata && (cookie->evtype == XI_Enter)) ? windowdata->window : NULL; - if (pen) { - SDL_SendPenWindowEvent(0, pen->header.id, window); - } - } break; + // !!! FIXME: the pen code used to rescan all devices here, but we can do this device-by-device with XI_HierarchyChanged. When do these events fire and why? + //case XI_PropertyEvent: + //case XI_DeviceChanged: case XI_RawMotion: { const XIRawEvent *rawev = (const XIRawEvent *)cookie->data; - const SDL_bool is_pen = X11_PenIDFromDeviceID(rawev->sourceid) != SDL_PEN_INVALID; + const SDL_bool is_pen = X11_FindPenByDeviceID(rawev->sourceid) != NULL; SDL_Mouse *mouse = SDL_GetMouse(); SDL_XInput2DeviceInfo *devinfo; double coords[2]; @@ -341,11 +322,9 @@ void X11_HandleXinput2Event(SDL_VideoDevice *_this, XGenericEventCookie *cookie) videodata->global_mouse_changed = SDL_TRUE; if (is_pen) { - break; /* Pens check for XI_Motion instead */ + break; // Pens check for XI_Motion instead } - /* Non-pen: */ - if (!mouse->relative_mode || mouse->relative_mode_warp) { break; } @@ -426,31 +405,17 @@ void X11_HandleXinput2Event(SDL_VideoDevice *_this, XGenericEventCookie *cookie) case XI_ButtonRelease: { const XIDeviceEvent *xev = (const XIDeviceEvent *)cookie->data; - const SDL_Pen *pen = SDL_GetPenPtr(X11_PenIDFromDeviceID(xev->deviceid)); + X11_PenHandle *pen = X11_FindPenByDeviceID(xev->deviceid); const int button = xev->detail; const SDL_bool pressed = (cookie->evtype == XI_ButtonPress) ? SDL_TRUE : SDL_FALSE; if (pen) { - xinput2_pen_ensure_window(_this, pen, xev->event); - - /* Only report button event; if there was also pen movement / pressure changes, we expect - an XI_Motion event first anyway */ - if (button == 1) { - /* button 1 is the pen tip */ - if (pressed && SDL_PenPerformHitTest()) { - /* Check whether we should handle window resize / move events */ - SDL_WindowData *windowdata = X11_FindWindow(_this, xev->event); - if (windowdata && X11_TriggerHitTestAction(_this, windowdata, pen->last.x, pen->last.y)) { - SDL_SendWindowEvent(windowdata->window, SDL_EVENT_WINDOW_HIT_TEST, 0, 0); - break; /* Don't pass on this event */ - } - } - SDL_SendPenTipEvent(0, pen->header.id, - pressed ? SDL_PRESSED : SDL_RELEASED); + // Only report button event; if there was also pen movement / pressure changes, we expect an XI_Motion event first anyway. + SDL_Window *window = xinput2_get_sdlwindow(videodata, xev->event); + if (button == 1) { // button 1 is the pen tip + SDL_SendPenTouch(0, pen->pen, window, pressed ? SDL_PRESSED : SDL_RELEASED, pen->is_eraser); } else { - SDL_SendPenButton(0, pen->header.id, - pressed ? SDL_PRESSED : SDL_RELEASED, - button - 1); + SDL_SendPenButton(0, pen->pen, window, pressed ? SDL_PRESSED : SDL_RELEASED, button - 1); } } else { /* Otherwise assume a regular mouse */ @@ -475,7 +440,6 @@ void X11_HandleXinput2Event(SDL_VideoDevice *_this, XGenericEventCookie *cookie) case XI_Motion: { const XIDeviceEvent *xev = (const XIDeviceEvent *)cookie->data; - const SDL_Pen *pen = SDL_GetPenPtr(X11_PenIDFromDeviceID(xev->deviceid)); #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH SDL_bool pointer_emulated = ((xev->flags & XIPointerEmulated) != 0); #else @@ -489,25 +453,20 @@ void X11_HandleXinput2Event(SDL_VideoDevice *_this, XGenericEventCookie *cookie) break; } + X11_PenHandle *pen = X11_FindPenByDeviceID(xev->deviceid); if (pen) { - SDL_PenStatusInfo pen_status; - - pen_status.x = (float)xev->event_x; - pen_status.y = (float)xev->event_y; - - X11_PenAxesFromValuators(pen, - xev->valuators.values, xev->valuators.mask, xev->valuators.mask_len, - &pen_status.axes[0]); + SDL_Window *window = xinput2_get_sdlwindow(videodata, xev->event); + SDL_SendPenMotion(0, pen->pen, window, (float) xev->event_x, (float) xev->event_y); - xinput2_pen_ensure_window(_this, pen, xev->event); + float axes[SDL_PEN_NUM_AXES]; + X11_PenAxesFromValuators(pen, xev->valuators.values, xev->valuators.mask, xev->valuators.mask_len, axes); - SDL_SendPenMotion(0, pen->header.id, - SDL_TRUE, - &pen_status); - break; - } - - if (!pointer_emulated) { + for (int i = 0; i < SDL_arraysize(axes); i++) { + if (pen->valuator_for_axis[i] != SDL_X11_PEN_AXIS_VALUATOR_MISSING) { + SDL_SendPenAxis(0, pen->pen, window, (SDL_PenAxis) i, axes[i]); + } + } + } else if (!pointer_emulated) { SDL_Mouse *mouse = SDL_GetMouse(); if (!mouse->relative_mode || mouse->relative_mode_warp) { SDL_Window *window = xinput2_get_sdlwindow(videodata, xev->event); diff --git a/test/testautomation.c b/test/testautomation.c index 42dfeef58dd5e..6480feb70160f 100644 --- a/test/testautomation.c +++ b/test/testautomation.c @@ -34,9 +34,6 @@ static SDLTest_TestSuiteReference *testSuites[] = { &mainTestSuite, &mathTestSuite, &mouseTestSuite, -#if !defined(SDL_PLATFORM_IOS) && !defined(SDL_PLATFORM_TVOS) - &penTestSuite, -#endif &pixelsTestSuite, &platformTestSuite, &propertiesTestSuite, diff --git a/test/testautomation_pen.c b/test/testautomation_pen.c deleted file mode 100644 index 35f3beedf85f1..0000000000000 --- a/test/testautomation_pen.c +++ /dev/null @@ -1,1940 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2024 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef NO_BUILD_CONFIG -#include - -/** - * Pen test suite - */ - -#define SDL_internal_h_ /* Inhibit dynamic symbol redefinitions that clash with ours */ - -/* ================= System Under Test (SUT) ================== */ -/* Renaming SUT operations to avoid link-time symbol clashes */ -#define SDL_GetPens SDL_SUT_GetPens -#define SDL_GetPenStatus SDL_SUT_GetPenStatus -#define SDL_GetPenFromGUID SDL_SUT_GetPenFromGUID -#define SDL_GetPenGUID SDL_SUT_GetPenGUID -#define SDL_PenConnected SDL_SUT_PenConnected -#define SDL_GetPenName SDL_SUT_GetPenName -#define SDL_GetPenCapabilities SDL_SUT_GetPenCapabilities -#define SDL_GetPenType SDL_SUT_GetPenType -#define SDL_GetPersistentString(X) X - -#define SDL_GetPenPtr SDL_SUT_GetPenPtr -#define SDL_PenModifyBegin SDL_SUT_PenModifyBegin -#define SDL_PenModifyAddCapabilities SDL_SUT_PenModifyAddCapabilities -#define SDL_PenModifyForWacomID SDL_SUT_PenModifyForWacomID -#define SDL_PenUpdateGUIDForWacom SDL_SUT_PenUpdateGUIDForWacom -#define SDL_PenUpdateGUIDForType SDL_SUT_PenUpdateGUIDForType -#define SDL_PenUpdateGUIDForGeneric SDL_SUT_PenUpdateGUIDForGeneric -#define SDL_PenModifyEnd SDL_SUT_PenModifyEnd -#define SDL_PenGCMark SDL_SUT_PenGCMark -#define SDL_PenGCSweep SDL_SUT_PenGCSweep -#define SDL_SendPenMotion SDL_SUT_SendPenMotion -#define SDL_SendPenButton SDL_SUT_SendPenButton -#define SDL_SendPenTipEvent SDL_SUT_SendPenTipEvent -#define SDL_SendPenWindowEvent SDL_SUT_SendPenWindowEvent -#define SDL_PenPerformHitTest SDL_SUT_PenPerformHitTest -#define SDL_PenInit SDL_SUT_PenInit -#define SDL_PenQuit SDL_SUT_PenQuit - -/* ================= Mock API ================== */ - -#include -#include -#include -/* For SDL_Window, SDL_Mouse, SDL_MouseID: */ -#include "../src/events/SDL_mouse_c.h" -/* Divert calls to mock mouse API: */ -#define SDL_SendMouseMotion SDL_Mock_SendMouseMotion -#define SDL_SendMouseButton SDL_Mock_SendMouseButton -#define SDL_GetMouse SDL_Mock_GetMouse -#define SDL_MousePositionInWindow SDL_Mock_MousePositionInWindow -#define SDL_SetMouseFocus SDL_Mock_SetMouseFocus - -/* Mock mouse API */ -static int SDL_SendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, SDL_bool relative, float x, float y); -static int SDL_SendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, Uint8 state, Uint8 button); -static SDL_Mouse *SDL_GetMouse(void); -static SDL_bool SDL_MousePositionInWindow(SDL_Window *window, float x, float y); -static void SDL_SetMouseFocus(SDL_Window *window); - -/* Import SUT code with macro-renamed function names */ -#define SDL_waylanddyn_h_ /* hack: suppress spurious build problem with libdecor.h on Wayland */ -#include "../src/events/SDL_pen.c" -#include "../src/events/SDL_pen_c.h" - - -/* ================= Internal SDL API Compatibility ================== */ -/* Mock implementations of Pen -> Mouse calls */ -/* Not thread-safe! */ - -static SDL_bool SDL_MousePositionInWindow(SDL_Window *window, float x, float y) -{ - return SDL_TRUE; -} - -static int _mouseemu_last_event = 0; -static float _mouseemu_last_x = 0.0f; -static float _mouseemu_last_y = 0.0f; -static int _mouseemu_last_mouseid = 0; -static int _mouseemu_last_button = 0; -static SDL_bool _mouseemu_last_relative = SDL_FALSE; -static int _mouseemu_last_focus = -1; - -static int SDL_SendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, Uint8 state, Uint8 button) -{ - if (mouseID == SDL_PEN_MOUSEID) { - _mouseemu_last_event = (state == SDL_PRESSED) ? SDL_EVENT_MOUSE_BUTTON_DOWN : SDL_EVENT_MOUSE_BUTTON_UP; - _mouseemu_last_button = button; - _mouseemu_last_mouseid = mouseID; - } - return 1; -} - -static int SDL_SendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, SDL_bool relative, float x, float y) -{ - if (mouseID == SDL_PEN_MOUSEID) { - _mouseemu_last_event = SDL_EVENT_MOUSE_MOTION; - _mouseemu_last_x = x; - _mouseemu_last_y = y; - _mouseemu_last_mouseid = mouseID; - _mouseemu_last_relative = relative; - } - return 1; -} - -static SDL_Mouse *SDL_GetMouse(void) -{ - static SDL_Mouse dummy_mouse; - - return &dummy_mouse; -} - -static void SDL_SetMouseFocus(SDL_Window *window) -{ - _mouseemu_last_focus = window ? 1 : 0; -} - -/* ================= Test Case Support ================== */ - -#define PEN_NUM_TEST_IDS 8 - -/* Helper functions */ - -/* Iterate over all pens to find index for pen ID, otherwise -1 */ -static int _pen_iterationFindsPenIDAt(SDL_PenID needle) -{ - int i; - int num_pens = -1; - - SDL_PenID *pens = SDL_GetPens(&num_pens); - /* Check for (a) consistency and (b) ability to handle NULL parameter */ - SDL_PenID *pens2 = SDL_GetPens(NULL); - - SDLTest_AssertCheck(num_pens >= 0, - "SDL_GetPens() yielded %d pens", num_pens); - SDLTest_AssertCheck(pens[num_pens] == 0, - "SDL_GetPens() not 0 terminated (num_pens = %d)", num_pens); - SDLTest_AssertCheck(pens2[num_pens] == 0, - "SDL_GetPens(NULL) not 0 terminated (num_pens = %d)", num_pens); - - for (i = 0; i < num_pens; ++i) { - SDLTest_AssertCheck(pens[i] == pens2[i], - "SDL_GetPens(&i) and SDL_GetPens(NULL) disagree at index %d/%d", i, num_pens); - SDLTest_AssertCheck(pens[i] != SDL_PEN_INVALID, - "Invalid pen ID %08lx at index %d/%d after SDL_GetPens()", (unsigned long) pens[i], i, num_pens); - } - SDL_free(pens2); - - for (i = 0; pens[i]; ++i) { - SDL_PenID pen_id = pens[i]; - - SDLTest_AssertCheck(pen_id != SDL_PEN_INVALID, - "Invalid pen ID %08lx at index %d/%d after SDL_GetPens()", (unsigned long) pen_id, i, num_pens); - if (pen_id == needle) { - SDL_free(pens); - return i; - } - } - SDL_free(pens); - return -1; -} - -/* Retrieve number of pens and sanity-check SDL_GetPens() */ -static int -_num_pens(void) -{ - int num_pens = -1; - SDL_PenID *pens = SDL_GetPens(&num_pens); - SDLTest_AssertCheck(pens != NULL, - "SDL_GetPens() => NULL"); - SDLTest_AssertCheck(num_pens >= 0, - "SDL_GetPens() reports %d pens", num_pens); - SDLTest_AssertCheck(pens[num_pens] == 0, - "SDL_GetPens()[%d] != 0", num_pens); - SDL_free(pens); - return num_pens; -} - -/* Assert number of pens is as expected */ -static void _AssertCheck_num_pens(int expected, char *location) -{ - int num_pens = _num_pens(); - SDLTest_AssertCheck(expected == num_pens, - "Expected SDL_GetPens() =>count = %d, actual = %d: %s", expected, num_pens, location); -} - -/* ---------------------------------------- */ -/* Test device deallocation */ - -typedef struct /* Collection of pen (de)allocation information */ -{ - unsigned int deallocated_id_flags; /* ith bits set to 1 if the ith test_id is deallocated */ - unsigned int deallocated_deviceinfo_flags; /* ith bits set to 1 if deviceinfo as *int with value i was deallocated */ - SDL_PenID ids[PEN_NUM_TEST_IDS]; - SDL_GUID guids[PEN_NUM_TEST_IDS]; - SDL_Window *window; - int num_ids; - int initial_pen_count; -} pen_testdata; - -/* SDL_PenGCSweep(): callback for tracking pen deallocation */ -static void _pen_testdata_callback(Uint32 deviceid, void *deviceinfo, void *tracker_ref) -{ - pen_testdata *tracker = (pen_testdata *)tracker_ref; - int offset = -1; - int i; - - for (i = 0; i < tracker->num_ids; ++i) { - if (deviceid == tracker->ids[i]) { - tracker->deallocated_id_flags |= (1 << i); - } - } - - SDLTest_AssertCheck(deviceinfo != NULL, - "Device %lu has deviceinfo", - (unsigned long) deviceid); - offset = *((int *)deviceinfo); - SDLTest_AssertCheck(offset >= 0 && offset <= 31, - "Device %lu has well-formed deviceinfo %d", - (unsigned long) deviceid, offset); - tracker->deallocated_deviceinfo_flags |= 1 << offset; - SDL_free(deviceinfo); -} - -/* GC Sweep tracking: update "tracker->deallocated_id_flags" and "tracker->deallocated_deviceinfo_flags" to record deallocations */ -static void _pen_trackGCSweep(pen_testdata *tracker) -{ - tracker->deallocated_id_flags = 0; - tracker->deallocated_deviceinfo_flags = 0; - SDL_PenGCSweep(tracker, _pen_testdata_callback); -} - -/* Finds a number of unused pen IDs (does not allocate them). Also initialises GUIDs. */ -static void _pen_unusedIDs(pen_testdata *tracker, int count) -{ - static Uint8 guidmod = 0; /* Ensure uniqueness as long as we use no more than 256 test pens */ - Uint32 synthetic_penid = 1000u; - int index = 0; - - tracker->num_ids = count; - SDLTest_AssertCheck(count < PEN_NUM_TEST_IDS, "Test setup: Valid number of test IDs requested: %d", (int)count); - - while (count--) { - int k; - - while (SDL_GetPenPtr(synthetic_penid)) { - ++synthetic_penid; - } - tracker->ids[index] = synthetic_penid; - for (k = 0; k < 15; ++k) { - tracker->guids[index].data[k] = (Uint8)((16 * k) + index); - } - tracker->guids[index].data[15] = ++guidmod; - - ++synthetic_penid; - ++index; - } -} - -#define DEVICEINFO_UNCHANGED -17 - -/* Allocate deviceinfo for pen */ -static void _pen_setDeviceinfo(SDL_Pen *pen, int deviceinfo) -{ - if (deviceinfo == DEVICEINFO_UNCHANGED) { - SDLTest_AssertCheck(pen->deviceinfo != NULL, - "pen->deviceinfo was already set for %p (%lu), as expected", - pen, (unsigned long) pen->header.id); - } else { - int *data = (int *)SDL_malloc(sizeof(int)); - *data = deviceinfo; - - SDLTest_AssertCheck(pen->deviceinfo == NULL, - "pen->deviceinfo was NULL for %p (%lu) when requesting deviceinfo %d", - pen, (unsigned long) pen->header.id, deviceinfo); - - pen->deviceinfo = data; - } - SDL_PenModifyEnd(pen, SDL_TRUE); -} - -/* ---------------------------------------- */ -/* Back up and restore device information */ - -typedef struct deviceinfo_backup -{ - Uint32 deviceid; - void *deviceinfo; - struct deviceinfo_backup *next; -} deviceinfo_backup; - -/* SDL_PenGCSweep(): Helper callback for collecting all deviceinfo records */ -static void _pen_accumulate_gc_sweep(Uint32 deviceid, void *deviceinfo, void *backup_ref) -{ - deviceinfo_backup **db_ref = (deviceinfo_backup **)backup_ref; - deviceinfo_backup *next = *db_ref; - - *db_ref = SDL_calloc(sizeof(deviceinfo_backup), 1); - (*db_ref)->deviceid = deviceid; - (*db_ref)->deviceinfo = deviceinfo; - (*db_ref)->next = next; -} - -/* SDL_PenGCSweep(): Helper callback that must never be called */ -static void _pen_assert_impossible(Uint32 deviceid, void *deviceinfo, void *backup_ref) -{ - SDLTest_AssertCheck(0, "Deallocation for deviceid %lu during enableAndRestore: not expected", - (unsigned long) deviceid); -} - -/* Disable all pens and store their status */ -static deviceinfo_backup *_pen_disableAndBackup(void) -{ - deviceinfo_backup *backup = NULL; - - SDL_PenGCMark(); - SDL_PenGCSweep(&backup, _pen_accumulate_gc_sweep); - return backup; -} - -/* Restore all pens to their previous status */ -static void _pen_enableAndRestore(deviceinfo_backup *backup, int test_marksweep) -{ - if (test_marksweep) { - SDL_PenGCMark(); - } - while (backup) { - SDL_Pen *disabledpen = SDL_GetPenPtr(backup->deviceid); - deviceinfo_backup *next = backup->next; - - SDL_PenModifyEnd(SDL_PenModifyBegin(disabledpen->header.id), - SDL_TRUE); - disabledpen->deviceinfo = backup->deviceinfo; - - SDL_free(backup); - backup = next; - } - if (test_marksweep) { - SDL_PenGCSweep(NULL, _pen_assert_impossible); - } -} - -static struct SDL_Window _test_window = { 0 }; - -/* ---------------------------------------- */ -/* Default set-up and tear down routines */ - -/* Back up existing pens, allocate fresh ones but don't assign them yet */ -static deviceinfo_backup *_setup_test(pen_testdata *ptest, int pens_for_testing) -{ - int i; - deviceinfo_backup *backup; - - /* Get number of pens */ - SDL_free(SDL_GetPens(&ptest->initial_pen_count)); - - /* Provide fake window for window enter/exit simulation */ - _test_window.id = 0x7e57da7a; - _test_window.w = 1600; - _test_window.h = 1200; - ptest->window = &_test_window; - - /* Grab unused pen IDs for testing */ - _pen_unusedIDs(ptest, pens_for_testing); - for (i = 0; i < pens_for_testing; ++i) { - int index = _pen_iterationFindsPenIDAt(ptest->ids[i]); - SDLTest_AssertCheck(-1 == index, - "Registered PenID(%lu) since index %d == -1", - (unsigned long) ptest->ids[i], index); - } - - /* Remove existing pens, but back up */ - backup = _pen_disableAndBackup(); - - _AssertCheck_num_pens(0, "after disabling and backing up all current pens"); - SDLTest_AssertPass("Removed existing pens"); - - return backup; -} - -static void _teardown_test_general(pen_testdata *ptest, deviceinfo_backup *backup, int with_gc_test) -{ - /* Restore previously existing pens */ - _pen_enableAndRestore(backup, with_gc_test); - - /* validate */ - SDLTest_AssertPass("Restored pens to pre-test state"); - _AssertCheck_num_pens(ptest->initial_pen_count, "after restoring all initial pens"); -} - -static void _teardown_test(pen_testdata *ptest, deviceinfo_backup *backup) -{ - _teardown_test_general(ptest, backup, 0); -} - -static void _teardown_test_with_gc(pen_testdata *ptest, deviceinfo_backup *backup) -{ - _teardown_test_general(ptest, backup, 1); -} - -/* ---------------------------------------- */ -/* Pen simulation */ - -#define SIMPEN_ACTION_DONE 0 -#define SIMPEN_ACTION_MOVE_X 1 -#define SIMPEN_ACTION_MOVE_Y 2 -#define SIMPEN_ACTION_AXIS 3 -#define SIMPEN_ACTION_MOTION_EVENT 4 /* epxlicit motion event */ -#define SIMPEN_ACTION_MOTION_EVENT_S 5 /* send motion event but expect it to be suppressed */ -#define SIMPEN_ACTION_PRESS 6 /* implicit update event */ -#define SIMPEN_ACTION_RELEASE 7 /* implicit update event */ -#define SIMPEN_ACTION_DOWN 8 /* implicit update event */ -#define SIMPEN_ACTION_UP 9 /* implicit update event */ -#define SIMPEN_ACTION_ERASER_MODE 10 - -/* Individual action in pen simulation script */ -typedef struct simulated_pen_action -{ - int type; - int pen_index; /* index into the list of simulated pens */ - int index; /* button or axis number, if needed */ - float update; /* x,y; for AXIS, update[0] is the updated axis */ -} simulated_pen_action; - -static simulated_pen_action _simpen_event(int type, int pen_index, int index, float v, int line_nr) -{ - simulated_pen_action action; - action.type = type; - action.pen_index = pen_index; - action.index = index; - action.update = v; - - /* Sanity check-- turned out to be necessary */ - if ((type == SIMPEN_ACTION_PRESS || type == SIMPEN_ACTION_RELEASE) && index == 0) { - SDL_Log("Error: SIMPEN_EVENT_BUTTON must have button > 0 (first button has number 1!), in line %d!", line_nr); - exit(1); - } - return action; -} - -/* STEP is passed in later (C macros use dynamic scoping) */ - -#define SIMPEN_DONE() \ - STEP _simpen_event(SIMPEN_ACTION_DONE, 0, 0, 0.0f, __LINE__) -#define SIMPEN_MOVE(pen_index, x, y) \ - STEP _simpen_event(SIMPEN_ACTION_MOVE_X, (pen_index), 0, (x), __LINE__); \ - STEP _simpen_event(SIMPEN_ACTION_MOVE_Y, (pen_index), 0, (y), __LINE__) - -#define SIMPEN_AXIS(pen_index, axis, y) \ - STEP _simpen_event(SIMPEN_ACTION_AXIS, (pen_index), (axis), (y), __LINE__) - -#define SIMPEN_EVENT_MOTION(pen_index) \ - STEP _simpen_event(SIMPEN_ACTION_MOTION_EVENT, (pen_index), 0, 0.0f, __LINE__) - -#define SIMPEN_EVENT_MOTION_SUPPRESSED(pen_index) \ - STEP _simpen_event(SIMPEN_ACTION_MOTION_EVENT_S, (pen_index), 0, 0.0f, __LINE__) - -#define SIMPEN_EVENT_BUTTON(pen_index, push, button) \ - STEP _simpen_event((push) ? SIMPEN_ACTION_PRESS : SIMPEN_ACTION_RELEASE, (pen_index), (button), 0.0f, __LINE__) - -#define SIMPEN_EVENT_TIP(pen_index, touch, tip) \ - STEP _simpen_event((touch) ? SIMPEN_ACTION_DOWN : SIMPEN_ACTION_UP, (pen_index), tip, 0.0f, __LINE__) - -#define SIMPEN_SET_ERASER(pen_index, eraser_mode) \ - STEP _simpen_event(SIMPEN_ACTION_ERASER_MODE, (pen_index), eraser_mode, 0.0f, __LINE__) - -static void -_pen_dump(const char *prefix, SDL_Pen *pen) -{ - int i; - char *axes_str; - - if (!pen) { - SDL_Log("(NULL pen)"); - return; - } - - axes_str = SDL_strdup(""); - for (i = 0; i < SDL_PEN_NUM_AXES; ++i) { - char *old_axes_str = axes_str; - SDL_asprintf(&axes_str, "%s\t%f", old_axes_str, pen->last.axes[i]); - SDL_free(old_axes_str); - } - SDL_Log("%s: pen %lu (%s): status=%04lx, flags=%lx, x,y=(%f, %f) axes = %s", - prefix, - (unsigned long) pen->header.id, - pen->name, - (unsigned long) pen->last.buttons, - (unsigned long) pen->header.flags, - pen->last.x, pen->last.y, - axes_str); - SDL_free(axes_str); -} - -/* Runs until the next event has been issued or we are done and returns pointer to it. - Returns NULL once we hit SIMPEN_ACTION_DONE. - Updates simulated_pens accordingly. There must be as many simulated_pens as the highest pen_index used in - any of the "steps". - Also validates the internal state with expectations (via SDL_GetPenStatus()) and updates the, but does not poll SDL events. */ -static simulated_pen_action * -_pen_simulate(simulated_pen_action *steps, int *step_counter, SDL_Pen *simulated_pens, int num_pens) -{ - SDL_bool done = SDL_FALSE; - SDL_bool dump_pens = SDL_FALSE; - unsigned int mask; - int pen_nr; - - do { - simulated_pen_action step = steps[*step_counter]; - SDL_Pen *simpen = &simulated_pens[step.pen_index]; - - if (step.pen_index >= num_pens) { - SDLTest_AssertCheck(0, - "Unexpected pen index %d at step %d, action %d", step.pen_index, *step_counter, step.type); - return NULL; - } - - switch (step.type) { - case SIMPEN_ACTION_DONE: - SDLTest_AssertPass("SIMPEN_ACTION_DONE"); - return NULL; - - case SIMPEN_ACTION_MOVE_X: - SDLTest_AssertPass("SIMPEN_ACTION_MOVE_X [pen %d] : y <- %f", step.pen_index, step.update); - simpen->last.x = step.update; - break; - - case SIMPEN_ACTION_MOVE_Y: - SDLTest_AssertPass("SIMPEN_ACTION_MOVE_Y [pen %d] : x <- %f", step.pen_index, step.update); - simpen->last.y = step.update; - break; - - case SIMPEN_ACTION_AXIS: - SDLTest_AssertPass("SIMPEN_ACTION_AXIS [pen %d] : axis[%d] <- %f", step.pen_index, step.index, step.update); - simpen->last.axes[step.index] = step.update; - break; - - case SIMPEN_ACTION_MOTION_EVENT: - done = SDL_TRUE; - SDLTest_AssertCheck(SDL_SendPenMotion(0, simpen->header.id, SDL_TRUE, - &simpen->last), - "SIMPEN_ACTION_MOTION_EVENT [pen %d]", step.pen_index); - break; - - case SIMPEN_ACTION_MOTION_EVENT_S: - SDLTest_AssertCheck(!SDL_SendPenMotion(0, simpen->header.id, SDL_TRUE, - &simpen->last), - "SIMPEN_ACTION_MOTION_EVENT_SUPPRESSED [pen %d]", step.pen_index); - break; - - case SIMPEN_ACTION_PRESS: - mask = (1 << (step.index - 1)); - simpen->last.buttons |= mask; - SDLTest_AssertCheck(SDL_SendPenButton(0, simpen->header.id, SDL_PRESSED, (Uint8)step.index), - "SIMPEN_ACTION_PRESS [pen %d]: button %d (mask %x)", step.pen_index, step.index, mask); - done = SDL_TRUE; - break; - - case SIMPEN_ACTION_RELEASE: - mask = ~(1 << (step.index - 1)); - simpen->last.buttons &= mask; - SDLTest_AssertCheck(SDL_SendPenButton(0, simpen->header.id, SDL_RELEASED, (Uint8)step.index), - "SIMPEN_ACTION_RELEASE [pen %d]: button %d (mask %x)", step.pen_index, step.index, mask); - done = SDL_TRUE; - break; - - case SIMPEN_ACTION_DOWN: - simpen->last.buttons |= SDL_PEN_DOWN_MASK; - SDLTest_AssertCheck(SDL_SendPenTipEvent(0, simpen->header.id, SDL_PRESSED), - "SIMPEN_ACTION_DOWN [pen %d]: (mask %lx)", step.pen_index, SDL_PEN_DOWN_MASK); - done = SDL_TRUE; - break; - - case SIMPEN_ACTION_UP: - simpen->last.buttons &= ~SDL_PEN_DOWN_MASK; - SDLTest_AssertCheck(SDL_SendPenTipEvent(0, simpen->header.id, SDL_RELEASED), - "SIMPEN_ACTION_UP [pen %d]: (mask %lx)", step.pen_index, ~SDL_PEN_DOWN_MASK); - done = SDL_TRUE; - break; - - case SIMPEN_ACTION_ERASER_MODE: { - Uint32 pmask; - SDL_Pen *pen = SDL_PenModifyBegin(simpen->header.id); - - if (step.index) { - pmask = SDL_PEN_ERASER_MASK; - } else { - pmask = SDL_PEN_INK_MASK; - } - - SDL_PenModifyAddCapabilities(pen, pmask); - SDL_PenModifyEnd(pen, SDL_TRUE); - - simpen->header.flags &= ~(SDL_PEN_INK_MASK | SDL_PEN_ERASER_MASK); - simpen->header.flags |= pmask; - break; - } - - default: - SDLTest_AssertCheck(0, - "Unexpected pen simulation action %d", step.type); - return NULL; - } - ++(*step_counter); - } while (!done); - - for (pen_nr = 0; pen_nr < num_pens; ++pen_nr) { - SDL_Pen *simpen = &simulated_pens[pen_nr]; - float x = -1.0f, y = -1.0f; - float axes[SDL_PEN_NUM_AXES]; - Uint32 actual_flags = SDL_GetPenStatus(simpen->header.id, &x, &y, axes, SDL_PEN_NUM_AXES); - int i; - - if (simpen->last.x != x || simpen->last.y != y) { - SDLTest_AssertCheck(0, "Coordinate mismatch in pen %d", pen_nr); - dump_pens = SDL_TRUE; - } - if ((actual_flags & ~(SDL_PEN_INK_MASK | SDL_PEN_ERASER_MASK)) != (simpen->last.buttons & ~(SDL_PEN_INK_MASK | SDL_PEN_ERASER_MASK))) { - SDLTest_AssertCheck(0, "Status mismatch in pen %d (reported: %08x)", pen_nr, (unsigned int)actual_flags); - dump_pens = SDL_TRUE; - } - if ((actual_flags & (SDL_PEN_INK_MASK | SDL_PEN_ERASER_MASK)) != (simpen->header.flags & (SDL_PEN_INK_MASK | SDL_PEN_ERASER_MASK))) { - SDLTest_AssertCheck(0, "Flags mismatch in pen %d (reported: %08x)", pen_nr, (unsigned int)actual_flags); - dump_pens = SDL_TRUE; - } - for (i = 0; i < SDL_PEN_NUM_AXES; ++i) { - if (axes[i] != simpen->last.axes[i]) { - SDLTest_AssertCheck(0, "Axis %d mismatch in pen %d", pen_nr, i); - dump_pens = SDL_TRUE; - } - } - } - - if (dump_pens) { - int i; - for (i = 0; i < num_pens; ++i) { - SDL_Log("==== pen #%d", i); - _pen_dump("expect", simulated_pens + i); - _pen_dump("actual", SDL_GetPenPtr(simulated_pens[i].header.id)); - } - } - - return &steps[(*step_counter) - 1]; -} - -/* Init simulated_pens with suitable initial state */ -static void -_pen_simulate_init(pen_testdata *ptest, SDL_Pen *simulated_pens, int num_pens) -{ - int i; - for (i = 0; i < num_pens; ++i) { - simulated_pens[i] = *SDL_GetPenPtr(ptest->ids[i]); - } -} - -/* ---------------------------------------- */ -/* Other helper functions */ - -/* "standard" pen registration process */ -static SDL_Pen * -_pen_register(SDL_PenID penid, SDL_GUID guid, char *name, Uint32 flags) -{ - SDL_Pen *pen = SDL_PenModifyBegin(penid); - pen->guid = guid; - SDL_strlcpy(pen->name, name, SDL_PEN_MAX_NAME); - SDL_PenModifyAddCapabilities(pen, flags); - return pen; -} - -/* Test whether EXPECTED and ACTUAL of type TY agree. Their C format string must be FMT. - MESSAGE is a string with one format string, passed as ARG0. */ -#define SDLTest_AssertEq1(TY, FMT, EXPECTED, ACTUAL, MESSAGE, ARG0) \ - { \ - TY _t_expect = (EXPECTED); \ - TY _t_actual = (ACTUAL); \ - SDLTest_AssertCheck(_t_expect == _t_actual, "L%d: " MESSAGE ": expected " #EXPECTED " = " FMT ", actual = " FMT, __LINE__, (ARG0), _t_expect, _t_actual); \ - } - -/* ================= Test Case Implementation ================== */ - -/** - * @brief Check basic pen device introduction and iteration, as well as basic queries - * - * @sa SDL_GetPens, SDL_GetPenName, SDL_GetPenCapabilities - */ -static int -pen_iteration(void *arg) -{ - pen_testdata ptest; - int i; - char long_pen_name[SDL_PEN_MAX_NAME + 10]; - const char *name; - deviceinfo_backup *backup; - - /* Check initial pens */ - SDL_PumpEvents(); - SDLTest_AssertPass("SDL_GetPens() => count = %d", _num_pens()); - - /* Grab unused pen IDs for testing */ - backup = _setup_test(&ptest, 3); /* validates that we have zero pens */ - - /* Re-run GC, track deallocations */ - SDL_PenGCMark(); - _pen_trackGCSweep(&ptest); - _AssertCheck_num_pens(0, "after second GC pass"); - SDLTest_AssertCheck(ptest.deallocated_id_flags == 0, "No unexpected device deallocations"); - SDLTest_AssertCheck(ptest.deallocated_deviceinfo_flags == 0, "No unexpected deviceinfo deallocations"); - SDLTest_AssertPass("Validated that GC on empty pen set is idempotent"); - - /* Add three pens, validate */ - SDL_PenGCMark(); - - SDL_memset(long_pen_name, 'x', sizeof(long_pen_name)); /* Include pen name that is too long */ - long_pen_name[sizeof(long_pen_name) - 1] = 0; - - _pen_setDeviceinfo(_pen_register(ptest.ids[0], ptest.guids[0], "pen 0", - SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK), - 16); - _pen_setDeviceinfo(_pen_register(ptest.ids[2], ptest.guids[2], long_pen_name, - SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK), - 20); - _pen_setDeviceinfo(_pen_register(ptest.ids[1], ptest.guids[1], "pen 1", - SDL_PEN_ERASER_MASK | SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_YTILT_MASK), - 24); - _pen_trackGCSweep(&ptest); - - _AssertCheck_num_pens(3, "after allocating three pens"); - - SDLTest_AssertCheck(ptest.deallocated_id_flags == 0, "No unexpected device deallocations"); - SDLTest_AssertCheck(ptest.deallocated_deviceinfo_flags == 0, "No unexpected deviceinfo deallocations"); - - for (i = 0; i < 3; ++i) { - /* Check that all pens are accounted for */ - int index = _pen_iterationFindsPenIDAt(ptest.ids[i]); - SDLTest_AssertCheck(-1 != index, "Found PenID(%lu)", (unsigned long) ptest.ids[i]); - } - SDLTest_AssertPass("Validated that all three pens are indexable"); - - /* Check pen properties */ - SDLTest_AssertCheck(0 == SDL_strcmp("pen 0", SDL_GetPenName(ptest.ids[0])), - "Pen #0 name"); - SDLTest_AssertCheck((SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK) == SDL_GetPenCapabilities(ptest.ids[0], NULL), - "Pen #0 capabilities"); - - SDLTest_AssertCheck(0 == SDL_strcmp("pen 1", SDL_GetPenName(ptest.ids[1])), - "Pen #1 name"); - SDLTest_AssertCheck((SDL_PEN_ERASER_MASK | SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_YTILT_MASK) == SDL_GetPenCapabilities(ptest.ids[1], NULL), - "Pen #1 capabilities"); - - name = SDL_GetPenName(ptest.ids[2]); - SDLTest_AssertCheck(SDL_PEN_MAX_NAME - 1 == SDL_strlen(name), - "Pen #2 name length"); - SDLTest_AssertCheck(0 == SDL_memcmp(name, long_pen_name, SDL_PEN_MAX_NAME - 1), - "Pen #2 name contents"); - SDLTest_AssertCheck((SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK) == SDL_GetPenCapabilities(ptest.ids[2], NULL), - "Pen #2 capabilities"); - SDLTest_AssertPass("Pen registration and basic queries"); - - /* Re-run GC, track deallocations */ - SDL_PenGCMark(); - _pen_trackGCSweep(&ptest); - _AssertCheck_num_pens(0, "after third GC pass"); - SDLTest_AssertCheck(ptest.deallocated_id_flags == 0x07, - "No unexpected device deallocation : %08x", ptest.deallocated_id_flags); - SDLTest_AssertCheck(ptest.deallocated_deviceinfo_flags == 0x01110000, - "No unexpected deviceinfo deallocation : %08x ", ptest.deallocated_deviceinfo_flags); - SDLTest_AssertPass("Validated that GC on empty pen set is idempotent"); - - /* tear down and finish */ - _teardown_test(&ptest, backup); - return TEST_COMPLETED; -} - -static void -_expect_pen_attached(SDL_PenID penid) -{ - SDLTest_AssertCheck(-1 != _pen_iterationFindsPenIDAt(penid), - "Found PenID(%lu)", (unsigned long) penid); - SDLTest_AssertCheck(SDL_PenConnected(penid), - "Pen %lu was attached, as expected", (unsigned long) penid); -} - -static void -_expect_pen_detached(SDL_PenID penid) -{ - SDLTest_AssertCheck(-1 == _pen_iterationFindsPenIDAt(penid), - "Did not find PenID(%lu), as expected", (unsigned long) penid); - SDLTest_AssertCheck(!SDL_PenConnected(penid), - "Pen %lu was detached, as expected", (unsigned long) penid); -} - -#define ATTACHED(i) (1 << (i)) - -static void -_expect_pens_attached_or_detached(SDL_PenID *pen_ids, int ids, Uint32 mask) -{ - int i; - int attached_count = 0; - for (i = 0; i < ids; ++i) { - if (mask & (1 << i)) { - ++attached_count; - _expect_pen_attached(pen_ids[i]); - } else { - _expect_pen_detached(pen_ids[i]); - } - } - _AssertCheck_num_pens(attached_count, "While checking attached/detached status"); -} - -/** - * @brief Check pen device hotplugging - * - * @sa SDL_GetPens, SDL_GetPenName, SDL_GetPenCapabilities, SDL_PenConnected - */ -static int -pen_hotplugging(void *arg) -{ - pen_testdata ptest; - deviceinfo_backup *backup = _setup_test(&ptest, 3); - SDL_GUID checkguid; - - /* Add two pens */ - SDL_PenGCMark(); - - _pen_setDeviceinfo(_pen_register(ptest.ids[0], ptest.guids[0], "pen 0", SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK), - 16); - _pen_setDeviceinfo(_pen_register(ptest.ids[2], ptest.guids[2], "pen 2", SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK), - 24); - _pen_trackGCSweep(&ptest); - - _AssertCheck_num_pens(2, "after allocating two pens (pass 1)"); - SDLTest_AssertCheck(ptest.deallocated_id_flags == 0, "No unexpected device deallocation (pass 1)"); - SDLTest_AssertCheck(ptest.deallocated_deviceinfo_flags == 0, "No unexpected deviceinfo deallocation (pass 1)"); - - _expect_pens_attached_or_detached(ptest.ids, 3, ATTACHED(0) | ATTACHED(2)); - SDLTest_AssertPass("Validated hotplugging (pass 1): attachmend of two pens"); - - /* Introduce pen #1, remove pen #2 */ - SDL_PenGCMark(); - _pen_setDeviceinfo(_pen_register(ptest.ids[0], ptest.guids[0], "pen 0", SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK), - DEVICEINFO_UNCHANGED); - _pen_setDeviceinfo(_pen_register(ptest.ids[1], ptest.guids[1], "pen 1", SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK), - 20); - _pen_trackGCSweep(&ptest); - - _AssertCheck_num_pens(2, "after allocating two pens (pass 2)"); - SDLTest_AssertCheck(ptest.deallocated_id_flags == 0x04, "No unexpected device deallocation (pass 2): %x", ptest.deallocated_id_flags); - SDLTest_AssertCheck(ptest.deallocated_deviceinfo_flags == 0x01000000, "No unexpected deviceinfo deallocation (pass 2): %x", ptest.deallocated_deviceinfo_flags); - - _expect_pens_attached_or_detached(ptest.ids, 3, ATTACHED(0) | ATTACHED(1)); - SDLTest_AssertPass("Validated hotplugging (pass 2): unplug one, attach another"); - - /* Return to previous state (#0 and #2 attached) */ - SDL_PenGCMark(); - - _pen_setDeviceinfo(_pen_register(ptest.ids[0], ptest.guids[0], "pen 0", SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_YTILT), - DEVICEINFO_UNCHANGED); - _pen_setDeviceinfo(_pen_register(ptest.ids[2], ptest.guids[2], "pen 2", SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK), - 24); - _pen_trackGCSweep(&ptest); - - _AssertCheck_num_pens(2, "after allocating two pens (pass 3)"); - SDLTest_AssertCheck(ptest.deallocated_id_flags == 0x02, "No unexpected device deallocation (pass 3)"); - SDLTest_AssertCheck(ptest.deallocated_deviceinfo_flags == 0x00100000, "No unexpected deviceinfo deallocation (pass 3)"); - - _expect_pens_attached_or_detached(ptest.ids, 3, ATTACHED(0) | ATTACHED(2)); - SDLTest_AssertPass("Validated hotplugging (pass 3): return to state of pass 1"); - - /* Introduce pen #1, remove pen #0 */ - SDL_PenGCMark(); - _pen_setDeviceinfo(_pen_register(ptest.ids[1], ptest.guids[1], "pen 1", SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK), - 20); - _pen_setDeviceinfo(_pen_register(ptest.ids[2], ptest.guids[2], "pen 2", SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK), - DEVICEINFO_UNCHANGED); - _pen_trackGCSweep(&ptest); - - _AssertCheck_num_pens(2, "after allocating two pens (pass 4)"); - SDLTest_AssertCheck(ptest.deallocated_id_flags == 0x01, "No unexpected device deallocation (pass 4): %x", ptest.deallocated_id_flags); - SDLTest_AssertCheck(ptest.deallocated_deviceinfo_flags == 0x00010000, "No unexpected deviceinfo deallocation (pass 4): %x", ptest.deallocated_deviceinfo_flags); - - _expect_pens_attached_or_detached(ptest.ids, 3, ATTACHED(1) | ATTACHED(2)); - SDLTest_AssertPass("Validated hotplugging (pass 5)"); - - /* Check detached pen */ - SDLTest_AssertCheck(0 == SDL_strcmp("pen 0", SDL_GetPenName(ptest.ids[0])), - "Pen #0 name"); - checkguid = SDL_GetPenGUID(ptest.ids[0]); - SDLTest_AssertCheck(0 == SDL_memcmp(ptest.guids[0].data, checkguid.data, sizeof(ptest.guids[0].data)), - "Pen #0 guid"); - SDLTest_AssertCheck((SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_YTILT) == SDL_GetPenCapabilities(ptest.ids[0], NULL), - "Pen #0 capabilities"); - SDLTest_AssertPass("Validated that detached pens retained name, GUID, axis info after pass 5"); - - /* Individually detach #1 dn #2 */ - _expect_pens_attached_or_detached(ptest.ids, 3, ATTACHED(1) | ATTACHED(2)); - SDL_PenModifyEnd(SDL_PenModifyBegin(ptest.ids[1]), SDL_FALSE); - _expect_pens_attached_or_detached(ptest.ids, 3, ATTACHED(2)); - - SDL_PenModifyEnd(SDL_PenModifyBegin(ptest.ids[2]), SDL_FALSE); - _expect_pens_attached_or_detached(ptest.ids, 3, 0); - - SDLTest_AssertPass("Validated individual hotplugging (pass 6)"); - - /* Individually attach all */ - SDL_PenModifyEnd(SDL_PenModifyBegin(ptest.ids[2]), SDL_TRUE); - _expect_pens_attached_or_detached(ptest.ids, 3, ATTACHED(2)); - - SDL_PenModifyEnd(SDL_PenModifyBegin(ptest.ids[0]), SDL_TRUE); - _expect_pens_attached_or_detached(ptest.ids, 3, ATTACHED(0) | ATTACHED(2)); - - SDL_PenModifyEnd(SDL_PenModifyBegin(ptest.ids[1]), SDL_TRUE); - _expect_pens_attached_or_detached(ptest.ids, 3, ATTACHED(0) | ATTACHED(1) | ATTACHED(2)); - SDLTest_AssertPass("Validated individual hotplugging (pass 7)"); - - SDL_PenGCMark(); - _pen_trackGCSweep(&ptest); - _AssertCheck_num_pens(0, "after hotplugging test (cleanup)"); - SDLTest_AssertCheck(ptest.deallocated_id_flags == 0x06, "No unexpected device deallocation (cleanup): %x", ptest.deallocated_id_flags); - SDLTest_AssertCheck(ptest.deallocated_deviceinfo_flags == 0x01100000, "No unexpected deviceinfo deallocation (pass 4): %x", ptest.deallocated_deviceinfo_flags); - - _teardown_test_with_gc(&ptest, backup); - - return TEST_COMPLETED; -} - -/** - * @brief Check pen device GUID handling - * - * @sa SDL_GetPenGUID - */ -static int -pen_GUIDs(void *arg) -{ - int i; - char *names[4] = { "pen 0", "pen 1", "pen 2", "pen 3" }; - pen_testdata ptest; - deviceinfo_backup *backup; - - backup = _setup_test(&ptest, 4); - - /* Define four pens */ - SDL_PenGCMark(); - for (i = 0; i < 4; ++i) { - _pen_setDeviceinfo(_pen_register(ptest.ids[i], ptest.guids[i], names[i], SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK), - 20); - } - _pen_trackGCSweep(&ptest); - - /* Detach pens 0 and 2 */ - SDL_PenGCMark(); - for (i = 1; i < 4; i += 2) { - _pen_setDeviceinfo(_pen_register(ptest.ids[i], ptest.guids[i], names[i], SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK), - DEVICEINFO_UNCHANGED); - } - _pen_trackGCSweep(&ptest); - - for (i = 0; i < 4; ++i) { - SDLTest_AssertCheck(ptest.ids[i] == SDL_GetPenFromGUID(ptest.guids[i]), - "GUID search succeeded for %d", i); - } - - /* detach all */ - SDL_PenGCMark(); - _pen_trackGCSweep(&ptest); - - _teardown_test(&ptest, backup); - SDLTest_AssertPass("Pen ID lookup by GUID"); - - return TEST_COMPLETED; -} - -/** - * @brief Check pen device button reporting - * - */ -static int -pen_buttonReporting(void *arg) -{ - int i; - int button_nr, pen_nr; - pen_testdata ptest; - SDL_Event event; - SDL_PenStatusInfo update; - float axes[SDL_PEN_NUM_AXES + 1]; - const float expected_x[2] = { 10.0f, 20.0f }; - const float expected_y[2] = { 11.0f, 21.0f }; - const Uint32 all_axes = SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK | SDL_PEN_AXIS_ROTATION_MASK | SDL_PEN_AXIS_SLIDER_MASK; - - /* Register pen */ - deviceinfo_backup *backup = _setup_test(&ptest, 2); - SDL_PenGCMark(); - _pen_setDeviceinfo(_pen_register(ptest.ids[0], ptest.guids[0], "test pen", - SDL_PEN_INK_MASK | all_axes), - 20); - _pen_setDeviceinfo(_pen_register(ptest.ids[1], ptest.guids[1], "test eraser", - SDL_PEN_ERASER_MASK | all_axes), - 24); - _pen_trackGCSweep(&ptest); - - /* Position mouse suitably before we start */ - for (i = 0; i <= SDL_PEN_NUM_AXES; ++i) { - axes[i] = 0.0625f * i; /* initialise with numbers that can be represented precisely in IEEE 754 and - are > 0.0f and <= 1.0f */ - } - - /* Let pens enter the test window */ - SDL_SendPenWindowEvent(0, ptest.ids[0], ptest.window); - SDL_SendPenWindowEvent(0, ptest.ids[1], ptest.window); - - update.x = expected_x[0]; - update.y = expected_y[0]; - SDL_memcpy(update.axes, axes, sizeof(float) * SDL_PEN_NUM_AXES); - SDL_SendPenMotion(0, ptest.ids[0], SDL_TRUE, &update); - update.x = expected_x[1]; - update.y = expected_y[1]; - SDL_memcpy(update.axes, axes + 1, sizeof(float) * SDL_PEN_NUM_AXES); - SDL_SendPenMotion(0, ptest.ids[1], SDL_TRUE, &update); - - while (SDL_PollEvent(&event)) - ; /* Flush event queue */ - - /* Trigger pen tip events for PEN_DOWN */ - SDLTest_AssertPass("Touch pens to surface"); - - for (pen_nr = 0; pen_nr < 2; ++pen_nr) { - float *expected_axes = axes + pen_nr; - SDL_bool found_event = SDL_FALSE; - Uint16 pen_state = 0x0000 | SDL_PEN_DOWN_MASK; - Uint8 tip = SDL_PEN_TIP_INK; - - if (pen_nr == 1) { - pen_state |= SDL_PEN_ERASER_MASK; - tip = SDL_PEN_TIP_ERASER; - } - - SDL_SendPenTipEvent(0, ptest.ids[pen_nr], SDL_PRESSED); - - while (SDL_PollEvent(&event)) { - if (event.type == SDL_EVENT_PEN_DOWN) { - SDLTest_AssertCheck(event.ptip.which == ptest.ids[pen_nr], - "Received SDL_EVENT_PEN_DOWN from correct pen"); - SDLTest_AssertCheck(event.ptip.tip == (pen_nr == 0)? SDL_PEN_TIP_INK : SDL_PEN_TIP_ERASER, - "Received SDL_EVENT_PEN_DOWN for correct tip"); - SDLTest_AssertCheck(event.ptip.state == SDL_PRESSED, - "Received SDL_EVENT_PEN_DOWN but and marked SDL_PRESSED"); - SDLTest_AssertCheck(event.ptip.tip == tip, - "Received tip %x but expected %x", event.ptip.tip, tip); - SDLTest_AssertCheck(event.ptip.pen_state == pen_state, - "Received SDL_EVENT_PEN_DOWN, and state %04x == %04x (expected)", - event.pbutton.pen_state, pen_state); - SDLTest_AssertCheck((event.ptip.x == expected_x[pen_nr]) && (event.ptip.y == expected_y[pen_nr]), - "Received SDL_EVENT_PEN_DOWN event at correct coordinates: (%f, %f) vs (%f, %f) (expected)", - event.pbutton.x, event.pbutton.y, expected_x[pen_nr], expected_y[pen_nr]); - SDLTest_AssertCheck(0 == SDL_memcmp(expected_axes, event.pbutton.axes, sizeof(float) * SDL_PEN_NUM_AXES), - "Received SDL_EVENT_PEN_DOWN event with correct axis values"); - found_event = SDL_TRUE; - } - SDLTest_AssertCheck(found_event, - "Received the expected SDL_EVENT_PEN_DOWN event"); - } - } - - SDLTest_AssertPass("Pen and eraser set up for button testing"); - - /* Actual tests start: pen, then eraser */ - for (pen_nr = 0; pen_nr < 2; ++pen_nr) { - Uint16 pen_state = 0x0000 | SDL_PEN_DOWN_MASK; - float *expected_axes = axes + pen_nr; - - if (pen_nr == 1) { - pen_state |= SDL_PEN_ERASER_MASK; - } - for (button_nr = 1; button_nr <= 8; ++button_nr) { - SDL_bool found_event = SDL_FALSE; - pen_state |= (1 << (button_nr - 1)); - - SDL_SendPenButton(0, ptest.ids[pen_nr], SDL_PRESSED, (Uint8)button_nr); - while (SDL_PollEvent(&event)) { - if (event.type == SDL_EVENT_PEN_BUTTON_DOWN) { - SDLTest_AssertCheck(event.pbutton.which == ptest.ids[pen_nr], - "Received SDL_EVENT_PEN_BUTTON_DOWN from correct pen"); - SDLTest_AssertCheck(event.pbutton.button == button_nr, - "Received SDL_EVENT_PEN_BUTTON_DOWN from correct button"); - SDLTest_AssertCheck(event.pbutton.state == SDL_PRESSED, - "Received SDL_EVENT_PEN_BUTTON_DOWN but and marked SDL_PRESSED"); - SDLTest_AssertCheck(event.pbutton.pen_state == pen_state, - "Received SDL_EVENT_PEN_BUTTON_DOWN, and state %04x == %04x (expected)", - event.pbutton.pen_state, pen_state); - SDLTest_AssertCheck((event.pbutton.x == expected_x[pen_nr]) && (event.pbutton.y == expected_y[pen_nr]), - "Received SDL_EVENT_PEN_BUTTON_DOWN event at correct coordinates: (%f, %f) vs (%f, %f) (expected)", - event.pbutton.x, event.pbutton.y, expected_x[pen_nr], expected_y[pen_nr]); - SDLTest_AssertCheck(0 == SDL_memcmp(expected_axes, event.pbutton.axes, sizeof(float) * SDL_PEN_NUM_AXES), - "Received SDL_EVENT_PEN_BUTTON_DOWN event with correct axis values"); - if (0 != SDL_memcmp(expected_axes, event.pbutton.axes, sizeof(float) * SDL_PEN_NUM_AXES)) { - int ax; - for (ax = 0; ax < SDL_PEN_NUM_AXES; ++ax) { - SDL_Log("\tax %d\t%.5f\t%.5f expected (equal=%d)", - ax, - event.pbutton.axes[ax], expected_axes[ax], - event.pbutton.axes[ax] == expected_axes[ax]); - } - } - found_event = SDL_TRUE; - } - } - SDLTest_AssertCheck(found_event, - "Received the expected SDL_EVENT_PEN_BUTTON_DOWN event"); - } - } - SDLTest_AssertPass("Pressed all buttons"); - - /* Release every other button */ - for (pen_nr = 0; pen_nr < 2; ++pen_nr) { - Uint16 pen_state = 0x00ff | SDL_PEN_DOWN_MASK; /* 8 buttons pressed */ - float *expected_axes = axes + pen_nr; - - if (pen_nr == 1) { - pen_state |= SDL_PEN_ERASER_MASK; - } - for (button_nr = pen_nr + 1; button_nr <= 8; button_nr += 2) { - SDL_bool found_event = SDL_FALSE; - pen_state &= ~(1 << (button_nr - 1)); - - SDL_SendPenButton(0, ptest.ids[pen_nr], SDL_RELEASED, (Uint8)button_nr); - while (SDL_PollEvent(&event)) { - if (event.type == SDL_EVENT_PEN_BUTTON_UP) { - SDLTest_AssertCheck(event.pbutton.which == ptest.ids[pen_nr], - "Received SDL_EVENT_PEN_BUTTON_UP from correct pen"); - SDLTest_AssertCheck(event.pbutton.button == button_nr, - "Received SDL_EVENT_PEN_BUTTON_UP from correct button"); - SDLTest_AssertCheck(event.pbutton.state == SDL_RELEASED, - "Received SDL_EVENT_PEN_BUTTON_UP and is marked SDL_RELEASED"); - SDLTest_AssertCheck(event.pbutton.pen_state == pen_state, - "Received SDL_EVENT_PEN_BUTTON_UP, and state %04x == %04x (expected)", - event.pbutton.pen_state, pen_state); - SDLTest_AssertCheck((event.pbutton.x == expected_x[pen_nr]) && (event.pbutton.y == expected_y[pen_nr]), - "Received SDL_EVENT_PEN_BUTTON_UP event at correct coordinates"); - SDLTest_AssertCheck(0 == SDL_memcmp(expected_axes, event.pbutton.axes, sizeof(float) * SDL_PEN_NUM_AXES), - "Received SDL_EVENT_PEN_BUTTON_UP event with correct axis values"); - found_event = SDL_TRUE; - } - } - SDLTest_AssertCheck(found_event, - "Received the expected SDL_EVENT_PEN_BUTTON_UP event"); - } - } - SDLTest_AssertPass("Released every other button"); - - /* Trigger pen tip events for PEN_UP */ - SDLTest_AssertPass("Remove pens from surface"); - - for (pen_nr = 0; pen_nr < 2; ++pen_nr) { - float *expected_axes = axes + pen_nr; - SDL_bool found_event = SDL_FALSE; - Uint16 pen_state = 0x0000; - Uint8 tip = SDL_PEN_TIP_INK; - - if (pen_nr == 1) { - pen_state |= SDL_PEN_ERASER_MASK; - tip = SDL_PEN_TIP_ERASER; - } - - SDL_SendPenTipEvent(0, ptest.ids[pen_nr], SDL_RELEASED); - - while (SDL_PollEvent(&event)) { - if (event.type == SDL_EVENT_PEN_UP) { - SDLTest_AssertCheck(event.ptip.which == ptest.ids[pen_nr], - "Received SDL_EVENT_PEN_UP from correct pen"); - SDLTest_AssertCheck(event.ptip.tip == (pen_nr == 0)? SDL_PEN_TIP_INK : SDL_PEN_TIP_ERASER, - "Received SDL_EVENT_PEN_UP for correct tip"); - SDLTest_AssertCheck(event.ptip.state == SDL_RELEASED, - "Received SDL_EVENT_PEN_UP but and marked SDL_RELEASED"); - SDLTest_AssertCheck(event.ptip.tip == tip, - "Received tip %x but expected %x", event.ptip.tip, tip); - SDLTest_AssertCheck((event.ptip.pen_state & 0xff00) == (pen_state & 0xff00), - "Received SDL_EVENT_PEN_UP, and state %04x == %04x (expected)", - event.pbutton.pen_state, pen_state); - SDLTest_AssertCheck((event.ptip.x == expected_x[pen_nr]) && (event.ptip.y == expected_y[pen_nr]), - "Received SDL_EVENT_PEN_UP event at correct coordinates: (%f, %f) vs (%f, %f) (expected)", - event.pbutton.x, event.pbutton.y, expected_x[pen_nr], expected_y[pen_nr]); - SDLTest_AssertCheck(0 == SDL_memcmp(expected_axes, event.pbutton.axes, sizeof(float) * SDL_PEN_NUM_AXES), - "Received SDL_EVENT_PEN_UP event with correct axis values"); - found_event = SDL_TRUE; - } - SDLTest_AssertCheck(found_event, - "Received the expected SDL_EVENT_PEN_UP event"); - } - } - - /* Cleanup */ - SDL_PenGCMark(); - _pen_trackGCSweep(&ptest); - _teardown_test(&ptest, backup); - - return TEST_COMPLETED; -} - -/** - * @brief Check pen device movement and axis update reporting - * - * Also tests SDL_GetPenStatus for agreement with the most recently reported events - * - * @sa SDL_GetPenStatus - */ -static int -pen_movementAndAxes(void *arg) -{ - pen_testdata ptest; - SDL_Event event; -#define MAX_STEPS 80 - /* Pen simulation */ - simulated_pen_action steps[MAX_STEPS]; - size_t num_steps = 0; - - SDL_Pen simulated_pens[2]; - int sim_pc = 0; - simulated_pen_action *last_action; - - /* Register pen */ - deviceinfo_backup *backup = _setup_test(&ptest, 2); - - /* Pen simulation program */ -#define STEP steps[num_steps++] = - - /* #1: Check basic reporting */ - /* Hover eraser, tilt axes */ - SIMPEN_MOVE(0, 30.0f, 31.0f); - SIMPEN_AXIS(0, SDL_PEN_AXIS_PRESSURE, 0.0f); - SIMPEN_AXIS(0, SDL_PEN_AXIS_XTILT, 22.5f); - SIMPEN_AXIS(0, SDL_PEN_AXIS_YTILT, 45.0f); - SIMPEN_EVENT_MOTION(0); - - /* #2: Check that motion events without motion aren't reported */ - SIMPEN_EVENT_MOTION_SUPPRESSED(0); - SIMPEN_EVENT_MOTION_SUPPRESSED(0); - - /* #3: Check multiple pens being reported */ - /* Move pen and touch surface, don't tilt */ - SIMPEN_MOVE(1, 40.0f, 41.0f); - SIMPEN_AXIS(1, SDL_PEN_AXIS_PRESSURE, 0.25f); - SIMPEN_EVENT_MOTION(1); - - /* $4: Multi-buttons */ - /* Press eraser buttons */ - SIMPEN_EVENT_TIP(0, "down", SDL_PEN_TIP_ERASER); - SIMPEN_EVENT_BUTTON(0, "push", 2); - SIMPEN_EVENT_BUTTON(0, "push", 1); - SIMPEN_EVENT_BUTTON(0, 0, 2); /* release again */ - SIMPEN_EVENT_BUTTON(0, "push", 3); - - /* #5: Check move + button actions connecting */ - /* Move and tilt pen, press some pen buttons */ - SIMPEN_MOVE(1, 3.0f, 8.0f); - SIMPEN_AXIS(1, SDL_PEN_AXIS_PRESSURE, 0.5f); - SIMPEN_AXIS(1, SDL_PEN_AXIS_XTILT, -21.0f); - SIMPEN_AXIS(1, SDL_PEN_AXIS_YTILT, -25.0f); - SIMPEN_EVENT_MOTION(1); - SIMPEN_EVENT_BUTTON(1, "push", 2); - SIMPEN_EVENT_TIP(1, "down", SDL_PEN_TIP_INK); - - /* #6: Check nonterference between pens */ - /* Eraser releases buttons */ - SIMPEN_EVENT_BUTTON(0, 0, 1); - SIMPEN_EVENT_TIP(0, 0, SDL_PEN_TIP_ERASER); - - /* #7: Press-move-release action */ - /* Eraser press-move-release */ - SIMPEN_EVENT_BUTTON(0, "push", 1); - SIMPEN_MOVE(0, 99.0f, 88.0f); - SIMPEN_AXIS(0, SDL_PEN_AXIS_PRESSURE, 0.625f); - SIMPEN_EVENT_MOTION(0); - SIMPEN_MOVE(0, 44.5f, 42.25f); - SIMPEN_EVENT_MOTION(0); - SIMPEN_EVENT_BUTTON(0, 0, 1); - - /* #8: Intertwining button release actions some more */ - /* Pen releases button */ - SIMPEN_EVENT_BUTTON(1, 0, 2); - SIMPEN_EVENT_TIP(1, 0, SDL_PEN_TIP_INK); - - /* Push one more pen button, then release all ereaser buttons */ - SIMPEN_EVENT_TIP(1, "down", SDL_PEN_TIP_INK); - SIMPEN_EVENT_BUTTON(0, 0, 2); - SIMPEN_EVENT_BUTTON(0, 0, 3); - - /* Lift up pen, flip it so it becomes an eraser, and touch it again */ - SIMPEN_EVENT_TIP(1, 0, SDL_PEN_TIP_INK); - SIMPEN_SET_ERASER(1, 1); - SIMPEN_EVENT_TIP(1, "push", SDL_PEN_TIP_ERASER); - - /* And back again */ - SIMPEN_EVENT_TIP(1, 0, SDL_PEN_TIP_ERASER); - SIMPEN_SET_ERASER(1, 0); - SIMPEN_EVENT_TIP(1, "push", SDL_PEN_TIP_INK); - - /* #9: Suppress move on unsupported axis */ - SIMPEN_AXIS(1, SDL_PEN_AXIS_DISTANCE, 0.25f); - SIMPEN_EVENT_MOTION_SUPPRESSED(0); - - SIMPEN_DONE(); -#undef STEP - /* End of pen simulation program */ - - SDLTest_AssertCheck(num_steps < MAX_STEPS, "Pen simulation program does not exceed buffer size"); -#undef MAX_STEPS - - SDL_PenGCMark(); - _pen_setDeviceinfo(_pen_register(ptest.ids[0], ptest.guids[0], "test eraser", - SDL_PEN_ERASER_MASK | SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK), - 20); - _pen_setDeviceinfo(_pen_register(ptest.ids[1], ptest.guids[1], "test pen", - SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK), - 24); - _pen_trackGCSweep(&ptest); - SDL_SendPenWindowEvent(0, ptest.ids[0], ptest.window); - SDL_SendPenWindowEvent(0, ptest.ids[1], ptest.window); - while (SDL_PollEvent(&event)) - ; /* Flush event queue */ - SDLTest_AssertPass("Pen and eraser set up for testing"); - - _pen_simulate_init(&ptest, simulated_pens, 2); - /* Simulate pen movements */ - while ((last_action = _pen_simulate(steps, &sim_pc, &simulated_pens[0], 2)) != 0) { - int attempts = 0; - SDL_Pen *simpen = &simulated_pens[last_action->pen_index]; - SDL_PenID reported_which = 0; - float reported_x = -1.0f, reported_y = -1.0f; - float *reported_axes = NULL; - Uint32 reported_pen_state = 0; - Uint32 expected_pen_state = simpen->header.flags & SDL_PEN_ERASER_MASK; - SDL_bool dump_pens = SDL_FALSE; - - do { - SDL_PumpEvents(); - SDL_PollEvent(&event); - if (++attempts > 10000) { - SDLTest_AssertCheck(0, "Never got the anticipated event"); - return TEST_ABORTED; - } - } while (event.type != SDL_EVENT_PEN_DOWN - && event.type != SDL_EVENT_PEN_UP - && event.type != SDL_EVENT_PEN_MOTION - && event.type != SDL_EVENT_PEN_BUTTON_UP - && event.type != SDL_EVENT_PEN_BUTTON_DOWN); /* skip boring events */ - - expected_pen_state |= simpen->last.buttons; - - SDLTest_AssertCheck(0 != event.type, - "Received the anticipated event"); - - switch (last_action->type) { - case SIMPEN_ACTION_MOTION_EVENT: - SDLTest_AssertCheck(event.type == SDL_EVENT_PEN_MOTION, "Expected pen motion event (but got 0x%lx)", (unsigned long) event.type); - reported_which = event.pmotion.which; - reported_x = event.pmotion.x; - reported_y = event.pmotion.y; - reported_pen_state = event.pmotion.pen_state; - reported_axes = &event.pmotion.axes[0]; - break; - - case SIMPEN_ACTION_PRESS: - SDLTest_AssertCheck(event.type == SDL_EVENT_PEN_BUTTON_DOWN, "Expected PENBUTTONDOWN event (but got 0x%lx)", (unsigned long) event.type); - SDLTest_AssertCheck(event.pbutton.state == SDL_PRESSED, "Expected PRESSED button"); - SDL_FALLTHROUGH; - case SIMPEN_ACTION_RELEASE: - if (last_action->type == SIMPEN_ACTION_RELEASE) { - SDLTest_AssertCheck(event.type == SDL_EVENT_PEN_BUTTON_UP, "Expected PENBUTTONUP event (but got 0x%lx)", (unsigned long) event.type); - SDLTest_AssertCheck(event.pbutton.state == SDL_RELEASED, "Expected RELEASED button"); - } - SDLTest_AssertCheck(event.pbutton.button == last_action->index, "Expected button %d, but got %d", - last_action->index, event.pbutton.button); - reported_which = event.pbutton.which; - reported_x = event.pbutton.x; - reported_y = event.pbutton.y; - reported_pen_state = event.pbutton.pen_state; - reported_axes = &event.pbutton.axes[0]; - break; - - case SIMPEN_ACTION_DOWN: - SDLTest_AssertCheck(event.type == SDL_EVENT_PEN_DOWN, "Expected PENBUTTONDOWN event (but got 0x%lx)", (unsigned long) event.type); - SDLTest_AssertCheck(event.ptip.state == SDL_PRESSED, "Expected PRESSED button"); - SDL_FALLTHROUGH; - case SIMPEN_ACTION_UP: - if (last_action->type == SIMPEN_ACTION_UP) { - SDLTest_AssertCheck(event.type == SDL_EVENT_PEN_UP, "Expected PENBUTTONUP event (but got 0x%lx)", (unsigned long) event.type); - SDLTest_AssertCheck(event.ptip.state == SDL_RELEASED, "Expected RELEASED button"); - } - SDLTest_AssertCheck(event.ptip.tip == last_action->index, "Expected tip %d, but got %d", - last_action->index, event.ptip.tip); - reported_which = event.ptip.which; - reported_x = event.ptip.x; - reported_y = event.ptip.y; - reported_pen_state = event.ptip.pen_state; - reported_axes = &event.ptip.axes[0]; - break; - - case SIMPEN_ACTION_ERASER_MODE: - break; - - default: - SDLTest_AssertCheck(0, "Error in pen simulator: unexpected action %d", last_action->type); - return TEST_ABORTED; - } - - if (reported_which != simpen->header.id) { - dump_pens = SDL_TRUE; - SDLTest_AssertCheck(0, "Expected report for pen %lu but got report for pen %lu", - (unsigned long) simpen->header.id, - (unsigned long) reported_which); - } - if (reported_x != simpen->last.x || reported_y != simpen->last.y) { - dump_pens = SDL_TRUE; - SDLTest_AssertCheck(0, "Mismatch in pen coordinates"); - } - if (reported_x != simpen->last.x || reported_y != simpen->last.y) { - dump_pens = SDL_TRUE; - SDLTest_AssertCheck(0, "Mismatch in pen coordinates"); - } - if (reported_pen_state != expected_pen_state) { - dump_pens = SDL_TRUE; - SDLTest_AssertCheck(0, "Mismatch in pen state: %lx vs %lx (expected)", - (unsigned long) reported_pen_state, - (unsigned long) expected_pen_state); - } - if (0 != SDL_memcmp(reported_axes, simpen->last.axes, sizeof(float) * SDL_PEN_NUM_AXES)) { - dump_pens = SDL_TRUE; - SDLTest_AssertCheck(0, "Mismatch in axes"); - } - - if (dump_pens) { - SDL_Log("----- Pen #%d:", last_action->pen_index); - _pen_dump("expect", simpen); - _pen_dump("actual", SDL_GetPenPtr(simpen->header.id)); - } - } - SDLTest_AssertPass("Pen and eraser move and report events correctly and independently"); - - /* Cleanup */ - SDL_PenGCMark(); - _pen_trackGCSweep(&ptest); - _teardown_test(&ptest, backup); - return TEST_COMPLETED; -} - -static void -_expect_pen_config(SDL_PenID penid, - SDL_GUID expected_guid, - SDL_bool expected_attached, - char *expected_name, - int expected_type, - int expected_num_buttons, - float expected_max_tilt, - int expected_axes) -{ - SDL_PenCapabilityInfo actual_info = { 0 }; - const char *actual_name = SDL_GetPenName(penid); - - if (penid == SDL_PEN_INVALID) { - SDLTest_Assert(0, "Invalid pen ID"); - return; - } - - SDLTest_AssertEq1(int, "%d", 0, SDL_GUIDCompare(expected_guid, SDL_GetPenGUID(penid)), - "Pen %lu guid equality", (unsigned long) penid); - - SDLTest_AssertCheck(0 == SDL_strcmp(expected_name, actual_name), - "Expected name='%s' vs actual='%s'", expected_name, actual_name); - - SDLTest_AssertEq1(int, "%d", expected_attached, SDL_PenConnected(penid), - "Pen %lu is attached", (unsigned long) penid); - SDLTest_AssertEq1(int, "%d", expected_type, SDL_GetPenType(penid), - "Pen %lu type", (unsigned long) penid); - SDLTest_AssertEq1(int, "%x", expected_axes, SDL_GetPenCapabilities(penid, &actual_info), - "Pen %lu axis flags", (unsigned long) penid); - SDLTest_AssertEq1(int, "%d", expected_num_buttons, actual_info.num_buttons, - "Pen %lu number of buttons", (unsigned long) penid); - SDLTest_AssertEq1(float, "%f", expected_max_tilt, actual_info.max_tilt, - "Pen %lu max tilt", (unsigned long) penid); -} - -/** - * @brief Check backend pen iniitalisation and pen meta-information - * - * @sa SDL_GetPenCapabilities, SDL_PenAxisInfo - */ -static int -pen_initAndInfo(void *arg) -{ - pen_testdata ptest; - SDL_Pen *pen; - Uint32 mask; - char strbuf[SDL_PEN_MAX_NAME]; - - /* Init */ - deviceinfo_backup *backup = _setup_test(&ptest, 7); - - /* Register default pen */ - _expect_pens_attached_or_detached(ptest.ids, 7, 0); - - /* Register completely default pen */ - pen = SDL_PenModifyBegin(ptest.ids[0]); - SDL_memcpy(pen->guid.data, ptest.guids[0].data, sizeof(ptest.guids[0].data)); - SDL_PenModifyEnd(pen, SDL_TRUE); - - SDL_snprintf(strbuf, sizeof(strbuf), - "Pen %lu", (unsigned long) ptest.ids[0]); - _expect_pen_config(ptest.ids[0], ptest.guids[0], SDL_TRUE, - strbuf, SDL_PEN_TYPE_PEN, SDL_PEN_INFO_UNKNOWN, 0.0f, - SDL_PEN_INK_MASK); - _expect_pens_attached_or_detached(ptest.ids, 7, ATTACHED(0)); - SDLTest_AssertPass("Pass #1: default pen"); - - /* Register mostly-default pen with buttons and custom name */ - pen = SDL_PenModifyBegin(ptest.ids[1]); - SDL_PenModifyAddCapabilities(pen, SDL_PEN_AXIS_PRESSURE_MASK); - SDL_memcpy(pen->guid.data, ptest.guids[1].data, sizeof(ptest.guids[1].data)); - SDL_strlcpy(strbuf, "My special test pen", SDL_PEN_MAX_NAME); - SDL_strlcpy(pen->name, strbuf, SDL_PEN_MAX_NAME); - pen->info.num_buttons = 7; - SDL_PenModifyEnd(pen, SDL_TRUE); - - _expect_pen_config(ptest.ids[1], ptest.guids[1], SDL_TRUE, - strbuf, SDL_PEN_TYPE_PEN, 7, 0.0f, - SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK); - _expect_pens_attached_or_detached(ptest.ids, 7, ATTACHED(0) | ATTACHED(1)); - SDLTest_AssertPass("Pass #2: default pen with button and name info"); - - /* Register eraser with default name, but keep initially detached */ - pen = SDL_PenModifyBegin(ptest.ids[2]); - SDL_memcpy(pen->guid.data, ptest.guids[2].data, sizeof(ptest.guids[2].data)); - pen->type = SDL_PEN_TYPE_ERASER; - SDL_PenModifyAddCapabilities(pen, SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK); - SDL_PenModifyEnd(pen, SDL_FALSE); - - SDL_snprintf(strbuf, sizeof(strbuf), - "Eraser %lu", (unsigned long) ptest.ids[2]); - _expect_pen_config(ptest.ids[2], ptest.guids[2], SDL_FALSE, - strbuf, SDL_PEN_TYPE_ERASER, SDL_PEN_INFO_UNKNOWN, SDL_PEN_INFO_UNKNOWN, - SDL_PEN_ERASER_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK); - _expect_pens_attached_or_detached(ptest.ids, 7, ATTACHED(0) | ATTACHED(1)); - /* now make available */ - SDL_PenModifyEnd(SDL_PenModifyBegin(ptest.ids[2]), SDL_TRUE); - _expect_pen_config(ptest.ids[2], ptest.guids[2], SDL_TRUE, - strbuf, SDL_PEN_TYPE_ERASER, SDL_PEN_INFO_UNKNOWN, SDL_PEN_INFO_UNKNOWN, - SDL_PEN_ERASER_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK); - _expect_pens_attached_or_detached(ptest.ids, 7, ATTACHED(0) | ATTACHED(1) | ATTACHED(2)); - SDLTest_AssertPass("Pass #3: eraser-type pen initially detached, then attached"); - - /* Abort pen registration */ - pen = SDL_PenModifyBegin(ptest.ids[3]); - SDL_memcpy(pen->guid.data, ptest.guids[3].data, sizeof(ptest.guids[3].data)); - SDL_PenModifyAddCapabilities(pen, SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK); - pen->type = SDL_PEN_TYPE_NONE; - SDL_PenModifyEnd(pen, SDL_TRUE); - _expect_pens_attached_or_detached(ptest.ids, 7, ATTACHED(0) | ATTACHED(1) | ATTACHED(2)); - SDLTest_AssertCheck(NULL == SDL_GetPenName(ptest.ids[3]), "Pen with aborted registration remains unknown"); - SDLTest_AssertPass("Pass #4: aborted pen registration"); - - /* Brush with custom axes */ - pen = SDL_PenModifyBegin(ptest.ids[4]); - SDL_memcpy(pen->guid.data, ptest.guids[4].data, sizeof(ptest.guids[4].data)); - SDL_strlcpy(pen->name, "Testish Brush", SDL_PEN_MAX_NAME); - pen->type = SDL_PEN_TYPE_BRUSH; - pen->info.num_buttons = 1; - SDL_PenModifyAddCapabilities(pen, SDL_PEN_AXIS_ROTATION_MASK); - pen->info.max_tilt = 72.5f; - SDL_PenModifyAddCapabilities(pen, SDL_PEN_AXIS_XTILT_MASK); - SDL_PenModifyAddCapabilities(pen, SDL_PEN_AXIS_PRESSURE_MASK); - SDL_PenModifyEnd(pen, SDL_TRUE); - _expect_pen_config(ptest.ids[4], ptest.guids[4], SDL_TRUE, - "Testish Brush", SDL_PEN_TYPE_BRUSH, 1, 72.5f, - SDL_PEN_INK_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_ROTATION_MASK | SDL_PEN_AXIS_PRESSURE_MASK); - _expect_pens_attached_or_detached(ptest.ids, 7, ATTACHED(0) | ATTACHED(1) | ATTACHED(2) | ATTACHED(4)); - SDLTest_AssertPass("Pass #5: brush-type pen with unusual axis layout"); - - /* Wacom airbrush pen */ - { - const Uint32 wacom_type_id = 0x0912; - const Uint32 wacom_serial_id = 0xa0b1c2d3; - SDL_GUID guid = { - { 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0 } - }; - guid.data[0] = (wacom_serial_id >> 0) & 0xff; - guid.data[1] = (wacom_serial_id >> 8) & 0xff; - guid.data[2] = (wacom_serial_id >> 16) & 0xff; - guid.data[3] = (wacom_serial_id >> 24) & 0xff; - guid.data[4] = (wacom_type_id >> 0) & 0xff; - guid.data[5] = (wacom_type_id >> 8) & 0xff; - guid.data[6] = (wacom_type_id >> 16) & 0xff; - guid.data[7] = (wacom_type_id >> 24) & 0xff; - - pen = SDL_PenModifyBegin(ptest.ids[5]); - SDL_PenModifyForWacomID(pen, wacom_type_id, &mask); - SDL_PenUpdateGUIDForWacom(&pen->guid, wacom_type_id, wacom_serial_id); - SDL_PenModifyAddCapabilities(pen, mask); - SDL_PenModifyEnd(pen, SDL_TRUE); - _expect_pen_config(ptest.ids[5], guid, SDL_TRUE, - "Wacom Airbrush Pen", SDL_PEN_TYPE_AIRBRUSH, 1, 64.0f, /* Max tilt angle */ - SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT_MASK | SDL_PEN_AXIS_YTILT_MASK | SDL_PEN_AXIS_DISTANCE_MASK | SDL_PEN_AXIS_SLIDER_MASK); - _expect_pens_attached_or_detached(ptest.ids, 7, ATTACHED(0) | ATTACHED(1) | ATTACHED(2) | ATTACHED(4) | ATTACHED(5)); - } - SDLTest_AssertPass("Pass #6: wacom airbrush pen"); - - /* Cleanup */ - SDL_PenGCMark(); - _pen_trackGCSweep(&ptest); - _teardown_test(&ptest, backup); - return TEST_COMPLETED; -} - -#define SET_POS(update, xpos, ypos) \ - (update).x = (xpos); \ - (update).y = (ypos); - -static void -_penmouse_expect_button(int type, int button) -{ - SDL_bool press = type == SDL_PRESSED; - SDLTest_AssertCheck((press ? SDL_EVENT_MOUSE_BUTTON_DOWN : SDL_EVENT_MOUSE_BUTTON_UP) == _mouseemu_last_event, - "Mouse button %s: %x", - (press ? "press" : "release"), _mouseemu_last_event); - SDLTest_AssertCheck(button == _mouseemu_last_button, - "Observed the expected simulated button: %d", _mouseemu_last_button); - SDLTest_AssertCheck(SDL_PEN_MOUSEID == _mouseemu_last_mouseid, - "Observed the expected mouse ID: 0x%x", _mouseemu_last_mouseid); - - _mouseemu_last_event = 0; -} - -/** - * @brief Check pen device mouse emulation and event suppression without SDL_HINT_PEN_DELAY_MOUSE_BUTTON - * - * Since we include SDL_pen.c, we link it against our own mock implementations of SDL_PSendMouseButton - * and SDL_SendMouseMotion; see tehere for details. - */ -static int -pen_mouseEmulation(void *arg) -{ - pen_testdata ptest; - SDL_Event event; - int i; - SDL_PenStatusInfo update; - deviceinfo_backup *backup; - - pen_delay_mouse_button_mode = 0; - pen_mouse_emulation_mode = PEN_MOUSE_EMULATE; /* to trigger our own SDL_SendMouseButton */ - - /* Register pen */ - backup = _setup_test(&ptest, 1); - SDL_PenGCMark(); - _pen_setDeviceinfo(_pen_register(ptest.ids[0], ptest.guids[0], "testpen", - SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT | SDL_PEN_AXIS_YTILT), - 20); - _pen_trackGCSweep(&ptest); - - /* Move pen into window */ - SDL_SendPenWindowEvent(0, ptest.ids[0], ptest.window); - - /* Initialise pen location */ - SDL_memset(update.axes, 0, sizeof(update.axes)); - SET_POS(update, 100.0f, 100.0f); - SDL_SendPenMotion(0, ptest.ids[0], SDL_TRUE, &update); - while (SDL_PollEvent(&event)) - ; /* Flush event queue */ - - /* Test motion forwarding */ - _mouseemu_last_event = 0; - SET_POS(update, 121.25f, 110.75f); - SDL_SendPenMotion(0, ptest.ids[0], SDL_TRUE, &update); - SDLTest_AssertCheck(SDL_EVENT_MOUSE_MOTION == _mouseemu_last_event, - "Mouse motion event: %d", _mouseemu_last_event); - SDLTest_AssertCheck(121.25f == _mouseemu_last_x && 110.75f == _mouseemu_last_y, - "Motion to correct position: %f,%f", _mouseemu_last_x, _mouseemu_last_y); - SDLTest_AssertCheck(SDL_PEN_MOUSEID == _mouseemu_last_mouseid, - "Observed the expected mouse ID: 0x%x", _mouseemu_last_mouseid); - SDLTest_AssertCheck(0 == _mouseemu_last_relative, - "Absolute motion event"); - SDLTest_AssertPass("Motion emulation"); - - /* Test redundant motion report suppression */ - _mouseemu_last_event = 0; - - SET_POS(update, 121.25f, 110.75f); - SDL_SendPenMotion(0, ptest.ids[0], SDL_TRUE, &update); - - SET_POS(update, 121.25f, 110.75f); - SDL_SendPenMotion(0, ptest.ids[0], SDL_TRUE, &update); - - update.axes[0] = 1.0f; - SDL_SendPenMotion(0, ptest.ids[0], SDL_TRUE, &update); - - SET_POS(update, 121.25f, 110.75f); - update.axes[0] = 0.0f; - update.axes[1] = 0.75f; - SDL_SendPenMotion(0, ptest.ids[0], SDL_TRUE, &update); - - SDLTest_AssertCheck(0 == _mouseemu_last_event, - "Redundant mouse motion suppressed: %d", _mouseemu_last_event); - SDLTest_AssertPass("Redundant motion suppression"); - - /* Test button press reporting */ - SDL_SendPenTipEvent(0, ptest.ids[0], SDL_PRESSED); - _penmouse_expect_button(SDL_PRESSED, 1); - - for (i = 1; i <= 3; ++i) { - SDL_SendPenButton(0, ptest.ids[0], SDL_PRESSED, (Uint8)i); - _penmouse_expect_button(SDL_PRESSED, i + 1); - } - SDLTest_AssertPass("Button press mouse emulation"); - - /* Test button release reporting */ - SDL_SendPenTipEvent(0, ptest.ids[0], SDL_RELEASED); - _penmouse_expect_button(SDL_RELEASED, 1); - - for (i = 1; i <= 3; ++i) { - SDL_SendPenButton(0, ptest.ids[0], SDL_RELEASED, (Uint8)i); - _penmouse_expect_button(SDL_RELEASED, i + 1); - } - SDLTest_AssertPass("Button release mouse emulation"); - - /* Cleanup */ - SDL_PenGCMark(); - _pen_trackGCSweep(&ptest); - _teardown_test(&ptest, backup); - return TEST_COMPLETED; -} - -/** - * @brief Check pen device mouse emulation when SDL_HINT_PEN_DELAY_MOUSE_BUTTON is enabled (default) - */ -static int -pen_mouseEmulationDelayed(void *arg) -{ - pen_testdata ptest; - SDL_Event event; - int i; - SDL_PenStatusInfo update; - deviceinfo_backup *backup; - - pen_delay_mouse_button_mode = 1; - pen_mouse_emulation_mode = PEN_MOUSE_EMULATE; /* to trigger our own SDL_SendMouseButton */ - - /* Register pen */ - backup = _setup_test(&ptest, 1); - SDL_PenGCMark(); - _pen_setDeviceinfo(_pen_register(ptest.ids[0], ptest.guids[0], "testpen", - SDL_PEN_INK_MASK | SDL_PEN_AXIS_PRESSURE_MASK | SDL_PEN_AXIS_XTILT | SDL_PEN_AXIS_YTILT), - 20); - _pen_trackGCSweep(&ptest); - - /* Move pen into window */ - SDL_SendPenWindowEvent(0, ptest.ids[0], ptest.window); - - /* Initialise pen location */ - SDL_memset(update.axes, 0, sizeof(update.axes)); - SET_POS(update, 100.0f, 100.0f); - SDL_SendPenMotion(0, ptest.ids[0], SDL_TRUE, &update); - while (SDL_PollEvent(&event)) - ; /* Flush event queue */ - - /* Test motion forwarding */ - _mouseemu_last_event = 0; - SET_POS(update, 121.25f, 110.75f); - SDL_SendPenMotion(0, ptest.ids[0], SDL_TRUE, &update); - SDLTest_AssertCheck(SDL_EVENT_MOUSE_MOTION == _mouseemu_last_event, - "Mouse motion event: %d", _mouseemu_last_event); - SDLTest_AssertCheck(121.25f == _mouseemu_last_x && 110.75f == _mouseemu_last_y, - "Motion to correct position: %f,%f", _mouseemu_last_x, _mouseemu_last_y); - SDLTest_AssertCheck(SDL_PEN_MOUSEID == _mouseemu_last_mouseid, - "Observed the expected mouse ID: 0x%x", _mouseemu_last_mouseid); - SDLTest_AssertCheck(0 == _mouseemu_last_relative, - "Absolute motion event"); - SDLTest_AssertPass("Motion emulation"); - _mouseemu_last_event = 0; - - /* Test button press reporting */ - for (i = 1; i <= 2; ++i) { - SDL_SendPenButton(0, ptest.ids[0], SDL_PRESSED, (Uint8)i); - SDLTest_AssertCheck(0 == _mouseemu_last_event, - "Non-touching button press suppressed: %d", _mouseemu_last_event); - SDL_SendPenButton(0, ptest.ids[0], SDL_RELEASED, (Uint8)i); - SDLTest_AssertCheck(0 == _mouseemu_last_event, - "Non-touching button release suppressed: %d", _mouseemu_last_event); - } - - /* Touch surface */ - SDL_SendPenTipEvent(0, ptest.ids[0], SDL_PRESSED); - _penmouse_expect_button(SDL_PRESSED, 1); - SDL_SendPenTipEvent(0, ptest.ids[0], SDL_RELEASED); - _penmouse_expect_button(SDL_RELEASED, 1); - - /* Test button press reporting, releasing extra button AFTER lifting pen */ - for (i = 1; i <= 2; ++i) { - SDL_SendPenButton(0, ptest.ids[0], SDL_PRESSED, (Uint8)i); - SDLTest_AssertCheck(0 == _mouseemu_last_event, - "Non-touching button press suppressed (A.1): %d", _mouseemu_last_event); - SDL_SendPenTipEvent(0, ptest.ids[0], SDL_PRESSED); - _penmouse_expect_button(SDL_PRESSED, i + 1); - - SDL_SendPenTipEvent(0, ptest.ids[0], SDL_RELEASED); - _penmouse_expect_button(SDL_RELEASED, i + 1); - - SDL_SendPenButton(0, ptest.ids[0], SDL_RELEASED, (Uint8)i); - SDLTest_AssertCheck(0 == _mouseemu_last_event, - "Non-touching button press suppressed (A.2): %d", _mouseemu_last_event); - } - SDLTest_AssertPass("Delayed button press mouse emulation, touching without releasing button"); - - /* Test button press reporting, releasing extra button BEFORE lifting pen */ - for (i = 1; i <= 2; ++i) { - SDL_SendPenButton(0, ptest.ids[0], SDL_PRESSED, (Uint8)i); - SDLTest_AssertCheck(0 == _mouseemu_last_event, - "Non-touching button press suppressed (B.1): %d", _mouseemu_last_event); - SDL_SendPenTipEvent(0, ptest.ids[0], SDL_PRESSED); - _penmouse_expect_button(SDL_PRESSED, i + 1); - - SDL_SendPenButton(0, ptest.ids[0], SDL_RELEASED, (Uint8)i); - SDLTest_AssertCheck(0 == _mouseemu_last_event, - "Non-touching button press suppressed (B.2): %d", _mouseemu_last_event); - SDL_SendPenTipEvent(0, ptest.ids[0], SDL_RELEASED); - _penmouse_expect_button(SDL_RELEASED, i + 1); - } - SDLTest_AssertPass("Delayed button press mouse emulation, touching and then releasing button"); - - /* Cleanup */ - SDL_PenGCMark(); - _pen_trackGCSweep(&ptest); - _teardown_test(&ptest, backup); - return TEST_COMPLETED; -} - -/** - * @brief Ensure that all SDL_Pen*Event structures have compatible memory layout, as expected by SDL_pen.c - */ -static int -pen_memoryLayout(void *arg) -{ -#define LAYOUT_COMPATIBLE(field) \ - SDLTest_AssertCheck(offsetof(SDL_PenTipEvent, field) == offsetof(SDL_PenMotionEvent, field), \ - "Memory layout SDL_PenTipEvent and SDL_PenMotionEvent compatibility: '" #field "'"); \ - SDLTest_AssertCheck(offsetof(SDL_PenTipEvent, field) == offsetof(SDL_PenButtonEvent, field), \ - "Memory layout SDL_PenTipEvent and SDL_PenBUttonEvent compatibility: '" #field "'"); - - LAYOUT_COMPATIBLE(which); - LAYOUT_COMPATIBLE(x); - LAYOUT_COMPATIBLE(y); - LAYOUT_COMPATIBLE(axes); - - return TEST_COMPLETED; -} - -/* ================= Test Setup and Teardown ================== */ - -static void -pen_test_setup(void *arg) { - SDL_PenInit(); -} - -static void -pen_test_teardown(void *arg) { - SDL_PenQuit(); -} - -/* ================= Test References ================== */ - -/* Pen test cases */ -static const SDLTest_TestCaseReference penTest1 = { (SDLTest_TestCaseFp)pen_iteration, "pen_iteration", "Iterate over all pens with SDL_PenIDForIndex", TEST_ENABLED }; - -static const SDLTest_TestCaseReference penTest2 = { (SDLTest_TestCaseFp)pen_hotplugging, "pen_hotplugging", "Hotplug pens and validate their status, including SDL_PenConnected", TEST_ENABLED }; - -static const SDLTest_TestCaseReference penTest3 = { (SDLTest_TestCaseFp)pen_GUIDs, "pen_GUIDs", "Check Pen SDL_GUID operations", TEST_ENABLED }; - -static const SDLTest_TestCaseReference penTest4 = { (SDLTest_TestCaseFp)pen_buttonReporting, "pen_buttonReporting", "Check pen button presses", TEST_ENABLED }; - -static const SDLTest_TestCaseReference penTest5 = { (SDLTest_TestCaseFp)pen_movementAndAxes, "pen_movementAndAxes", "Check pen movement and axis update reporting", TEST_ENABLED }; - -static const SDLTest_TestCaseReference penTest6 = { (SDLTest_TestCaseFp)pen_initAndInfo, "pen_info", "Check pen self-description and initialisation", TEST_ENABLED }; - -static const SDLTest_TestCaseReference penTest7 = { (SDLTest_TestCaseFp)pen_mouseEmulation, "pen_mouseEmulation", "Check pen-as-mouse event forwarding (direct)", TEST_ENABLED }; - -static const SDLTest_TestCaseReference penTest8 = { (SDLTest_TestCaseFp)pen_mouseEmulationDelayed, "pen_mouseEmulationDelayed", "Check pen-as-mouse event forwarding (delayed)", TEST_ENABLED }; - -static const SDLTest_TestCaseReference penTest9 = { (SDLTest_TestCaseFp)pen_memoryLayout, "pen_memoryLayout", "Check that all pen events have compatible layout (required by SDL_pen.c)", TEST_ENABLED }; - -/* Sequence of Pen test cases */ -static const SDLTest_TestCaseReference *penTests[] = { - &penTest1, &penTest2, &penTest3, &penTest4, &penTest5, &penTest6, &penTest7, &penTest8, &penTest9, NULL -}; - -/* Pen test suite (global) */ -SDLTest_TestSuiteReference penTestSuite = { - "Pen", - (SDLTest_TestCaseSetUpFp)pen_test_setup, - penTests, - (SDLTest_TestCaseTearDownFp)pen_test_teardown -}; - -#else - -#include -#include "testautomation_suites.h" - -/* Sequence of Mouse test cases */ -static const SDLTest_TestCaseReference *penTests[] = { - NULL -}; - -/* Mouse test suite (global) */ -SDLTest_TestSuiteReference penTestSuite = { - "Pen", - NULL, - penTests, - NULL -}; - -#endif diff --git a/test/testautomation_suites.h b/test/testautomation_suites.h index db1b98b1cb72b..093bb9b69f7ce 100644 --- a/test/testautomation_suites.h +++ b/test/testautomation_suites.h @@ -25,7 +25,6 @@ extern SDLTest_TestSuiteReference logTestSuite; extern SDLTest_TestSuiteReference mainTestSuite; extern SDLTest_TestSuiteReference mathTestSuite; extern SDLTest_TestSuiteReference mouseTestSuite; -extern SDLTest_TestSuiteReference penTestSuite; extern SDLTest_TestSuiteReference pixelsTestSuite; extern SDLTest_TestSuiteReference platformTestSuite; extern SDLTest_TestSuiteReference propertiesTestSuite; diff --git a/test/testpen.c b/test/testpen.c index 288ec54862a5a..ace0fd656b4b5 100644 --- a/test/testpen.c +++ b/test/testpen.c @@ -1,5 +1,4 @@ /* - Simple DirectMedia Layer Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied @@ -8,519 +7,284 @@ Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. + freely. */ -#include +#define SDL_MAIN_USE_CALLBACKS 1 #include #include +#include -#define WIDTH 1600 -#define HEIGHT 1200 - -#define VERBOSE 0 - -#define ALWAYS_SHOW_PRESSURE_BOX 1 - -static SDLTest_CommonState *state; -static int quitting = 0; - -static float last_x, last_y; -static float last_xtilt, last_ytilt, last_pressure, last_distance, last_rotation; -static int last_button; -static int last_touching; /* tip touches surface */ -static int last_was_eraser; - -static SDL_Texture *offscreen_texture = NULL; - -static void DrawScreen(SDL_Renderer *renderer) +typedef struct Pen { - float xdelta, ydelta, endx, endy; - /* off-screen texture to render into */ - SDL_Texture *window_texture; - const float X = 128.0f, Y = 128.0f; /* mid-point in the off-screen texture */ - SDL_FRect dest_rect; - float tilt_vec_x = SDL_sinf(last_xtilt * SDL_PI_F / 180.0f); - float tilt_vec_y = SDL_sinf(last_ytilt * SDL_PI_F / 180.0f); - int color = last_button + 1; + SDL_PenID pen; + Uint8 r, g, b; + float axes[SDL_PEN_NUM_AXES]; + float x; + float y; + Uint32 buttons; + SDL_bool eraser; + SDL_bool touching; + struct Pen *next; +} Pen; + +static SDL_Renderer *renderer = NULL; +static SDLTest_CommonState *state = NULL; +static SDL_Texture *white_pixel = NULL; +static Pen pens; + + +int SDL_AppInit(void **appstate, int argc, char *argv[]) +{ + int i; - if (!renderer) { - return; - } + SDL_srand(0); - SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); - SDL_SetRenderDrawColor(renderer, 0x40, 0x40, 0x40, 0xff); - SDL_RenderClear(renderer); + /* Initialize test framework */ + state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); + if (!state) { + return SDL_APP_FAILURE; + } - if (offscreen_texture == NULL) { - offscreen_texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, (int)(X * 2.0f), (int)(Y * 2.0f)); + /* Enable standard application logging */ + SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + + /* Parse commandline */ + for (i = 1; i < argc;) { + int consumed = SDLTest_CommonArg(state, i); + if (consumed <= 0) { + static const char *options[] = { + NULL, + }; + SDLTest_CommonLogUsage(state, argv[0], options); + SDL_Quit(); + SDLTest_CommonDestroyState(state); + return 1; + } + i += consumed; } - /* Render into off-screen texture so we can do pixel-precise rendering later */ - window_texture = SDL_GetRenderTarget(renderer); - SDL_SetRenderTarget(renderer, offscreen_texture); + state->num_windows = 1; - /* Rendering starts here */ - SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); - SDL_SetRenderDrawColor(renderer, 0x40, 0x40, 0x40, 0xff); - SDL_RenderClear(renderer); + /* Load the SDL library */ + if (!SDLTest_CommonInit(state)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); + return SDL_APP_FAILURE; + } - SDL_SetRenderDrawColor(renderer, 0xa0, 0xa0, 0xa0, 0xff); - if (last_touching) { - SDL_FRect rect; + SDL_SetLogPriorities(SDL_LOG_PRIORITY_VERBOSE); - rect.x = 0; - rect.y = 0; - rect.w = 2.0f * X - 1.0f; - rect.h = 2.0f * Y - 1.0f; + renderer = state->renderers[0]; + if (!renderer) { + /* SDL_Log("Couldn't create renderer: %s", SDL_GetError()); */ + return SDL_APP_FAILURE; + } - SDL_RenderRect(renderer, &rect); + white_pixel = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STATIC, 16, 16); + if (!white_pixel) { + SDL_Log("Couldn't create white_pixel texture: %s", SDL_GetError()); + return SDL_APP_FAILURE; } else { - /* Show where the pen is rotating when it isn't touching the surface. - Otherwise we draw the rotation angle below together with pressure information. */ - float rot_vecx = SDL_sinf(last_rotation / 180.0f * SDL_PI_F); - float rot_vecy = -SDL_cosf(last_rotation / 180.0f * SDL_PI_F); - float px = X + rot_vecx * 100.0f; - float py = Y + rot_vecy * 100.0f; - float px2 = X + rot_vecx * 80.0f; - float py2 = Y + rot_vecy * 80.0f; - - SDL_RenderLine(renderer, - px, py, - px2 + rot_vecy * 20.0f, - py2 - rot_vecx * 20.0f); - SDL_RenderLine(renderer, - px, py, - px2 - rot_vecy * 20.0f, - py2 + rot_vecx * 20.0f); + const SDL_Rect rect = { 0, 0, 16, 16 }; + Uint32 pixels[16 * 16]; + SDL_memset(pixels, 0xFF, sizeof (pixels)); + SDL_UpdateTexture(white_pixel, &rect, pixels, 16 * sizeof (Uint32)); } - if (last_was_eraser) { - SDL_FRect rect; - - rect.x = X - 10.0f; - rect.y = Y - 10.0f; - rect.w = 21.0f; - rect.h = 21.0f; + SDL_HideCursor(); - SDL_SetRenderDrawColor(renderer, 0x00, 0xff, 0xff, 0xff); - SDL_RenderFillRect(renderer, &rect); - } else { - float distance = last_distance * 50.0f; - - SDL_SetRenderDrawColor(renderer, 0xff, 0, 0, 0xff); - SDL_RenderLine(renderer, - X - 10.0f - distance, Y, - X - distance, Y); - SDL_RenderLine(renderer, - X + 10.0f + distance, Y, - X + distance, Y); - SDL_RenderLine(renderer, - X, Y - 10.0f - distance, - X, Y - distance); - SDL_RenderLine(renderer, - X, Y + 10.0f + distance, - X, Y + distance); - - } + return SDL_APP_CONTINUE; +} - /* Draw a cone based on the direction the pen is leaning as if it were shining a light. */ - /* Colour derived from pens, intensity based on pressure: */ - SDL_SetRenderDrawColor(renderer, - (color & 0x01) ? 0xff : 0, - (color & 0x02) ? 0xff : 0, - (color & 0x04) ? 0xff : 0, - (int)(0xff)); - - xdelta = -tilt_vec_x * 100.0f; - ydelta = -tilt_vec_y * 100.0f; - endx = X + xdelta; - endy = Y + ydelta; - SDL_RenderLine(renderer, X, Y, endx, endy); - - SDL_SetRenderDrawColor(renderer, - (color & 0x01) ? 0xff : 0, - (color & 0x02) ? 0xff : 0, - (color & 0x04) ? 0xff : 0, - (Uint8)(0xff * last_pressure)); - /* Cone base width based on pressure: */ - SDL_RenderLine(renderer, X, Y, endx + (ydelta * last_pressure / 3.0f), endy - (xdelta * last_pressure / 3.0f)); - SDL_RenderLine(renderer, X, Y, endx - (ydelta * last_pressure / 3.0f), endy + (xdelta * last_pressure / 3.0f)); - - /* If tilt is very small (or zero, for pens that don't have tilt), add some extra lines, rotated by the current rotation value */ - if (ALWAYS_SHOW_PRESSURE_BOX || (SDL_fabsf(tilt_vec_x) < 0.2f && SDL_fabsf(tilt_vec_y) < 0.2f)) { - int rot; - float pressure = last_pressure * 80.0f; - - /* Four times, rotated 90 degrees, so that we get a box */ - for (rot = 0; rot < 4; ++rot) { - - float vecx = SDL_cosf((last_rotation + (rot * 90.0f)) / 180.0f * SDL_PI_F); - float vecy = SDL_sinf((last_rotation + (rot * 90.0f)) / 180.0f * SDL_PI_F); - - float px = X + vecx * pressure; - float py = Y + vecy * pressure; - - SDL_RenderLine(renderer, - px + vecy * 10.0f, py - vecx * 10.0f, - px - vecy * 10.0f, py + vecx * 10.0f); - - if (rot == 3) { - int r = 0; - for (; r >= 0; r -= 2) { - float delta = 10.0f - ((float) r); - - SDL_RenderLine(renderer, - px + vecy * delta, py - vecx * delta, - px + (vecx * pressure * 0.4f), - py + (vecy * pressure * 0.4f)); - SDL_RenderLine(renderer, - px - vecy * delta, py + vecx * delta, - px + (vecx * pressure * 0.4f), - py + (vecy * pressure * 0.4f)); - } - } +static Pen *FindPen(SDL_PenID which) +{ + Pen *i; + for (i = pens.next; i != NULL; i = i->next) { + if (i->pen == which) { + return i; } } - - SDL_SetRenderTarget(renderer, window_texture); - /* Now render to pixel-precise position */ - dest_rect.x = last_x - X; - dest_rect.y = last_y - Y; - dest_rect.w = X * 2.0f; - dest_rect.h = Y * 2.0f; - SDL_RenderTexture(renderer, offscreen_texture, NULL, &dest_rect); - SDL_RenderPresent(renderer); + return NULL; } -static void dump_state(void) +int SDL_AppEvent(void *appstate, const SDL_Event *event) { - int i; - int pens_nr; - - /* Make sure this also works with a NULL parameter */ - SDL_PenID* pens = SDL_GetPens(NULL); - if (pens) { - SDL_free(pens); - } + Pen *pen = NULL; + + switch (event->type) { + case SDL_EVENT_PEN_PROXIMITY_IN: { + pen = (Pen *) SDL_calloc(1, sizeof (*pen)); + if (!pen) { + SDL_Log("Out of memory!"); + return SDL_APP_FAILURE; + } - pens = SDL_GetPens(&pens_nr); - if (!pens) { - SDL_Log("Couldn't get pens: %s\n", SDL_GetError()); - return; - } - SDL_Log("Found %d pens (terminated by %u)\n", pens_nr, (unsigned) pens[pens_nr]); - - for (i = 0; i < pens_nr; ++i) { - SDL_PenID penid = pens[i]; - SDL_GUID guid = SDL_GetPenGUID(penid); - char guid_str[33]; - float axes[SDL_PEN_NUM_AXES]; - float x, y; - int k; - SDL_PenCapabilityInfo info; - Uint32 status = SDL_GetPenStatus(penid, &x, &y, axes, SDL_PEN_NUM_AXES); - const SDL_PenCapabilityFlags capabilities = SDL_GetPenCapabilities(penid, &info); - char *type; - char *buttons_str; - - SDL_GUIDToString(guid, guid_str, sizeof(guid_str)); - - switch (SDL_GetPenType(penid)) { - case SDL_PEN_TYPE_ERASER: - type = "Eraser"; - break; - case SDL_PEN_TYPE_PEN: - type = "Pen"; - break; - case SDL_PEN_TYPE_PENCIL: - type = "Pencil"; - break; - case SDL_PEN_TYPE_BRUSH: - type = "Brush"; - break; - case SDL_PEN_TYPE_AIRBRUSH: - type = "Airbrush"; - break; - default: - type = "Unknown (bug?)"; + SDL_Log("Pen %" SDL_PRIu32 " enters proximity!", event->pproximity.which); + pen->pen = event->pproximity.which; + pen->r = (Uint8) SDL_rand(256); + pen->g = (Uint8) SDL_rand(256); + pen->b = (Uint8) SDL_rand(256); + pen->x = 320.0f; + pen->y = 240.0f; + pen->next = pens.next; + pens.next = pen; + + return SDL_APP_CONTINUE; } - switch (info.num_buttons) { - case SDL_PEN_INFO_UNKNOWN: - SDL_asprintf(&buttons_str, "? buttons"); - break; - case 1: - SDL_asprintf(&buttons_str, "1 button"); - break; - default: - SDL_asprintf(&buttons_str, "%d button", info.num_buttons); - break; - } + case SDL_EVENT_PEN_PROXIMITY_OUT: { + Pen *prev = &pens; + Pen *i; - SDL_Log("%s %lu: [%s] attached=%d, %s [cap= %08lx:%08lx =status] '%s'\n", - type, - (unsigned long) penid, guid_str, - SDL_PenConnected(penid), /* should always be SDL_TRUE during iteration */ - buttons_str, - (unsigned long) capabilities, - (unsigned long) status, - SDL_GetPenName(penid)); - SDL_free(buttons_str); - SDL_Log(" pos=(%.2f, %.2f)", x, y); - for (k = 0; k < SDL_PEN_NUM_AXES; ++k) { - SDL_bool supported = ((capabilities & SDL_PEN_AXIS_CAPABILITY(k)) != 0); - if (supported) { - if (k == SDL_PEN_AXIS_XTILT || k == SDL_PEN_AXIS_YTILT) { - if (info.max_tilt == SDL_PEN_INFO_UNKNOWN) { - SDL_Log(" axis %d: %.3f (max tilt unknown)", k, axes[k]); - } else { - SDL_Log(" axis %d: %.3f (tilt -%.1f..%.1f)", k, axes[k], - info.max_tilt, info.max_tilt); - } - } else { - SDL_Log(" axis %d: %.3f", k, axes[k]); + SDL_Log("Pen %" SDL_PRIu32 " leaves proximity!", event->pproximity.which); + for (i = pens.next; i != NULL; i = i->next) { + if (i->pen == event->pproximity.which) { + prev->next = i->next; + SDL_free(i); + break; } - } else { - SDL_Log(" axis %d: unsupported (%.3f)", k, axes[k]); + prev = i; } - } - } - SDL_free(pens); -} - -static void update_axes(float *axes) -{ - last_xtilt = axes[SDL_PEN_AXIS_XTILT]; - last_ytilt = axes[SDL_PEN_AXIS_YTILT]; - last_pressure = axes[SDL_PEN_AXIS_PRESSURE]; - last_distance = axes[SDL_PEN_AXIS_DISTANCE]; - last_rotation = axes[SDL_PEN_AXIS_ROTATION]; -} -static void update_axes_from_touch(const float pressure) -{ - last_xtilt = 0; - last_ytilt = 0; - last_pressure = pressure; - last_distance = 0; - last_rotation = 0; -} + return SDL_APP_CONTINUE; + } -static void process_event(SDL_Event event) -{ - SDLTest_CommonEvent(state, &event, &quitting); + case SDL_EVENT_PEN_DOWN: + /*SDL_Log("Pen %" SDL_PRIu32 " down!", event->ptouch.which);*/ + pen = FindPen(event->ptouch.which); + if (pen) { + pen->touching = SDL_TRUE; + pen->eraser = (event->ptouch.eraser != 0); + } + return SDL_APP_CONTINUE; + + case SDL_EVENT_PEN_UP: + /*SDL_Log("Pen %" SDL_PRIu32 " up!", event->ptouch.which);*/ + pen = FindPen(event->ptouch.which); + if (pen) { + pen->touching = SDL_FALSE; + pen->axes[SDL_PEN_AXIS_PRESSURE] = 0.0f; + } + return SDL_APP_CONTINUE; - switch (event.type) { - case SDL_EVENT_KEY_DOWN: - { - dump_state(); - break; - } - case SDL_EVENT_MOUSE_MOTION: - case SDL_EVENT_MOUSE_BUTTON_DOWN: - case SDL_EVENT_MOUSE_BUTTON_UP: -#if VERBOSE - { - float x, y; - SDL_GetMouseState(&x, &y); - if (event.type == SDL_EVENT_MOUSE_MOTION) { - SDL_Log("[%lu] mouse motion: mouse ID %d is at (%.2f, %.2f) (state: %.2f,%.2f) delta (%.2f, %.2f)\n", - event.motion.timestamp, - event.motion.which, - event.motion.x, event.motion.y, - event.motion.xrel, event.motion.yrel, - x, y); - } else { - SDL_Log("[%lu] mouse button: mouse ID %d is at (%.2f, %.2f) (state: %.2f,%.2f)\n", - event.button.timestamp, - event.button.which, - event.button.x, event.button.y, - x, y); - } - } -#endif - if (event.motion.which != SDL_PEN_MOUSEID && event.motion.which != SDL_TOUCH_MOUSEID) { - SDL_ShowCursor(); - } break; + case SDL_EVENT_PEN_BUTTON_DOWN: + /*SDL_Log("Pen %" SDL_PRIu32 " button %d down!", event->pbutton.which, (int) event->pbutton.button);*/ + pen = FindPen(event->ptouch.which); + if (pen) { + pen->buttons |= (1 << event->pbutton.button); + } + return SDL_APP_CONTINUE; - case SDL_EVENT_PEN_MOTION: - { - SDL_PenMotionEvent *ev = &event.pmotion; - - SDL_HideCursor(); - last_x = ev->x; - last_y = ev->y; - update_axes(ev->axes); - last_was_eraser = ev->pen_state & SDL_PEN_ERASER_MASK; -#if VERBOSE - SDL_Log("[%lu] pen motion: %s %u at (%.4f, %.4f); pressure=%.3f, tilt=%.3f/%.3f, dist=%.3f [buttons=%02x]\n", - (unsigned long) ev->timestamp, - last_was_eraser ? "eraser" : "pen", - (unsigned int)ev->which, ev->x, ev->y, last_pressure, last_xtilt, last_ytilt, last_distance, - ev->pen_state); -#endif - } break; - - case SDL_EVENT_PEN_UP: - case SDL_EVENT_PEN_DOWN: { - SDL_PenTipEvent *ev = &event.ptip; - last_x = ev->x; - last_y = ev->y; - update_axes(ev->axes); - last_was_eraser = ev->tip == SDL_PEN_TIP_ERASER; - last_button = ev->pen_state & 0xf; /* button mask */ - last_touching = (event.type == SDL_EVENT_PEN_DOWN); - } break; - - case SDL_EVENT_PEN_BUTTON_UP: - case SDL_EVENT_PEN_BUTTON_DOWN: - { - SDL_PenButtonEvent *ev = &event.pbutton; + case SDL_EVENT_PEN_BUTTON_UP: + /*SDL_Log("Pen %" SDL_PRIu32 " button %d up!", event->pbutton.which, (int) event->pbutton.button);*/ + pen = FindPen(event->ptouch.which); + if (pen) { + pen->buttons &= ~(1 << event->pbutton.button); + } + return SDL_APP_CONTINUE; + + case SDL_EVENT_PEN_MOTION: + /*SDL_Log("Pen %" SDL_PRIu32 " moved to (%f,%f)!", event->pmotion.which, event->pmotion.x, event->pmotion.y);*/ + pen = FindPen(event->ptouch.which); + if (pen) { + pen->x = event->pmotion.x; + pen->y = event->pmotion.y; + } + return SDL_APP_CONTINUE; - SDL_HideCursor(); - last_x = ev->x; - last_y = ev->y; - update_axes(ev->axes); - if (last_pressure > 0.0f && !last_touching) { - SDL_LogWarn(SDL_LOG_CATEGORY_TEST, - "[%lu] : reported pressure %.5f even though pen is not touching surface", - (unsigned long) ev->timestamp, last_pressure); + case SDL_EVENT_PEN_AXIS: + /*SDL_Log("Pen %" SDL_PRIu32 " axis %d is now %f!", event->paxis.which, (int) event->paxis.axis, event->paxis.value);*/ + pen = FindPen(event->ptouch.which); + if (pen && (event->paxis.axis < SDL_arraysize(pen->axes))) { + pen->axes[event->paxis.axis] = event->paxis.value; + } + return SDL_APP_CONTINUE; + case SDL_EVENT_KEY_DOWN: { + const SDL_Keycode sym = event->key.key; + if (sym == SDLK_ESCAPE || sym == SDLK_AC_BACK) { + SDL_Log("Key : Escape!"); + return SDL_APP_SUCCESS; + } + break; } - last_was_eraser = ev->pen_state & SDL_PEN_ERASER_MASK; - last_button = ev->pen_state & 0xf; /* button mask */ - if ((ev->pen_state & SDL_PEN_DOWN_MASK) && !last_touching) { - SDL_LogWarn(SDL_LOG_CATEGORY_TEST, - "[%lu] : reported flags %x (SDL_PEN_FLAG_DOWN_MASK) despite not receiving SDL_EVENT_PEN_DOWN", - (unsigned long) ev->timestamp, ev->pen_state); - } - if (!(ev->pen_state & SDL_PEN_DOWN_MASK) && last_touching) { - SDL_LogWarn(SDL_LOG_CATEGORY_TEST, - "[%lu] : reported flags %x (no SDL_PEN_FLAG_DOWN_MASK) despite receiving SDL_EVENT_PEN_DOWN without SDL_EVENT_PEN_UP afterwards", - (unsigned long) ev->timestamp, ev->pen_state); + case SDL_EVENT_QUIT: + return SDL_APP_SUCCESS; - } -#if VERBOSE - SDL_Log("[%lu] pen button: %s %u at (%.4f, %.4f); BUTTON %d reported %s with event %s [pressure=%.3f, tilt=%.3f/%.3f, dist=%.3f]\n", - (unsigned long) ev->timestamp, - last_was_eraser ? "eraser" : "pen", - (unsigned int)ev->which, ev->x, ev->y, - ev->button, - (ev->state == SDL_PRESSED) ? "PRESSED" - : ((ev->state == SDL_RELEASED) ? "RELEASED" : "--invalid--"), - event.type == SDL_EVENT_PEN_BUTTON_UP ? "PENBUTTONUP" : "PENBUTTONDOWN", - last_pressure, last_xtilt, last_ytilt, last_distance); -#endif - } break; - - case SDL_EVENT_WINDOW_PEN_ENTER: - SDL_Log("[%lu] Pen %lu entered window %lx", - (unsigned long) event.window.timestamp, - (unsigned long) event.window.data1, - (unsigned long) event.window.windowID); - break; - - case SDL_EVENT_WINDOW_PEN_LEAVE: - SDL_Log("[%lu] Pen %lu left window %lx", - (unsigned long) event.window.timestamp, - (unsigned long) event.window.data1, - (unsigned long) event.window.windowID); - break; - -#if VERBOSE - case SDL_EVENT_WINDOW_MOUSE_ENTER: - SDL_Log("[%lu] Mouse entered window %lx", - (unsigned long) event.window.timestamp, - (unsigned long) event.window.windowID); - break; - - case SDL_EVENT_WINDOW_MOUSE_LEAVE: - SDL_Log("[%lu] Mouse left window %lx", - (unsigned long) event.window.timestamp, - (unsigned long) event.window.windowID); - break; -#endif - - case SDL_EVENT_FINGER_DOWN: - case SDL_EVENT_FINGER_MOTION: - case SDL_EVENT_FINGER_UP: - { - SDL_TouchFingerEvent *ev = &event.tfinger; - int w, h; - SDL_HideCursor(); - SDL_GetWindowSize(SDL_GetWindowFromID(ev->windowID), &w, &h); - last_x = ev->x * w; - last_y = ev->y * h; - update_axes_from_touch(ev->pressure); - last_was_eraser = SDL_FALSE; - last_button = 0; - last_touching = (ev->type != SDL_EVENT_FINGER_UP); -#if VERBOSE - SDL_Log("[%lu] finger %s: %s (touchId: %" SDL_PRIu64 ", fingerId: %" SDL_PRIu64 ") at (%.4f, %.4f); pressure=%.3f\n", - (unsigned long) ev->timestamp, - ev->type == SDL_EVENT_FINGER_DOWN ? "down" : (ev->type == SDL_EVENT_FINGER_MOTION ? "motion" : "up"), - SDL_GetTouchDeviceName(ev->touchId), - ev->touchId, - ev->fingerId, - last_x, last_y, last_pressure); -#endif - } break; - - default: - break; + default: + break; } + + return SDLTest_CommonEventMainCallbacks(state, event); } -static void loop(void) +static void DrawOnePen(Pen *pen, int num) { - SDL_Event event; int i; - for (i = 0; i < state->num_windows; ++i) { - if (state->renderers[i]) { - DrawScreen(state->renderers[i]); + /* draw button presses for this pen. A square for each in the pen's color, offset down the screen so they don't overlap. */ + SDL_SetRenderDrawColor(renderer, pen->r, pen->g, pen->b, 255); + for (i = 0; i < 8; i++) { /* we assume you don't have more than 8 buttons atm... */ + if (pen->buttons & (1 << i)) { + const SDL_FRect rect = { 30.0f * ((float) i), ((float) num) * 30.0f, 30.0f, 30.0f }; + SDL_RenderFillRect(renderer, &rect); } } - if (SDL_WaitEventTimeout(&event, 10)) { - process_event(event); + /* draw a square to represent pressure. Always green for eraser and blue for pen */ + /* we do this with a texture, so we can trivially rotate it, which SDL_RenderFillRect doesn't offer. */ + if (pen->axes[SDL_PEN_AXIS_PRESSURE] > 0.0f) { + const float size = (150.0f * pen->axes[SDL_PEN_AXIS_PRESSURE]) + 20.0f; + const float halfsize = size / 2.0f; + const SDL_FRect rect = { pen->x - halfsize, pen->y - halfsize, size, size }; + const SDL_FPoint center = { halfsize, halfsize }; + if (pen->eraser) { + SDL_SetTextureColorMod(white_pixel, 0, 255, 0); + } else { + SDL_SetTextureColorMod(white_pixel, 0, 0, 255); + } + SDL_RenderTextureRotated(renderer, white_pixel, NULL, &rect, pen->axes[SDL_PEN_AXIS_ROTATION], ¢er, SDL_FLIP_NONE); } - while (SDL_PollEvent(&event)) { - process_event(event); + + /* draw a little square for position in the center of the pressure, with the pen-specific color. */ + { + const float distance = pen->touching ? 0.0f : SDL_clamp(pen->axes[SDL_PEN_AXIS_DISTANCE], 0.0f, 1.0f); + const float size = 10 + (30.0f * (1.0f - distance)); + const float halfsize = size / 2.0f; + const SDL_FRect rect = { pen->x - halfsize, pen->y - halfsize, size, size }; + const SDL_FPoint center = { halfsize, halfsize }; + SDL_SetTextureColorMod(white_pixel, pen->r, pen->g, pen->b); + SDL_RenderTextureRotated(renderer, white_pixel, NULL, &rect, pen->axes[SDL_PEN_AXIS_ROTATION], ¢er, SDL_FLIP_NONE); } } -int main(int argc, char *argv[]) +int SDL_AppIterate(void *appstate) { - state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (!state) { - return 1; - } + int num = 0; + Pen *pen; - state->window_title = "Pressure-Sensitive Pen Test"; - state->window_w = WIDTH; - state->window_h = HEIGHT; - state->skip_renderer = SDL_FALSE; + SDL_SetRenderDrawColor(renderer, 0x99, 0x99, 0x99, 255); + SDL_RenderClear(renderer); - if (!SDLTest_CommonDefaultArgs(state, argc, argv) || !SDLTest_CommonInit(state)) { - SDLTest_CommonQuit(state); - return 1; + for (pen = pens.next; pen != NULL; pen = pen->next, num++) { + DrawOnePen(pen, num); } - while (!quitting) { - loop(); - } + SDL_RenderPresent(renderer); + return SDL_APP_CONTINUE; +} + +void SDL_AppQuit(void *appstate) +{ + Pen *i, *next; + for (i = pens.next; i != NULL; i = next) { + next = i->next; + SDL_free(i); + } + pens.next = NULL; + SDL_DestroyTexture(white_pixel); SDLTest_CommonQuit(state); - return 0; } + From b4ca15b654c6eaaa41657d6a2ad7ceed09000e0a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 9 Aug 2024 02:27:37 -0400 Subject: [PATCH 251/253] pen: Added Cocoa backend. --- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 7 + src/video/cocoa/SDL_cocoapen.h | 32 +++++ src/video/cocoa/SDL_cocoapen.m | 177 ++++++++++++++++++++++++ src/video/cocoa/SDL_cocoavideo.h | 1 + src/video/cocoa/SDL_cocoavideo.m | 3 + src/video/cocoa/SDL_cocoawindow.h | 4 + src/video/cocoa/SDL_cocoawindow.m | 22 +++ test/testpen.c | 4 +- 8 files changed, 248 insertions(+), 2 deletions(-) create mode 100644 src/video/cocoa/SDL_cocoapen.h create mode 100644 src/video/cocoa/SDL_cocoapen.m diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index e93e7d67e5e4f..3fa652201da23 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -524,6 +524,8 @@ F3FA5A242B59ACE000FEAD97 /* yuv_rgb_lsx.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FA5A1B2B59ACE000FEAD97 /* yuv_rgb_lsx.h */; }; F3FA5A252B59ACE000FEAD97 /* yuv_rgb_common.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FA5A1C2B59ACE000FEAD97 /* yuv_rgb_common.h */; }; FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; platformFilters = (ios, maccatalyst, macos, tvos, watchos, ); }; + 0000E5D7110DFF81FF660000 /* SDL_cocoapen.h in Headers */ = {isa = PBXBuildFile; fileRef = 00002F2F5496FA184A0F0000 /* SDL_cocoapen.h */; }; + 0000D5B526B85DE7AB1C0000 /* SDL_cocoapen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0000CCA310B73A7B59910000 /* SDL_cocoapen.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -1076,6 +1078,8 @@ F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = ""; }; F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; }; FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + 00002F2F5496FA184A0F0000 /* SDL_cocoapen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoapen.h; path = SDL_cocoapen.h; sourceTree = ""; }; + 0000CCA310B73A7B59910000 /* SDL_cocoapen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoapen.m; path = SDL_cocoapen.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1676,6 +1680,8 @@ A7D8A68323E2513E00DCD162 /* SDL_cocoavulkan.m */, A7D8A69223E2513E00DCD162 /* SDL_cocoawindow.h */, A7D8A68423E2513E00DCD162 /* SDL_cocoawindow.m */, + 00002F2F5496FA184A0F0000 /* SDL_cocoapen.h */, + 0000CCA310B73A7B59910000 /* SDL_cocoapen.m */, ); path = cocoa; sourceTree = ""; @@ -2908,6 +2914,7 @@ 0000494CC93F3E624D3C0000 /* SDL_systime.c in Sources */, 000095FA1BDE436CF3AF0000 /* SDL_time.c in Sources */, 0000140640E77F73F1DF0000 /* SDL_dialog_utils.c in Sources */, + 0000D5B526B85DE7AB1C0000 /* SDL_cocoapen.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/src/video/cocoa/SDL_cocoapen.h b/src/video/cocoa/SDL_cocoapen.h new file mode 100644 index 0000000000000..61d8496f7d4df --- /dev/null +++ b/src/video/cocoa/SDL_cocoapen.h @@ -0,0 +1,32 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_internal.h" + +#ifndef SDL_cocoapen_h_ +#define SDL_cocoapenm_h_ + +#include "SDL_cocoavideo.h" + +extern int Cocoa_InitPen(SDL_VideoDevice *_this); +extern SDL_bool Cocoa_HandlePenEvent(SDL_CocoaWindowData *_data, NSEvent *event); // return SDL_FALSE if we didn't handle this event. +extern void Cocoa_QuitPen(SDL_VideoDevice *_this); + +#endif /* SDL_cocoapen_h_ */ diff --git a/src/video/cocoa/SDL_cocoapen.m b/src/video/cocoa/SDL_cocoapen.m new file mode 100644 index 0000000000000..24f5f5104bbda --- /dev/null +++ b/src/video/cocoa/SDL_cocoapen.m @@ -0,0 +1,177 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_internal.h" + +#ifdef SDL_VIDEO_DRIVER_COCOA + +#include "SDL_cocoapen.h" +#include "SDL_cocoavideo.h" + +#include "../../events/SDL_pen_c.h" + +int Cocoa_InitPen(SDL_VideoDevice *_this) +{ + return 0; +} + +typedef struct Cocoa_PenHandle +{ + NSUInteger deviceid; + NSUInteger toolid; + SDL_PenID pen; + SDL_bool is_eraser; +} Cocoa_PenHandle; + +typedef struct FindPenByDeviceAndToolIDData +{ + NSUInteger deviceid; + NSUInteger toolid; + void *handle; +} FindPenByDeviceAndToolIDData; + +static SDL_bool FindPenByDeviceAndToolID(void *handle, void *userdata) +{ + const Cocoa_PenHandle *cocoa_handle = (const Cocoa_PenHandle *) handle; + FindPenByDeviceAndToolIDData *data = (FindPenByDeviceAndToolIDData *) userdata; + + if (cocoa_handle->deviceid != data->deviceid) { + return SDL_FALSE; + } else if (cocoa_handle->toolid != data->toolid) { + return SDL_FALSE; + } + data->handle = handle; + return SDL_TRUE; +} + +static Cocoa_PenHandle *Cocoa_FindPenByDeviceID(NSUInteger deviceid, NSUInteger toolid) +{ + FindPenByDeviceAndToolIDData data; + data.deviceid = deviceid; + data.toolid = toolid; + data.handle = NULL; + SDL_FindPenByCallback(FindPenByDeviceAndToolID, &data); + return (Cocoa_PenHandle *) data.handle; +} + +static void Cocoa_HandlePenProximityEvent(SDL_CocoaWindowData *_data, NSEvent *event) +{ + const NSUInteger devid = [event deviceID]; + const NSUInteger toolid = [event pointingDeviceID]; + + if (event.enteringProximity) { // new pen coming! + const NSPointingDeviceType devtype = [event pointingDeviceType]; + const SDL_bool is_eraser = (devtype == NSPointingDeviceTypeEraser); + const SDL_bool is_pen = (devtype == NSPointingDeviceTypePen); + if (!is_eraser && !is_pen) { + return; // we ignore other things, which hopefully is right. + } + + Cocoa_PenHandle *handle = (Cocoa_PenHandle *) SDL_calloc(1, sizeof (*handle)); + if (!handle) { + return; // oh well. + } + + // Cocoa offers almost none of this information. + SDL_PenInfo peninfo; + SDL_zero(peninfo); + peninfo.capabilities = SDL_PEN_CAPABILITY_PRESSURE | SDL_PEN_CAPABILITY_ROTATION | SDL_PEN_CAPABILITY_XTILT | SDL_PEN_CAPABILITY_YTILT | (is_eraser ? SDL_PEN_CAPABILITY_ERASER : 0); + peninfo.max_tilt = 90.0f; + peninfo.num_buttons = 2; + peninfo.subtype = is_eraser ? SDL_PEN_TYPE_ERASER : SDL_PEN_TYPE_PEN; + + handle->deviceid = devid; + handle->toolid = toolid; + handle->is_eraser = is_eraser; + handle->pen = SDL_AddPenDevice(Cocoa_GetEventTimestamp([event timestamp]), NULL, &peninfo, handle); + if (!handle->pen) { + SDL_free(handle); // oh well. + } + } else { // old pen leaving! + Cocoa_PenHandle *handle = Cocoa_FindPenByDeviceID(devid, toolid); + if (handle) { + SDL_RemovePenDevice(Cocoa_GetEventTimestamp([event timestamp]), handle->pen); + SDL_free(handle); + } + } +} + +static void Cocoa_HandlePenPointEvent(SDL_CocoaWindowData *_data, NSEvent *event) +{ + const Uint32 timestamp = Cocoa_GetEventTimestamp([event timestamp]); + Cocoa_PenHandle *handle = Cocoa_FindPenByDeviceID([event deviceID], [event pointingDeviceID]); + if (!handle) { + return; + } + + const SDL_PenID pen = handle->pen; + const NSEventButtonMask buttons = [event buttonMask]; + const NSPoint tilt = [event tilt]; + const NSPoint point = [event locationInWindow]; + const SDL_bool is_touching = (buttons & NSEventButtonMaskPenTip) != 0; + SDL_Window *window = _data.window; + + SDL_SendPenTouch(timestamp, pen, window, is_touching, handle->is_eraser ? 1 : 0); + SDL_SendPenMotion(timestamp, pen, window, (float) point.x, (float) (window->h - point.y)); + SDL_SendPenButton(timestamp, pen, window, (buttons & NSEventButtonMaskPenLowerSide) ? SDL_PRESSED : SDL_RELEASED, 1); + SDL_SendPenButton(timestamp, pen, window, (buttons & NSEventButtonMaskPenUpperSide) ? SDL_PRESSED : SDL_RELEASED, 2); + SDL_SendPenAxis(timestamp, pen, window, SDL_PEN_AXIS_PRESSURE, [event pressure]); + SDL_SendPenAxis(timestamp, pen, window, SDL_PEN_AXIS_ROTATION, [event rotation]); + SDL_SendPenAxis(timestamp, pen, window, SDL_PEN_AXIS_XTILT, ((float) tilt.x) * 90.0f); + SDL_SendPenAxis(timestamp, pen, window, SDL_PEN_AXIS_YTILT, ((float) tilt.y) * 90.0f); +} + +SDL_bool Cocoa_HandlePenEvent(SDL_CocoaWindowData *_data, NSEvent *event) +{ + NSEventType type = [event type]; + + if ((type != NSEventTypeTabletPoint) && (type != NSEventTypeTabletProximity)) { + const NSEventSubtype subtype = [event subtype]; + if (subtype == NSEventSubtypeTabletPoint) { + type = NSEventTypeTabletPoint; + } else if (subtype == NSEventSubtypeTabletProximity) { + type = NSEventTypeTabletProximity; + } else { + return SDL_FALSE; // not a tablet event. + } + } + + if (type == NSEventTypeTabletPoint) { + Cocoa_HandlePenPointEvent(_data, event); + } else if (type == NSEventTypeTabletProximity) { + Cocoa_HandlePenProximityEvent(_data, event); + } else { + return SDL_FALSE; // not a tablet event. + } + + return SDL_TRUE; +} + +static void Cocoa_FreePenHandle(SDL_PenID instance_id, void *handle, void *userdata) +{ + SDL_free(handle); +} + +void Cocoa_QuitPen(SDL_VideoDevice *_this) +{ + SDL_RemoveAllPenDevices(Cocoa_FreePenHandle, NULL); +} + +#endif /* SDL_VIDEO_DRIVER_COCOA */ diff --git a/src/video/cocoa/SDL_cocoavideo.h b/src/video/cocoa/SDL_cocoavideo.h index df7fb382d2683..a3c1df6263c05 100644 --- a/src/video/cocoa/SDL_cocoavideo.h +++ b/src/video/cocoa/SDL_cocoavideo.h @@ -38,6 +38,7 @@ #include "SDL_cocoamouse.h" #include "SDL_cocoaopengl.h" #include "SDL_cocoawindow.h" +#include "SDL_cocoapen.h" #ifndef MAC_OS_X_VERSION_10_12 #define DECLARE_EVENT(name) static const NSEventType NSEventType##name = NS##name diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index 7bc315805a83c..677c24a08babe 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/src/video/cocoa/SDL_cocoavideo.m @@ -201,6 +201,8 @@ int Cocoa_VideoInit(SDL_VideoDevice *_this) Cocoa_InitKeyboard(_this); if (Cocoa_InitMouse(_this) < 0) { return -1; + } else if (Cocoa_InitPen(_this) < 0) { + return -1; } // Assume we have a mouse and keyboard @@ -227,6 +229,7 @@ void Cocoa_VideoQuit(SDL_VideoDevice *_this) Cocoa_QuitModes(_this); Cocoa_QuitKeyboard(_this); Cocoa_QuitMouse(_this); + Cocoa_QuitPen(_this); SDL_DestroyMutex(data.swaplock); data.swaplock = NULL; } diff --git a/src/video/cocoa/SDL_cocoawindow.h b/src/video/cocoa/SDL_cocoawindow.h index ce8cf3117cee1..9dfffac6dc23d 100644 --- a/src/video/cocoa/SDL_cocoawindow.h +++ b/src/video/cocoa/SDL_cocoawindow.h @@ -121,6 +121,10 @@ typedef enum /* Touch event handling */ - (void)handleTouches:(NSTouchPhase)phase withEvent:(NSEvent *)theEvent; +/* Tablet event handling (but these also come through on mouse events sometimes!) */ +- (void)tabletProximity:(NSEvent *)theEvent; +- (void)tabletPoint:(NSEvent *)theEvent; + @end /* *INDENT-ON* */ diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index a457a5a53f200..a353981191c30 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1568,6 +1568,10 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_ - (void)mouseDown:(NSEvent *)theEvent { + if (Cocoa_HandlePenEvent(_data, theEvent)) { + return; // pen code handled it. + } + SDL_Mouse *mouse = SDL_GetMouse(); int button; @@ -1625,6 +1629,10 @@ - (void)otherMouseDown:(NSEvent *)theEvent - (void)mouseUp:(NSEvent *)theEvent { + if (Cocoa_HandlePenEvent(_data, theEvent)) { + return; // pen code handled it. + } + SDL_Mouse *mouse = SDL_GetMouse(); int button; @@ -1672,6 +1680,10 @@ - (void)otherMouseUp:(NSEvent *)theEvent - (void)mouseMoved:(NSEvent *)theEvent { + if (Cocoa_HandlePenEvent(_data, theEvent)) { + return; // pen code handled it. + } + SDL_MouseID mouseID = SDL_DEFAULT_MOUSE_ID; SDL_Mouse *mouse = SDL_GetMouse(); NSPoint point; @@ -1887,6 +1899,16 @@ - (void)handleTouches:(NSTouchPhase)phase withEvent:(NSEvent *)theEvent } } +- (void)tabletProximity:(NSEvent *)theEvent +{ + Cocoa_HandlePenEvent(_data, theEvent); +} + +- (void)tabletPoint:(NSEvent *)theEvent +{ + Cocoa_HandlePenEvent(_data, theEvent); +} + @end @interface SDL3View : NSView diff --git a/test/testpen.c b/test/testpen.c index ace0fd656b4b5..1dfef50076d19 100644 --- a/test/testpen.c +++ b/test/testpen.c @@ -171,7 +171,7 @@ int SDL_AppEvent(void *appstate, const SDL_Event *event) /*SDL_Log("Pen %" SDL_PRIu32 " button %d down!", event->pbutton.which, (int) event->pbutton.button);*/ pen = FindPen(event->ptouch.which); if (pen) { - pen->buttons |= (1 << event->pbutton.button); + pen->buttons |= (1 << (event->pbutton.button-1)); } return SDL_APP_CONTINUE; @@ -179,7 +179,7 @@ int SDL_AppEvent(void *appstate, const SDL_Event *event) /*SDL_Log("Pen %" SDL_PRIu32 " button %d up!", event->pbutton.which, (int) event->pbutton.button);*/ pen = FindPen(event->ptouch.which); if (pen) { - pen->buttons &= ~(1 << event->pbutton.button); + pen->buttons &= ~(1 << (event->pbutton.button-1)); } return SDL_APP_CONTINUE; From a7fa3752754b0fd02a46d84580777657fa5bfae4 Mon Sep 17 00:00:00 2001 From: SDL Wiki Bot Date: Sat, 10 Aug 2024 02:09:54 +0000 Subject: [PATCH 252/253] Sync SDL3 wiki -> header --- include/SDL3/SDL_events.h | 33 ++++++++++++++++----------------- include/SDL3/SDL_pen.h | 18 +++++++++--------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index 57b412df27713..6ee2cb90889b5 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -719,10 +719,10 @@ typedef struct SDL_TouchFingerEvent * Pressure-sensitive pen proximity event structure (event.pmotion.*) * * When a pen becomes visible to the system (it is close enough to a tablet, - * etc), SDL will send an SDL_EVENT_PEN_PROXIMITY_IN event with the new - * pen's ID. This ID is valid until the pen leaves proximity again (has - * been removed from the tablet's area, the tablet has been unplugged, etc). - * If the same pen reenters proximity again, it will be given a new ID. + * etc), SDL will send an SDL_EVENT_PEN_PROXIMITY_IN event with the new pen's + * ID. This ID is valid until the pen leaves proximity again (has been removed + * from the tablet's area, the tablet has been unplugged, etc). If the same + * pen reenters proximity again, it will be given a new ID. * * Note that "proximity" means "close enough for the tablet to know the tool * is there." The pen touching and lifting off from the tablet while not @@ -742,11 +742,11 @@ typedef struct SDL_PenProximityEvent /** * Pressure-sensitive pen motion event structure (event.pmotion.*) * - * Depending on the hardware, you may get motion events when the - * pen is not touching a tablet, for tracking a pen even when it - * isn't drawing. You should listen for SDL_EVENT_PEN_DOWN and - * SDL_EVENT_PEN_UP events, or check `pen_state & SDL_PEN_INPUT_DOWN` - * to decide if a pen is "drawing" when dealing with pen motion. + * Depending on the hardware, you may get motion events when the pen is not + * touching a tablet, for tracking a pen even when it isn't drawing. You + * should listen for SDL_EVENT_PEN_DOWN and SDL_EVENT_PEN_UP events, or check + * `pen_state & SDL_PEN_INPUT_DOWN` to decide if a pen is "drawing" when + * dealing with pen motion. * * \since This struct is available since SDL 3.0.0. */ @@ -765,8 +765,8 @@ typedef struct SDL_PenMotionEvent /** * Pressure-sensitive pen touched event structure (event.ptouch.*) * - * These events come when a pen touches a surface (a tablet, etc), - * or lifts off from one. + * These events come when a pen touches a surface (a tablet, etc), or lifts + * off from one. * * \since This struct is available since SDL 3.0.0. */ @@ -787,9 +787,8 @@ typedef struct SDL_PenTouchEvent /** * Pressure-sensitive pen button event structure (event.pbutton.*) * - * This is for buttons on the pen itself that the user might click. - * The pen itself pressing down to draw triggers a SDL_EVENT_PEN_DOWN - * event instead. + * This is for buttons on the pen itself that the user might click. The pen + * itself pressing down to draw triggers a SDL_EVENT_PEN_DOWN event instead. * * \since This struct is available since SDL 3.0.0. */ @@ -808,10 +807,10 @@ typedef struct SDL_PenButtonEvent } SDL_PenButtonEvent; /** - * Pressure-sensitive pen pressure / angle event structure - * (event.paxis.*) + * Pressure-sensitive pen pressure / angle event structure (event.paxis.*) * - * You might get some of these events even if the pen isn't touching the tablet. + * You might get some of these events even if the pen isn't touching the + * tablet. * * \since This struct is available since SDL 3.0.0. */ diff --git a/include/SDL3/SDL_pen.h b/include/SDL3/SDL_pen.h index 02b22b07fb90a..f195d8db0c0ef 100644 --- a/include/SDL3/SDL_pen.h +++ b/include/SDL3/SDL_pen.h @@ -24,9 +24,9 @@ * * SDL pen event handling. * - * SDL provides an API for pressure-sensitive pen (stylus and/or - * eraser) handling, e.g., for input and drawing tablets or suitably equipped - * mobile / tablet devices. + * SDL provides an API for pressure-sensitive pen (stylus and/or eraser) + * handling, e.g., for input and drawing tablets or suitably equipped mobile / + * tablet devices. * * To get started with pens, simply handle SDL_EVENT_PEN_* events. When a pen * starts providing input, SDL will assign it a unique SDL_PenID, which will @@ -52,8 +52,8 @@ extern "C" { * Zero is used to signify an invalid/null device. * * These show up in pen events when SDL sees input from them. They remain - * consistent as long as SDL can recognize a tool to be the same pen; but if - * a pen physically leaves the area and returns, it might get a new ID. + * consistent as long as SDL can recognize a tool to be the same pen; but if a + * pen physically leaves the area and returns, it might get a new ID. * * \since This datatype is available since SDL 3.0.0. */ @@ -77,10 +77,10 @@ typedef Uint32 SDL_PenInputFlags; /** * Pen axis indices. * - * These are the valid values for the `axis` field in SDL_PenAxisEvent. - * All axes are either normalised to 0..1 or report a (positive or negative) angle - * in degrees, with 0.0 representing the centre. Not all pens/backends support all - * axes: unsupported axes are always zero. + * These are the valid values for the `axis` field in SDL_PenAxisEvent. All + * axes are either normalised to 0..1 or report a (positive or negative) angle + * in degrees, with 0.0 representing the centre. Not all pens/backends support + * all axes: unsupported axes are always zero. * * To convert angles for tilt and rotation into vector representation, use * SDL_sinf on the XTILT, YTILT, or ROTATION component, for example: From 8a6fd058b4c2592d55193577108a4082bb68ebc0 Mon Sep 17 00:00:00 2001 From: Anthony Date: Sat, 10 Aug 2024 02:38:02 +0100 Subject: [PATCH 253/253] Update proguard-rules.pro in line with recent changes Also sort methods and add a note about preserving unused native method nativeGetHint. --- android-project/app/proguard-rules.pro | 70 ++++++++++---------------- 1 file changed, 27 insertions(+), 43 deletions(-) diff --git a/android-project/app/proguard-rules.pro b/android-project/app/proguard-rules.pro index ffc6976e5b3a6..9985625dc3958 100644 --- a/android-project/app/proguard-rules.pro +++ b/android-project/app/proguard-rules.pro @@ -17,74 +17,58 @@ #} -keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLActivity { - void manualBackButton(); - boolean setActivityTitle(java.lang.String); - void setWindowStyle(boolean); - void setOrientation(int, int, boolean, java.lang.String); - void minimizeWindow(); - boolean shouldMinimizeOnFocusLoss(); - boolean isScreenKeyboardShown(); - boolean supportsRelativeMouse(); - boolean setRelativeMouseEnabled(boolean); - boolean sendMessage(int, int); - android.content.Context getContext(); - boolean isAndroidTV(); - boolean isTablet(); - boolean isChromebook(); - boolean isDeXMode(); - boolean getManifestEnvironmentVariables(); - boolean showTextInput(int, int, int, int); - android.view.Surface getNativeSurface(); - void initTouch(); - int messageboxShowMessageBox(int, java.lang.String, java.lang.String, int[], int[], java.lang.String[], int[]); - boolean clipboardHasText(); + java.lang.String nativeGetHint(java.lang.String); # Java-side doesn't use this, so it gets minified, but C-side still tries to register it java.lang.String clipboardGetText(); + boolean clipboardHasText(); void clipboardSetText(java.lang.String); int createCustomCursor(int[], int, int, int, int); void destroyCustomCursor(int); - boolean setCustomCursor(int); - boolean setSystemCursor(int); - void requestPermission(java.lang.String, int); + android.content.Context getContext(); + boolean getManifestEnvironmentVariables(); + android.view.Surface getNativeSurface(); + void initTouch(); + boolean isAndroidTV(); + boolean isChromebook(); + boolean isDeXMode(); + boolean isScreenKeyboardShown(); + boolean isTablet(); + void manualBackButton(); + void minimizeWindow(); int openURL(java.lang.String); + void requestPermission(java.lang.String, int); int showToast(java.lang.String, int, int, int, int); - java.lang.String nativeGetHint(java.lang.String); + boolean sendMessage(int, int); + boolean setActivityTitle(java.lang.String); + boolean setCustomCursor(int); + void setOrientation(int, int, boolean, java.lang.String); + boolean setRelativeMouseEnabled(boolean); + boolean setSystemCursor(int); + void setWindowStyle(boolean); + boolean shouldMinimizeOnFocusLoss(); + boolean showTextInput(int, int, int, int, int); + boolean supportsRelativeMouse(); int openFileDescriptor(java.lang.String, java.lang.String); boolean showFileDialog(java.lang.String[], boolean, boolean, int); - void onNativeFileDialog(int, java.lang.String[], int); - void onNativeInsetsChanged(int, int, int, int); } -keep,includedescriptorclasses,allowoptimization class org.libsdl.app.HIDDeviceManager { + void closeDevice(int); boolean initialize(boolean, boolean); boolean openDevice(int); - int writeReport(int, byte[], boolean); boolean readReport(int, byte[], boolean); - void closeDevice(int); + int writeReport(int, byte[], boolean); } -keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLAudioManager { void registerAudioDeviceCallback(); void unregisterAudioDeviceCallback(); - int[] audioOpen(int, int, int, int, int); - void audioWriteFloatBuffer(float[]); - void audioWriteShortBuffer(short[]); - void audioWriteByteBuffer(byte[]); - int[] recordingOpen(int, int, int, int, int); - int recordingReadFloatBuffer(float[], boolean); - int recordingReadShortBuffer(short[], boolean); - int recordingReadByteBuffer(byte[], boolean); - void audioClose(); - void recordingClose(); void audioSetThreadPriority(boolean, int); - int nativeSetupJNI(); - void removeAudioDevice(boolean, int); - void addAudioDevice(boolean, java.lang.String, int); } -keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLControllerManager { void pollInputDevices(); void pollHapticDevices(); void hapticRun(int, float, int); + void hapticRumble(int, float, float, int); void hapticStop(int); - void hapticRumble(int, float , float, int); }