reference-libobs-graphics-graphics.rst 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549
  1. Core Graphics API
  2. =================
  3. .. code:: cpp
  4. #include <graphics/graphics.h>
  5. Graphics Enumerations
  6. ---------------------
  7. .. type:: enum gs_draw_mode
  8. Draw mode. Can be one of the following values:
  9. - GS_POINTS - Draws points
  10. - GS_LINES - Draws individual lines
  11. - GS_LINESTRIP - Draws a line strip
  12. - GS_TRIS - Draws individual triangles
  13. - GS_TRISTRIP - Draws a triangle strip
  14. .. type:: enum gs_color_format
  15. Color format. Can be one of the following values:
  16. - GS_UNKNOWN - Unknown format
  17. - GS_A8 - 8 bit alpha channel only
  18. - GS_R8 - 8 bit red channel only
  19. - GS_RGBA - RGBA, 8 bits per channel
  20. - GS_BGRX - BGRX, 8 bits per channel
  21. - GS_BGRA - BGRA, 8 bits per channel
  22. - GS_R10G10B10A2 - RGBA, 10 bits per channel except alpha, which is 2
  23. bits
  24. - GS_RGBA16 - RGBA, 16 bits per channel
  25. - GS_R16 - 16 bit red channel only
  26. - GS_RGBA16F - RGBA, 16 bit floating point per channel
  27. - GS_RGBA32F - RGBA, 32 bit floating point per channel
  28. - GS_RG16F - 16 bit floating point red and green channels only
  29. - GS_RG32F - 32 bit floating point red and green channels only
  30. - GS_R16F - 16 bit floating point red channel only
  31. - GS_R32F - 32 bit floating point red channel only
  32. - GS_DXT1 - Compressed DXT1
  33. - GS_DXT3 - Compressed DXT3
  34. - GS_DXT5 - Compressed DXT5
  35. - GS_RGBA_UNORM - RGBA, 8 bits per channel, no SRGB aliasing
  36. - GS_BGRX_UNORM - BGRX, 8 bits per channel, no SRGB aliasing
  37. - GS_BGRA_UNORM - BGRA, 8 bits per channel, no SRGB aliasing
  38. - GS_RG16 - RG, 16 bits per channel
  39. .. type:: enum gs_zstencil_format
  40. Z-Stencil buffer format. Can be one of the following values:
  41. - GS_ZS_NONE - No Z-stencil buffer
  42. - GS_Z16 - 16 bit Z buffer
  43. - GS_Z24_S8 - 24 bit Z buffer, 8 bit stencil
  44. - GS_Z32F - 32 bit floating point Z buffer
  45. - GS_Z32F_S8X24 - 32 bit floating point Z buffer, 8 bit stencil
  46. .. type:: enum gs_index_type
  47. Index buffer type. Can be one of the following values:
  48. - GS_UNSIGNED_SHORT - 16 bit index
  49. - GS_UNSIGNED_LONG - 32 bit index
  50. .. type:: enum gs_cull_mode
  51. Cull mode. Can be one of the following values:
  52. - GS_BACK - Cull back faces
  53. - GS_FRONT - Cull front faces
  54. - GS_NEITHER - Cull neither
  55. .. type:: enum gs_blend_type
  56. Blend type. Can be one of the following values:
  57. - GS_BLEND_ZERO
  58. - GS_BLEND_ONE
  59. - GS_BLEND_SRCCOLOR
  60. - GS_BLEND_INVSRCCOLOR
  61. - GS_BLEND_SRCALPHA
  62. - GS_BLEND_INVSRCALPHA
  63. - GS_BLEND_DSTCOLOR
  64. - GS_BLEND_INVDSTCOLOR
  65. - GS_BLEND_DSTALPHA
  66. - GS_BLEND_INVDSTALPHA
  67. - GS_BLEND_SRCALPHASAT
  68. .. type:: enum gs_depth_test
  69. Depth test type. Can be one of the following values:
  70. - GS_NEVER
  71. - GS_LESS
  72. - GS_LEQUAL
  73. - GS_EQUAL
  74. - GS_GEQUAL
  75. - GS_GREATER
  76. - GS_NOTEQUAL
  77. - GS_ALWAYS
  78. .. type:: enum gs_stencil_side
  79. Stencil side. Can be one of the following values:
  80. - GS_STENCIL_FRONT=1
  81. - GS_STENCIL_BACK
  82. - GS_STENCIL_BOTH
  83. .. type:: enum gs_stencil_op_type
  84. Stencil operation type. Can be one of the following values:
  85. - GS_KEEP
  86. - GS_ZERO
  87. - GS_REPLACE
  88. - GS_INCR
  89. - GS_DECR
  90. - GS_INVERT
  91. .. type:: enum gs_cube_sides
  92. Cubemap side. Can be one of the following values:
  93. - GS_POSITIVE_X
  94. - GS_NEGATIVE_X
  95. - GS_POSITIVE_Y
  96. - GS_NEGATIVE_Y
  97. - GS_POSITIVE_Z
  98. - GS_NEGATIVE_Z
  99. .. type:: enum gs_sample_filter
  100. Sample filter type. Can be one of the following values:
  101. - GS_FILTER_POINT
  102. - GS_FILTER_LINEAR
  103. - GS_FILTER_ANISOTROPIC
  104. - GS_FILTER_MIN_MAG_POINT_MIP_LINEAR
  105. - GS_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT
  106. - GS_FILTER_MIN_POINT_MAG_MIP_LINEAR
  107. - GS_FILTER_MIN_LINEAR_MAG_MIP_POINT
  108. - GS_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR
  109. - GS_FILTER_MIN_MAG_LINEAR_MIP_POINT
  110. .. type:: enum gs_address_mode
  111. Address mode. Can be one of the following values:
  112. - GS_ADDRESS_CLAMP
  113. - GS_ADDRESS_WRAP
  114. - GS_ADDRESS_MIRROR
  115. - GS_ADDRESS_BORDER
  116. - GS_ADDRESS_MIRRORONCE
  117. .. type:: enum gs_texture_type
  118. Texture type. Can be one of the following values:
  119. - GS_TEXTURE_2D
  120. - GS_TEXTURE_3D
  121. - GS_TEXTURE_CUBE
  122. Graphics Structures
  123. -------------------
  124. .. type:: struct gs_monitor_info
  125. .. member:: int gs_monitor_info.rotation_degrees
  126. .. member:: long gs_monitor_info.x
  127. .. member:: long gs_monitor_info.y
  128. .. member:: long gs_monitor_info.cx
  129. .. member:: long gs_monitor_info.cy
  130. ---------------------
  131. .. type:: struct gs_tvertarray
  132. .. member:: size_t gs_tvertarray.width
  133. .. member:: void *gs_tvertarray.array
  134. ---------------------
  135. .. type:: struct gs_vb_data
  136. .. member:: size_t gs_vb_data.num
  137. .. member:: struct vec3 *gs_vb_data.points
  138. .. member:: struct vec3 *gs_vb_data.normals
  139. .. member:: struct vec3 *gs_vb_data.tangents
  140. .. member:: uint32_t *gs_vb_data.colors
  141. .. member:: size_t gs_vb_data.num_tex
  142. .. member:: struct gs_tvertarray *gs_vb_data.tvarray
  143. ---------------------
  144. .. type:: struct gs_sampler_info
  145. .. member:: enum gs_sample_filter gs_sampler_info.filter
  146. .. member:: enum gs_address_mode gs_sampler_info.address_u
  147. .. member:: enum gs_address_mode gs_sampler_info.address_v
  148. .. member:: enum gs_address_mode gs_sampler_info.address_w
  149. .. member:: int gs_sampler_info.max_anisotropy
  150. .. member:: uint32_t gs_sampler_info.border_color
  151. ---------------------
  152. .. type:: struct gs_display_mode
  153. .. member:: uint32_t gs_display_mode.width
  154. .. member:: uint32_t gs_display_mode.height
  155. .. member:: uint32_t gs_display_mode.bits
  156. .. member:: uint32_t gs_display_mode.freq
  157. ---------------------
  158. .. type:: struct gs_rect
  159. .. member:: int gs_rect.x
  160. .. member:: int gs_rect.y
  161. .. member:: int gs_rect.cx
  162. .. member:: int gs_rect.cy
  163. ---------------------
  164. .. type:: struct gs_window
  165. A window structure. This structure is used with a native widget.
  166. .. member:: void *gs_window.hwnd
  167. (Windows only) an HWND widget.
  168. .. member:: id gs_window.view
  169. (Mac only) A view ID.
  170. .. member:: uint32_t gs_window.id
  171. void* gs_window.display
  172. (Linux only) Window ID and display
  173. ---------------------
  174. .. type:: struct gs_init_data
  175. Swap chain initialization data.
  176. .. member:: struct gs_window gs_init_data.window
  177. .. member:: uint32_t gs_init_data.cx
  178. .. member:: uint32_t gs_init_data.cy
  179. .. member:: uint32_t gs_init_data.num_backbuffers
  180. .. member:: enum gs_color_format gs_init_data.format
  181. .. member:: enum gs_zstencil_format gs_init_data.zsformat
  182. .. member:: uint32_t gs_init_data.adapter
  183. ---------------------
  184. Initialization Functions
  185. ------------------------
  186. .. function:: void gs_enum_adapters(bool (*callback)(void *param, const char *name, uint32_t id), void *param)
  187. Enumerates adapters (this really only applies on windows).
  188. :param callback: Enumeration callback
  189. :param param: Private data passed to the callback
  190. ---------------------
  191. .. function:: int gs_create(graphics_t **graphics, const char *module, uint32_t adapter)
  192. Creates a graphics context
  193. :param graphics: Pointer to receive the graphics context
  194. :param module: Module name
  195. :param adapter: Adapter index
  196. :return: Can return one of the following values:
  197. - GS_SUCCESS
  198. - GS_ERROR_FAIL
  199. - GS_ERROR_MODULE_NOT_FOUND
  200. - GS_ERROR_NOT_SUPPORTED
  201. ---------------------
  202. .. function:: void gs_destroy(graphics_t *graphics)
  203. Destroys a graphics context
  204. :param graphics: Graphics context
  205. ---------------------
  206. .. function:: void gs_enter_context(graphics_t *graphics)
  207. Enters and locks the graphics context
  208. :param graphics: Graphics context
  209. ---------------------
  210. .. function:: void gs_leave_context(void)
  211. Leaves and unlocks the graphics context
  212. :param graphics: Graphics context
  213. ---------------------
  214. .. function:: graphics_t *gs_get_context(void)
  215. :return: The currently locked graphics context for this thread
  216. ---------------------
  217. Matrix Stack Functions
  218. ----------------------
  219. .. function:: void gs_matrix_push(void)
  220. Pushes the matrix stack and duplicates the current matrix.
  221. ---------------------
  222. .. function:: void gs_matrix_pop(void)
  223. Pops the current matrix from the matrix stack.
  224. ---------------------
  225. .. function:: void gs_matrix_identity(void)
  226. Sets the current matrix to an identity matrix.
  227. ---------------------
  228. .. function:: void gs_matrix_transpose(void)
  229. Transposes the current matrix.
  230. ---------------------
  231. .. function:: void gs_matrix_set(const struct matrix4 *matrix)
  232. Sets the current matrix.
  233. :param matrix: The matrix to set
  234. ---------------------
  235. .. function:: void gs_matrix_get(struct matrix4 *dst)
  236. Gets the current matrix
  237. :param dst: Destination matrix
  238. ---------------------
  239. .. function:: void gs_matrix_mul(const struct matrix4 *matrix)
  240. Multiplies the current matrix
  241. :param matrix: Matrix to multiply the current stack matrix with
  242. ---------------------
  243. .. function:: void gs_matrix_rotquat(const struct quat *rot)
  244. Multiplies the current matrix with a quaternion
  245. :param rot: Quaternion to multiple the current matrix stack with
  246. ---------------------
  247. .. function:: void gs_matrix_rotaa(const struct axisang *rot)
  248. void gs_matrix_rotaa4f(float x, float y, float z, float angle)
  249. Multiplies the current matrix with an axis angle
  250. :param rot: Axis angle to multiple the current matrix stack with
  251. ---------------------
  252. .. function:: void gs_matrix_translate(const struct vec3 *pos)
  253. void gs_matrix_translate3f(float x, float y, float z)
  254. Translates the current matrix
  255. :param pos: Vector to translate the current matrix stack with
  256. ---------------------
  257. .. function:: void gs_matrix_scale(const struct vec3 *scale)
  258. void gs_matrix_scale3f(float x, float y, float z)
  259. Scales the current matrix
  260. :param scale: Scale value to scale the current matrix stack with
  261. ---------------------
  262. Draw Functions
  263. --------------
  264. .. function:: gs_effect_t *gs_get_effect(void)
  265. :return: The currently active effect, or *NULL* if none active
  266. ---------------------
  267. .. function:: void gs_draw_sprite(gs_texture_t *tex, uint32_t flip, uint32_t width, uint32_t height)
  268. Draws a 2D sprite. Sets the "image" parameter of the current effect
  269. to the texture and renders a quad.
  270. If width or height is 0, the width or height of the texture will be
  271. used. The flip value specifies whether the texture should be flipped
  272. on the U or V axis with GS_FLIP_U and GS_FLIP_V.
  273. :param tex: Texture to draw
  274. :param flip: Can be 0 or a bitwise-OR combination of one of the
  275. following values:
  276. - GS_FLIP_U - Flips the texture horizontally
  277. - GS_FLIP_V - Flips the texture vertically
  278. :param width: Width
  279. :param height: Height
  280. ---------------------
  281. .. function:: void gs_draw_sprite_subregion(gs_texture_t *tex, uint32_t flip, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy)
  282. Draws a subregion of a 2D sprite. Sets the "image" parameter of the
  283. current effect to the texture and renders a quad.
  284. :param tex: Texture to draw
  285. :param flip: Can be 0 or a bitwise-OR combination of one of the
  286. following values:
  287. - GS_FLIP_U - Flips the texture horizontally
  288. - GS_FLIP_V - Flips the texture vertically
  289. :param x: X value within subregion
  290. :param y: Y value within subregion
  291. :param cx: CX value of subregion
  292. :param cy: CY value of subregion
  293. ---------------------
  294. .. function:: void gs_reset_viewport(void)
  295. Sets the viewport to current swap chain size
  296. ---------------------
  297. .. function:: void gs_set_2d_mode(void)
  298. Sets the projection matrix to a default screen-sized orthographic
  299. mode
  300. ---------------------
  301. .. function:: void gs_set_3d_mode(double fovy, double znear, double zfar)
  302. Sets the projection matrix to a default screen-sized perspective
  303. mode
  304. :param fovy: Field of view (in degrees)
  305. :param znear: Near plane
  306. :param zfar: Far plane
  307. ---------------------
  308. .. function:: void gs_viewport_push(void)
  309. Pushes/stores the current viewport
  310. ---------------------
  311. .. function:: void gs_viewport_pop(void)
  312. Pops/recalls the last pushed viewport
  313. ---------------------
  314. .. function:: void gs_perspective(float fovy, float aspect, float znear, float zfar)
  315. Sets the projection matrix to a perspective mode
  316. :param fovy: Field of view (in degrees)
  317. :param aspect: Aspect ratio
  318. :param znear: Near plane
  319. :param zfar: Far plane
  320. ---------------------
  321. .. function:: void gs_blend_state_push(void)
  322. Pushes/stores the current blend state
  323. ---------------------
  324. .. function:: void gs_blend_state_pop(void)
  325. Pops/restores the last blend state
  326. ---------------------
  327. .. function:: void gs_reset_blend_state(void)
  328. Sets the blend state to the default value: source alpha and invert
  329. source alpha.
  330. ---------------------
  331. Swap Chains
  332. -----------
  333. .. function:: gs_swapchain_t *gs_swapchain_create(const struct gs_init_data *data)
  334. Creates a swap chain (display view on a native widget)
  335. :param data: Swap chain initialization data
  336. :return: New swap chain object, or *NULL* if failed
  337. ---------------------
  338. .. function:: void gs_swapchain_destroy(gs_swapchain_t *swapchain)
  339. Destroys a swap chain
  340. ---------------------
  341. .. function:: void gs_resize(uint32_t cx, uint32_t cy)
  342. Resizes the currently active swap chain
  343. :param cx: New width
  344. :param cy: New height
  345. ---------------------
  346. .. function:: void gs_get_size(uint32_t *cx, uint32_t *cy)
  347. Gets the size of the currently active swap chain
  348. :param cx: Pointer to receive width
  349. :param cy: Pointer to receive height
  350. ---------------------
  351. .. function:: uint32_t gs_get_width(void)
  352. Gets the width of the currently active swap chain
  353. ---------------------
  354. .. function:: uint32_t gs_get_height(void)
  355. Gets the height of the currently active swap chain
  356. ---------------------
  357. Resource Loading
  358. ----------------
  359. .. function:: void gs_load_vertexbuffer(gs_vertbuffer_t *vertbuffer)
  360. Loads a vertex buffer
  361. :param vertbuffer: Vertex buffer to load, or NULL to unload
  362. ---------------------
  363. .. function:: void gs_load_indexbuffer(gs_indexbuffer_t *indexbuffer)
  364. Loads a index buffer
  365. :param indexbuffer: Index buffer to load, or NULL to unload
  366. ---------------------
  367. .. function:: void gs_load_texture(gs_texture_t *tex, int unit)
  368. Loads a texture (this is usually not called manually)
  369. :param tex: Texture to load, or NULL to unload
  370. :param unit: Texture unit to load texture for
  371. ---------------------
  372. .. function:: void gs_load_samplerstate(gs_samplerstate_t *samplerstate, int unit)
  373. Loads a sampler state (this is usually not called manually)
  374. :param samplerstate: Sampler state to load, or NULL to unload
  375. :param unit: Texture unit to load sampler state for
  376. ---------------------
  377. .. function:: void gs_load_swapchain(gs_swapchain_t *swapchain)
  378. Loads a swapchain
  379. :param swapchain: Swap chain to load, or NULL to unload
  380. ---------------------
  381. Draw Functions
  382. --------------
  383. .. function:: gs_texture_t *gs_get_render_target(void)
  384. :return: The currently active render target
  385. ---------------------
  386. .. function:: gs_zstencil_t *gs_get_zstencil_target(void)
  387. :return: The currently active Z-stencil target
  388. ---------------------
  389. .. function:: void gs_set_render_target(gs_texture_t *tex, gs_zstencil_t *zstencil)
  390. Sets the active render target
  391. :param tex: Texture to set as the active render target
  392. :param zstencil: Z-stencil to use as the active render target
  393. ---------------------
  394. .. function:: void gs_set_cube_render_target(gs_texture_t *cubetex, int side, gs_zstencil_t *zstencil)
  395. Sets a cubemap side as the active render target
  396. :param cubetex: Cubemap
  397. :param side: Cubemap side
  398. :param zstencil: Z-stencil buffer, or *NULL* if none
  399. ---------------------
  400. .. function:: void gs_copy_texture(gs_texture_t *dst, gs_texture_t *src)
  401. Copies a texture
  402. :param dst: Destination texture
  403. :param src: Source texture
  404. ---------------------
  405. .. function:: void gs_stage_texture(gs_stagesurf_t *dst, gs_texture_t *src)
  406. Copies a texture to a staging surface and copies it to RAM. Ideally
  407. best to give this a frame to process to prevent stalling.
  408. :param dst: Staging surface
  409. :param src: Texture to stage
  410. ---------------------
  411. .. function:: void gs_begin_scene(void)
  412. void gs_end_scene(void)
  413. Begins/ends a scene (this is automatically called by libobs, there's
  414. no need to call this manually).
  415. ---------------------
  416. .. function:: void gs_draw(enum gs_draw_mode draw_mode, uint32_t start_vert, uint32_t num_verts)
  417. Draws a primitive or set of primitives.
  418. :param draw_mode: The primitive draw mode to use
  419. :param start_vert: Starting vertex index
  420. :param num_verts: Number of vertices
  421. ---------------------
  422. .. function:: void gs_clear(uint32_t clear_flags, const struct vec4 *color, float depth, uint8_t stencil)
  423. Clears color/depth/stencil buffers.
  424. :param clear_flags: Flags to clear with. Can be one of the following
  425. values:
  426. - GS_CLEAR_COLOR - Clears color buffer
  427. - GS_CLEAR_DEPTH - Clears depth buffer
  428. - GS_CLEAR_STENCIL - Clears stencil buffer
  429. :param color: Color value to clear the color buffer with
  430. :param depth: Depth value to clear the depth buffer with
  431. :param stencil: Stencil value to clear the stencil buffer with
  432. ---------------------
  433. .. function:: void gs_present(void)
  434. Displays what was rendered on to the current render target
  435. ---------------------
  436. .. function:: void gs_flush(void)
  437. Flushes GPU calls
  438. ---------------------
  439. .. function:: void gs_set_cull_mode(enum gs_cull_mode mode)
  440. Sets the current cull mode.
  441. :param mode: Cull mode
  442. ---------------------
  443. .. function:: enum gs_cull_mode gs_get_cull_mode(void)
  444. :return: The current cull mode
  445. ---------------------
  446. .. function:: void gs_enable_blending(bool enable)
  447. Enables/disables blending
  448. :param enable: *true* to enable, *false* to disable
  449. ---------------------
  450. .. function:: void gs_enable_depth_test(bool enable)
  451. Enables/disables depth testing
  452. :param enable: *true* to enable, *false* to disable
  453. ---------------------
  454. .. function:: void gs_enable_stencil_test(bool enable)
  455. Enables/disables stencil testing
  456. :param enable: *true* to enable, *false* to disable
  457. ---------------------
  458. .. function:: void gs_enable_stencil_write(bool enable)
  459. Enables/disables stencil writing
  460. :param enable: *true* to enable, *false* to disable
  461. ---------------------
  462. .. function:: void gs_enable_color(bool red, bool green, bool blue, bool alpha)
  463. Enables/disables specific color channels
  464. :param red: *true* to enable red channel, *false* to disable
  465. :param green: *true* to enable green channel, *false* to disable
  466. :param blue: *true* to enable blue channel, *false* to disable
  467. :param alpha: *true* to enable alpha channel, *false* to disable
  468. ---------------------
  469. .. function:: void gs_blend_function(enum gs_blend_type src, enum gs_blend_type dest)
  470. Sets the blend function's source and destination factors
  471. :param src: Blend type for the blending equation's source factors
  472. :param dest: Blend type for the blending equation's destination factors
  473. ---------------------
  474. .. function:: void gs_blend_function_separate(enum gs_blend_type src_c, enum gs_blend_type dest_c, enum gs_blend_type src_a, enum gs_blend_type dest_a)
  475. Sets the blend function's source and destination factors for RGB and alpha separately
  476. :param src_c: Blend type for the blending equation's source RGB factor
  477. :param dest_c: Blend type for the blending equation's destination RGB factor
  478. :param src_a: Blend type for the blending equation's source alpha factor
  479. :param dest_a: Blend type for the blending equation's destination alpha factor
  480. ---------------------
  481. .. function:: void gs_blend_op(enum gs_blend_op_type op)
  482. Sets the blend function's operation type
  483. :param op: Operation type for the blending equation
  484. ---------------------
  485. .. function:: void gs_depth_function(enum gs_depth_test test)
  486. Sets the depth function
  487. :param test: Sets the depth test type
  488. ---------------------
  489. .. function:: void gs_stencil_function(enum gs_stencil_side side, enum gs_depth_test test)
  490. Sets the stencil function
  491. :param side: Stencil side
  492. :param test: Depth test
  493. ---------------------
  494. .. function:: void gs_stencil_op(enum gs_stencil_side side, enum gs_stencil_op_type fail, enum gs_stencil_op_type zfail, enum gs_stencil_op_type zpass)
  495. Sets the stencil operation
  496. :param side: Stencil side
  497. :param fail: Operation to perform on stencil test failure
  498. :param zfail: Operation to perform on depth test failure
  499. :param zpass: Operation to perform on depth test success
  500. ---------------------
  501. .. function:: void gs_set_viewport(int x, int y, int width, int height)
  502. Sets the current viewport
  503. :param x: X position relative to upper left
  504. :param y: Y position relative to upper left
  505. :param width: Width of the viewport
  506. :param height: Height of the viewport
  507. ---------------------
  508. .. function:: void gs_get_viewport(struct gs_rect *rect)
  509. Gets the current viewport
  510. :param rect: Pointer to receive viewport rectangle
  511. ---------------------
  512. .. function:: void gs_set_scissor_rect(const struct gs_rect *rect)
  513. Sets or clears the current scissor rectangle
  514. :rect: Scissor rectangle, or *NULL* to clear
  515. ---------------------
  516. .. function:: void gs_ortho(float left, float right, float top, float bottom, float znear, float zfar)
  517. Sets the projection matrix to an orthographic matrix
  518. ---------------------
  519. .. function:: void gs_frustum(float left, float right, float top, float bottom, float znear, float zfar)
  520. Sets the projection matrix to a frustum matrix
  521. ---------------------
  522. .. function:: void gs_projection_push(void)
  523. Pushes/stores the current projection matrix
  524. ---------------------
  525. .. function:: void gs_projection_pop(void)
  526. Pops/restores the last projection matrix pushed
  527. ---------------------
  528. Texture Functions
  529. -----------------
  530. .. function:: gs_texture_t *gs_texture_create(uint32_t width, uint32_t height, enum gs_color_format color_format, uint32_t levels, const uint8_t **data, uint32_t flags)
  531. Creates a texture.
  532. :param width: Width
  533. :param height: Height
  534. :param color_format: Color format
  535. :param levels: Number of total texture levels. Set to 1 if no
  536. mip-mapping
  537. :param data: Pointer to array of texture data pointers
  538. :param flags: Can be 0 or a bitwise-OR combination of one or
  539. more of the following value:
  540. - GS_BUILD_MIPMAPS - Automatically builds
  541. mipmaps (Note: not fully tested)
  542. - GS_DYNAMIC - Dynamic
  543. - GS_RENDER_TARGET - Render target
  544. :return: A new texture object
  545. ---------------------
  546. .. function:: gs_texture_t *gs_texture_create_from_file(const char *file)
  547. Creates a texture from a file. Note that this isn't recommended for
  548. animated gifs -- instead use the :ref:`image_file_helper`.
  549. :param file: Image file to open
  550. ---------------------
  551. .. function:: void gs_texture_destroy(gs_texture_t *tex)
  552. Destroys a texture
  553. :param tex: Texture object
  554. ---------------------
  555. .. function:: uint32_t gs_texture_get_width(const gs_texture_t *tex)
  556. Gets the texture's width
  557. :param tex: Texture object
  558. :return: The texture's width
  559. ---------------------
  560. .. function:: uint32_t gs_texture_get_height(const gs_texture_t *tex)
  561. Gets the texture's height
  562. :param tex: Texture object
  563. :return: The texture's height
  564. ---------------------
  565. .. function:: enum gs_color_format gs_texture_get_color_format(const gs_texture_t *tex)
  566. Gets the texture's color format
  567. :param tex: Texture object
  568. :return: The texture's color format
  569. ---------------------
  570. .. function:: bool gs_texture_map(gs_texture_t *tex, uint8_t **ptr, uint32_t *linesize)
  571. Maps a texture.
  572. :param tex: Texture object
  573. :param ptr: Pointer to receive the pointer to the texture data
  574. to write to
  575. :param linesize: Pointer to receive the line size (pitch) of the
  576. texture
  577. ---------------------
  578. .. function:: void gs_texture_unmap(gs_texture_t *tex)
  579. Unmaps a texture.
  580. :param tex: Texture object
  581. ---------------------
  582. .. function:: void gs_texture_set_image(gs_texture_t *tex, const uint8_t *data, uint32_t linesize, bool invert)
  583. Sets the image of a dynamic texture
  584. :param tex: Texture object
  585. :param data: Data to set as the image
  586. :param linesize: Line size (pitch) of the data
  587. :param invert: *true* to invert vertically, *false* otherwise
  588. ---------------------
  589. .. function:: gs_texture_t *gs_texture_create_from_dmabuf(unsigned int width, unsigned int height, uint32_t drm_format, enum gs_color_format color_format, uint32_t n_planes, const int *fds, const uint32_t *strides, const uint32_t *offsets, const uint64_t *modifiers)
  590. **Linux only:** Creates a texture from DMA-BUF metadata.
  591. Exchanging DMA-BUFs is a verbose process because of its multiplanar nature.
  592. For example, YUV can have each plane as a color channel, or a monitor buffer
  593. can have the cursor stored in a separate plane.
  594. This function treats the OBS Studio format and the DRM format separately.
  595. This allows creating textures from DMA-BUFs with unsupported formats (e.g.
  596. YUV) and perform the color format conversion using shaders. However, be
  597. careful to always try and match the formats correctly, otherwise textures
  598. can fail to be created or rendered.
  599. All modifiers passed in the modifiers array must be equal. Passing different
  600. modifiers for each plane is unsupported.
  601. :param width: Width of the texture
  602. :param height: Height of the texture
  603. :param drm_format: DRM format of the DMA-BUF buffer
  604. :param color_format: Color format compatible with OBS Studio
  605. :param n_planes: Number of planes of the DMA-BUF
  606. :param fds: Array of size *n_planes* with the file descriptor of each plane
  607. :param strides: Array of size *n_planes* with the stride of each plane
  608. :param offsets: Array of size *n_planes* with the offset of each plane
  609. :param modifiers: Array of size *n_planes* with the modifier of each plane
  610. :return: A texture object on success, or *NULL* on failure
  611. :rtype: gs_texture_t*
  612. ---------------------
  613. .. type:: enum gs_dmabuf_flags
  614. DMA-BUF capabilities:
  615. - GS_DMABUF_FLAG_NONE
  616. - GS_DMABUF_FLAG_SUPPORTS_IMPLICIT_MODIFIERS - Renderer supports implicit modifiers
  617. ---------------------
  618. .. function:: bool *gs_query_dmabuf_capabilities(enum gs_dmabuf_flags *dmabuf_flags, uint32_t **drm_formats, size_t *n_formats)
  619. **Linux only:** Queries the capabilities for DMA-BUFs.
  620. Graphics cards can optimize frame buffers by storing them in custom layouts,
  621. depending on their hardware features. These layouts can make these frame
  622. buffers unsuitable for linear processing. This function allows querying whether
  623. the graphics card in use supports implicit modifiers, and the supported texture
  624. formats.
  625. The caller must free the `drm_formats` array with `bfree()` after use.
  626. :param dmabuf_flags: Pointer to receive a capability bitmap
  627. :param drm_formats: Pointer to receive an array of DRM formats
  628. :param n_formats: Pointer to receive the number of formats
  629. :rtype: bool
  630. ---------------------
  631. .. function:: bool *gs_query_dmabuf_modifiers_for_format(uint32_t drm_format, uint64_t **modifiers, size_t *n_modifiers)
  632. **Linux only:** Queries the supported DMA-BUF modifiers for a given format.
  633. This function queries all supported explicit modifiers for a format,
  634. stores them as an array and returns the number of supported modifiers.
  635. The caller must free the `modifiers` array with `bfree()` after use.
  636. :param drm_format: DRM format of the DMA-BUF buffer
  637. :param modifiers: Pointer to receive an array of modifiers
  638. :param n_modifiers: Pointer to receive the number of modifiers
  639. :rtype: bool
  640. ---------------------
  641. .. function:: gs_texture_t *gs_texture_create_from_iosurface(void *iosurf)
  642. **Mac only:** Creates a texture from an IOSurface.
  643. :param iosurf: IOSurface object
  644. ---------------------
  645. .. function:: bool gs_texture_rebind_iosurface(gs_texture_t *texture, void *iosurf)
  646. **Mac only:** Rebinds a texture to another IOSurface
  647. :param texture: Texture object
  648. :param iosuf: IOSurface object
  649. ---------------------
  650. .. function:: gs_texture_t *gs_texture_create_gdi(uint32_t width, uint32_t height)
  651. **Windows only:** Creates a GDI-interop texture
  652. :param width: Width
  653. :param height: Height
  654. ---------------------
  655. .. function:: void *gs_texture_get_dc(gs_texture_t *gdi_tex)
  656. **Windows only:** Gets the HDC of a GDI-interop texture. Call
  657. :c:func:`gs_texture_release_dc()` to release the HDC.
  658. :param gdi_tex: GDI-interop texture object
  659. :return: HDC object
  660. ---------------------
  661. .. function:: void gs_texture_release_dc(gs_texture_t *gdi_tex)
  662. **Windows only:** Releases the HDC of the GDI-interop texture.
  663. :param gdi_tex: GDI-interop texture object
  664. ---------------------
  665. .. function:: gs_texture_t *gs_texture_open_shared(uint32_t handle)
  666. **Windows only:** Creates a texture from a shared texture handle.
  667. :param handle: Shared texture handle
  668. :return: A texture object
  669. ---------------------
  670. .. function:: bool gs_gdi_texture_available(void)
  671. **Windows only:** Returns whether GDI-interop textures are available.
  672. :return: *true* if available, *false* otherwise
  673. ---------------------
  674. .. function:: bool gs_shared_texture_available(void)
  675. **Windows only:** Returns whether shared textures are available.
  676. :return: *true* if available, *false* otherwise
  677. ---------------------
  678. Cube Texture Functions
  679. ----------------------
  680. .. function:: gs_texture_t *gs_cubetexture_create(uint32_t size, enum gs_color_format color_format, uint32_t levels, const uint8_t **data, uint32_t flags)
  681. Creates a cubemap texture.
  682. :param size: Width/height/depth value
  683. :param color_format: Color format
  684. :param levels: Number of texture levels
  685. :param data: Pointer to array of texture data pointers
  686. :param flags: Can be 0 or a bitwise-OR combination of one or
  687. more of the following value:
  688. - GS_BUILD_MIPMAPS - Automatically builds
  689. mipmaps (Note: not fully tested)
  690. - GS_DYNAMIC - Dynamic
  691. - GS_RENDER_TARGET - Render target
  692. :return: A new cube texture object
  693. ---------------------
  694. .. function:: void gs_cubetexture_destroy(gs_texture_t *cubetex)
  695. Destroys a cube texture.
  696. :param cubetex: Cube texture object
  697. ---------------------
  698. .. function:: uint32_t gs_cubetexture_get_size(const gs_texture_t *cubetex)
  699. Get the width/height/depth value of a cube texture.
  700. :param cubetex: Cube texture object
  701. :return: The width/height/depth value of the cube texture
  702. ---------------------
  703. .. function:: enum gs_color_format gs_cubetexture_get_color_format(const gs_texture_t *cubetex)
  704. Gets the color format of a cube texture.
  705. :param cubetex: Cube texture object
  706. :return: The color format of the cube texture
  707. ---------------------
  708. .. function:: void gs_cubetexture_set_image(gs_texture_t *cubetex, uint32_t side, const void *data, uint32_t linesize, bool invert)
  709. Sets an image of a cube texture side.
  710. :param cubetex: Cube texture object
  711. :param side: Side
  712. :param data: Texture data to set
  713. :param linesize: Line size (pitch) of the texture data
  714. :param invert: *true* to invert texture data, *false* otherwise
  715. ---------------------
  716. Staging Surface Functions
  717. -------------------------
  718. Staging surfaces are used to efficiently copy textures from VRAM to RAM.
  719. .. function:: gs_stagesurf_t *gs_stagesurface_create(uint32_t width, uint32_t height, enum gs_color_format color_format)
  720. Creates a staging surface.
  721. :param width: Width
  722. :param height: Height
  723. :param color_format: Color format
  724. :return: The staging surface object
  725. ---------------------
  726. .. function:: void gs_stagesurface_destroy(gs_stagesurf_t *stagesurf)
  727. Destroys a staging surface.
  728. :param stagesurf: Staging surface object
  729. ---------------------
  730. .. function:: uint32_t gs_stagesurface_get_width(const gs_stagesurf_t *stagesurf)
  731. uint32_t gs_stagesurface_get_height(const gs_stagesurf_t *stagesurf)
  732. Gets the width/height of a staging surface object.
  733. :param stagesurf: Staging surface object
  734. :return: Width/height of the staging surface
  735. ---------------------
  736. .. function:: enum gs_color_format gs_stagesurface_get_color_format(const gs_stagesurf_t *stagesurf)
  737. Gets the color format of a staging surface object.
  738. :param stagesurf: Staging surface object
  739. :return: Color format of the staging surface
  740. ---------------------
  741. .. function:: bool gs_stagesurface_map(gs_stagesurf_t *stagesurf, uint8_t **data, uint32_t *linesize)
  742. Maps the staging surface texture (for reading). Call
  743. :c:func:`gs_stagesurface_unmap()` to unmap when complete.
  744. :param stagesurf: Staging surface object
  745. :param data: Pointer to receive texture data pointer
  746. :param linesize: Pointer to receive line size (pitch) of the texture
  747. data
  748. :return: *true* if map successful, *false* otherwise
  749. ---------------------
  750. .. function:: void gs_stagesurface_unmap(gs_stagesurf_t *stagesurf)
  751. Unmaps a staging surface.
  752. :param stagesurf: Staging surface object
  753. ---------------------
  754. Z-Stencil Functions
  755. -------------------
  756. .. function:: gs_zstencil_t *gs_zstencil_create(uint32_t width, uint32_t height, enum gs_zstencil_format format)
  757. Creates a Z-stencil surface object.
  758. :param width: Width
  759. :param height: Height
  760. :param format: Format
  761. :return: New Z-stencil surface object, or *NULL* if failed
  762. ---------------------
  763. .. function:: void gs_zstencil_destroy(gs_zstencil_t *zstencil)
  764. Destroys a Z-stencil buffer.
  765. :param zstencil: Z-stencil surface object
  766. ---------------------
  767. Sampler State Functions
  768. -----------------------
  769. .. function:: gs_samplerstate_t *gs_samplerstate_create(const struct gs_sampler_info *info)
  770. Creates a sampler state object.
  771. :param info: Sampler state information
  772. :return: New sampler state object
  773. ---------------------
  774. .. function:: void gs_samplerstate_destroy(gs_samplerstate_t *samplerstate)
  775. Destroys a sampler state object.
  776. :param samplerstate: Sampler state object
  777. ---------------------
  778. Vertex Buffer Functions
  779. -----------------------
  780. .. function:: gs_vertbuffer_t *gs_vertexbuffer_create(struct gs_vb_data *data, uint32_t flags)
  781. Creates a vertex buffer.
  782. :param data: Vertex buffer data to create vertex buffer with. The
  783. structure should be created with gs_vbdata_create(),
  784. and then buffers in this structure should be allocated
  785. with :c:func:`bmalloc()`, :c:func:`bzalloc()`, or
  786. :c:func:`brealloc()`. The ownership of the gs_vb_data
  787. pointer is then passed to the function, and they should
  788. not be destroyed by the caller once passed
  789. :param flags: Creation flags. Can be 0 or a bitwise-OR combination
  790. of any of the following values:
  791. - GS_DYNAMIC - Can be dynamically updated in real time.
  792. - GS_DUP_BUFFER - Do not pass buffer ownership of the
  793. structure or the buffer pointers within the
  794. structure.
  795. :return: A new vertex buffer object, or *NULL* if failed
  796. ---------------------
  797. .. function:: void gs_vertexbuffer_destroy(gs_vertbuffer_t *vertbuffer)
  798. Destroys a vertex buffer object.
  799. :param vertbuffer: Vertex buffer object
  800. ---------------------
  801. .. function:: void gs_vertexbuffer_flush(gs_vertbuffer_t *vertbuffer)
  802. Flushes a vertex buffer to its interval vertex data object. To
  803. modify its internal vertex data, call
  804. :c:func:`gs_vertexbuffer_get_data()`.
  805. Can only be used with dynamic vertex buffer objects.
  806. :param vertbuffer: Vertex buffer object
  807. ---------------------
  808. .. function:: void gs_vertexbuffer_flush_direct(gs_vertbuffer_t *vertbuffer, const struct gs_vb_data *data)
  809. Directly flushes a vertex buffer to the specified vertex buffer data.
  810. .
  811. Can only be used with dynamic vertex buffer objects.
  812. :param vertbuffer: Vertex buffer object
  813. :param data: Vertex buffer data to flush. Components that
  814. don't need to be flushed can be left *NULL*
  815. ---------------------
  816. .. function:: struct gs_vb_data *gs_vertexbuffer_get_data(const gs_vertbuffer_t *vertbuffer)
  817. Gets the vertex buffer data associated with a vertex buffer object.
  818. This data can be changed and vertex buffer can be updated with
  819. :c:func:`gs_vertexbuffer_flush()`.
  820. Can only be used with dynamic vertex buffer objects.
  821. :param vertbuffer: Vertex buffer object
  822. :return: Vertex buffer data structure
  823. ---------------------
  824. Index Buffer Functions
  825. ----------------------
  826. .. function:: gs_indexbuffer_t *gs_indexbuffer_create(enum gs_index_type type, void *indices, size_t num, uint32_t flags)
  827. Creates an index buffer.
  828. :param type: Index buffer type
  829. :param indices: Index buffer data. This buffer must be allocated
  830. with :c:func:`bmalloc()`, :c:func:`bzalloc()`, or
  831. :c:func:`bralloc()`, and ownership of this buffer is
  832. passed to the index buffer object.
  833. :param num: Number of indices in the buffer
  834. :param flags: Creation flags. Can be 0 or a bitwise-OR combination
  835. of any of the following values:
  836. - GS_DYNAMIC - Can be dynamically updated in real time.
  837. - GS_DUP_BUFFER - Do not pass buffer ownership
  838. :return: A new index buffer object, or *NULL* if failed
  839. ---------------------
  840. .. function:: void gs_indexbuffer_destroy(gs_indexbuffer_t *indexbuffer)
  841. Destroys an index buffer object.
  842. :param indexbuffer: Index buffer object
  843. ---------------------
  844. .. function:: void gs_indexbuffer_flush(gs_indexbuffer_t *indexbuffer)
  845. Flushes a index buffer to its interval index data object. To modify
  846. its internal index data, call :c:func:`gs_indexbuffer_get_data()`.
  847. Can only be used with dynamic index buffer objects.
  848. :param indexbuffer: Index buffer object
  849. ---------------------
  850. .. function:: void gs_indexbuffer_flush_direct(gs_indexbuffer_t *indexbuffer, const void *data)
  851. Flushes a index buffer to the specified index buffer data.
  852. Can only be used with dynamic index buffer objects.
  853. :param indexbuffer: Index buffer object
  854. :param data: Index buffer data to flush
  855. ---------------------
  856. .. function:: void *gs_indexbuffer_get_data(const gs_indexbuffer_t *indexbuffer)
  857. Gets the index buffer data associated with a index buffer object.
  858. This data can be changed and index buffer can be updated with
  859. :c:func:`gs_indexbuffer_flush()`.
  860. Can only be used with dynamic index buffer objects.
  861. :param vertbuffer: Index buffer object
  862. :return: Index buffer data pointer
  863. ---------------------
  864. .. function:: size_t gs_indexbuffer_get_num_indices(const gs_indexbuffer_t *indexbuffer)
  865. Gets the number of indices associated with this index buffer.
  866. :param indexbuffer: Index buffer object
  867. :return: Number of indices the vertex buffer object has
  868. ---------------------
  869. .. function:: enum gs_index_type gs_indexbuffer_get_type(const gs_indexbuffer_t *indexbuffer)
  870. Gets the type of index buffer.
  871. :param indexbuffer: Index buffer object
  872. :return: Index buffer type
  873. ---------------------
  874. Display Duplicator (Windows Only)
  875. ---------------------------------
  876. .. function:: gs_duplicator_t *gs_duplicator_create(int monitor_idx)
  877. ---------------------
  878. .. function:: void gs_duplicator_destroy(gs_duplicator_t *duplicator)
  879. ---------------------
  880. .. function:: bool gs_duplicator_update_frame(gs_duplicator_t *duplicator)
  881. ---------------------
  882. .. function:: gs_texture_t *gs_duplicator_get_texture(gs_duplicator_t *duplicator)
  883. ---------------------
  884. .. function:: bool gs_get_duplicator_monitor_info(int monitor_idx, struct gs_monitor_info *monitor_info)
  885. ---------------------
  886. Render Helper Functions
  887. -----------------------
  888. .. function:: void gs_render_start(bool b_new)
  889. ---------------------
  890. .. function:: void gs_render_stop(enum gs_draw_mode mode)
  891. ---------------------
  892. .. function:: gs_vertbuffer_t *gs_render_save(void)
  893. ---------------------
  894. .. function:: void gs_vertex2f(float x, float y)
  895. ---------------------
  896. .. function:: void gs_vertex3f(float x, float y, float z)
  897. ---------------------
  898. .. function:: void gs_normal3f(float x, float y, float z)
  899. ---------------------
  900. .. function:: void gs_color(uint32_t color)
  901. ---------------------
  902. .. function:: void gs_texcoord(float x, float y, int unit)
  903. ---------------------
  904. .. function:: void gs_vertex2v(const struct vec2 *v)
  905. ---------------------
  906. .. function:: void gs_vertex3v(const struct vec3 *v)
  907. ---------------------
  908. .. function:: void gs_normal3v(const struct vec3 *v)
  909. ---------------------
  910. .. function:: void gs_color4v(const struct vec4 *v)
  911. ---------------------
  912. .. function:: void gs_texcoord2v(const struct vec2 *v, int unit)
  913. ---------------------
  914. Graphics Types
  915. --------------
  916. .. type:: typedef struct gs_duplicator gs_duplicator_t
  917. .. type:: typedef struct gs_texture gs_texture_t
  918. .. type:: typedef struct gs_stage_surface gs_stagesurf_t
  919. .. type:: typedef struct gs_zstencil_buffer gs_zstencil_t
  920. .. type:: typedef struct gs_vertex_buffer gs_vertbuffer_t
  921. .. type:: typedef struct gs_index_buffer gs_indexbuffer_t
  922. .. type:: typedef struct gs_sampler_state gs_samplerstate_t
  923. .. type:: typedef struct gs_swap_chain gs_swapchain_t
  924. .. type:: typedef struct gs_texture_render gs_texrender_t
  925. .. type:: typedef struct gs_shader gs_shader_t
  926. .. type:: typedef struct gs_shader_param gs_sparam_t
  927. .. type:: typedef struct gs_device gs_device_t
  928. .. type:: typedef struct graphics_subsystem graphics_t