reference-libobs-graphics-graphics.rst 43 KB

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