gl-subsystem.c 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. #include "gl-subsystem.h"
  2. #include "gl-exports.h"
  3. device_t device_create(struct gs_init_data *info)
  4. {
  5. struct gs_device *device = bmalloc(sizeof(struct gs_device));
  6. memset(device, 0, sizeof(struct gs_device));
  7. device->plat = gl_platform_create(device, info);
  8. if (!device->plat) {
  9. blog(LOG_ERROR, "device_create (GL) failed");
  10. bfree(device);
  11. return NULL;
  12. }
  13. return device;
  14. }
  15. void device_destroy(device_t device)
  16. {
  17. if (device) {
  18. gl_platform_destroy(device->plat);
  19. bfree(device);
  20. }
  21. }
  22. swapchain_t device_create_swapchain(device_t device, struct gs_init_data *info)
  23. {
  24. struct gs_swap_chain *swap = bmalloc(sizeof(struct gs_swap_chain));
  25. memset(swap, 0, sizeof(struct gs_swap_chain));
  26. swap->device = device;
  27. swap->info = *info;
  28. swap->wi = gl_windowinfo_create(info);
  29. if (!swap->wi) {
  30. blog(LOG_ERROR, "device_create_swapchain (GL) failed");
  31. swapchain_destroy(swap);
  32. return NULL;
  33. }
  34. return swap;
  35. }
  36. void device_resize(device_t device, uint32_t cx, uint32_t cy)
  37. {
  38. /* GL automatically resizes the device, so it doesn't do much */
  39. device->cur_swap->info.cx = cx;
  40. device->cur_swap->info.cy = cy;
  41. }
  42. void device_getsize(device_t device, uint32_t *cx, uint32_t *cy)
  43. {
  44. *cx = device->cur_swap->info.cx;
  45. *cy = device->cur_swap->info.cy;
  46. }
  47. uint32_t device_getwidth(device_t device)
  48. {
  49. return device->cur_swap->info.cx;
  50. }
  51. uint32_t device_getheight(device_t device)
  52. {
  53. return device->cur_swap->info.cy;
  54. }
  55. texture_t device_create_cubetexture(device_t device, uint32_t size,
  56. enum gs_color_format color_format, uint32_t levels,
  57. void **data, uint32_t flags)
  58. {
  59. }
  60. texture_t device_create_volumetexture(device_t device, uint32_t width,
  61. uint32_t height, uint32_t depth,
  62. enum gs_color_format color_format, uint32_t levels, void **data,
  63. uint32_t flags)
  64. {
  65. }
  66. zstencil_t device_create_zstencil(device_t device, uint32_t width,
  67. uint32_t height, enum gs_zstencil_format format)
  68. {
  69. }
  70. stagesurf_t device_create_stagesurface(device_t device, uint32_t width,
  71. uint32_t height, enum gs_color_format color_format)
  72. {
  73. }
  74. samplerstate_t device_create_samplerstate(device_t device,
  75. struct gs_sampler_info *info)
  76. {
  77. }
  78. shader_t device_create_vertexshader(device_t device,
  79. const char *shader, const char *file,
  80. char **error_string)
  81. {
  82. }
  83. shader_t device_create_pixelshader(device_t device,
  84. const char *shader, const char *file,
  85. char **error_string)
  86. {
  87. }
  88. vertbuffer_t device_create_vertexbuffer(device_t device,
  89. struct vb_data *data, uint32_t flags)
  90. {
  91. }
  92. indexbuffer_t device_create_indexbuffer(device_t device,
  93. enum gs_index_type type, void *indices, size_t num,
  94. uint32_t flags)
  95. {
  96. }
  97. enum gs_texture_type device_gettexturetype(device_t device,
  98. texture_t texture)
  99. {
  100. }
  101. void device_load_vertexbuffer(device_t device, vertbuffer_t vertbuffer)
  102. {
  103. }
  104. void device_load_indexbuffer(device_t device, indexbuffer_t indexbuffer)
  105. {
  106. }
  107. void device_load_texture(device_t device, texture_t tex, int unit)
  108. {
  109. }
  110. void device_load_cubetexture(device_t device, texture_t cubetex,
  111. int unit)
  112. {
  113. }
  114. void device_load_volumetexture(device_t device, texture_t voltex,
  115. int unit)
  116. {
  117. }
  118. void device_load_samplerstate(device_t device,
  119. samplerstate_t samplerstate, int unit)
  120. {
  121. }
  122. void device_load_vertexshader(device_t device, shader_t vertshader)
  123. {
  124. }
  125. void device_load_pixelshader(device_t device, shader_t pixelshader)
  126. {
  127. }
  128. void device_load_defaultsamplerstate(device_t device, bool b_3d,
  129. int unit)
  130. {
  131. }
  132. shader_t device_getvertexshader(device_t device)
  133. {
  134. }
  135. shader_t device_getpixelshader(device_t device)
  136. {
  137. }
  138. texture_t device_getrendertarget(device_t device)
  139. {
  140. }
  141. zstencil_t device_getzstenciltarget(device_t device)
  142. {
  143. }
  144. void device_setrendertarget(device_t device, texture_t tex,
  145. zstencil_t zstencil)
  146. {
  147. }
  148. void device_setcuberendertarget(device_t device, texture_t cubetex,
  149. int side, zstencil_t zstencil)
  150. {
  151. }
  152. void device_copy_texture(device_t device, texture_t dst, texture_t src)
  153. {
  154. }
  155. void device_stage_texture(device_t device, stagesurf_t dst,
  156. texture_t src)
  157. {
  158. }
  159. void device_beginscene(device_t device)
  160. {
  161. }
  162. void device_draw(device_t device, enum gs_draw_mode draw_mode,
  163. uint32_t start_vert, uint32_t num_verts)
  164. {
  165. }
  166. void device_endscene(device_t device)
  167. {
  168. }
  169. void device_load_swapchain(device_t device, swapchain_t swapchain)
  170. {
  171. }
  172. void device_clear(device_t device, uint32_t clear_flags,
  173. struct vec4 *color, float depth, uint8_t stencil)
  174. {
  175. }
  176. void device_present(device_t device)
  177. {
  178. }
  179. void device_setcullmode(device_t device, enum gs_cull_mode mode)
  180. {
  181. }
  182. enum gs_cull_mode device_getcullmode(device_t device)
  183. {
  184. }
  185. void device_enable_blending(device_t device, bool enable)
  186. {
  187. }
  188. void device_enable_depthtest(device_t device, bool enable)
  189. {
  190. }
  191. void device_enable_stenciltest(device_t device, bool enable)
  192. {
  193. }
  194. void device_enable_stencilwrite(device_t device, bool enable)
  195. {
  196. }
  197. void device_enable_color(device_t device, bool red, bool blue,
  198. bool green, bool alpha)
  199. {
  200. }
  201. void device_blendfunction(device_t device, enum gs_blend_type src,
  202. enum gs_blend_type dest)
  203. {
  204. }
  205. void device_depthfunction(device_t device, enum gs_depth_test test)
  206. {
  207. }
  208. void device_stencilfunction(device_t device, enum gs_stencil_side side,
  209. enum gs_depth_test test)
  210. {
  211. }
  212. void device_stencilop(device_t device, enum gs_stencil_side side,
  213. enum gs_stencil_op fail, enum gs_stencil_op zfail,
  214. enum gs_stencil_op zpass)
  215. {
  216. }
  217. void device_enable_fullscreen(device_t device, bool enable)
  218. {
  219. }
  220. int device_fullscreen_enabled(device_t device)
  221. {
  222. }
  223. void device_setdisplaymode(device_t device,
  224. const struct gs_display_mode *mode)
  225. {
  226. }
  227. void device_getdisplaymode(device_t device,
  228. struct gs_display_mode *mode)
  229. {
  230. }
  231. void device_setcolorramp(device_t device, float gamma, float brightness,
  232. float contrast)
  233. {
  234. }
  235. void device_setviewport(device_t device, int x, int y, int width,
  236. int height)
  237. {
  238. }
  239. void device_getviewport(device_t device, struct gs_rect *rect)
  240. {
  241. }
  242. void device_setscissorrect(device_t device, struct gs_rect *rect)
  243. {
  244. }
  245. void device_ortho(device_t device, float left, float right,
  246. float top, float bottom, float znear, float zfar)
  247. {
  248. }
  249. void device_frustum(device_t device, float left, float right,
  250. float top, float bottom, float znear, float zfar)
  251. {
  252. }
  253. void device_perspective(device_t device, float fovy, float aspect,
  254. float znear, float zfar)
  255. {
  256. }
  257. void device_set_view_matrix(device_t device, struct matrix3 *mat)
  258. {
  259. }
  260. void device_projection_push(device_t device)
  261. {
  262. }
  263. void device_projection_pop(device_t device)
  264. {
  265. }
  266. void swapchain_destroy(swapchain_t swapchain)
  267. {
  268. }
  269. uint32_t texture_getwidth(texture_t tex)
  270. {
  271. }
  272. uint32_t texture_getheight(texture_t tex)
  273. {
  274. }
  275. enum gs_color_format texture_getcolorformat(texture_t tex)
  276. {
  277. }
  278. bool texture_map(texture_t tex, void **ptr, uint32_t *byte_width)
  279. {
  280. }
  281. void texture_unmap(texture_t tex)
  282. {
  283. }
  284. void cubetexture_destroy(texture_t cubetex)
  285. {
  286. }
  287. uint32_t cubetexture_getsize(texture_t cubetex)
  288. {
  289. }
  290. enum gs_color_format cubetexture_getcolorformat(texture_t cubetex)
  291. {
  292. }
  293. void volumetexture_destroy(texture_t voltex)
  294. {
  295. }
  296. uint32_t volumetexture_getwidth(texture_t voltex)
  297. {
  298. }
  299. uint32_t volumetexture_getheight(texture_t voltex)
  300. {
  301. }
  302. uint32_t volumetexture_getdepth(texture_t voltex)
  303. {
  304. }
  305. enum gs_color_format volumetexture_getcolorformat(texture_t voltex)
  306. {
  307. }
  308. void stagesurface_destroy(stagesurf_t stagesurf)
  309. {
  310. }
  311. uint32_t stagesurface_getwidth(stagesurf_t stagesurf)
  312. {
  313. }
  314. uint32_t stagesurface_getheight(stagesurf_t stagesurf)
  315. {
  316. }
  317. enum gs_color_format stagesurface_getcolorformat(stagesurf_t stagesurf)
  318. {
  319. }
  320. bool stagesurface_map(stagesurf_t stagesurf, const void **data,
  321. uint32_t *byte_width)
  322. {
  323. }
  324. void stagesurface_unmap(stagesurf_t stagesurf)
  325. {
  326. }
  327. void zstencil_destroy(zstencil_t zstencil)
  328. {
  329. }
  330. void samplerstate_destroy(samplerstate_t samplerstate)
  331. {
  332. }
  333. void vertexbuffer_destroy(vertbuffer_t vertbuffer)
  334. {
  335. }
  336. void vertexbuffer_flush(vertbuffer_t vertbuffer, bool rebuild)
  337. {
  338. }
  339. struct vb_data *vertexbuffer_getdata(vertbuffer_t vertbuffer)
  340. {
  341. }
  342. void indexbuffer_destroy(indexbuffer_t indexbuffer)
  343. {
  344. }
  345. void indexbuffer_flush(indexbuffer_t indexbuffer)
  346. {
  347. }
  348. void *indexbuffer_getdata(indexbuffer_t indexbuffer)
  349. {
  350. }
  351. size_t indexbuffer_numindices(indexbuffer_t indexbuffer)
  352. {
  353. }
  354. enum gs_index_type indexbuffer_gettype(indexbuffer_t indexbuffer)
  355. {
  356. }
  357. void shader_destroy(shader_t shader)
  358. {
  359. }
  360. int shader_numparams(shader_t shader)
  361. {
  362. }
  363. sparam_t shader_getparambyidx(shader_t shader, int param)
  364. {
  365. }
  366. sparam_t shader_getparambyname(shader_t shader, const char *name)
  367. {
  368. }
  369. void shader_getparaminfo(shader_t shader, sparam_t param,
  370. struct shader_param_info *info)
  371. {
  372. }
  373. sparam_t shader_getviewprojmatrix(shader_t shader)
  374. {
  375. }
  376. sparam_t shader_getworldmatrix(shader_t shader)
  377. {
  378. }
  379. void shader_setbool(shader_t shader, sparam_t param, bool val)
  380. {
  381. }
  382. void shader_setfloat(shader_t shader, sparam_t param, float val)
  383. {
  384. }
  385. void shader_setint(shader_t shader, sparam_t param, int val)
  386. {
  387. }
  388. void shader_setmatrix3(shader_t shader, sparam_t param,
  389. const struct matrix3 *val)
  390. {
  391. }
  392. void shader_setmatrix4(shader_t shader, sparam_t param,
  393. const struct matrix4 *val)
  394. {
  395. }
  396. void shader_setvec2(shader_t shader, sparam_t param,
  397. const struct vec2 *val)
  398. {
  399. }
  400. void shader_setvec3(shader_t shader, sparam_t param,
  401. const struct vec3 *val)
  402. {
  403. }
  404. void shader_setvec4(shader_t shader, sparam_t param,
  405. const struct vec4 *val)
  406. {
  407. }
  408. void shader_settexture(shader_t shader, sparam_t param, texture_t val)
  409. {
  410. }
  411. void shader_setval(shader_t shader, sparam_t param, const void *val,
  412. size_t size)
  413. {
  414. }
  415. void shader_setdefault(shader_t shader, sparam_t param)
  416. {
  417. }