mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
80-char width limit nits
This commit is contained in:
parent
ea2094126b
commit
55abe2e38f
@ -404,7 +404,8 @@ struct decomp_state
|
|||||||
bool found;
|
bool found;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool content_zip_file_decompressed_handle(file_archive_file_handle_t *handle,
|
static bool content_zip_file_decompressed_handle(
|
||||||
|
file_archive_file_handle_t *handle,
|
||||||
const uint8_t *cdata, uint32_t csize,
|
const uint8_t *cdata, uint32_t csize,
|
||||||
uint32_t size, uint32_t crc32)
|
uint32_t size, uint32_t crc32)
|
||||||
{
|
{
|
||||||
|
10
libretro.h
10
libretro.h
@ -1396,13 +1396,17 @@ struct retro_camera_callback
|
|||||||
*/
|
*/
|
||||||
uint64_t caps;
|
uint64_t caps;
|
||||||
|
|
||||||
unsigned width; /* Desired resolution for camera. Is only used as a hint. */
|
/* Desired resolution for camera. Is only used as a hint. */
|
||||||
|
unsigned width;
|
||||||
unsigned height;
|
unsigned height;
|
||||||
retro_camera_start_t start; /* Set by frontend. */
|
|
||||||
retro_camera_stop_t stop; /* Set by frontend. */
|
/* Set by frontend. */
|
||||||
|
retro_camera_start_t start;
|
||||||
|
retro_camera_stop_t stop;
|
||||||
|
|
||||||
/* Set by libretro core if raw framebuffer callbacks will be used. */
|
/* Set by libretro core if raw framebuffer callbacks will be used. */
|
||||||
retro_camera_frame_raw_framebuffer_t frame_raw_framebuffer;
|
retro_camera_frame_raw_framebuffer_t frame_raw_framebuffer;
|
||||||
|
|
||||||
/* Set by libretro core if OpenGL texture callbacks will be used. */
|
/* Set by libretro core if OpenGL texture callbacks will be used. */
|
||||||
retro_camera_frame_opengl_texture_t frame_opengl_texture;
|
retro_camera_frame_opengl_texture_t frame_opengl_texture;
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ typedef void (*retro_vulkan_unlock_queue_t)(void *handle);
|
|||||||
/* Note on thread safety:
|
/* Note on thread safety:
|
||||||
* The Vulkan API is heavily designed around multi-threading, and
|
* The Vulkan API is heavily designed around multi-threading, and
|
||||||
* the libretro interface for it should also be threading friendly.
|
* the libretro interface for it should also be threading friendly.
|
||||||
* A core should be able to build command buffers and submit command buffers to the GPU from
|
* A core should be able to build command buffers and submit
|
||||||
* any thread.
|
* command buffers to the GPU from any thread.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct retro_hw_render_interface_vulkan
|
struct retro_hw_render_interface_vulkan
|
||||||
@ -66,7 +66,8 @@ struct retro_hw_render_interface_vulkan
|
|||||||
* which must be passed along to all function pointers
|
* which must be passed along to all function pointers
|
||||||
* in this interface.
|
* in this interface.
|
||||||
*
|
*
|
||||||
* The rationale for including a handle here (which libretro v1 doesn't current do in general) is:
|
* The rationale for including a handle here (which libretro v1
|
||||||
|
* doesn't currently do in general) is:
|
||||||
*
|
*
|
||||||
* - Vulkan cores should be able to be freely threaded without lots of fuzz.
|
* - Vulkan cores should be able to be freely threaded without lots of fuzz.
|
||||||
* This would break frontends which currently rely on TLS
|
* This would break frontends which currently rely on TLS
|
||||||
@ -95,10 +96,14 @@ struct retro_hw_render_interface_vulkan
|
|||||||
/* Before calling retro_video_refresh_t with RETRO_HW_FRAME_BUFFER_VALID,
|
/* Before calling retro_video_refresh_t with RETRO_HW_FRAME_BUFFER_VALID,
|
||||||
* set which image to use for this frame.
|
* set which image to use for this frame.
|
||||||
*
|
*
|
||||||
* If num_semaphores is non-zero, the frontend will wait for the semaphores provided to be signaled
|
* If num_semaphores is non-zero, the frontend will wait for the
|
||||||
* before using the results further in the pipeline.
|
* semaphores provided to be signaled before using the results further
|
||||||
* Using semaphores is optional for synchronization purposes, but if not using
|
* in the pipeline.
|
||||||
* semaphores, an image memory barrier in vkCmdPipelineBarrier should be used in the graphics_queue.
|
*
|
||||||
|
* Using semaphores is optional for synchronization purposes,
|
||||||
|
* but if not using
|
||||||
|
* semaphores, an image memory barrier in vkCmdPipelineBarrier
|
||||||
|
* should be used in the graphics_queue.
|
||||||
* Example:
|
* Example:
|
||||||
*
|
*
|
||||||
* vkCmdPipelineBarrier(cmd,
|
* vkCmdPipelineBarrier(cmd,
|
||||||
@ -109,85 +114,126 @@ struct retro_hw_render_interface_vulkan
|
|||||||
* dstAccessMask = VK_ACCESS_SHADER_READ_BIT,
|
* dstAccessMask = VK_ACCESS_SHADER_READ_BIT,
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* The use of pipeline barriers instead of semaphores is encouraged as it is simpler
|
* The use of pipeline barriers instead of semaphores is encouraged
|
||||||
* and more fine-grained. A layout transition must generally happen anyways which requires a
|
* as it is simpler and more fine-grained. A layout transition
|
||||||
|
* must generally happen anyways which requires a
|
||||||
* pipeline barrier.
|
* pipeline barrier.
|
||||||
*
|
*
|
||||||
* The image passed to set_image must have imageUsage flags set to at least
|
* The image passed to set_image must have imageUsage flags set to at least
|
||||||
* VK_IMAGE_USAGE_TRANSFER_SRC_BIT and VK_IMAGE_USAGE_SAMPLED_BIT.
|
* VK_IMAGE_USAGE_TRANSFER_SRC_BIT and VK_IMAGE_USAGE_SAMPLED_BIT.
|
||||||
* The core will naturally want to use flags such as
|
* The core will naturally want to use flags such as
|
||||||
* VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT and/or VK_IMAGE_USAGE_TRANSFER_DST_BIT depending
|
* VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT and/or
|
||||||
|
* VK_IMAGE_USAGE_TRANSFER_DST_BIT depending
|
||||||
* on how the final image is created.
|
* on how the final image is created.
|
||||||
*
|
*
|
||||||
* The image must also have been created with MUTABLE_FORMAT bit set if 8-bit formatt are used, so that the frontend can
|
* The image must also have been created with MUTABLE_FORMAT bit set if
|
||||||
* reinterpret sRGB formats as it sees fit.
|
* 8-bit formats are used, so that the frontend can reinterpret sRGB
|
||||||
|
* formats as it sees fit.
|
||||||
*
|
*
|
||||||
* Images passed to set_image should be created with TILING_OPTIMAL.
|
* Images passed to set_image should be created with TILING_OPTIMAL.
|
||||||
* The image layout should be transitioned to either VK_IMAGE_LAYOUT_GENERIC or VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL.
|
* The image layout should be transitioned to either
|
||||||
|
* VK_IMAGE_LAYOUT_GENERIC or VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL.
|
||||||
* The actual image layout used must be set in image_layout.
|
* The actual image layout used must be set in image_layout.
|
||||||
*
|
*
|
||||||
* The image must be a 2D texture which may or not be layered and/or mipmapped.
|
* The image must be a 2D texture which may or not be layered
|
||||||
|
* and/or mipmapped.
|
||||||
|
*
|
||||||
* The image must be suitable for linear sampling.
|
* The image must be suitable for linear sampling.
|
||||||
* While the image_view is typically the only field used,
|
* While the image_view is typically the only field used,
|
||||||
* the frontend may want to reinterpret the texture as sRGB vs. no-sRGB for example
|
* the frontend may want to reinterpret the texture as sRGB vs.
|
||||||
* so the VkImageViewCreateInfo used to create the image view must also be passed in.
|
* non-sRGB for example so the VkImageViewCreateInfo used to
|
||||||
|
* create the image view must also be passed in.
|
||||||
|
*
|
||||||
* The data in the pointer to the image struct will not be copied
|
* The data in the pointer to the image struct will not be copied
|
||||||
* as the pNext field in create_info cannot be reliably deep-copied.
|
* as the pNext field in create_info cannot be reliably deep-copied.
|
||||||
* The image pointer passed to set_image must be valid until retro_video_refresh_t has returned.
|
* The image pointer passed to set_image must be valid until
|
||||||
|
* retro_video_refresh_t has returned.
|
||||||
*
|
*
|
||||||
* If frame duping is used when passing NULL to retro_video_refresh_t,
|
* If frame duping is used when passing NULL to retro_video_refresh_t,
|
||||||
* the frontend is free to either use the latest image passed to set_image or reuse the older pointer
|
* the frontend is free to either use the latest image passed to
|
||||||
* passed to set_image the frame RETRO_HW_FRAME_BUFFER_VALID was last used.
|
* set_image or reuse the older pointer passed to set_image the
|
||||||
* Essentially, the lifetime of the pointer passed to retro_video_refresh_t should be extended
|
* frame RETRO_HW_FRAME_BUFFER_VALID was last used.
|
||||||
* if frame duping is used so that the frontend can reuse the older pointer.
|
*
|
||||||
|
* Essentially, the lifetime of the pointer passed to
|
||||||
|
* retro_video_refresh_t should be extended if frame duping is used
|
||||||
|
* so that the frontend can reuse the older pointer.
|
||||||
*
|
*
|
||||||
* If frame duping is used, the frontend will not wait for any semaphores.
|
* If frame duping is used, the frontend will not wait for any semaphores.
|
||||||
*/
|
*/
|
||||||
retro_vulkan_set_image_t set_image;
|
retro_vulkan_set_image_t set_image;
|
||||||
|
|
||||||
/* Get the current sync index for this frame which is obtained in frontend by calling
|
/* Get the current sync index for this frame which is obtained in
|
||||||
* e.g. vkAcquireNextImageKHR before calling retro_run().
|
* frontend by calling e.g. vkAcquireNextImageKHR before calling
|
||||||
* This index will correspond to which swapchain buffer is currently the active one.
|
* retro_run().
|
||||||
* Knowing this index is very useful for maintaining safe async CPU and GPU operation without stalling.
|
|
||||||
*
|
*
|
||||||
* The common pattern for synchronization is to receive fences when submitting command buffers
|
* This index will correspond to which swapchain buffer is currently
|
||||||
* to Vulkan (vkQueueSubmit) and add this fence to a list of fences for frame number get_sync_index().
|
* the active one.
|
||||||
* Next time we receive the same get_sync_index(), we can wait for the fences from before,
|
*
|
||||||
* which will usually return immediately as the frontend will generally also avoid letting the GPU run ahead too much.
|
* Knowing this index is very useful for maintaining safe asynchronous CPU
|
||||||
* After the fence has signaled, we know that the GPU has completed all GPU work related to work submitted in the frame
|
* and GPU operation without stalling.
|
||||||
* we last saw get_sync_index(). This means we can safely reuse or free resources allocated in this frame.
|
*
|
||||||
|
* The common pattern for synchronization is to receive fences when
|
||||||
|
* submitting command buffers to Vulkan (vkQueueSubmit) and add this fence
|
||||||
|
* to a list of fences for frame number get_sync_index().
|
||||||
|
*
|
||||||
|
* Next time we receive the same get_sync_index(), we can wait for the
|
||||||
|
* fences from before, which will usually return immediately as the
|
||||||
|
* frontend will generally also avoid letting the GPU run ahead too much.
|
||||||
|
*
|
||||||
|
* After the fence has signaled, we know that the GPU has completed all
|
||||||
|
* GPU work related to work submitted in the frame we last saw get_sync_index().
|
||||||
|
*
|
||||||
|
* This means we can safely reuse or free resources allocated in this frame.
|
||||||
|
*
|
||||||
|
* In theory, even if we wait for the fences correctly, it is not technically
|
||||||
|
* safe to write to the image we earlier passed to the frontend since we're
|
||||||
|
* not waiting for the frontend GPU jobs to complete.
|
||||||
*
|
*
|
||||||
* In theory, even if we wait for the fences correctly, it is not technically safe to write to the image
|
|
||||||
* we earlier passed to the frontend since we're not waiting for the frontend GPU jobs to complete.
|
|
||||||
* The frontend will guarantee that the appropriate pipeline barrier
|
* The frontend will guarantee that the appropriate pipeline barrier
|
||||||
* in graphics_queue has been used such that VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT cannot
|
* in graphics_queue has been used such that
|
||||||
|
* VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT cannot
|
||||||
* start until the frontend is done with the image.
|
* start until the frontend is done with the image.
|
||||||
*/
|
*/
|
||||||
retro_vulkan_get_sync_index_t get_sync_index;
|
retro_vulkan_get_sync_index_t get_sync_index;
|
||||||
|
|
||||||
/* Returns a bitmask of how many swapchain images we currently have in the frontend.
|
/* Returns a bitmask of how many swapchain images we currently have
|
||||||
* If bit #N is set in the return value, get_sync_index can return N.
|
* in the frontend.
|
||||||
* Knowing this value is useful for preallocating per-frame management structures ahead of time.
|
|
||||||
*
|
*
|
||||||
* While this value will typically remain constant throughout the applications lifecycle,
|
* If bit #N is set in the return value, get_sync_index can return N.
|
||||||
* it may for example change if the frontend suddently changes fullscreen state and/or latency.
|
* Knowing this value is useful for preallocating per-frame management
|
||||||
* If this value ever changes, it is safe to assume that the device is completely idle and all synchronization
|
* structures ahead of time.
|
||||||
* objects can be deleted right away as desired.
|
*
|
||||||
|
* While this value will typically remain constant throughout the
|
||||||
|
* applications lifecycle, it may for example change if the frontend
|
||||||
|
* suddently changes fullscreen state and/or latency.
|
||||||
|
*
|
||||||
|
* If this value ever changes, it is safe to assume that the device
|
||||||
|
* is completely idle and all synchronization objects can be deleted
|
||||||
|
* right away as desired.
|
||||||
*/
|
*/
|
||||||
retro_vulkan_get_sync_index_mask_t get_sync_index_mask;
|
retro_vulkan_get_sync_index_mask_t get_sync_index_mask;
|
||||||
|
|
||||||
/* Instead of submitting the command buffer to the queue first, the core can pass along
|
/* Instead of submitting the command buffer to the queue first, the core
|
||||||
* its command buffer to the frontend, and the frontend will submit the command buffer together
|
* can pass along its command buffer to the frontend, and the frontend
|
||||||
* with the frontends command buffers. This has the advantage that the overhead of vkQueueSubmit
|
* will submit the command buffer together with the frontends command buffers.
|
||||||
* can be amortized into a single call. For this mode, semaphores in set_image will be ignored, so
|
*
|
||||||
* vkCmdPipelineBarrier must be used to synchronize the core and frontend.
|
* This has the advantage that the overhead of vkQueueSubmit can be
|
||||||
* The command buffers in set_command_buffers are only executed once, even if frame duping is used.
|
* amortized into a single call. For this mode, semaphores in set_image
|
||||||
* If frame duping is used, set_image should be used for the frames which should be duped instead.
|
* will be ignored, so vkCmdPipelineBarrier must be used to synchronize
|
||||||
|
* the core and frontend.
|
||||||
|
*
|
||||||
|
* The command buffers in set_command_buffers are only executed once,
|
||||||
|
* even if frame duping is used.
|
||||||
|
*
|
||||||
|
* If frame duping is used, set_image should be used for the frames
|
||||||
|
* which should be duped instead.
|
||||||
*
|
*
|
||||||
* Command buffers passed to the frontend with set_command_buffers
|
* Command buffers passed to the frontend with set_command_buffers
|
||||||
* must not actually be submitted to the GPU until retro_video_refresh_t is called.
|
* must not actually be submitted to the GPU until retro_video_refresh_t
|
||||||
* The frontend must submit the command buffer before submitting any other command buffers
|
* is called.
|
||||||
* provided by set_command_buffers. */
|
*
|
||||||
|
* The frontend must submit the command buffer before submitting any
|
||||||
|
* other command buffers provided by set_command_buffers. */
|
||||||
retro_vulkan_set_command_buffers_t set_command_buffers;
|
retro_vulkan_set_command_buffers_t set_command_buffers;
|
||||||
|
|
||||||
/* Waits on CPU for device activity for the current sync index to complete.
|
/* Waits on CPU for device activity for the current sync index to complete.
|
||||||
@ -195,11 +241,13 @@ struct retro_hw_render_interface_vulkan
|
|||||||
* when the frontend is submitting the command buffers. */
|
* when the frontend is submitting the command buffers. */
|
||||||
retro_vulkan_wait_sync_index_t wait_sync_index;
|
retro_vulkan_wait_sync_index_t wait_sync_index;
|
||||||
|
|
||||||
/* If the core submits command buffers itself to any of the queues provided in this interface,
|
/* If the core submits command buffers itself to any of the queues provided
|
||||||
* the core must lock and unlock the frontend from racing on the VkQueue.
|
* in this interface, the core must lock and unlock the frontend from
|
||||||
|
* racing on the VkQueue.
|
||||||
|
*
|
||||||
* Queue submission can happen on any thread.
|
* Queue submission can happen on any thread.
|
||||||
* Even if queue submission happens on the same thread as retro_run(), the lock/unlock
|
* Even if queue submission happens on the same thread as retro_run(),
|
||||||
* functions must still be called.
|
* the lock/unlock functions must still be called.
|
||||||
*
|
*
|
||||||
* NOTE: Queue submissions are heavy-weight. */
|
* NOTE: Queue submissions are heavy-weight. */
|
||||||
retro_vulkan_lock_queue_t lock_queue;
|
retro_vulkan_lock_queue_t lock_queue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user