From efc507147e0beb1ac5b2f046bf8e4d902bca652c Mon Sep 17 00:00:00 2001 From: Reiko Asakura Date: Wed, 23 Sep 2020 13:03:51 -0400 Subject: Refactor SceGxmInternal headers --- include/user/gxm/memory.h | 109 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 include/user/gxm/memory.h (limited to 'include/user/gxm/memory.h') diff --git a/include/user/gxm/memory.h b/include/user/gxm/memory.h new file mode 100644 index 0000000..fb33636 --- /dev/null +++ b/include/user/gxm/memory.h @@ -0,0 +1,109 @@ +#ifndef _DOLCESDK_PSP2_GXM_MEMORY_INTERNAL_H_ +#define _DOLCESDK_PSP2_GXM_MEMORY_INTERNAL_H_ + +/** @file + + Memory mapping API for the GPU. +*/ + +#include + +#ifdef __cplusplus +extern "C" { +#endif // def __cplusplus + +/** Maps memory for vertex USSE code usage. If successful, this mapping + operation returns a USSE offset to address the memory as vertex USSE code. + + @param[in] base A 4K-aligned base address of the region to map. + @param[in] size A 4K-aligned size in bytes of the region to map. This + cannot be greater than 8MB. + @param[in] offset A pointer to a 32-bit value to hold the USSE offset. + + @retval + SCE_OK The operation was completed successfully. + @retval + SCE_GXM_ERROR_UNINITIALIZED The operation failed because the library was not initialized. + @retval + SCE_GXM_ERROR_INVALID_POINTER The operation failed because a pointer was invalid. + @retval + SCE_GXM_ERROR_INVALID_VALUE The operation failed because a parameter was invalid. + @retval + SCE_GXM_ERROR_DRIVER The operation failed due to a driver error. + + @ingroup render +*/ +SceGxmErrorCode sceGxmMapVertexUsseMemoryInternal(void *base, uint32_t size, uint32_t *offset); + +/** Unmaps memory that was previously mapped as vertex USSE code. It is the + responsibility of the caller to ensure that the GPU no longer needs this + memory for rendering. This could be accomplished by calling #sceGxmFinish() + before unmapping. + + @param[in] base The base address of the region to unmap. This must match + the base address that was used when mapping the memory + using #sceGxmMapVertexUsseMemory(). + + @retval + SCE_OK The operation was completed successfully. + @retval + SCE_GXM_ERROR_UNINITIALIZED The operation failed because the library was not initialized. + @retval + SCE_GXM_ERROR_INVALID_POINTER The operation failed because a pointer was invalid. + @retval + SCE_GXM_ERROR_DRIVER The operation failed due to a driver error. + + @ingroup render +*/ +SceGxmErrorCode sceGxmUnmapVertexUsseMemoryInternal(void *base); + +/** Maps memory for fragment USSE code usage. If successful, this mapping + operation returns a USSE offset to address the memory as fragment USSE code. + + @param[in] base A 4K-aligned base address of the region to map. + @param[in] size A 4K-aligned size in bytes of the region to map. This + cannot be greater than 8MB. + @param[in] offset A pointer to a 32-bit value to hold the USSE offset. + + @retval + SCE_OK The operation was completed successfully. + @retval + SCE_GXM_ERROR_UNINITIALIZED The operation failed because the library was not initialized. + @retval + SCE_GXM_ERROR_INVALID_POINTER The operation failed because a pointer was invalid. + @retval + SCE_GXM_ERROR_INVALID_VALUE The operation failed because a parameter was invalid. + @retval + SCE_GXM_ERROR_DRIVER The operation failed due to a driver error. + + @ingroup render +*/ +SceGxmErrorCode sceGxmMapFragmentUsseMemoryInternal(void *base, uint32_t size, uint32_t *offset); + +/** Unmaps memory that was previously mapped as fragment USSE code. It is the + responsibility of the caller to ensure that the GPU no longer needs this + memory for rendering. This could be accomplished by calling #sceGxmFinish() + before unmapping. + + @param[in] base The base address of the region to unmap. This must match + the base address that was used when mapping the memory + using #sceGxmMapFragmentUsseMemory(). + + @retval + SCE_OK The operation was completed successfully. + @retval + SCE_GXM_ERROR_UNINITIALIZED The operation failed because the library was not initialized. + @retval + SCE_GXM_ERROR_INVALID_POINTER The operation failed because a pointer was invalid. + @retval + SCE_GXM_ERROR_DRIVER The operation failed due to a driver error. + + @ingroup render +*/ +SceGxmErrorCode sceGxmUnmapFragmentUsseMemoryInternal(void *base); + +#ifdef __cplusplus +} +#endif // def __cplusplus + +#endif /* _DOLCESDK_PSP2_GXM_MEMORY_INTERNAL_H_ */ -- cgit v1.2.3