From 26906f5db645e65c3fec12a1179c035eec8d1334 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Tue, 16 Dec 2025 11:19:07 +0100 Subject: [PATCH] Fix warnings --- base/sources/backends/direct3d12_gpu.c | 4 +- base/sources/backends/metal_gpu.m | 6 +- base/sources/backends/vulkan_gpu.c | 4 +- base/sources/backends/webgpu_gpu.c | 4 +- base/sources/iron_gpu.c | 2 +- base/sources/iron_gpu.h | 30 ++++---- base/sources/ts/const_data.ts | 6 +- base/sources/ts/iron.ts | 44 +++++------ base/sources/ts/line_draw.ts | 20 ++--- base/sources/ts/mesh_data.ts | 6 +- base/sources/ts/render_path.ts | 20 ++--- base/sources/ts/shader_data.ts | 74 +++++++++---------- base/sources/ts/sys.ts | 2 +- base/tests/triangle/main.ts | 6 +- base/tools/amake/alang.js | 2 +- base/tools/amake/alang.ts | 2 +- base/tools/pad/sources/main.ts | 4 +- paint/sources/base.ts | 8 +- paint/sources/brush_nodes/color_node.ts | 2 +- paint/sources/brush_nodes/float_node.ts | 2 +- paint/sources/brush_nodes/vector_node.ts | 2 +- paint/sources/history.ts | 8 +- paint/sources/import_arm.ts | 8 +- paint/sources/import_envmap.ts | 8 +- paint/sources/make_material.ts | 2 +- paint/sources/make_paint.ts | 10 +-- paint/sources/make_sculpt.ts | 2 +- paint/sources/neural_nodes/tile_image_node.ts | 2 +- paint/sources/pipes.ts | 42 +++++------ paint/sources/render_path_deferred.ts | 4 +- paint/sources/slot_layer.ts | 22 +++--- paint/sources/slot_material.ts | 4 +- paint/sources/ui_view2d.ts | 6 +- paint/sources/util_render.ts | 14 ++-- paint/sources/util_uv.ts | 14 ++-- 35 files changed, 198 insertions(+), 198 deletions(-) diff --git a/base/sources/backends/direct3d12_gpu.c b/base/sources/backends/direct3d12_gpu.c index 16631a79..7fe4464e 100644 --- a/base/sources/backends/direct3d12_gpu.c +++ b/base/sources/backends/direct3d12_gpu.c @@ -43,7 +43,7 @@ static ID3D12Resource *resources_to_destroy[512]; static int resources_to_destroy_count = 0; static char device_name[256]; -static D3D12_BLEND convert_blend_factor(gpu_blending_factor_t factor) { +static D3D12_BLEND convert_blend_factor(gpu_blend_t factor) { switch (factor) { case GPU_BLEND_ONE: return D3D12_BLEND_ONE; @@ -64,7 +64,7 @@ static D3D12_CULL_MODE convert_cull_mode(gpu_cull_mode_t cull_mode) { switch (cull_mode) { case GPU_CULL_MODE_CLOCKWISE: return D3D12_CULL_MODE_FRONT; - case GPU_CULL_MODE_COUNTERCLOCKWISE: + case GPU_CULL_MODE_COUNTER_CLOCKWISE: return D3D12_CULL_MODE_BACK; default: return D3D12_CULL_MODE_NONE; diff --git a/base/sources/backends/metal_gpu.m b/base/sources/backends/metal_gpu.m index 06a23a20..635d4bac 100644 --- a/base/sources/backends/metal_gpu.m +++ b/base/sources/backends/metal_gpu.m @@ -30,7 +30,7 @@ static void *readback_buffer; static int readback_buffer_size = 0; static bool linear_sampling = true; -static MTLBlendFactor convert_blending_factor(gpu_blending_factor_t factor) { +static MTLBlendFactor convert_blending_factor(gpu_blend_t factor) { switch (factor) { case GPU_BLEND_ONE: return MTLBlendFactorOne; @@ -64,9 +64,9 @@ static MTLCullMode convert_cull_mode(gpu_cull_mode_t cull) { switch (cull) { case GPU_CULL_MODE_CLOCKWISE: return MTLCullModeFront; - case GPU_CULL_MODE_COUNTERCLOCKWISE: + case GPU_CULL_MODE_COUNTER_CLOCKWISE: return MTLCullModeBack; - case GPU_CULL_MODE_NEVER: + case GPU_CULL_MODE_NONE: return MTLCullModeNone; } } diff --git a/base/sources/backends/vulkan_gpu.c b/base/sources/backends/vulkan_gpu.c index 327c4ad4..b304690f 100644 --- a/base/sources/backends/vulkan_gpu.c +++ b/base/sources/backends/vulkan_gpu.c @@ -97,7 +97,7 @@ static VkCullModeFlagBits convert_cull_mode(gpu_cull_mode_t cull_mode) { switch (cull_mode) { case GPU_CULL_MODE_CLOCKWISE: return VK_CULL_MODE_BACK_BIT; - case GPU_CULL_MODE_COUNTERCLOCKWISE: + case GPU_CULL_MODE_COUNTER_CLOCKWISE: return VK_CULL_MODE_FRONT_BIT; default: return VK_CULL_MODE_NONE; @@ -118,7 +118,7 @@ static VkCompareOp convert_compare_mode(gpu_compare_mode_t compare) { } } -static VkBlendFactor convert_blend_factor(gpu_blending_factor_t factor) { +static VkBlendFactor convert_blend_factor(gpu_blend_t factor) { switch (factor) { case GPU_BLEND_ONE: return VK_BLEND_FACTOR_ONE; diff --git a/base/sources/backends/webgpu_gpu.c b/base/sources/backends/webgpu_gpu.c index 0a2a50f6..ccd4985d 100644 --- a/base/sources/backends/webgpu_gpu.c +++ b/base/sources/backends/webgpu_gpu.c @@ -62,7 +62,7 @@ static WGPUCullMode convert_cull_mode(gpu_cull_mode_t cull_mode) { switch (cull_mode) { case GPU_CULL_MODE_CLOCKWISE: return WGPUCullMode_Back; - case GPU_CULL_MODE_COUNTERCLOCKWISE: + case GPU_CULL_MODE_COUNTER_CLOCKWISE: return WGPUCullMode_Front; default: return WGPUCullMode_None; @@ -83,7 +83,7 @@ static WGPUCompareFunction convert_compare_mode(gpu_compare_mode_t compare) { } } -static WGPUBlendFactor convert_blend_factor(gpu_blending_factor_t factor) { +static WGPUBlendFactor convert_blend_factor(gpu_blend_t factor) { switch (factor) { case GPU_BLEND_ONE: return WGPUBlendFactor_One; diff --git a/base/sources/iron_gpu.c b/base/sources/iron_gpu.c index 2eba1001..8f77ac72 100644 --- a/base/sources/iron_gpu.c +++ b/base/sources/iron_gpu.c @@ -253,7 +253,7 @@ void gpu_pipeline_init(gpu_pipeline_t *pipe) { pipe->input_layout = NULL; pipe->vertex_shader = NULL; pipe->fragment_shader = NULL; - pipe->cull_mode = GPU_CULL_MODE_NEVER; + pipe->cull_mode = GPU_CULL_MODE_NONE; pipe->depth_write = false; pipe->depth_mode = GPU_COMPARE_MODE_ALWAYS; pipe->blend_source = GPU_BLEND_ONE; diff --git a/base/sources/iron_gpu.h b/base/sources/iron_gpu.h index 94b30d88..4f6c5a08 100644 --- a/base/sources/iron_gpu.h +++ b/base/sources/iron_gpu.h @@ -21,26 +21,26 @@ #define GPU_FRAMEBUFFER_COUNT 3 #endif -typedef enum gpu_clear { +typedef enum { GPU_CLEAR_NONE = 0, GPU_CLEAR_COLOR = 1, GPU_CLEAR_DEPTH = 2, } gpu_clear_t; -typedef enum gpu_texture_state { +typedef enum { GPU_TEXTURE_STATE_SHADER_RESOURCE, GPU_TEXTURE_STATE_RENDER_TARGET, GPU_TEXTURE_STATE_RENDER_TARGET_DEPTH, GPU_TEXTURE_STATE_PRESENT } gpu_texture_state_t; -typedef enum gpu_texture_compression { +typedef enum { GPU_TEXTURE_COMPRESSION_NONE, GPU_TEXTURE_COMPRESSION_DXT5, GPU_TEXTURE_COMPRESSION_ASTC } gpu_texture_compression_t; -typedef enum gpu_texture_format { +typedef enum { GPU_TEXTURE_FORMAT_RGBA32, GPU_TEXTURE_FORMAT_RGBA64, GPU_TEXTURE_FORMAT_RGBA128, @@ -50,7 +50,7 @@ typedef enum gpu_texture_format { GPU_TEXTURE_FORMAT_D32 } gpu_texture_format_t; -typedef enum gpu_vertex_data { +typedef enum { GPU_VERTEX_DATA_F32_1X, GPU_VERTEX_DATA_F32_2X, GPU_VERTEX_DATA_F32_3X, @@ -59,7 +59,7 @@ typedef enum gpu_vertex_data { GPU_VERTEX_DATA_I16_4X_NORM } gpu_vertex_data_t; -typedef enum gpu_shader_type { +typedef enum { GPU_SHADER_TYPE_VERTEX, GPU_SHADER_TYPE_FRAGMENT, GPU_SHADER_TYPE_COUNT @@ -72,15 +72,15 @@ typedef enum { GPU_BLEND_DEST_ALPHA, GPU_BLEND_INV_SOURCE_ALPHA, GPU_BLEND_INV_DEST_ALPHA -} gpu_blending_factor_t; +} gpu_blend_t; -typedef enum gpu_cull_mode { +typedef enum { GPU_CULL_MODE_CLOCKWISE, - GPU_CULL_MODE_COUNTERCLOCKWISE, - GPU_CULL_MODE_NEVER + GPU_CULL_MODE_COUNTER_CLOCKWISE, + GPU_CULL_MODE_NONE } gpu_cull_mode_t; -typedef enum gpu_compare_mode { +typedef enum { GPU_COMPARE_MODE_ALWAYS, GPU_COMPARE_MODE_NEVER, GPU_COMPARE_MODE_LESS, @@ -125,10 +125,10 @@ typedef struct gpu_pipeline { gpu_cull_mode_t cull_mode; bool depth_write; gpu_compare_mode_t depth_mode; - gpu_blending_factor_t blend_source; - gpu_blending_factor_t blend_destination; - gpu_blending_factor_t alpha_blend_source; - gpu_blending_factor_t alpha_blend_destination; + gpu_blend_t blend_source; + gpu_blend_t blend_destination; + gpu_blend_t alpha_blend_source; + gpu_blend_t alpha_blend_destination; bool color_write_mask_red[8]; bool color_write_mask_green[8]; bool color_write_mask_blue[8]; diff --git a/base/sources/ts/const_data.ts b/base/sources/ts/const_data.ts index 73847610..74399807 100644 --- a/base/sources/ts/const_data.ts +++ b/base/sources/ts/const_data.ts @@ -10,7 +10,7 @@ function const_data_create_screen_aligned_data() { let indices: i32[] = [ 0, 1, 2 ]; let structure: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(structure, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(structure, "pos", gpu_vertex_data_t.F32_2X); const_data_screen_aligned_vb = gpu_create_vertex_buffer(math_floor(data.length / math_floor(gpu_vertex_struct_size(structure) / 4)), structure); let vertices: buffer_t = gpu_lock_vertex_buffer(const_data_screen_aligned_vb); for (let i: i32 = 0; i < math_floor((vertices.length) / 4); ++i) { @@ -36,8 +36,8 @@ declare let _const_data_skydome_nor_count: i32; function const_data_create_skydome_data() { let structure: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(structure, "pos", vertex_data_t.F32_3X); - gpu_vertex_struct_add(structure, "nor", vertex_data_t.F32_3X); + gpu_vertex_struct_add(structure, "pos", gpu_vertex_data_t.F32_3X); + gpu_vertex_struct_add(structure, "nor", gpu_vertex_data_t.F32_3X); let struct_length: i32 = math_floor(gpu_vertex_struct_size(structure) / 4); const_data_skydome_vb = gpu_create_vertex_buffer(math_floor(_const_data_skydome_pos_count / 3), structure); let vertices: buffer_t = gpu_lock_vertex_buffer(const_data_skydome_vb); diff --git a/base/sources/ts/iron.ts b/base/sources/ts/iron.ts index c1a70a08..03d773c9 100644 --- a/base/sources/ts/iron.ts +++ b/base/sources/ts/iron.ts @@ -220,7 +220,7 @@ declare function gpu_vertex_buffer_unlock(buffer: any): void; declare function gpu_set_vertex_buffer(buffer: any): void; declare function gpu_draw(): void; declare function gpu_create_shader(data: buffer_t, type: i32): gpu_shader_t; -declare function gpu_create_shader_from_source(source: string, source_size: i32, shader_type: shader_type_t): gpu_shader_t; +declare function gpu_create_shader_from_source(source: string, source_size: i32, shader_type: gpu_shader_type_t): gpu_shader_t; declare function gpu_shader_destroy(shader: gpu_shader_t): void; declare function gpu_create_pipeline(): any; declare function gpu_delete_pipeline(pipeline: any): void; @@ -269,8 +269,8 @@ declare function iron_display_y(index: i32): i32; declare function iron_display_frequency(index: i32): i32; declare function iron_display_is_primary(index: i32): bool; -declare function gpu_create_render_target(width: i32, height: i32, format: i32 = tex_format_t.RGBA32): any; -declare function gpu_create_texture_from_bytes(data: buffer_t, width: i32, height: i32, format: i32 = tex_format_t.RGBA32): any; +declare function gpu_create_render_target(width: i32, height: i32, format: i32 = gpu_texture_format_t.RGBA32): any; +declare function gpu_create_texture_from_bytes(data: buffer_t, width: i32, height: i32, format: i32 = gpu_texture_format_t.RGBA32): any; declare function gpu_create_texture_from_encoded_bytes(data: buffer_t, format: string): any; declare function gpu_get_texture_pixels(texture: any): buffer_t; declare function gpu_viewport(x: i32, y: i32, width: i32, height: i32): void; @@ -332,7 +332,7 @@ declare type draw_font_t = { }; declare function iron_set_save_and_quit_callback(callback: (save: bool) => void): void; -declare function iron_mouse_set_cursor(id: cursor_t): void; +declare function iron_mouse_set_cursor(id: iron_cursor_t): void; declare function iron_delay_idle_sleep(): void; declare function iron_open_dialog(filter_list: string, default_path: string, open_multiple: bool): string[]; declare function iron_save_dialog(filter_list: string, default_path: string): string; @@ -537,7 +537,7 @@ type vec4_box_t = { declare function f32_nan(): f32; declare function f32_isnan(f: f32): bool; -function gpu_vertex_struct_add(raw: gpu_vertex_structure_t, name: string, data: vertex_data_t) { +function gpu_vertex_struct_add(raw: gpu_vertex_structure_t, name: string, data: gpu_vertex_data_t) { let e: gpu_vertex_element_t = ADDRESS(ARRAY_ACCESS(raw.elements, raw.size)); e.name = name; e.data = data; @@ -545,19 +545,19 @@ function gpu_vertex_struct_add(raw: gpu_vertex_structure_t, name: string, data: } declare function gpu_vertex_struct_size(s: gpu_vertex_structure_t): i32; -declare function gpu_vertex_data_size(data: vertex_data_t); +declare function gpu_vertex_data_size(data: gpu_vertex_data_t); declare type gpu_pipeline_t = { input_layout?: any; vertex_shader?: any; fragment_shader?: any; - cull_mode?: cull_mode_t; + cull_mode?: gpu_cull_mode_t; depth_write?: bool; - depth_mode?: compare_mode_t; - blend_source?: blend_factor_t; - blend_destination?: blend_factor_t; - alpha_blend_source?: blend_factor_t; - alpha_blend_destination?: blend_factor_t; + depth_mode?: gpu_compare_mode_t; + blend_source?: gpu_blend_t; + blend_destination?: gpu_blend_t; + alpha_blend_source?: gpu_blend_t; + alpha_blend_destination?: gpu_blend_t; color_write_mask_red?: any; color_write_mask_green?: any; color_write_mask_blue?: any; @@ -574,7 +574,7 @@ declare type gpu_shader_t = { declare type gpu_vertex_element_t = { name?: string; - data?: vertex_data_t; + data?: gpu_vertex_data_t; }; declare type gpu_vertex_structure_t = { @@ -592,7 +592,7 @@ declare enum gpu_clear_t { DEPTH = 2, } -enum tex_format_t { +declare enum gpu_texture_format_t { RGBA32, RGBA64, RGBA128, @@ -602,7 +602,7 @@ enum tex_format_t { D32, } -enum vertex_data_t { +declare enum gpu_vertex_data_t { F32_1X, F32_2X, F32_3X, @@ -611,34 +611,34 @@ enum vertex_data_t { I16_4X_NORM, } -enum blend_factor_t { - BLEND_ONE, - BLEND_ZERO, +declare enum gpu_blend_t { + ONE, + ZERO, SOURCE_ALPHA, DEST_ALPHA, INV_SOURCE_ALPHA, INV_DEST_ALPHA, } -enum compare_mode_t { +declare enum gpu_compare_mode_t { ALWAYS, NEVER, LESS, EQUAL, } -enum cull_mode_t { +declare enum gpu_cull_mode_t { CLOCKWISE, COUNTER_CLOCKWISE, NONE, } -enum shader_type_t { +declare enum gpu_shader_type_t { VERTEX, FRAGMENT, } -enum cursor_t { +declare enum iron_cursor_t { ARROW, HAND, IBEAM, diff --git a/base/sources/ts/line_draw.ts b/base/sources/ts/line_draw.ts index a68cde10..3bf7ac22 100644 --- a/base/sources/ts/line_draw.ts +++ b/base/sources/ts/line_draw.ts @@ -41,17 +41,17 @@ let line_draw_camera_look: vec4_t = vec4_create(); function line_draw_init() { if (line_draw_pipeline == null) { let structure: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(structure, "pos", vertex_data_t.F32_3X); + gpu_vertex_struct_add(structure, "pos", gpu_vertex_data_t.F32_3X); line_draw_pipeline = gpu_create_pipeline(); line_draw_pipeline.input_layout = structure; line_draw_pipeline.fragment_shader = sys_get_shader("line.frag"); line_draw_pipeline.vertex_shader = sys_get_shader("line.vert"); line_draw_pipeline.depth_write = true; - line_draw_pipeline.depth_mode = compare_mode_t.LESS; - line_draw_pipeline.cull_mode = cull_mode_t.NONE; + line_draw_pipeline.depth_mode = gpu_compare_mode_t.LESS; + line_draw_pipeline.cull_mode = gpu_cull_mode_t.NONE; line_draw_pipeline.color_attachment_count = 2; - ARRAY_ACCESS(line_draw_pipeline.color_attachment, 0) = tex_format_t.RGBA64; - ARRAY_ACCESS(line_draw_pipeline.color_attachment, 1) = tex_format_t.RGBA64; + ARRAY_ACCESS(line_draw_pipeline.color_attachment, 0) = gpu_texture_format_t.RGBA64; + ARRAY_ACCESS(line_draw_pipeline.color_attachment, 1) = gpu_texture_format_t.RGBA64; line_draw_pipeline.depth_attachment_bits = 32; gpu_pipeline_compile(line_draw_pipeline); pipes_offset = 0; @@ -63,16 +63,16 @@ function line_draw_init() { } if (line_draw_overlay_pipeline == null) { let structure: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(structure, "pos", vertex_data_t.F32_3X); + gpu_vertex_struct_add(structure, "pos", gpu_vertex_data_t.F32_3X); line_draw_overlay_pipeline = gpu_create_pipeline(); line_draw_overlay_pipeline.input_layout = structure; line_draw_overlay_pipeline.fragment_shader = sys_get_shader("line_overlay.frag"); line_draw_overlay_pipeline.vertex_shader = sys_get_shader("line_overlay.vert"); line_draw_overlay_pipeline.depth_write = false; - line_draw_overlay_pipeline.depth_mode = compare_mode_t.ALWAYS; - line_draw_overlay_pipeline.cull_mode = cull_mode_t.NONE; + line_draw_overlay_pipeline.depth_mode = gpu_compare_mode_t.ALWAYS; + line_draw_overlay_pipeline.cull_mode = gpu_cull_mode_t.NONE; line_draw_overlay_pipeline.color_attachment_count = 1; - ARRAY_ACCESS(line_draw_overlay_pipeline.color_attachment, 0) = tex_format_t.RGBA64; + ARRAY_ACCESS(line_draw_overlay_pipeline.color_attachment, 0) = gpu_texture_format_t.RGBA64; gpu_pipeline_compile(line_draw_overlay_pipeline); } } @@ -254,7 +254,7 @@ function shape_draw_sphere(mat: mat4_t) { let posa: i16_array_t = md.vertex_arrays[0].values; let structure: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(structure, "pos", vertex_data_t.F32_3X); + gpu_vertex_struct_add(structure, "pos", gpu_vertex_data_t.F32_3X); _shape_draw_sphere_vb = gpu_create_vertex_buffer(posa.length, structure); let data: buffer_t = gpu_lock_vertex_buffer(_shape_draw_sphere_vb); for (let i: i32 = 0; i < posa.length / 4; ++i) { diff --git a/base/sources/ts/mesh_data.ts b/base/sources/ts/mesh_data.ts index 4cb14f14..3b7f329a 100644 --- a/base/sources/ts/mesh_data.ts +++ b/base/sources/ts/mesh_data.ts @@ -44,11 +44,11 @@ function mesh_data_get_vertex_struct(vertex_arrays: vertex_array_t[]): gpu_verte return structure; } -function mesh_data_get_vertex_data(data: string): vertex_data_t { +function mesh_data_get_vertex_data(data: string): gpu_vertex_data_t { if (data == "short4norm") { - return vertex_data_t.I16_4X_NORM; + return gpu_vertex_data_t.I16_4X_NORM; } - return vertex_data_t.I16_2X_NORM; // short2norm + return gpu_vertex_data_t.I16_2X_NORM; // short2norm } function mesh_data_get_vertex_size(vertex_data: string): i32 { diff --git a/base/sources/ts/render_path.ts b/base/sources/ts/render_path.ts index f9c9b7ed..4eba22e7 100644 --- a/base/sources/ts/render_path.ts +++ b/base/sources/ts/render_path.ts @@ -269,32 +269,32 @@ function render_path_create_image(t: render_target_t): gpu_texture_t { if (height < 1) { height = 1; } - return gpu_create_render_target(width, height, t.format != null ? render_path_get_tex_format(t.format) : tex_format_t.RGBA32); + return gpu_create_render_target(width, height, t.format != null ? render_path_get_tex_format(t.format) : gpu_texture_format_t.RGBA32); } -function render_path_get_tex_format(s: string): tex_format_t { +function render_path_get_tex_format(s: string): gpu_texture_format_t { if (s == "RGBA32") { - return tex_format_t.RGBA32; + return gpu_texture_format_t.RGBA32; } if (s == "RGBA64") { - return tex_format_t.RGBA64; + return gpu_texture_format_t.RGBA64; } if (s == "RGBA128") { - return tex_format_t.RGBA128; + return gpu_texture_format_t.RGBA128; } if (s == "R32") { - return tex_format_t.R32; + return gpu_texture_format_t.R32; } if (s == "R16") { - return tex_format_t.R16; + return gpu_texture_format_t.R16; } if (s == "R8") { - return tex_format_t.R8; + return gpu_texture_format_t.R8; } if (s == "D32") { - return tex_format_t.D32; + return gpu_texture_format_t.D32; } - return tex_format_t.RGBA32; + return gpu_texture_format_t.RGBA32; } function render_target_create(): render_target_t { diff --git a/base/sources/ts/shader_data.ts b/base/sources/ts/shader_data.ts index 4f98514f..ef242cae 100644 --- a/base/sources/ts/shader_data.ts +++ b/base/sources/ts/shader_data.ts @@ -120,8 +120,8 @@ function shader_context_compile(raw: shader_context_t) { } if (raw.shader_from_source) { - raw._.pipe.vertex_shader = gpu_create_shader_from_source(raw.vertex_shader, raw._.vertex_shader_size, shader_type_t.VERTEX); - raw._.pipe.fragment_shader = gpu_create_shader_from_source(raw.fragment_shader, raw._.fragment_shader_size, shader_type_t.FRAGMENT); + raw._.pipe.vertex_shader = gpu_create_shader_from_source(raw.vertex_shader, raw._.vertex_shader_size, gpu_shader_type_t.VERTEX); + raw._.pipe.fragment_shader = gpu_create_shader_from_source(raw.fragment_shader, raw._.fragment_shader_size, gpu_shader_type_t.FRAGMENT); if (raw._.pipe.vertex_shader == null || raw._.pipe.fragment_shader == null) { return; } @@ -135,9 +135,9 @@ function shader_context_compile(raw: shader_context_t) { /// else // Load shaders manually let vs_buffer: buffer_t = data_get_blob(raw.vertex_shader + shader_data_ext()); - raw._.pipe.vertex_shader = gpu_create_shader(vs_buffer, shader_type_t.VERTEX); + raw._.pipe.vertex_shader = gpu_create_shader(vs_buffer, gpu_shader_type_t.VERTEX); let fs_buffer: buffer_t = data_get_blob(raw.fragment_shader + shader_data_ext()); - raw._.pipe.fragment_shader = gpu_create_shader(fs_buffer, shader_type_t.FRAGMENT); + raw._.pipe.fragment_shader = gpu_create_shader(fs_buffer, gpu_shader_type_t.FRAGMENT); /// end } @@ -244,26 +244,26 @@ function shader_context_finish_compile(raw: shader_context_t) { } } -function shader_context_parse_data(data: string): vertex_data_t { +function shader_context_parse_data(data: string): gpu_vertex_data_t { if (data == "float1") { - return vertex_data_t.F32_1X; + return gpu_vertex_data_t.F32_1X; } else if (data == "float2") { - return vertex_data_t.F32_2X; + return gpu_vertex_data_t.F32_2X; } else if (data == "float3") { - return vertex_data_t.F32_3X; + return gpu_vertex_data_t.F32_3X; } else if (data == "float4") { - return vertex_data_t.F32_4X; + return gpu_vertex_data_t.F32_4X; } else if (data == "short2norm") { - return vertex_data_t.I16_2X_NORM; + return gpu_vertex_data_t.I16_2X_NORM; } else if (data == "short4norm") { - return vertex_data_t.I16_4X_NORM; + return gpu_vertex_data_t.I16_4X_NORM; } - return vertex_data_t.F32_1X; + return gpu_vertex_data_t.F32_1X; } function shader_context_parse_vertex_struct(raw: shader_context_t) { @@ -286,71 +286,71 @@ function shader_context_delete(raw: shader_context_t) { gpu_delete_pipeline(raw._.pipe); } -function shader_context_get_compare_mode(s: string): compare_mode_t { +function shader_context_get_compare_mode(s: string): gpu_compare_mode_t { if (s == "always") { - return compare_mode_t.ALWAYS; + return gpu_compare_mode_t.ALWAYS; } if (s == "never") { - return compare_mode_t.NEVER; + return gpu_compare_mode_t.NEVER; } if (s == "equal") { - return compare_mode_t.EQUAL; + return gpu_compare_mode_t.EQUAL; } - return compare_mode_t.LESS; + return gpu_compare_mode_t.LESS; } -function shader_context_get_cull_mode(s: string): cull_mode_t { +function shader_context_get_cull_mode(s: string): gpu_cull_mode_t { if (s == "none") { - return cull_mode_t.NONE; + return gpu_cull_mode_t.NONE; } if (s == "clockwise") { - return cull_mode_t.CLOCKWISE; + return gpu_cull_mode_t.CLOCKWISE; } - return cull_mode_t.COUNTER_CLOCKWISE; + return gpu_cull_mode_t.COUNTER_CLOCKWISE; } -function shader_context_get_blend_fac(s: string): blend_factor_t { +function shader_context_get_blend_fac(s: string): gpu_blend_t { if (s == "blend_one") { - return blend_factor_t.BLEND_ONE; + return gpu_blend_t.ONE; } if (s == "blend_zero") { - return blend_factor_t.BLEND_ZERO; + return gpu_blend_t.ZERO; } if (s == "source_alpha") { - return blend_factor_t.SOURCE_ALPHA; + return gpu_blend_t.SOURCE_ALPHA; } if (s == "destination_alpha") { - return blend_factor_t.DEST_ALPHA; + return gpu_blend_t.DEST_ALPHA; } if (s == "inverse_source_alpha") { - return blend_factor_t.INV_SOURCE_ALPHA; + return gpu_blend_t.INV_SOURCE_ALPHA; } if (s == "inverse_destination_alpha") { - return blend_factor_t.INV_DEST_ALPHA; + return gpu_blend_t.INV_DEST_ALPHA; } - return blend_factor_t.BLEND_ONE; + return gpu_blend_t.ONE; } -function shader_context_get_tex_format(s: string): tex_format_t { +function shader_context_get_tex_format(s: string): gpu_texture_format_t { if (s == "RGBA32") { - return tex_format_t.RGBA32; + return gpu_texture_format_t.RGBA32; } if (s == "RGBA64") { - return tex_format_t.RGBA64; + return gpu_texture_format_t.RGBA64; } if (s == "RGBA128") { - return tex_format_t.RGBA128; + return gpu_texture_format_t.RGBA128; } if (s == "R32") { - return tex_format_t.R32; + return gpu_texture_format_t.R32; } if (s == "R16") { - return tex_format_t.R16; + return gpu_texture_format_t.R16; } if (s == "R8") { - return tex_format_t.R8; + return gpu_texture_format_t.R8; } - return tex_format_t.RGBA32; + return gpu_texture_format_t.RGBA32; } function shader_context_add_const(raw: shader_context_t, offset: i32) { diff --git a/base/sources/ts/sys.ts b/base/sources/ts/sys.ts index 72ab8789..c7c50349 100644 --- a/base/sources/ts/sys.ts +++ b/base/sources/ts/sys.ts @@ -288,7 +288,7 @@ function sys_get_shader(name: string): gpu_shader_t { let shader: gpu_shader_t = map_get(_sys_shaders, name); if (shader == null) { shader = - gpu_create_shader(iron_load_blob(data_path() + name + sys_shader_ext()), ends_with(name, ".frag") ? shader_type_t.FRAGMENT : shader_type_t.VERTEX); + gpu_create_shader(iron_load_blob(data_path() + name + sys_shader_ext()), ends_with(name, ".frag") ? gpu_shader_type_t.FRAGMENT : gpu_shader_type_t.VERTEX); map_set(_sys_shaders, name, shader); } return shader; diff --git a/base/tests/triangle/main.ts b/base/tests/triangle/main.ts index 4c22c43b..dfdb6d19 100644 --- a/base/tests/triangle/main.ts +++ b/base/tests/triangle/main.ts @@ -32,11 +32,11 @@ function main() { pipeline = gpu_create_pipeline(); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_3X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_3X); let vs_buffer: buffer_t = iron_load_blob("./data/test.vert" + sys_shader_ext()); let fs_buffer: buffer_t = iron_load_blob("./data/test.frag" + sys_shader_ext()); - let vert: gpu_shader_t = gpu_create_shader(vs_buffer, shader_type_t.VERTEX); - let frag: gpu_shader_t = gpu_create_shader(fs_buffer, shader_type_t.FRAGMENT); + let vert: gpu_shader_t = gpu_create_shader(vs_buffer, gpu_shader_type_t.VERTEX); + let frag: gpu_shader_t = gpu_create_shader(fs_buffer, gpu_shader_type_t.FRAGMENT); pipeline.vertex_shader = vert; pipeline.fragment_shader = frag; pipeline.input_layout = vs; diff --git a/base/tools/amake/alang.js b/base/tools/amake/alang.js index 56cbe8eb..8abae8e4 100644 --- a/base/tools/amake/alang.js +++ b/base/tools/amake/alang.js @@ -1099,7 +1099,7 @@ function _t_to_struct(type) { // type_t * -> struct type * if (type.endsWith("_t *") && type != "string_t *") { let type_short = strip(type, 4); // _t * - if (type_short.endsWith("_array")) { // tex_format_t_array -> i32_array + if (type_short.endsWith("_array")) { // gpu_texture_format_t_array -> i32_array for (let e of enums) { if (type_short.startsWith(e)) { type_short = "i32_array"; diff --git a/base/tools/amake/alang.ts b/base/tools/amake/alang.ts index eaac42d4..7b947574 100644 --- a/base/tools/amake/alang.ts +++ b/base/tools/amake/alang.ts @@ -1121,7 +1121,7 @@ function _t_to_struct(type: string): string { // type_t * -> struct type * if (ends_with(type, "_t *") && type != "string_t *") { let type_short: string = strip(type, 4); // _t * - if (ends_with(type_short, "_array")) { // tex_format_t_array -> i32_array + if (ends_with(type_short, "_array")) { // gpu_texture_format_t_array -> i32_array for (let i: i32 = 0; i < enums.length; ++i) { let e: string = enums[i]; if (starts_with(type_short, e)) { diff --git a/base/tools/pad/sources/main.ts b/base/tools/pad/sources/main.ts index c3fbce67..63b82136 100644 --- a/base/tools/pad/sources/main.ts +++ b/base/tools/pad/sources/main.ts @@ -182,7 +182,7 @@ function render() { storage.window_x = iron_window_x(); storage.window_y = iron_window_y(); if (ui.input_dx != 0 || ui.input_dy != 0) { - iron_mouse_set_cursor(cursor_t.ARROW); + iron_mouse_set_cursor(iron_cursor_t.ARROW); } ui_begin(ui); @@ -362,7 +362,7 @@ function on_border_hover(handle: ui_handle_t, side: i32) { return; // Right } - iron_mouse_set_cursor(cursor_t.SIZEWE); + iron_mouse_set_cursor(iron_cursor_t.SIZEWE); if (ui.input_started) { resizing_sidebar = true; diff --git a/paint/sources/base.ts b/paint/sources/base.ts index a4ad3245..cf07a714 100644 --- a/paint/sources/base.ts +++ b/paint/sources/base.ts @@ -311,7 +311,7 @@ function base_resize() { function base_update() { if (mouse_movement_x != 0 || mouse_movement_y != 0) { - iron_mouse_set_cursor(cursor_t.ARROW); + iron_mouse_set_cursor(iron_cursor_t.ARROW); } let has_drag: bool = base_drag_asset != null || base_drag_material != null || base_drag_layer != null || base_drag_file != null || base_drag_swatch != null; @@ -421,7 +421,7 @@ function base_update() { base_drag_layer = null; } - iron_mouse_set_cursor(cursor_t.ARROW); + iron_mouse_set_cursor(iron_cursor_t.ARROW); base_is_dragging = false; } if (context_raw.color_picker_callback != null && (mouse_released() || mouse_released("right"))) { @@ -561,7 +561,7 @@ function base_render() { context_raw.frame++; if (base_is_dragging) { - iron_mouse_set_cursor(cursor_t.HAND); + iron_mouse_set_cursor(iron_cursor_t.HAND); let img: gpu_texture_t = base_get_drag_image(); let scale_factor: f32 = UI_SCALE(); let size: f32 = (base_drag_size == -1 ? 50 : base_drag_size) * scale_factor; @@ -1921,7 +1921,7 @@ function ui_base_on_border_hover(handle: ui_handle_t, side: i32) { return; // UI is snapped to the right side } - side == border_side_t.LEFT || side == border_side_t.RIGHT ? iron_mouse_set_cursor(cursor_t.SIZEWE) : iron_mouse_set_cursor(cursor_t.SIZENS); + side == border_side_t.LEFT || side == border_side_t.RIGHT ? iron_mouse_set_cursor(iron_cursor_t.SIZEWE) : iron_mouse_set_cursor(iron_cursor_t.SIZENS); if (ui.input_started) { ui_base_border_started = side; diff --git a/paint/sources/brush_nodes/color_node.ts b/paint/sources/brush_nodes/color_node.ts index 93debd00..af98833e 100644 --- a/paint/sources/brush_nodes/color_node.ts +++ b/paint/sources/brush_nodes/color_node.ts @@ -41,7 +41,7 @@ function color_node_get_as_image(self: color_node_t, from: i32): gpu_texture_t { buffer_set_f32(b, 4, self.value.y); buffer_set_f32(b, 8, self.value.z); buffer_set_f32(b, 12, self.value.w); - self.image = gpu_create_texture_from_bytes(b, 1, 1, tex_format_t.RGBA128); + self.image = gpu_create_texture_from_bytes(b, 1, 1, gpu_texture_format_t.RGBA128); return self.image; } diff --git a/paint/sources/brush_nodes/float_node.ts b/paint/sources/brush_nodes/float_node.ts index 9f267a63..3f8079de 100644 --- a/paint/sources/brush_nodes/float_node.ts +++ b/paint/sources/brush_nodes/float_node.ts @@ -37,7 +37,7 @@ function float_node_get_as_image(self: float_node_t, from: i32): gpu_texture_t { buffer_set_f32(b, 4, self.value); buffer_set_f32(b, 8, self.value); buffer_set_f32(b, 12, 1.0); - self.image = gpu_create_texture_from_bytes(b, 1, 1, tex_format_t.RGBA128); + self.image = gpu_create_texture_from_bytes(b, 1, 1, gpu_texture_format_t.RGBA128); return self.image; } diff --git a/paint/sources/brush_nodes/vector_node.ts b/paint/sources/brush_nodes/vector_node.ts index 37062045..aadb2065 100644 --- a/paint/sources/brush_nodes/vector_node.ts +++ b/paint/sources/brush_nodes/vector_node.ts @@ -48,7 +48,7 @@ function vector_node_get_as_image(self: vector_node_t, from: i32): gpu_texture_t buffer_set_f32(b, 4, n1.value); buffer_set_f32(b, 8, n2.value); buffer_set_f32(b, 12, 1.0); - self.image = gpu_create_texture_from_bytes(b, 1, 1, tex_format_t.RGBA128); + self.image = gpu_create_texture_from_bytes(b, 1, 1, gpu_texture_format_t.RGBA128); return self.image; } diff --git a/paint/sources/history.ts b/paint/sources/history.ts index fe64ad03..29831b1e 100644 --- a/paint/sources/history.ts +++ b/paint/sources/history.ts @@ -671,11 +671,11 @@ function history_copy_to_undo(from_id: i32, to_id: i32, is_mask: bool) { render_path_bind_target("texpaint_nor" + from_id, "tex1"); render_path_bind_target("texpaint_pack" + from_id, "tex2"); - let format: tex_format_t = base_bits_handle.i == texture_bits_t.BITS8 ? tex_format_t.RGBA32 - : base_bits_handle.i == texture_bits_t.BITS16 ? tex_format_t.RGBA64 - : tex_format_t.RGBA128; + let format: gpu_texture_format_t = base_bits_handle.i == texture_bits_t.BITS8 ? gpu_texture_format_t.RGBA32 + : base_bits_handle.i == texture_bits_t.BITS16 ? gpu_texture_format_t.RGBA64 + : gpu_texture_format_t.RGBA128; - let pipe: string = format == tex_format_t.RGBA32 ? "copy_mrt3_pass" : format == tex_format_t.RGBA64 ? "copy_mrt3RGBA64_pass" : "copy_mrt3RGBA128_pass"; + let pipe: string = format == gpu_texture_format_t.RGBA32 ? "copy_mrt3_pass" : format == gpu_texture_format_t.RGBA64 ? "copy_mrt3RGBA64_pass" : "copy_mrt3RGBA128_pass"; render_path_draw_shader("Scene/copy_mrt3_pass/" + pipe); } diff --git a/paint/sources/import_arm.ts b/paint/sources/import_arm.ts index fbe54c32..2cff65c5 100644 --- a/paint/sources/import_arm.ts +++ b/paint/sources/import_arm.ts @@ -72,7 +72,7 @@ function import_arm_run_project(path: string) { let bits_pos: texture_bits_t = l0.bpp == 8 ? texture_bits_t.BITS8 : l0.bpp == 16 ? texture_bits_t.BITS16 : texture_bits_t.BITS32; base_bits_handle.i = bits_pos; let bytes_per_pixel: i32 = math_floor(l0.bpp / 8); - let format: tex_format_t = l0.bpp == 8 ? tex_format_t.RGBA32 : l0.bpp == 16 ? tex_format_t.RGBA64 : tex_format_t.RGBA128; + let format: gpu_texture_format_t = l0.bpp == 8 ? gpu_texture_format_t.RGBA32 : l0.bpp == 16 ? gpu_texture_format_t.RGBA64 : gpu_texture_format_t.RGBA128; let base: string = path_base_dir(path); if (project_raw.envmap != null) { @@ -184,13 +184,13 @@ function import_arm_run_project(path: string) { gpu_delete_texture(_texpaint_blend0); blend0.width = config_get_texture_res_x(); blend0.height = config_get_texture_res_y(); - blend0._image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), tex_format_t.R8); + blend0._image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), gpu_texture_format_t.R8); let blend1: render_target_t = map_get(rts, "texpaint_blend1"); let _texpaint_blend1: gpu_texture_t = blend1._image; gpu_delete_texture(_texpaint_blend1); blend1.width = config_get_texture_res_x(); blend1.height = config_get_texture_res_y(); - blend1._image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), tex_format_t.R8); + blend1._image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), gpu_texture_format_t.R8); context_raw.brush_blend_dirty = true; } @@ -217,7 +217,7 @@ function import_arm_run_project(path: string) { let _texpaint_pack: gpu_texture_t = null; if (is_mask) { - _texpaint = gpu_create_texture_from_bytes(lz4_decode(ld.texpaint, ld.res * ld.res * 4), ld.res, ld.res, tex_format_t.RGBA32); + _texpaint = gpu_create_texture_from_bytes(lz4_decode(ld.texpaint, ld.res * ld.res * 4), ld.res, ld.res, gpu_texture_format_t.RGBA32); draw_begin(l.texpaint); // draw_set_pipeline(pipes_copy8); draw_set_pipeline(project.is_bgra ? pipes_copy_bgra : pipes_copy); // Full bits for undo support, R8 is used diff --git a/paint/sources/import_envmap.ts b/paint/sources/import_envmap.ts index 524e95f5..66ffa0f1 100644 --- a/paint/sources/import_envmap.ts +++ b/paint/sources/import_envmap.ts @@ -15,22 +15,22 @@ function import_envmap_run(path: string, image: gpu_texture_t) { import_envmap_pipeline.vertex_shader = sys_get_shader("prefilter_envmap.vert"); import_envmap_pipeline.fragment_shader = sys_get_shader("prefilter_envmap.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_2X); import_envmap_pipeline.input_layout = vs; import_envmap_pipeline.color_attachment_count = 1; - ARRAY_ACCESS(import_envmap_pipeline.color_attachment, 0) = tex_format_t.RGBA128; + ARRAY_ACCESS(import_envmap_pipeline.color_attachment, 0) = gpu_texture_format_t.RGBA128; gpu_pipeline_compile(import_envmap_pipeline); import_envmap_params_loc = 0; import_envmap_radiance_loc = 0; import_envmap_noise_loc = 1; - import_envmap_radiance = gpu_create_render_target(1024, 512, tex_format_t.RGBA128); + import_envmap_radiance = gpu_create_render_target(1024, 512, gpu_texture_format_t.RGBA128); import_envmap_mips = []; let w: i32 = 512; for (let i: i32 = 0; i < 5; ++i) { - array_push(import_envmap_mips, gpu_create_render_target(w, w > 1 ? math_floor(w / 2) : 1, tex_format_t.RGBA128)); + array_push(import_envmap_mips, gpu_create_render_target(w, w > 1 ? math_floor(w / 2) : 1, gpu_texture_format_t.RGBA128)); w = math_floor(w / 2); } } diff --git a/paint/sources/make_material.ts b/paint/sources/make_material.ts index 2c6c6933..053e74e9 100644 --- a/paint/sources/make_material.ts +++ b/paint/sources/make_material.ts @@ -276,7 +276,7 @@ function make_material_bake_node_preview(node: ui_node_t, group: ui_node_canvas_ if (image != null) { gpu_delete_texture(image); } - image = gpu_create_render_target(res_x, res_y, tex_format_t.R8); + image = gpu_create_render_target(res_x, res_y, gpu_texture_format_t.R8); map_set(context_raw.node_previews, id, image); } diff --git a/paint/sources/make_paint.ts b/paint/sources/make_paint.ts index 2a75a8db..8ca274a6 100644 --- a/paint/sources/make_paint.ts +++ b/paint/sources/make_paint.ts @@ -21,15 +21,15 @@ function make_paint_color_attachments(): string[] { return res; } - let format: tex_format_t = base_bits_handle.i == texture_bits_t.BITS8 ? tex_format_t.RGBA32 - : base_bits_handle.i == texture_bits_t.BITS16 ? tex_format_t.RGBA64 - : tex_format_t.RGBA128; + let format: gpu_texture_format_t = base_bits_handle.i == texture_bits_t.BITS8 ? gpu_texture_format_t.RGBA32 + : base_bits_handle.i == texture_bits_t.BITS16 ? gpu_texture_format_t.RGBA64 + : gpu_texture_format_t.RGBA128; - if (format == tex_format_t.RGBA64) { + if (format == gpu_texture_format_t.RGBA64) { let res: string[] = [ "RGBA64", "RGBA64", "RGBA64", "R8" ]; return res; } - if (format == tex_format_t.RGBA128) { + if (format == gpu_texture_format_t.RGBA128) { let res: string[] = [ "RGBA128", "RGBA128", "RGBA128", "R8" ]; return res; } diff --git a/paint/sources/make_sculpt.ts b/paint/sources/make_sculpt.ts index e3b8a76e..a30fac46 100644 --- a/paint/sources/make_sculpt.ts +++ b/paint/sources/make_sculpt.ts @@ -11,7 +11,7 @@ function sculpt_import_mesh_pack_to_texture(mesh: mesh_data_t, l: slot_layer_t) buffer_set_f32(b, 4 * i * 4 + 3 * 4, 1.0); } - let imgmesh: gpu_texture_t = gpu_create_texture_from_bytes(b, config_get_texture_res_x(), config_get_texture_res_y(), tex_format_t.RGBA128); + let imgmesh: gpu_texture_t = gpu_create_texture_from_bytes(b, config_get_texture_res_x(), config_get_texture_res_y(), gpu_texture_format_t.RGBA128); draw_begin(l.texpaint_sculpt); draw_set_pipeline(pipes_copy128); draw_scaled_image(imgmesh, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); diff --git a/paint/sources/neural_nodes/tile_image_node.ts b/paint/sources/neural_nodes/tile_image_node.ts index 0ff6e062..920a4c18 100644 --- a/paint/sources/neural_nodes/tile_image_node.ts +++ b/paint/sources/neural_nodes/tile_image_node.ts @@ -51,7 +51,7 @@ function tile_image_node_button(node_id: i32) { u8a[i] = (x > 256 - l && x < 256 + l) ? 255 : 0; // u8a[i] = (x > 256 - l && x < 256 + l) ? 128 : 0; } - let mask: gpu_texture_t = gpu_create_texture_from_bytes(u8a, 512, 512, tex_format_t.R8); + let mask: gpu_texture_t = gpu_create_texture_from_bytes(u8a, 512, 512, gpu_texture_format_t.R8); let dir: string = neural_node_dir(); iron_write_png(dir + path_sep + "input.png", gpu_get_texture_pixels(tile), tile.width, tile.height, 0); diff --git a/paint/sources/pipes.ts b/paint/sources/pipes.ts index 26609245..66ace2e0 100644 --- a/paint/sources/pipes.ts +++ b/paint/sources/pipes.ts @@ -58,7 +58,7 @@ function _pipes_make_merge(red: bool, green: bool, blue: bool, alpha: bool): gpu pipe.vertex_shader = sys_get_shader("layer_merge.vert"); pipe.fragment_shader = sys_get_shader("layer_merge.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_2X); pipe.input_layout = vs; ARRAY_ACCESS(pipe.color_write_mask_red, 0) = red; ARRAY_ACCESS(pipe.color_write_mask_green, 0) = green; @@ -87,7 +87,7 @@ function pipes_init() { pipes_copy.vertex_shader = sys_get_shader("layer_copy.vert"); pipes_copy.fragment_shader = sys_get_shader("layer_copy.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_2X); pipes_copy.input_layout = vs; gpu_pipeline_compile(pipes_copy); } @@ -97,7 +97,7 @@ function pipes_init() { pipes_copy_bgra.vertex_shader = sys_get_shader("layer_copy_bgra.vert"); pipes_copy_bgra.fragment_shader = sys_get_shader("layer_copy_bgra.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_2X); pipes_copy_bgra.input_layout = vs; gpu_pipeline_compile(pipes_copy_bgra); } @@ -107,10 +107,10 @@ function pipes_init() { pipes_copy8.vertex_shader = sys_get_shader("layer_copy.vert"); pipes_copy8.fragment_shader = sys_get_shader("layer_copy.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_2X); pipes_copy8.input_layout = vs; pipes_copy8.color_attachment_count = 1; - ARRAY_ACCESS(pipes_copy8.color_attachment, 0) = tex_format_t.R8; + ARRAY_ACCESS(pipes_copy8.color_attachment, 0) = gpu_texture_format_t.R8; gpu_pipeline_compile(pipes_copy8); } @@ -119,10 +119,10 @@ function pipes_init() { pipes_copy64.vertex_shader = sys_get_shader("layer_copy.vert"); pipes_copy64.fragment_shader = sys_get_shader("layer_copy.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_2X); pipes_copy64.input_layout = vs; pipes_copy64.color_attachment_count = 1; - ARRAY_ACCESS(pipes_copy64.color_attachment, 0) = tex_format_t.RGBA64; + ARRAY_ACCESS(pipes_copy64.color_attachment, 0) = gpu_texture_format_t.RGBA64; gpu_pipeline_compile(pipes_copy64); } @@ -131,10 +131,10 @@ function pipes_init() { pipes_copy128.vertex_shader = sys_get_shader("layer_copy.vert"); pipes_copy128.fragment_shader = sys_get_shader("layer_copy.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_2X); pipes_copy128.input_layout = vs; pipes_copy128.color_attachment_count = 1; - ARRAY_ACCESS(pipes_copy128.color_attachment, 0) = tex_format_t.RGBA128; + ARRAY_ACCESS(pipes_copy128.color_attachment, 0) = gpu_texture_format_t.RGBA128; gpu_pipeline_compile(pipes_copy128); } @@ -143,10 +143,10 @@ function pipes_init() { pipes_invert8.vertex_shader = sys_get_shader("layer_invert.vert"); pipes_invert8.fragment_shader = sys_get_shader("layer_invert.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_2X); pipes_invert8.input_layout = vs; pipes_invert8.color_attachment_count = 1; - ARRAY_ACCESS(pipes_invert8.color_attachment, 0) = tex_format_t.R8; + ARRAY_ACCESS(pipes_invert8.color_attachment, 0) = gpu_texture_format_t.R8; gpu_pipeline_compile(pipes_invert8); } @@ -155,7 +155,7 @@ function pipes_init() { pipes_apply_mask.vertex_shader = sys_get_shader("mask_apply.vert"); pipes_apply_mask.fragment_shader = sys_get_shader("mask_apply.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_2X); pipes_apply_mask.input_layout = vs; gpu_pipeline_compile(pipes_apply_mask); pipes_tex0_mask = 0; @@ -167,7 +167,7 @@ function pipes_init() { pipes_merge_mask.vertex_shader = sys_get_shader("mask_merge.vert"); pipes_merge_mask.fragment_shader = sys_get_shader("mask_merge.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_2X); pipes_merge_mask.input_layout = vs; gpu_pipeline_compile(pipes_merge_mask); pipes_tex0_merge_mask = 0; @@ -182,7 +182,7 @@ function pipes_init() { pipes_colorid_to_mask.vertex_shader = sys_get_shader("mask_colorid.vert"); pipes_colorid_to_mask.fragment_shader = sys_get_shader("mask_colorid.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_2X); pipes_colorid_to_mask.input_layout = vs; gpu_pipeline_compile(pipes_colorid_to_mask); pipes_texpaint_colorid = 0; @@ -194,7 +194,7 @@ function pipes_init() { pipes_copy_rgb.vertex_shader = sys_get_shader("layer_copy.vert"); pipes_copy_rgb.fragment_shader = sys_get_shader("layer_copy.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_2X); pipes_copy_rgb.input_layout = vs; ARRAY_ACCESS(pipes_copy_rgb.color_write_mask_alpha, 0) = false; gpu_pipeline_compile(pipes_copy_rgb); @@ -205,14 +205,14 @@ function pipes_init() { pipes_cursor.vertex_shader = sys_get_shader("cursor.vert"); pipes_cursor.fragment_shader = sys_get_shader("cursor.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.I16_4X_NORM); - gpu_vertex_struct_add(vs, "nor", vertex_data_t.I16_2X_NORM); - gpu_vertex_struct_add(vs, "tex", vertex_data_t.I16_2X_NORM); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.I16_4X_NORM); + gpu_vertex_struct_add(vs, "nor", gpu_vertex_data_t.I16_2X_NORM); + gpu_vertex_struct_add(vs, "tex", gpu_vertex_data_t.I16_2X_NORM); pipes_cursor.input_layout = vs; - pipes_cursor.blend_source = blend_factor_t.SOURCE_ALPHA; - pipes_cursor.blend_destination = blend_factor_t.INV_SOURCE_ALPHA; + pipes_cursor.blend_source = gpu_blend_t.SOURCE_ALPHA; + pipes_cursor.blend_destination = gpu_blend_t.INV_SOURCE_ALPHA; pipes_cursor.depth_write = false; - pipes_cursor.depth_mode = compare_mode_t.ALWAYS; + pipes_cursor.depth_mode = gpu_compare_mode_t.ALWAYS; gpu_pipeline_compile(pipes_cursor); pipes_offset = 0; pipes_cursor_vp = pipes_get_constant_location("mat4"); diff --git a/paint/sources/render_path_deferred.ts b/paint/sources/render_path_deferred.ts index 92f9a9e0..7bf9c310 100644 --- a/paint/sources/render_path_deferred.ts +++ b/paint/sources/render_path_deferred.ts @@ -63,7 +63,7 @@ function render_path_deferred_init() { t.format = "R8"; let b: buffer_t = buffer_create(1); buffer_set_u8(b, 0, 255); - t._image = gpu_create_texture_from_bytes(b, t.width, t.height, tex_format_t.R8); + t._image = gpu_create_texture_from_bytes(b, t.width, t.height, gpu_texture_format_t.R8); map_set(render_path_render_targets, t.name, t); } { @@ -77,7 +77,7 @@ function render_path_deferred_init() { buffer_set_u8(b, 1, 0); buffer_set_u8(b, 2, 0); buffer_set_u8(b, 3, 0); - t._image = gpu_create_texture_from_bytes(b, t.width, t.height, tex_format_t.RGBA32); + t._image = gpu_create_texture_from_bytes(b, t.width, t.height, gpu_texture_format_t.RGBA32); map_set(render_path_render_targets, t.name, t); } diff --git a/paint/sources/slot_layer.ts b/paint/sources/slot_layer.ts index 78f9e91b..6944317c 100644 --- a/paint/sources/slot_layer.ts +++ b/paint/sources/slot_layer.ts @@ -106,7 +106,7 @@ function slot_layer_create(ext: string = "", type: layer_slot_type_t = layer_slo raw.texpaint_pack = render_path_create_render_target(t)._image; } - raw.texpaint_preview = gpu_create_render_target(util_render_layer_preview_size, util_render_layer_preview_size, tex_format_t.RGBA32); + raw.texpaint_preview = gpu_create_render_target(util_render_layer_preview_size, util_render_layer_preview_size, gpu_texture_format_t.RGBA32); } else { // Mask @@ -124,7 +124,7 @@ function slot_layer_create(ext: string = "", type: layer_slot_type_t = layer_slo raw.texpaint = render_path_create_render_target(t)._image; } - raw.texpaint_preview = gpu_create_render_target(util_render_layer_preview_size, util_render_layer_preview_size, tex_format_t.RGBA32); + raw.texpaint_preview = gpu_create_render_target(util_render_layer_preview_size, util_render_layer_preview_size, gpu_texture_format_t.RGBA32); } return raw; @@ -255,7 +255,7 @@ function slot_layer_clear(raw: slot_layer_t, base_color: i32 = 0x00000000, base_ } function slot_layer_invert_mask(raw: slot_layer_t) { - let inverted: gpu_texture_t = gpu_create_render_target(raw.texpaint.width, raw.texpaint.height, tex_format_t.RGBA32); + let inverted: gpu_texture_t = gpu_create_render_target(raw.texpaint.width, raw.texpaint.height, gpu_texture_format_t.RGBA32); draw_begin(inverted); draw_set_pipeline(pipes_invert8); draw_image(raw.texpaint, 0, 0); @@ -363,11 +363,11 @@ function slot_layer_resize_and_set_bits(raw: slot_layer_t) { let rts: map_t = render_path_render_targets; if (slot_layer_is_layer(raw)) { - let format: tex_format_t = base_bits_handle.i == texture_bits_t.BITS8 ? tex_format_t.RGBA32 - : base_bits_handle.i == texture_bits_t.BITS16 ? tex_format_t.RGBA64 - : tex_format_t.RGBA128; + let format: gpu_texture_format_t = base_bits_handle.i == texture_bits_t.BITS8 ? gpu_texture_format_t.RGBA32 + : base_bits_handle.i == texture_bits_t.BITS16 ? gpu_texture_format_t.RGBA64 + : gpu_texture_format_t.RGBA128; - let pipe: gpu_pipeline_t = format == tex_format_t.RGBA32 ? pipes_copy : format == tex_format_t.RGBA64 ? pipes_copy64 : pipes_copy128; + let pipe: gpu_pipeline_t = format == gpu_texture_format_t.RGBA32 ? pipes_copy : format == gpu_texture_format_t.RGBA64 ? pipes_copy64 : pipes_copy128; let _texpaint: gpu_texture_t = raw.texpaint; raw.texpaint = gpu_create_render_target(res_x, res_y, format); @@ -422,7 +422,7 @@ function slot_layer_resize_and_set_bits(raw: slot_layer_t) { } else if (slot_layer_is_mask(raw)) { let _texpaint: gpu_texture_t = raw.texpaint; - raw.texpaint = gpu_create_render_target(res_x, res_y, tex_format_t.RGBA32); + raw.texpaint = gpu_create_render_target(res_x, res_y, gpu_texture_format_t.RGBA32); draw_begin(raw.texpaint); draw_set_pipeline(pipes_copy8); @@ -821,14 +821,14 @@ function layers_resize() { gpu_delete_texture(_texpaint_blend0); blend0.width = config_get_texture_res_x(); blend0.height = config_get_texture_res_y(); - blend0._image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), tex_format_t.R8); + blend0._image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), gpu_texture_format_t.R8); let blend1: render_target_t = map_get(rts, "texpaint_blend1"); let _texpaint_blend1: gpu_texture_t = blend1._image; gpu_delete_texture(_texpaint_blend1); blend1.width = config_get_texture_res_x(); blend1.height = config_get_texture_res_y(); - blend1._image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), tex_format_t.R8); + blend1._image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), gpu_texture_format_t.R8); context_raw.brush_blend_dirty = true; @@ -891,7 +891,7 @@ function layers_make_temp_mask_img() { pipes_temp_mask_image = null; } if (pipes_temp_mask_image == null) { - pipes_temp_mask_image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), tex_format_t.R8); + pipes_temp_mask_image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), gpu_texture_format_t.R8); } } diff --git a/paint/sources/slot_material.ts b/paint/sources/slot_material.ts index 4a232f57..caf9bf2f 100644 --- a/paint/sources/slot_material.ts +++ b/paint/sources/slot_material.ts @@ -45,8 +45,8 @@ function slot_material_create(m: material_data_t = null, c: ui_node_canvas_t = n let w: i32 = util_render_material_preview_size; let w_icon: i32 = 50; - raw.image = gpu_create_render_target(w, w, tex_format_t.RGBA64); - raw.image_icon = gpu_create_render_target(w_icon, w_icon, tex_format_t.RGBA64); + raw.image = gpu_create_render_target(w, w, gpu_texture_format_t.RGBA64); + raw.image_icon = gpu_create_render_target(w_icon, w_icon, gpu_texture_format_t.RGBA64); if (c == null) { if (slot_material_default_canvas == null) { // Synchronous diff --git a/paint/sources/ui_view2d.ts b/paint/sources/ui_view2d.ts index 0dbe85c5..dbe761e6 100644 --- a/paint/sources/ui_view2d.ts +++ b/paint/sources/ui_view2d.ts @@ -31,10 +31,10 @@ function ui_view2d_init() { ui_view2d_pipe.vertex_shader = sys_get_shader("layer_view.vert"); ui_view2d_pipe.fragment_shader = sys_get_shader("layer_view.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.F32_2X); ui_view2d_pipe.input_layout = vs; - ui_view2d_pipe.blend_source = blend_factor_t.BLEND_ONE; - ui_view2d_pipe.blend_destination = blend_factor_t.BLEND_ZERO; + ui_view2d_pipe.blend_source = gpu_blend_t.ONE; + ui_view2d_pipe.blend_destination = gpu_blend_t.ZERO; ARRAY_ACCESS(ui_view2d_pipe.color_write_mask_alpha, 0) = false; gpu_pipeline_compile(ui_view2d_pipe); pipes_offset = 0; diff --git a/paint/sources/util_render.ts b/paint/sources/util_render.ts index 2e1bfb62..eb5b4ae9 100644 --- a/paint/sources/util_render.ts +++ b/paint/sources/util_render.ts @@ -80,7 +80,7 @@ function util_render_make_material_preview() { function util_render_make_decal_preview() { if (context_raw.decal_image == null) { - context_raw.decal_image = gpu_create_render_target(util_render_decal_preview_size, util_render_decal_preview_size, tex_format_t.RGBA64); + context_raw.decal_image = gpu_create_render_target(util_render_decal_preview_size, util_render_decal_preview_size, gpu_texture_format_t.RGBA64); } context_raw.decal_preview = true; @@ -156,7 +156,7 @@ function util_render_make_text_preview() { context_raw.text_tool_image = null; } if (context_raw.text_tool_image == null) { - context_raw.text_tool_image = gpu_create_render_target(tex_w, tex_w, tex_format_t.RGBA32); + context_raw.text_tool_image = gpu_create_render_target(tex_w, tex_w, gpu_texture_format_t.RGBA32); } draw_begin(context_raw.text_tool_image, true, 0xff000000); draw_set_font(font, font_size); @@ -181,7 +181,7 @@ function util_render_make_font_preview() { let text_h: i32 = math_floor(draw_font_height(font, font_size)) + 8; let tex_w: i32 = text_w + 32; if (context_raw.font.image == null) { - context_raw.font.image = gpu_create_render_target(tex_w, tex_w, tex_format_t.RGBA32); + context_raw.font.image = gpu_create_render_target(tex_w, tex_w, gpu_texture_format_t.RGBA32); } draw_begin(context_raw.font.image, true, 0x00000000); draw_set_font(font, font_size); @@ -473,10 +473,10 @@ function util_render_create_screen_aligned_full_data() { // Mandatory vertex data names and sizes let structure: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(structure, "pos", vertex_data_t.I16_4X_NORM); - gpu_vertex_struct_add(structure, "nor", vertex_data_t.I16_2X_NORM); - gpu_vertex_struct_add(structure, "tex", vertex_data_t.I16_2X_NORM); - gpu_vertex_struct_add(structure, "col", vertex_data_t.I16_4X_NORM); + gpu_vertex_struct_add(structure, "pos", gpu_vertex_data_t.I16_4X_NORM); + gpu_vertex_struct_add(structure, "nor", gpu_vertex_data_t.I16_2X_NORM); + gpu_vertex_struct_add(structure, "tex", gpu_vertex_data_t.I16_2X_NORM); + gpu_vertex_struct_add(structure, "col", gpu_vertex_data_t.I16_4X_NORM); util_render_screen_aligned_full_vb = gpu_create_vertex_buffer(math_floor(data.length / math_floor(gpu_vertex_struct_size(structure) / 2)), structure); let vertices: buffer_t = gpu_lock_vertex_buffer(util_render_screen_aligned_full_vb); for (let i: i32 = 0; i < math_floor((vertices.length) / 2); ++i) { diff --git a/paint/sources/util_uv.ts b/paint/sources/util_uv.ts index 6f074a78..937c0fce 100644 --- a/paint/sources/util_uv.ts +++ b/paint/sources/util_uv.ts @@ -102,7 +102,7 @@ function util_uv_cache_dilate_map() { return; if (util_uv_dilatemap == null) { - util_uv_dilatemap = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), tex_format_t.R8); + util_uv_dilatemap = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), gpu_texture_format_t.R8); } if (util_uv_pipe_dilate == null) { @@ -110,13 +110,13 @@ function util_uv_cache_dilate_map() { util_uv_pipe_dilate.vertex_shader = sys_get_shader("dilate_map.vert"); util_uv_pipe_dilate.fragment_shader = sys_get_shader("dilate_map.frag"); let vs: gpu_vertex_structure_t = {}; - gpu_vertex_struct_add(vs, "pos", vertex_data_t.I16_4X_NORM); - gpu_vertex_struct_add(vs, "nor", vertex_data_t.I16_2X_NORM); - gpu_vertex_struct_add(vs, "tex", vertex_data_t.I16_2X_NORM); + gpu_vertex_struct_add(vs, "pos", gpu_vertex_data_t.I16_4X_NORM); + gpu_vertex_struct_add(vs, "nor", gpu_vertex_data_t.I16_2X_NORM); + gpu_vertex_struct_add(vs, "tex", gpu_vertex_data_t.I16_2X_NORM); util_uv_pipe_dilate.input_layout = vs; util_uv_pipe_dilate.depth_write = false; - util_uv_pipe_dilate.depth_mode = compare_mode_t.ALWAYS; - ARRAY_ACCESS(util_uv_pipe_dilate.color_attachment, 0) = tex_format_t.R8; + util_uv_pipe_dilate.depth_mode = gpu_compare_mode_t.ALWAYS; + ARRAY_ACCESS(util_uv_pipe_dilate.color_attachment, 0) = gpu_texture_format_t.R8; gpu_pipeline_compile(util_uv_pipe_dilate); // dilate_tex_unpack = getConstantLocation(pipeDilate, "tex_unpack"); } @@ -185,6 +185,6 @@ function util_uv_cache_uv_island_map() { if (util_uv_uvislandmap != null) { gpu_delete_texture(util_uv_uvislandmap); } - util_uv_uvislandmap = gpu_create_texture_from_bytes(bytes, w, h, tex_format_t.R8); + util_uv_uvislandmap = gpu_create_texture_from_bytes(bytes, w, h, gpu_texture_format_t.R8); util_uv_uvislandmap_cached = true; }