work on texture debugger and encounter weird bug

This commit is contained in:
Tuomas Katajisto 2025-09-28 21:34:04 +03:00
parent 4e34dbdd4c
commit 03556d15e8
7 changed files with 1133 additions and 1059 deletions

View File

@ -2,6 +2,7 @@
#load "trile_editor.jai";
#load "level_editor.jai";
#load "iprof.jai";
#load "textureDebugger.jai";
#if HAS_TACOMA {
#load "tacoma.jai";
@ -58,6 +59,9 @@ draw_editor_ui :: (theme: *GR.Overall_Theme) {
}
draw_console(theme);
draw_profiler();
draw_texture_debugger(theme);
GR.draw_popups();
immediate_flush();
}
draw_editor :: () {

View File

@ -0,0 +1,51 @@
#scope_file
subwindow : GR.Subwindow_Info;
subwindow_initted : bool = false;
current_pipeline : s32 = 0;
current_slot : s32 = 0;
pipeline_names : []string = .["arbtri", "trixel", "sky", "trile", "plane"];
slot_names : []string = .["Slot 1","Slot 2","Slot 3","Slot 4","Slot 5","Slot 6","Slot 7","Slot 8"];
draw_subwindow_texture_debug :: (state: *GR.Subwindow_State, r: GR.Rect, data: *void) {
r2 := r;
r2.h = ui_h(5,0);
r2.w = r.w * 0.75;
GR.dropdown(r2, pipeline_names, *current_pipeline, null);
r2.x += r2.w;
r2.w = r.w * 0.25;
GR.dropdown(r2, slot_names, *current_slot, null);
r2.h = r.h - r2.h;
r2.y = r.y + r2.h;
immediate_flush();
}
#scope_export
draw_texture_debug :: () {
uiTex := Ui_Texture.{gPipelines.plane.bind.images[0]};
set_shader_for_images(*uiTex);
immediate_quad(.{0, 0}, .{0 + 500, 0}, .{0 + 500, 0 + 500}, .{0, 0 + 500});
set_shader_for_color();
}
toggle_texdebug :: () {
subwindow.open = !subwindow.open;
} @Command
draw_texture_debugger :: (theme: *GR.Overall_Theme) {
if !subwindow.open then return;
if !subwindow_initted {
r := GR.get_rect(ui_w(40, 0), ui_w(40, 0), ui_h(50,0), ui_h(50,0));
subwindow.rect = r;
subwindow.draw = draw_subwindow_texture_debug;
subwindow.title_text = "Texture Debugger";
subwindow_initted = true;
}
if subwindow.open { // The Subwindow starts open, but pressing the Close button can close it.
subwindow_state := GR.add_subwindow(*subwindow, *theme.subwindow_theme);
}
}

View File

@ -156,12 +156,10 @@ frame :: () {
sg_begin_pass(*(sg_pass.{ action = state.pass_action_clear, swapchain = cast,force(sg_swapchain) sglue_swapchain() }));
draw_editor();
// uiTex := Ui_Texture.{*gPipelines.plane.bind.images[2]};
// set_shader_for_images(*uiTex);
// r := GR.get_rect(500,500,300,300);
// immediate_quad(.{r.x, r.y}, .{r.x + r.w, r.y}, .{r.x + r.w, r.y + r.h}, .{r.x, r.y + r.h});
// set_shader_for_color();
if !in_editor_view then game_draw();
draw_texture_debug();
ui_pass();
sg_end_pass();
sg_commit();

View File

@ -4,7 +4,40 @@
#load "console_commands.jai";
#load "shaderload.jai";
endframe_modified := false;
pointerimage_modified := false;
// This function is causing issues and I don't want to deal with it.
remove_getrect_custom_cursor :: (message: *Message, w: *Workspace) {
if message.kind == {
case .TYPECHECKED;
tc_message := cast(*Message_Typechecked) message;
for tc : tc_message.procedure_bodies {
body := tc.expression;
assert(body.block != null);
if body.header.name == "pointer_end_frame" && !endframe_modified {
print("Found and killed %\n", body.header.name);
new_statements : [..] *Code_Node;
body.block.statements = new_statements;
compiler_modify_procedure(message.workspace, body);
endframe_modified = true;
}
if body.header.name == "getrect_set_pointer_image" && !pointerimage_modified {
print("Found and killed %\n", body.header.name);
new_statements : [..] *Code_Node;
body.block.statements = new_statements;
compiler_modify_procedure(message.workspace, body);
pointerimage_modified = true;
}
}
}
}
custom_message_handler :: (message: *Message, w: *Workspace) {
lint_checks(message);
remove_getrect_custom_cursor(message, w);
add_console_commands(message, w);
}

View File

@ -376,7 +376,7 @@ create_plane_pipeline :: () {
sample_count = 1,
data = imgdata
};
gPipelines.plane.bind.images[2] = sg_make_image(*ground_img_desc);
}

File diff suppressed because it is too large Load Diff

View File

@ -141,6 +141,7 @@ set_shader_for_color :: (enable_blend := false) {
set_shader_for_images :: (texture: *Ui_Texture) {
print("Setting shader for images!!!\n");
arb_tri_command_add(.{
type = .SET_TEXTURE,
texture = texture
@ -370,7 +371,6 @@ render_ui :: () {
my_theme := proc();
GR.set_default_theme(my_theme);
draw_editor_ui(*my_theme);
r := GR.get_rect(100, 100, 200, 50);
}
ui_pass :: () {