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/shader_patcher.h | 81 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 include/user/gxm/shader_patcher.h (limited to 'include/user/gxm/shader_patcher.h') diff --git a/include/user/gxm/shader_patcher.h b/include/user/gxm/shader_patcher.h new file mode 100644 index 0000000..7ae47dd --- /dev/null +++ b/include/user/gxm/shader_patcher.h @@ -0,0 +1,81 @@ +#ifndef _DOLCESDK_PSP2_GXM_SHADER_PATCHER_INTERNAL_H_ +#define _DOLCESDK_PSP2_GXM_SHADER_PATCHER_INTERNAL_H_ + +/** @file +*/ + +#include + +#ifdef __cplusplus +extern "C" { +#endif // def __cplusplus + +/** Finds or creates a final fragment program. + + The fragment program is constructed by appending the shader compiler output + with output register conversion and blending code. + + When this program is no longer needed, it should be released by calling + #sceGxmShaderPatcherReleaseFragmentProgram(). The caller is responsible for ensuring that + the GPU is no longer using this program before it is released. + + Blending/masking is only supported for the output register formats + #SCE_GXM_OUTPUT_REGISTER_FORMAT_UCHAR4 or #SCE_GXM_OUTPUT_REGISTER_FORMAT_HALF4. + If the blendInfo structure has an active blend or non-trivial mask when using + unsupported output register format, the error code #SCE_GXM_ERROR_UNSUPPORTED + will be returned. + + The parameter vertexProgram is only required to remap texture coordinates. If all + vertex programs that will be used with this fragment program write a contiguous range of + texture coordinates starting at TEXCOORD0 (or do not write texture coordinates), then the + vertexProgram parameter may be NULL. Any vertex program that uses texture coordinates + that either start at a non-zero binding (such as TEXCOORD1) or form a non-contiguous range + must be explicitly linked by passing the program as the vertexProgram parameter. + + The parameter texcoordMap can provide an explicit remapping of texture coordinates. + + @param[in,out] shaderPatcher A pointer to the shader patcher. + @param[in] programId The ID for a program registered with this shader patcher. + @param[in] outputFormat The format for the fragment program COLOR0 output. + @param[in] multisampleMode The multisample mode. + @param[in] blendInfo A pointer to the blend info structure or NULL. This + structure is copied by the function and therefore does not need to + persist after the call. + @param[in] vertexProgram A pointer to the vertex program or NULL. This + structure does not need to persist after the call. + @param[in] texcoordMap A pointer to explicit remapping of texture coordinates or NULL. + @param[out] fragmentProgram A pointer to storage for a fragment program pointer. + + @retval + SCE_OK The operation was successful. + @retval + SCE_GXM_ERROR_UNSUPPORTED Blending or masking is enabled for an unsupported + output register format. + @retval + SCE_GXM_ERROR_INVALID_POINTER The operation failed because one or more of the pointers supplied was NULL. + @retval + SCE_GXM_ERROR_INVALID_VALUE The operation failed due to an invalid input parameter. + @retval + SCE_GXM_ERROR_INVALID_ALIGNMENT The operation failed because some allocated memory did not have the required alignment. + @retval + SCE_GXM_ERROR_OUT_OF_HOST_MEMORY The operation failed because a host memory allocation failed. + @retval + SCE_GXM_ERROR_OUT_OF_FRAGMENT_USSE_MEMORY The operation failed because a fragment USSE memory allocation failed. + + @ingroup shaderpatcher +*/ +SceGxmErrorCode sceGxmShaderPatcherCreateFragmentProgramInternal( + SceGxmShaderPatcher *shaderPatcher, + SceGxmShaderPatcherId programId, + SceGxmOutputRegisterFormat outputFormat, + SceGxmMultisampleMode multisampleMode, + const SceGxmBlendInfo *blendInfo, + const SceGxmProgram *vertexProgram, + const uint32_t *texcoordMap, + SceGxmFragmentProgram **fragmentProgram); + +#ifdef __cplusplus +} +#endif // def __cplusplus + +#endif /* _DOLCESDK_PSP2_GXM_SHADER_PATCHER_INTERNAL_H_ */ -- cgit v1.2.3