aboutsummaryrefslogtreecommitdiff
path: root/src/draw/framebuffer.odin
diff options
context:
space:
mode:
Diffstat (limited to 'src/draw/framebuffer.odin')
-rw-r--r--src/draw/framebuffer.odin94
1 files changed, 0 insertions, 94 deletions
diff --git a/src/draw/framebuffer.odin b/src/draw/framebuffer.odin
deleted file mode 100644
index cd7848b..0000000
--- a/src/draw/framebuffer.odin
+++ /dev/null
@@ -1,94 +0,0 @@
-package draw
-
-import sg "shared:sokol/gfx"
-
-Framebuffer :: struct {
- img: sg.Image,
- view: sg.View,
- pipe: sg.Pipeline,
- pass: sg.Pass,
-}
-
-init_framebuffer :: proc(
- fb: ^Framebuffer,
- width: i32,
- height: i32,
- clear_color := Color{0, 0, 0, 0},
-) {
- fb.pipe = sg.make_pipeline({
- shader = sg.make_shader(default_shader_desc(sg.query_backend())),
- layout = {
- attrs = {
- ATTR_default_vposition = {format = .FLOAT2},
- ATTR_default_vuv = {format = .FLOAT2},
- ATTR_default_vcolor = {format = .FLOAT4},
- },
- },
- depth = {
- pixel_format = .NONE,
- },
- sample_count = 1,
- colors = {
- 0 = {
- pixel_format = .RGBA8,
- blend = {
- enabled = true,
- src_factor_rgb = .SRC_ALPHA,
- dst_factor_rgb = .ONE_MINUS_SRC_ALPHA,
- src_factor_alpha = .ONE,
- dst_factor_alpha = .ZERO,
- },
- },
- },
- })
-
- fb.img = sg.make_image({
- usage = {
- color_attachment = true,
- },
-
- width = width,
- height = height,
-
- pixel_format = .RGBA8,
- sample_count = 1,
- })
-
- fb.view = sg.make_view({
- texture = {
- image = fb.img,
- },
- })
-
- fb.pass = {
- attachments = {
- colors = {
- 0 = sg.make_view({
- color_attachment = {
- image = fb.img,
- },
- }),
- },
- },
- action = {
- colors = {
- 0 = {load_action = .CLEAR, clear_value = transmute(sg.Color)clear_color},
- },
- },
- }
-}
-
-destroy_framebuffer :: proc(fb: ^Framebuffer) {
- sg.destroy_pipeline(fb.pipe)
- sg.destroy_view(fb.view)
- sg.destroy_image(fb.img)
-}
-
-framebuffer_draw_start :: proc(fb: Framebuffer) {
- sg.begin_pass(fb.pass)
- sg.apply_pipeline(fb.pipe)
-}
-
-framebuffer_draw_end :: proc(fb: Framebuffer) {
- sg.end_pass()
-}