summaryrefslogtreecommitdiff
path: root/include/user/gxm/memory.h
blob: de0cb341f5a946feeff04ceb5d3aac76eaf32969 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef _DOLCESDK_PSP2_GXM_MEMORY_INTERNAL_H_
#define _DOLCESDK_PSP2_GXM_MEMORY_INTERNAL_H_

/** @file

  	Memory mapping API for the GPU.
*/

#include <psp2/gxm/memory.h>

#ifdef	__cplusplus
extern "C" {
#endif	// def __cplusplus

/** Checks if memory is mapped for GPU usage. If mapped, pointers within the region of
	memory described by <c><i>base</i></c> and <c><i>size</i></c> may be used with libgxm
	functions directly.

	@param[in]	base		The base address of the region to check.
	@param[in]	size		The size in bytes of the region to check.
	@param[in]	attribs		Bitwise combined attributes from #SceGxmMemoryAttribFlags.

	@retval
	SCE_OK	The memory region is mapped with <c><i>attribs</i></c>.
	@retval
	SCE_GXM_ERROR_UNINITIALIZED The operation failed because the library was not initialized.
	@retval
	SCE_GXM_ERROR_DRIVER The operation failed due to a driver error.
	@retval
	SCE_GXM_ERROR_INVALID_MAPPING The memory region is not mapped with <c><i>attribs</i></c>.

	@ingroup render
*/
SceGxmErrorCode sceGxmCheckMappedMemory(void *base, uint32_t size, uint32_t attribs);

/** 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_ */