graphics-imports.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /******************************************************************************
  2. Copyright (C) 2013 by Hugh Bailey <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #include "../util/base.h"
  15. #include "../util/dstr.h"
  16. #include "../util/platform.h"
  17. #include "graphics-internal.h"
  18. #define GRAPHICS_IMPORT(func) \
  19. do { \
  20. exports->func = os_dlsym(module, #func); \
  21. if (!exports->func) { \
  22. success = false; \
  23. blog(LOG_ERROR, "Could not load function '%s' from " \
  24. "module '%s'", #func, module_name); \
  25. } \
  26. } while (false)
  27. bool load_graphics_imports(struct gs_exports *exports, void *module,
  28. const char *module_name)
  29. {
  30. bool success = true;
  31. GRAPHICS_IMPORT(device_create);
  32. GRAPHICS_IMPORT(device_destroy);
  33. GRAPHICS_IMPORT(device_entercontext);
  34. GRAPHICS_IMPORT(device_leavecontext);
  35. GRAPHICS_IMPORT(device_create_swapchain);
  36. GRAPHICS_IMPORT(device_resize);
  37. GRAPHICS_IMPORT(device_getsize);
  38. GRAPHICS_IMPORT(device_getwidth);
  39. GRAPHICS_IMPORT(device_getheight);
  40. GRAPHICS_IMPORT(device_create_texture);
  41. GRAPHICS_IMPORT(device_create_cubetexture);
  42. GRAPHICS_IMPORT(device_create_volumetexture);
  43. GRAPHICS_IMPORT(device_create_zstencil);
  44. GRAPHICS_IMPORT(device_create_stagesurface);
  45. GRAPHICS_IMPORT(device_create_samplerstate);
  46. GRAPHICS_IMPORT(device_create_vertexshader);
  47. GRAPHICS_IMPORT(device_create_pixelshader);
  48. GRAPHICS_IMPORT(device_create_vertexbuffer);
  49. GRAPHICS_IMPORT(device_create_indexbuffer);
  50. GRAPHICS_IMPORT(device_gettexturetype);
  51. GRAPHICS_IMPORT(device_load_vertexbuffer);
  52. GRAPHICS_IMPORT(device_load_indexbuffer);
  53. GRAPHICS_IMPORT(device_load_texture);
  54. GRAPHICS_IMPORT(device_load_samplerstate);
  55. GRAPHICS_IMPORT(device_load_vertexshader);
  56. GRAPHICS_IMPORT(device_load_pixelshader);
  57. GRAPHICS_IMPORT(device_load_defaultsamplerstate);
  58. GRAPHICS_IMPORT(device_getvertexshader);
  59. GRAPHICS_IMPORT(device_getpixelshader);
  60. GRAPHICS_IMPORT(device_getrendertarget);
  61. GRAPHICS_IMPORT(device_getzstenciltarget);
  62. GRAPHICS_IMPORT(device_setrendertarget);
  63. GRAPHICS_IMPORT(device_setcuberendertarget);
  64. GRAPHICS_IMPORT(device_copy_texture);
  65. GRAPHICS_IMPORT(device_stage_texture);
  66. GRAPHICS_IMPORT(device_beginscene);
  67. GRAPHICS_IMPORT(device_draw);
  68. GRAPHICS_IMPORT(device_load_swapchain);
  69. GRAPHICS_IMPORT(device_endscene);
  70. GRAPHICS_IMPORT(device_clear);
  71. GRAPHICS_IMPORT(device_present);
  72. GRAPHICS_IMPORT(device_setcullmode);
  73. GRAPHICS_IMPORT(device_getcullmode);
  74. GRAPHICS_IMPORT(device_enable_blending);
  75. GRAPHICS_IMPORT(device_enable_depthtest);
  76. GRAPHICS_IMPORT(device_enable_stenciltest);
  77. GRAPHICS_IMPORT(device_enable_stencilwrite);
  78. GRAPHICS_IMPORT(device_enable_color);
  79. GRAPHICS_IMPORT(device_blendfunction);
  80. GRAPHICS_IMPORT(device_depthfunction);
  81. GRAPHICS_IMPORT(device_stencilfunction);
  82. GRAPHICS_IMPORT(device_stencilop);
  83. GRAPHICS_IMPORT(device_enable_fullscreen);
  84. GRAPHICS_IMPORT(device_fullscreen_enabled);
  85. GRAPHICS_IMPORT(device_setdisplaymode);
  86. GRAPHICS_IMPORT(device_getdisplaymode);
  87. GRAPHICS_IMPORT(device_setcolorramp);
  88. GRAPHICS_IMPORT(device_setviewport);
  89. GRAPHICS_IMPORT(device_getviewport);
  90. GRAPHICS_IMPORT(device_setscissorrect);
  91. GRAPHICS_IMPORT(device_ortho);
  92. GRAPHICS_IMPORT(device_frustum);
  93. GRAPHICS_IMPORT(device_projection_push);
  94. GRAPHICS_IMPORT(device_projection_pop);
  95. GRAPHICS_IMPORT(swapchain_destroy);
  96. GRAPHICS_IMPORT(texture_destroy);
  97. GRAPHICS_IMPORT(texture_getwidth);
  98. GRAPHICS_IMPORT(texture_getheight);
  99. GRAPHICS_IMPORT(texture_getcolorformat);
  100. GRAPHICS_IMPORT(texture_map);
  101. GRAPHICS_IMPORT(texture_unmap);
  102. GRAPHICS_IMPORT(cubetexture_destroy);
  103. GRAPHICS_IMPORT(cubetexture_getsize);
  104. GRAPHICS_IMPORT(cubetexture_getcolorformat);
  105. GRAPHICS_IMPORT(volumetexture_destroy);
  106. GRAPHICS_IMPORT(volumetexture_getwidth);
  107. GRAPHICS_IMPORT(volumetexture_getheight);
  108. GRAPHICS_IMPORT(volumetexture_getdepth);
  109. GRAPHICS_IMPORT(volumetexture_getcolorformat);
  110. GRAPHICS_IMPORT(stagesurface_destroy);
  111. GRAPHICS_IMPORT(stagesurface_getwidth);
  112. GRAPHICS_IMPORT(stagesurface_getheight);
  113. GRAPHICS_IMPORT(stagesurface_getcolorformat);
  114. GRAPHICS_IMPORT(stagesurface_map);
  115. GRAPHICS_IMPORT(stagesurface_unmap);
  116. GRAPHICS_IMPORT(zstencil_destroy);
  117. GRAPHICS_IMPORT(samplerstate_destroy);
  118. GRAPHICS_IMPORT(vertexbuffer_destroy);
  119. GRAPHICS_IMPORT(vertexbuffer_flush);
  120. GRAPHICS_IMPORT(vertexbuffer_getdata);
  121. GRAPHICS_IMPORT(indexbuffer_destroy);
  122. GRAPHICS_IMPORT(indexbuffer_flush);
  123. GRAPHICS_IMPORT(indexbuffer_getdata);
  124. GRAPHICS_IMPORT(indexbuffer_numindices);
  125. GRAPHICS_IMPORT(indexbuffer_gettype);
  126. GRAPHICS_IMPORT(shader_destroy);
  127. GRAPHICS_IMPORT(shader_numparams);
  128. GRAPHICS_IMPORT(shader_getparambyidx);
  129. GRAPHICS_IMPORT(shader_getparambyname);
  130. GRAPHICS_IMPORT(shader_getparaminfo);
  131. GRAPHICS_IMPORT(shader_getviewprojmatrix);
  132. GRAPHICS_IMPORT(shader_getworldmatrix);
  133. GRAPHICS_IMPORT(shader_setbool);
  134. GRAPHICS_IMPORT(shader_setfloat);
  135. GRAPHICS_IMPORT(shader_setint);
  136. GRAPHICS_IMPORT(shader_setmatrix3);
  137. GRAPHICS_IMPORT(shader_setmatrix4);
  138. GRAPHICS_IMPORT(shader_setvec2);
  139. GRAPHICS_IMPORT(shader_setvec3);
  140. GRAPHICS_IMPORT(shader_setvec4);
  141. GRAPHICS_IMPORT(shader_settexture);
  142. GRAPHICS_IMPORT(shader_setval);
  143. GRAPHICS_IMPORT(shader_setdefault);
  144. return success;
  145. }