render_backend_nil.odin 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #+build js
  2. #+private file
  3. package karl2d
  4. @(private="package")
  5. RENDER_BACKEND_NIL :: Render_Backend_Interface {
  6. state_size = rbnil_state_size,
  7. init = rbnil_init,
  8. shutdown = rbnil_shutdown,
  9. clear = rbnil_clear,
  10. present = rbnil_present,
  11. draw = rbnil_draw,
  12. resize_swapchain = rbnil_resize_swapchain,
  13. get_swapchain_width = rbnil_get_swapchain_width,
  14. get_swapchain_height = rbnil_get_swapchain_height,
  15. flip_z = rbnil_flip_z,
  16. set_internal_state = rbnil_set_internal_state,
  17. create_texture = rbnil_create_texture,
  18. load_texture = rbnil_load_texture,
  19. update_texture = rbnil_update_texture,
  20. destroy_texture = rbnil_destroy_texture,
  21. create_render_texture = rbnil_create_render_texture,
  22. destroy_render_target = rbnil_destroy_render_target,
  23. set_texture_filter = rbnil_set_texture_filter,
  24. load_shader = rbnil_load_shader,
  25. destroy_shader = rbnil_destroy_shader,
  26. default_shader_vertex_source = rbnil_default_shader_vertex_source,
  27. default_shader_fragment_source = rbnil_default_shader_fragment_source,
  28. }
  29. import "core:log"
  30. rbnil_state_size :: proc() -> int {
  31. return 0
  32. }
  33. rbnil_init :: proc(state: rawptr, window_handle: Window_Handle, swapchain_width, swapchain_height: int, allocator := context.allocator) {
  34. log.info("Render Backend nil init")
  35. }
  36. rbnil_shutdown :: proc() {
  37. log.info("Render Backend nil shutdown")
  38. }
  39. rbnil_clear :: proc(render_texture: Render_Target_Handle, color: Color) {
  40. }
  41. rbnil_present :: proc() {
  42. }
  43. rbnil_draw :: proc(
  44. shd: Shader,
  45. render_texture: Render_Target_Handle,
  46. bound_textures: []Texture_Handle,
  47. scissor: Maybe(Rect),
  48. blend_mode: Blend_Mode,
  49. vertex_buffer: []u8,
  50. ) {
  51. }
  52. rbnil_resize_swapchain :: proc(w, h: int) {
  53. }
  54. rbnil_get_swapchain_width :: proc() -> int {
  55. return 0
  56. }
  57. rbnil_get_swapchain_height :: proc() -> int {
  58. return 0
  59. }
  60. rbnil_flip_z :: proc() -> bool {
  61. return false
  62. }
  63. rbnil_set_internal_state :: proc(state: rawptr) {
  64. }
  65. rbnil_create_texture :: proc(width: int, height: int, format: Pixel_Format) -> Texture_Handle {
  66. return {}
  67. }
  68. rbnil_load_texture :: proc(data: []u8, width: int, height: int, format: Pixel_Format) -> Texture_Handle {
  69. return {}
  70. }
  71. rbnil_update_texture :: proc(th: Texture_Handle, data: []u8, rect: Rect) -> bool {
  72. return true
  73. }
  74. rbnil_destroy_texture :: proc(th: Texture_Handle) {
  75. }
  76. rbnil_create_render_texture :: proc(width: int, height: int) -> (Texture_Handle, Render_Target_Handle) {
  77. return {}, {}
  78. }
  79. rbnil_destroy_render_target :: proc(render_target: Render_Target_Handle) {
  80. }
  81. rbnil_set_texture_filter :: proc(
  82. th: Texture_Handle,
  83. scale_down_filter: Texture_Filter,
  84. scale_up_filter: Texture_Filter,
  85. mip_filter: Texture_Filter,
  86. ) {
  87. }
  88. rbnil_load_shader :: proc(
  89. vs_source: []byte,
  90. fs_source: []byte,
  91. desc_allocator := frame_allocator,
  92. layout_formats: []Pixel_Format = {},
  93. ) -> (
  94. handle: Shader_Handle,
  95. desc: Shader_Desc,
  96. ) {
  97. return {}, {}
  98. }
  99. rbnil_destroy_shader :: proc(h: Shader_Handle) {
  100. }
  101. rbnil_default_shader_vertex_source :: proc() -> []byte {
  102. return {}
  103. }
  104. rbnil_default_shader_fragment_source :: proc() -> []byte {
  105. return {}
  106. }