Resolve pipeline validator crash on debug
This commit is contained in:
parent
fe42f2665c
commit
aa28465147
2 changed files with 37 additions and 32 deletions
|
|
@ -17,6 +17,7 @@ import "core:os"
|
||||||
import stbi "vendor:stb/image"
|
import stbi "vendor:stb/image"
|
||||||
|
|
||||||
import sa "../sokol/app"
|
import sa "../sokol/app"
|
||||||
|
import sl "../sokol/log"
|
||||||
import sh "../sokol/helpers"
|
import sh "../sokol/helpers"
|
||||||
import sg "../sokol/gfx"
|
import sg "../sokol/gfx"
|
||||||
|
|
||||||
|
|
@ -25,7 +26,7 @@ import program_config "../config"
|
||||||
import shaders "../shaders/out"
|
import shaders "../shaders/out"
|
||||||
|
|
||||||
VertexData :: struct {
|
VertexData :: struct {
|
||||||
x, y, z: f32,
|
pos: Vec3,
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh :: struct {
|
Mesh :: struct {
|
||||||
|
|
@ -57,7 +58,7 @@ init_outline_material :: proc(render_system: ^RenderSystem) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
index_type = .UINT16,
|
index_type = .UINT16,
|
||||||
cull_mode = .FRONT,
|
cull_mode = .BACK,
|
||||||
depth = {
|
depth = {
|
||||||
pixel_format = .DEFAULT,
|
pixel_format = .DEFAULT,
|
||||||
write_enabled = true,
|
write_enabled = true,
|
||||||
|
|
@ -86,7 +87,7 @@ init_cube_material :: proc(render_system: ^RenderSystem) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
index_type = .UINT16,
|
index_type = .UINT16,
|
||||||
cull_mode = .BACK,
|
cull_mode = .FRONT,
|
||||||
depth = {
|
depth = {
|
||||||
pixel_format = .DEFAULT,
|
pixel_format = .DEFAULT,
|
||||||
write_enabled = true,
|
write_enabled = true,
|
||||||
|
|
@ -107,35 +108,35 @@ init_cube_material :: proc(render_system: ^RenderSystem) {
|
||||||
@(private="file")
|
@(private="file")
|
||||||
init_cube_mesh :: proc (render_system: ^RenderSystem) {
|
init_cube_mesh :: proc (render_system: ^RenderSystem) {
|
||||||
cube_vertices := []VertexData {
|
cube_vertices := []VertexData {
|
||||||
{ -0.5, -0.5, 0.5 },
|
{ pos = { -0.5, -0.5, 0.5 }, },
|
||||||
{ 0.5, -0.5, 0.5 },
|
{ pos = { 0.5, -0.5, 0.5 }, },
|
||||||
{ 0.5, 0.5, 0.5 },
|
{ pos = { 0.5, 0.5, 0.5 }, },
|
||||||
{ -0.5, 0.5, 0.5 },
|
{ pos = { -0.5, 0.5, 0.5 }, },
|
||||||
|
|
||||||
{ -0.5, -0.5, -0.5 },
|
{ pos = { -0.5, -0.5, -0.5 }, },
|
||||||
{ 0.5, -0.5, -0.5 },
|
{ pos = { 0.5, -0.5, -0.5 }, },
|
||||||
{ 0.5, 0.5, -0.5 },
|
{ pos = { 0.5, 0.5, -0.5 }, },
|
||||||
{ -0.5, 0.5, -0.5 },
|
{ pos = { -0.5, 0.5, -0.5 }, },
|
||||||
|
|
||||||
{ -0.5, 0.5, 0.5 },
|
{ pos = { -0.5, 0.5, 0.5 }, },
|
||||||
{ 0.5, 0.5, 0.5 },
|
{ pos = { 0.5, 0.5, 0.5 }, },
|
||||||
{ 0.5, 0.5, -0.5 },
|
{ pos = { 0.5, 0.5, -0.5 }, },
|
||||||
{ -0.5, 0.5, -0.5 },
|
{ pos = { -0.5, 0.5, -0.5 }, },
|
||||||
|
|
||||||
{ -0.5, -0.5, 0.5 },
|
{ pos = { -0.5, -0.5, 0.5 }, },
|
||||||
{ 0.5, -0.5, 0.5 },
|
{ pos = { 0.5, -0.5, 0.5 }, },
|
||||||
{ 0.5, -0.5, -0.5 },
|
{ pos = { 0.5, -0.5, -0.5 }, },
|
||||||
{ -0.5, -0.5, -0.5 },
|
{ pos = { -0.5, -0.5, -0.5 }, },
|
||||||
|
|
||||||
{ 0.5, -0.5, 0.5 },
|
{ pos = { 0.5, -0.5, 0.5 }, },
|
||||||
{ 0.5, -0.5, -0.5 },
|
{ pos = { 0.5, -0.5, -0.5 }, },
|
||||||
{ 0.5, 0.5, -0.5 },
|
{ pos = { 0.5, 0.5, -0.5 }, },
|
||||||
{ 0.5, 0.5, 0.5 },
|
{ pos = { 0.5, 0.5, 0.5 }, },
|
||||||
|
|
||||||
{ -0.5, -0.5, 0.5 },
|
{ pos = { -0.5, -0.5, 0.5 }, },
|
||||||
{ -0.5, -0.5, -0.5 },
|
{ pos = { -0.5, -0.5, -0.5 }, },
|
||||||
{ -0.5, 0.5, -0.5 },
|
{ pos = { -0.5, 0.5, -0.5 }, },
|
||||||
{ -0.5, 0.5, 0.5 },
|
{ pos = { -0.5, 0.5, 0.5 }, },
|
||||||
}
|
}
|
||||||
vertex_buffer := sg.make_buffer({
|
vertex_buffer := sg.make_buffer({
|
||||||
data = sg_range(cube_vertices)
|
data = sg_range(cube_vertices)
|
||||||
|
|
@ -167,7 +168,7 @@ render_system_init :: proc(render_system: ^RenderSystem, user_entity: EntityID)
|
||||||
sg.setup({
|
sg.setup({
|
||||||
environment = sh.glue_environment(),
|
environment = sh.glue_environment(),
|
||||||
allocator = sg.Allocator(sh.allocator(&default_context)),
|
allocator = sg.Allocator(sh.allocator(&default_context)),
|
||||||
logger = sg.Logger(sh.logger(&default_context)),
|
logger = sg.Logger( { func = sl.func } ),
|
||||||
})
|
})
|
||||||
|
|
||||||
render_system.materials = make(map[MaterialID]Material)
|
render_system.materials = make(map[MaterialID]Material)
|
||||||
|
|
@ -205,8 +206,8 @@ CLEAR_SCREEN_ACTION :: sg.Pass_Action{
|
||||||
0 = {
|
0 = {
|
||||||
load_action = .CLEAR,
|
load_action = .CLEAR,
|
||||||
clear_value = program_config.BACKGROUND_COLOR,
|
clear_value = program_config.BACKGROUND_COLOR,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private="file")
|
@(private="file")
|
||||||
|
|
@ -293,8 +294,8 @@ render_system_update :: proc(render_system: ^RenderSystem, coordinator: ^Coordin
|
||||||
view := linalg.matrix4_look_at_f32(camera.position, camera.target, { 0, 1, 0 } )
|
view := linalg.matrix4_look_at_f32(camera.position, camera.target, { 0, 1, 0 } )
|
||||||
|
|
||||||
sg.begin_pass({ swapchain = sh.glue_swapchain(), action = CLEAR_SCREEN_ACTION })
|
sg.begin_pass({ swapchain = sh.glue_swapchain(), action = CLEAR_SCREEN_ACTION })
|
||||||
outline_pass(render_system, coordinator, proj, view)
|
|
||||||
cube_pass(render_system, coordinator, proj, view)
|
cube_pass(render_system, coordinator, proj, view)
|
||||||
|
outline_pass(render_system, coordinator, proj, view)
|
||||||
sg.end_pass()
|
sg.end_pass()
|
||||||
|
|
||||||
sg.commit()
|
sg.commit()
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ import "core:math/rand"
|
||||||
import stbi "vendor:stb/image"
|
import stbi "vendor:stb/image"
|
||||||
|
|
||||||
import sa "sokol/app"
|
import sa "sokol/app"
|
||||||
|
import sg "sokol/app"
|
||||||
|
import sl "sokol/log"
|
||||||
import sh "sokol/helpers"
|
import sh "sokol/helpers"
|
||||||
|
|
||||||
import "ecs"
|
import "ecs"
|
||||||
|
|
@ -54,7 +56,9 @@ main :: proc() {
|
||||||
window_title = program_config.WINDOW_TITLE,
|
window_title = program_config.WINDOW_TITLE,
|
||||||
|
|
||||||
allocator = sa.Allocator(sh.allocator(&default_context)),
|
allocator = sa.Allocator(sh.allocator(&default_context)),
|
||||||
logger = sa.Logger(sh.logger(&default_context)),
|
logger = sg.Logger( { func = sl.func } ),
|
||||||
|
|
||||||
|
sample_count = 4,
|
||||||
|
|
||||||
init_cb = init_cb,
|
init_cb = init_cb,
|
||||||
frame_cb = frame_cb,
|
frame_cb = frame_cb,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue