render_backend_nil.odin 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #+private file
  2. package karl2d
  3. @(private="package")
  4. RENDER_BACKEND_NIL :: Render_Backend_Interface {
  5. state_size = rbnil_state_size,
  6. init = rbnil_init,
  7. shutdown = rbnil_shutdown,
  8. clear = rbnil_clear,
  9. present = rbnil_present,
  10. draw = rbnil_draw,
  11. resize_swapchain = rbnil_resize_swapchain,
  12. get_swapchain_width = rbnil_get_swapchain_width,
  13. get_swapchain_height = rbnil_get_swapchain_height,
  14. flip_z = rbnil_flip_z,
  15. set_internal_state = rbnil_set_internal_state,
  16. create_texture = rbnil_create_texture,
  17. load_texture = rbnil_load_texture,
  18. update_texture = rbnil_update_texture,
  19. destroy_texture = rbnil_destroy_texture,
  20. texture_needs_vertical_flip = rbnil_texture_needs_vertical_flip,
  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_texture_needs_vertical_flip :: proc(th: Texture_Handle) -> bool {
  77. return false
  78. }
  79. rbnil_create_render_texture :: proc(width: int, height: int) -> (Texture_Handle, Render_Target_Handle) {
  80. return {}, {}
  81. }
  82. rbnil_destroy_render_target :: proc(render_target: Render_Target_Handle) {
  83. }
  84. rbnil_set_texture_filter :: proc(
  85. th: Texture_Handle,
  86. scale_down_filter: Texture_Filter,
  87. scale_up_filter: Texture_Filter,
  88. mip_filter: Texture_Filter,
  89. ) {
  90. }
  91. rbnil_load_shader :: proc(
  92. vs_source: []byte,
  93. fs_source: []byte,
  94. desc_allocator := frame_allocator,
  95. layout_formats: []Pixel_Format = {},
  96. ) -> (
  97. handle: Shader_Handle,
  98. desc: Shader_Desc,
  99. ) {
  100. return {}, {}
  101. }
  102. rbnil_destroy_shader :: proc(h: Shader_Handle) {
  103. }
  104. rbnil_default_shader_vertex_source :: proc() -> []byte {
  105. return {}
  106. }
  107. rbnil_default_shader_fragment_source :: proc() -> []byte {
  108. return {}
  109. }