diff --git a/armorlab/sources/nodes/inpaint_node.ts b/armorlab/sources/nodes/inpaint_node.ts index fc4320e4..51603f54 100644 --- a/armorlab/sources/nodes/inpaint_node.ts +++ b/armorlab/sources/nodes/inpaint_node.ts @@ -89,8 +89,8 @@ function inpaint_node_get_cached_image(self: inpaint_node_t): iron_gpu_texture_t let source: iron_gpu_texture_t = logic_node_input_get_as_image(self.base.inputs[0]); _gpu_begin(inpaint_node_image); iron_gpu_set_pipeline(pipes_inpaint_preview); - _gpu_set_texture(pipes_tex0_inpaint_preview, source); - _gpu_set_texture(pipes_texa_inpaint_preview, inpaint_node_mask); + gpu_set_texture(pipes_tex0_inpaint_preview, source); + gpu_set_texture(pipes_texa_inpaint_preview, inpaint_node_mask); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw_indexed_vertices(); diff --git a/armorlab/sources/render_path_paint.ts b/armorlab/sources/render_path_paint.ts index 1267b5e5..fe9bc9df 100644 --- a/armorlab/sources/render_path_paint.ts +++ b/armorlab/sources/render_path_paint.ts @@ -190,17 +190,17 @@ function render_path_paint_draw_cursor(mx: f32, my: f32, radius: f32, tint_r: f3 render_path_set_target(""); iron_gpu_set_pipeline(pipes_cursor); let gbuffer0: render_target_t = map_get(render_path_render_targets, "gbuffer0"); - _gpu_set_texture_depth(pipes_cursor_gbufferd, gbuffer0._image); - _gpu_set_float2(pipes_cursor_mouse, mx, my); - _gpu_set_float2(pipes_cursor_tex_step, 1 / gbuffer0._image.width, 1 / gbuffer0._image.height); - _gpu_set_float(pipes_cursor_radius, radius); + gpu_set_texture_depth(pipes_cursor_gbufferd, gbuffer0._image); + gpu_set_float2(pipes_cursor_mouse, mx, my); + gpu_set_float2(pipes_cursor_tex_step, 1 / gbuffer0._image.width, 1 / gbuffer0._image.height); + gpu_set_float(pipes_cursor_radius, radius); let right: vec4_t = vec4_norm(camera_object_right_world(scene_camera)); - _gpu_set_float3(pipes_cursor_camera_right, right.x, right.y, right.z); - _gpu_set_float3(pipes_cursor_tint, tint_r, tint_g, tint_b); - _gpu_set_matrix4(pipes_cursor_vp, scene_camera.vp); + gpu_set_float3(pipes_cursor_camera_right, right.x, right.y, right.z); + gpu_set_float3(pipes_cursor_tint, tint_r, tint_g, tint_b); + gpu_set_matrix4(pipes_cursor_vp, scene_camera.vp); let help_mat: mat4_t = mat4_identity(); help_mat = mat4_inv(scene_camera.vp); - _gpu_set_matrix4(pipes_cursor_inv_vp, help_mat); + gpu_set_matrix4(pipes_cursor_inv_vp, help_mat); ///if (arm_metal || arm_vulkan) let vs: vertex_element_t[] = [ { diff --git a/armorlab/sources/ui_nodes_ext.ts b/armorlab/sources/ui_nodes_ext.ts index 9aceb99e..4854cdb1 100644 --- a/armorlab/sources/ui_nodes_ext.ts +++ b/armorlab/sources/ui_nodes_ext.ts @@ -80,7 +80,7 @@ function ui_nodes_ext_run() { if (texheight != null) { _gpu_begin(texpaint_pack._image); iron_gpu_set_pipeline(pipes_copy_a); - _gpu_set_texture(pipes_copy_a_tex, texheight); + gpu_set_texture(pipes_copy_a_tex, texheight); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw_indexed_vertices(); diff --git a/armorpaint/sources/layers_ext.ts b/armorpaint/sources/layers_ext.ts index fde47f09..9c963f1c 100644 --- a/armorpaint/sources/layers_ext.ts +++ b/armorpaint/sources/layers_ext.ts @@ -66,12 +66,12 @@ function layers_ext_flatten(height_to_normal: bool = false, layers: slot_layer_t ///else _gpu_begin(layers_expa); iron_gpu_set_pipeline(pipes_merge); - _gpu_set_texture(pipes_tex0, l1.texpaint); - _gpu_set_texture(pipes_tex1, empty); - _gpu_set_texture(pipes_texmask, mask); - _gpu_set_texture(pipes_texa, layers_temp_image); - _gpu_set_float(pipes_opac, slot_layer_get_opacity(l1)); - _gpu_set_int(pipes_blending, layers.length > 1 ? l1.blending : 0); + gpu_set_texture(pipes_tex0, l1.texpaint); + gpu_set_texture(pipes_tex1, empty); + gpu_set_texture(pipes_texmask, mask); + gpu_set_texture(pipes_texa, layers_temp_image); + gpu_set_float(pipes_opac, slot_layer_get_opacity(l1)); + gpu_set_int(pipes_blending, layers.length > 1 ? l1.blending : 0); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw_indexed_vertices(); @@ -88,12 +88,12 @@ function layers_ext_flatten(height_to_normal: bool = false, layers: slot_layer_t _gpu_begin(layers_expb); iron_gpu_set_pipeline(pipes_merge); - _gpu_set_texture(pipes_tex0, l1.texpaint); - _gpu_set_texture(pipes_tex1, l1.texpaint_nor); - _gpu_set_texture(pipes_texmask, mask); - _gpu_set_texture(pipes_texa, layers_temp_image); - _gpu_set_float(pipes_opac, slot_layer_get_opacity(l1)); - _gpu_set_int(pipes_blending, l1.paint_nor_blend ? -2 : -1); + gpu_set_texture(pipes_tex0, l1.texpaint); + gpu_set_texture(pipes_tex1, l1.texpaint_nor); + gpu_set_texture(pipes_texmask, mask); + gpu_set_texture(pipes_texa, layers_temp_image); + gpu_set_float(pipes_opac, slot_layer_get_opacity(l1)); + gpu_set_int(pipes_blending, l1.paint_nor_blend ? -2 : -1); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw_indexed_vertices(); @@ -151,12 +151,12 @@ function layers_ext_flatten(height_to_normal: bool = false, layers: slot_layer_t _gpu_begin(l0.texpaint_nor); iron_gpu_set_pipeline(pipes_merge); - _gpu_set_texture(pipes_tex0, layers_temp_image); - _gpu_set_texture(pipes_tex1, l0.texpaint_pack); - _gpu_set_texture(pipes_texmask, empty); - _gpu_set_texture(pipes_texa, empty); - _gpu_set_float(pipes_opac, 1.0); - _gpu_set_int(pipes_blending, -4); + gpu_set_texture(pipes_tex0, layers_temp_image); + gpu_set_texture(pipes_tex1, l0.texpaint_pack); + gpu_set_texture(pipes_texmask, empty); + gpu_set_texture(pipes_texa, empty); + gpu_set_float(pipes_opac, 1.0); + gpu_set_int(pipes_blending, -4); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw_indexed_vertices(); diff --git a/armorpaint/sources/render_path_paint.ts b/armorpaint/sources/render_path_paint.ts index f3837516..0e2b84d1 100644 --- a/armorpaint/sources/render_path_paint.ts +++ b/armorpaint/sources/render_path_paint.ts @@ -442,17 +442,17 @@ function render_path_paint_draw_cursor(mx: f32, my: f32, radius: f32, tint_r: f3 iron_gpu_set_pipeline(pipes_cursor); let rt: render_target_t = map_get(render_path_render_targets, "gbuffer0"); let gbuffer0: iron_gpu_texture_t = rt._image; - _gpu_set_texture_depth(pipes_cursor_gbufferd, gbuffer0); - _gpu_set_float2(pipes_cursor_mouse, mx, my); - _gpu_set_float2(pipes_cursor_tex_step, 1 / gbuffer0.width, 1 / gbuffer0.height); - _gpu_set_float(pipes_cursor_radius, radius); + gpu_set_texture_depth(pipes_cursor_gbufferd, gbuffer0); + gpu_set_float2(pipes_cursor_mouse, mx, my); + gpu_set_float2(pipes_cursor_tex_step, 1 / gbuffer0.width, 1 / gbuffer0.height); + gpu_set_float(pipes_cursor_radius, radius); let right: vec4_t = vec4_norm(camera_object_right_world(scene_camera)); - _gpu_set_float3(pipes_cursor_camera_right, right.x, right.y, right.z); - _gpu_set_float3(pipes_cursor_tint, tint_r, tint_g, tint_b); - _gpu_set_matrix4(pipes_cursor_vp, scene_camera.vp); + gpu_set_float3(pipes_cursor_camera_right, right.x, right.y, right.z); + gpu_set_float3(pipes_cursor_tint, tint_r, tint_g, tint_b); + gpu_set_matrix4(pipes_cursor_vp, scene_camera.vp); let help_mat: mat4_t = mat4_identity(); help_mat = mat4_inv(scene_camera.vp); - _gpu_set_matrix4(pipes_cursor_inv_vp, help_mat); + gpu_set_matrix4(pipes_cursor_inv_vp, help_mat); ///if (arm_metal || arm_vulkan) let vs: vertex_element_t[] = [ { diff --git a/armorpaint/sources/ui_header_ext.ts b/armorpaint/sources/ui_header_ext.ts index b354650e..e3ed2b9d 100644 --- a/armorpaint/sources/ui_header_ext.ts +++ b/armorpaint/sources/ui_header_ext.ts @@ -55,8 +55,8 @@ function ui_header_draw_tool_properties(ui: ui_t) { _gpu_begin(m.texpaint); iron_gpu_set_pipeline(pipes_colorid_to_mask); let rt: render_target_t = map_get(render_path_render_targets, "texpaint_colorid"); - _gpu_set_texture(pipes_texpaint_colorid, rt._image); - _gpu_set_texture(pipes_tex_colorid, project_get_image(project_assets[context_raw.colorid_handle.position])); + gpu_set_texture(pipes_texpaint_colorid, rt._image); + gpu_set_texture(pipes_tex_colorid, project_get_image(project_assets[context_raw.colorid_handle.position])); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw_indexed_vertices(); diff --git a/base/sources/backends/vulkan_gpu.c b/base/sources/backends/vulkan_gpu.c index 522f7997..ae7f2b62 100644 --- a/base/sources/backends/vulkan_gpu.c +++ b/base/sources/backends/vulkan_gpu.c @@ -1840,10 +1840,6 @@ void iron_gpu_command_list_render_target_to_texture_barrier(iron_gpu_command_lis // render-passes are used to transition render-targets } -void iron_gpu_command_list_set_vertex_constant_buffer(iron_gpu_command_list_t *list, struct iron_gpu_buffer *buffer, int offset, size_t size) { - last_vertex_constant_buffer_offset = offset; -} - int calc_descriptor_id(void) { int texture_count = 0; for (int i = 0; i < 16; ++i) { @@ -1934,7 +1930,6 @@ VkDescriptorSet get_descriptor_set() { vkAllocateDescriptorSets(vk_ctx.device, &alloc_info, &descriptor_set); VkDescriptorBufferInfo buffer_descs[2]; - memset(&buffer_descs, 0, sizeof(buffer_descs)); if (vk_ctx.vertex_uniform_buffer != NULL) { @@ -2017,6 +2012,10 @@ VkDescriptorSet get_descriptor_set() { return descriptor_set; } +void iron_gpu_command_list_set_vertex_constant_buffer(iron_gpu_command_list_t *list, struct iron_gpu_buffer *buffer, int offset, size_t size) { + last_vertex_constant_buffer_offset = offset; +} + void iron_gpu_command_list_set_fragment_constant_buffer(iron_gpu_command_list_t *list, struct iron_gpu_buffer *buffer, int offset, size_t size) { last_fragment_constant_buffer_offset = offset; diff --git a/base/sources/iron.h b/base/sources/iron.h index f6a594e9..97e26168 100644 --- a/base/sources/iron.h +++ b/base/sources/iron.h @@ -1294,14 +1294,6 @@ iron_gpu_texture_unit_t *gpu_get_texture_unit(iron_gpu_pipeline_t *pipeline, str return unit_copy; } -void _gpu_set_texture(iron_gpu_texture_unit_t *unit, iron_gpu_texture_t *texture) { - gpu_set_texture(unit, texture); -} - -void _gpu_set_texture_depth(iron_gpu_texture_unit_t *unit, iron_gpu_texture_t *render_target) { - gpu_set_texture_depth(unit, render_target); -} - void gpu_set_texture_parameters(iron_gpu_texture_unit_t *unit, i32 u_addr, i32 v_addr, i32 min_filter, i32 mag_filter, i32 mip_filter) { gpu_set_texture_addressing(*unit, GPU_TEXTURE_DIRECTION_U, (gpu_texture_addressing_t)u_addr); gpu_set_texture_addressing(*unit, GPU_TEXTURE_DIRECTION_V, (gpu_texture_addressing_t)v_addr); @@ -1310,42 +1302,6 @@ void gpu_set_texture_parameters(iron_gpu_texture_unit_t *unit, i32 u_addr, i32 v gpu_set_texture_mipmap_filter(*unit, (gpu_mipmap_filter_t)mip_filter); } -void _gpu_set_bool(iron_gpu_constant_location_t *location, bool value) { - gpu_set_bool(*location, value != 0); -} - -void _gpu_set_int(iron_gpu_constant_location_t *location, i32 value) { - gpu_set_int(*location, value); -} - -void _gpu_set_float(iron_gpu_constant_location_t *location, f32 value) { - gpu_set_float(*location, value); -} - -void _gpu_set_float2(iron_gpu_constant_location_t *location, f32 value1, f32 value2) { - gpu_set_float2(*location, value1, value2); -} - -void _gpu_set_float3(iron_gpu_constant_location_t *location, f32 value1, f32 value2, f32 value3) { - gpu_set_float3(*location, value1, value2, value3); -} - -void _gpu_set_float4(iron_gpu_constant_location_t *location, f32 value1, f32 value2, f32 value3, f32 value4) { - gpu_set_float4(*location, value1, value2, value3, value4); -} - -void _gpu_set_floats(iron_gpu_constant_location_t *location, f32_array_t *values) { - gpu_set_floats(*location, (float *)values->buffer, values->length); -} - -void _gpu_set_matrix4(iron_gpu_constant_location_t *location, mat4_t m) { - gpu_set_matrix4(*location, &m); -} - -void _gpu_set_matrix3(iron_gpu_constant_location_t *location, mat3_t m) { - gpu_set_matrix3(*location, &m); -} - void iron_set_window_title(string_t *title) { iron_window_set_title(title); #if defined(IRON_IOS) || defined(IRON_ANDROID) diff --git a/base/sources/iron_draw.c b/base/sources/iron_draw.c index ad12cec7..8404bfc4 100644 --- a/base/sources/iron_draw.c +++ b/base/sources/iron_draw.c @@ -342,7 +342,7 @@ void draw_image_buffer(bool end) { if (image_buffer_index - image_buffer_start == 0) return; iron_gpu_vertex_buffer_unlock(&image_vertex_buffer, (image_buffer_index - image_buffer_start) * 4); iron_gpu_set_pipeline(draw_custom_pipeline != NULL ? draw_custom_pipeline : &image_pipeline); - gpu_set_matrix4(image_proj_loc, &draw_projection_matrix); + gpu_set_matrix4(&image_proj_loc, draw_projection_matrix); gpu_set_vertex_buffer(&image_vertex_buffer); gpu_set_index_buffer(&image_index_buffer); gpu_set_texture(&image_tex_unit, image_last_texture); @@ -451,7 +451,7 @@ void draw_colored_rect_draw_buffer(bool tris_done) { iron_gpu_vertex_buffer_unlock(&colored_rect_vertex_buffer, (colored_rect_buffer_index - colored_rect_buffer_start) * 4); iron_gpu_set_pipeline(draw_custom_pipeline != NULL ? draw_custom_pipeline : &colored_pipeline); - gpu_set_matrix4(colored_proj_loc, &draw_projection_matrix); + gpu_set_matrix4(&colored_proj_loc, draw_projection_matrix); gpu_set_vertex_buffer(&colored_rect_vertex_buffer); gpu_set_index_buffer(&colored_rect_index_buffer); iron_gpu_draw_indexed_vertices_from_to(colored_rect_buffer_start * 2 * 3, (colored_rect_buffer_index - colored_rect_buffer_start) * 2 * 3); @@ -499,7 +499,7 @@ void draw_colored_tris_draw_buffer(bool rect_done) { iron_gpu_vertex_buffer_unlock(&colored_tris_vertex_buffer, (colored_tris_buffer_index - colored_tris_buffer_start) * 3); iron_gpu_set_pipeline(draw_custom_pipeline != NULL ? draw_custom_pipeline : &colored_pipeline); - gpu_set_matrix4(colored_proj_loc, &draw_projection_matrix); + gpu_set_matrix4(&colored_proj_loc, draw_projection_matrix); gpu_set_vertex_buffer(&colored_tris_vertex_buffer); gpu_set_index_buffer(&colored_tris_index_buffer); iron_gpu_draw_indexed_vertices_from_to(colored_tris_buffer_start * 3, (colored_tris_buffer_index - colored_tris_buffer_start) * 3); @@ -664,7 +664,7 @@ void draw_text_draw_buffer(bool end) { if (text_buffer_index - text_buffer_start == 0) return; iron_gpu_vertex_buffer_unlock(&text_vertex_buffer, text_buffer_index * 4); iron_gpu_set_pipeline(draw_custom_pipeline != NULL ? draw_custom_pipeline : _draw_current != NULL ? &text_pipeline_rt : &text_pipeline); - gpu_set_matrix4(text_proj_loc, &draw_projection_matrix); + gpu_set_matrix4(&text_proj_loc, draw_projection_matrix); gpu_set_vertex_buffer(&text_vertex_buffer); gpu_set_index_buffer(&text_index_buffer); gpu_set_texture(&text_tex_unit, text_last_texture); diff --git a/base/sources/iron_gpu.c b/base/sources/iron_gpu.c index 852eab26..c1b3bcab 100644 --- a/base/sources/iron_gpu.c +++ b/base/sources/iron_gpu.c @@ -309,95 +309,95 @@ void gpu_end() { iron_gpu_command_list_begin(&commandList); } -void gpu_set_int(iron_gpu_constant_location_t location, int value) { - if (location.impl.vertexOffset >= 0) - iron_gpu_constant_buffer_set_int(&vertexConstantBuffer, location.impl.vertexOffset, value); - if (location.impl.fragmentOffset >= 0) - iron_gpu_constant_buffer_set_int(&fragmentConstantBuffer, location.impl.fragmentOffset, value); +void gpu_set_int(iron_gpu_constant_location_t *location, int value) { + if (location->impl.vertexOffset >= 0) + iron_gpu_constant_buffer_set_int(&vertexConstantBuffer, location->impl.vertexOffset, value); + if (location->impl.fragmentOffset >= 0) + iron_gpu_constant_buffer_set_int(&fragmentConstantBuffer, location->impl.fragmentOffset, value); } -void gpu_set_int2(iron_gpu_constant_location_t location, int value1, int value2) { - if (location.impl.vertexOffset >= 0) - iron_gpu_constant_buffer_set_int2(&vertexConstantBuffer, location.impl.vertexOffset, value1, value2); - if (location.impl.fragmentOffset >= 0) - iron_gpu_constant_buffer_set_int2(&fragmentConstantBuffer, location.impl.fragmentOffset, value1, value2); +void gpu_set_int2(iron_gpu_constant_location_t *location, int value1, int value2) { + if (location->impl.vertexOffset >= 0) + iron_gpu_constant_buffer_set_int2(&vertexConstantBuffer, location->impl.vertexOffset, value1, value2); + if (location->impl.fragmentOffset >= 0) + iron_gpu_constant_buffer_set_int2(&fragmentConstantBuffer, location->impl.fragmentOffset, value1, value2); } -void gpu_set_int3(iron_gpu_constant_location_t location, int value1, int value2, int value3) { - if (location.impl.vertexOffset >= 0) - iron_gpu_constant_buffer_set_int3(&vertexConstantBuffer, location.impl.vertexOffset, value1, value2, value3); - if (location.impl.fragmentOffset >= 0) - iron_gpu_constant_buffer_set_int3(&fragmentConstantBuffer, location.impl.fragmentOffset, value1, value2, value3); +void gpu_set_int3(iron_gpu_constant_location_t *location, int value1, int value2, int value3) { + if (location->impl.vertexOffset >= 0) + iron_gpu_constant_buffer_set_int3(&vertexConstantBuffer, location->impl.vertexOffset, value1, value2, value3); + if (location->impl.fragmentOffset >= 0) + iron_gpu_constant_buffer_set_int3(&fragmentConstantBuffer, location->impl.fragmentOffset, value1, value2, value3); } -void gpu_set_int4(iron_gpu_constant_location_t location, int value1, int value2, int value3, int value4) { - if (location.impl.vertexOffset >= 0) - iron_gpu_constant_buffer_set_int4(&vertexConstantBuffer, location.impl.vertexOffset, value1, value2, value3, value4); - if (location.impl.fragmentOffset >= 0) - iron_gpu_constant_buffer_set_int4(&fragmentConstantBuffer, location.impl.fragmentOffset, value1, value2, value3, value4); +void gpu_set_int4(iron_gpu_constant_location_t *location, int value1, int value2, int value3, int value4) { + if (location->impl.vertexOffset >= 0) + iron_gpu_constant_buffer_set_int4(&vertexConstantBuffer, location->impl.vertexOffset, value1, value2, value3, value4); + if (location->impl.fragmentOffset >= 0) + iron_gpu_constant_buffer_set_int4(&fragmentConstantBuffer, location->impl.fragmentOffset, value1, value2, value3, value4); } -void gpu_set_ints(iron_gpu_constant_location_t location, int *values, int count) { - if (location.impl.vertexOffset >= 0) - iron_gpu_constant_buffer_set_ints(&vertexConstantBuffer, location.impl.vertexOffset, values, count); - if (location.impl.fragmentOffset >= 0) - iron_gpu_constant_buffer_set_ints(&fragmentConstantBuffer, location.impl.fragmentOffset, values, count); +void gpu_set_ints(iron_gpu_constant_location_t *location, int *values, int count) { + if (location->impl.vertexOffset >= 0) + iron_gpu_constant_buffer_set_ints(&vertexConstantBuffer, location->impl.vertexOffset, values, count); + if (location->impl.fragmentOffset >= 0) + iron_gpu_constant_buffer_set_ints(&fragmentConstantBuffer, location->impl.fragmentOffset, values, count); } -void gpu_set_float(iron_gpu_constant_location_t location, float value) { - if (location.impl.vertexOffset >= 0) - iron_gpu_constant_buffer_set_float(&vertexConstantBuffer, location.impl.vertexOffset, value); - if (location.impl.fragmentOffset >= 0) - iron_gpu_constant_buffer_set_float(&fragmentConstantBuffer, location.impl.fragmentOffset, value); +void gpu_set_float(iron_gpu_constant_location_t *location, float value) { + if (location->impl.vertexOffset >= 0) + iron_gpu_constant_buffer_set_float(&vertexConstantBuffer, location->impl.vertexOffset, value); + if (location->impl.fragmentOffset >= 0) + iron_gpu_constant_buffer_set_float(&fragmentConstantBuffer, location->impl.fragmentOffset, value); } -void gpu_set_float2(iron_gpu_constant_location_t location, float value1, float value2) { - if (location.impl.vertexOffset >= 0) - iron_gpu_constant_buffer_set_float2(&vertexConstantBuffer, location.impl.vertexOffset, value1, value2); - if (location.impl.fragmentOffset >= 0) - iron_gpu_constant_buffer_set_float2(&fragmentConstantBuffer, location.impl.fragmentOffset, value1, value2); +void gpu_set_float2(iron_gpu_constant_location_t *location, float value1, float value2) { + if (location->impl.vertexOffset >= 0) + iron_gpu_constant_buffer_set_float2(&vertexConstantBuffer, location->impl.vertexOffset, value1, value2); + if (location->impl.fragmentOffset >= 0) + iron_gpu_constant_buffer_set_float2(&fragmentConstantBuffer, location->impl.fragmentOffset, value1, value2); } -void gpu_set_float3(iron_gpu_constant_location_t location, float value1, float value2, float value3) { - if (location.impl.vertexOffset >= 0) - iron_gpu_constant_buffer_set_float3(&vertexConstantBuffer, location.impl.vertexOffset, value1, value2, value3); - if (location.impl.fragmentOffset >= 0) - iron_gpu_constant_buffer_set_float3(&fragmentConstantBuffer, location.impl.fragmentOffset, value1, value2, value3); +void gpu_set_float3(iron_gpu_constant_location_t *location, float value1, float value2, float value3) { + if (location->impl.vertexOffset >= 0) + iron_gpu_constant_buffer_set_float3(&vertexConstantBuffer, location->impl.vertexOffset, value1, value2, value3); + if (location->impl.fragmentOffset >= 0) + iron_gpu_constant_buffer_set_float3(&fragmentConstantBuffer, location->impl.fragmentOffset, value1, value2, value3); } -void gpu_set_float4(iron_gpu_constant_location_t location, float value1, float value2, float value3, float value4) { - if (location.impl.vertexOffset >= 0) - iron_gpu_constant_buffer_set_float4(&vertexConstantBuffer, location.impl.vertexOffset, value1, value2, value3, value4); - if (location.impl.fragmentOffset >= 0) - iron_gpu_constant_buffer_set_float4(&fragmentConstantBuffer, location.impl.fragmentOffset, value1, value2, value3, value4); +void gpu_set_float4(iron_gpu_constant_location_t *location, float value1, float value2, float value3, float value4) { + if (location->impl.vertexOffset >= 0) + iron_gpu_constant_buffer_set_float4(&vertexConstantBuffer, location->impl.vertexOffset, value1, value2, value3, value4); + if (location->impl.fragmentOffset >= 0) + iron_gpu_constant_buffer_set_float4(&fragmentConstantBuffer, location->impl.fragmentOffset, value1, value2, value3, value4); } -void gpu_set_floats(iron_gpu_constant_location_t location, float *values, int count) { - if (location.impl.vertexOffset >= 0) - iron_gpu_constant_buffer_set_floats(&vertexConstantBuffer, location.impl.vertexOffset, values, count); - if (location.impl.fragmentOffset >= 0) - iron_gpu_constant_buffer_set_floats(&fragmentConstantBuffer, location.impl.fragmentOffset, values, count); +void gpu_set_floats(iron_gpu_constant_location_t *location, f32_array_t *values) { + if (location->impl.vertexOffset >= 0) + iron_gpu_constant_buffer_set_floats(&vertexConstantBuffer, location->impl.vertexOffset, values->buffer, values->length); + if (location->impl.fragmentOffset >= 0) + iron_gpu_constant_buffer_set_floats(&fragmentConstantBuffer, location->impl.fragmentOffset, values->buffer, values->length); } -void gpu_set_bool(iron_gpu_constant_location_t location, bool value) { - if (location.impl.vertexOffset >= 0) - iron_gpu_constant_buffer_set_bool(&vertexConstantBuffer, location.impl.vertexOffset, value); - if (location.impl.fragmentOffset >= 0) - iron_gpu_constant_buffer_set_bool(&fragmentConstantBuffer, location.impl.fragmentOffset, value); +void gpu_set_bool(iron_gpu_constant_location_t *location, bool value) { + if (location->impl.vertexOffset >= 0) + iron_gpu_constant_buffer_set_bool(&vertexConstantBuffer, location->impl.vertexOffset, value); + if (location->impl.fragmentOffset >= 0) + iron_gpu_constant_buffer_set_bool(&fragmentConstantBuffer, location->impl.fragmentOffset, value); } -void gpu_set_matrix4(iron_gpu_constant_location_t location, iron_matrix4x4_t *value) { - if (location.impl.vertexOffset >= 0) - iron_gpu_constant_buffer_set_matrix4(&vertexConstantBuffer, location.impl.vertexOffset, value); - if (location.impl.fragmentOffset >= 0) - iron_gpu_constant_buffer_set_matrix4(&fragmentConstantBuffer, location.impl.fragmentOffset, value); +void gpu_set_matrix4(iron_gpu_constant_location_t *location, iron_matrix4x4_t value) { + if (location->impl.vertexOffset >= 0) + iron_gpu_constant_buffer_set_matrix4(&vertexConstantBuffer, location->impl.vertexOffset, &value); + if (location->impl.fragmentOffset >= 0) + iron_gpu_constant_buffer_set_matrix4(&fragmentConstantBuffer, location->impl.fragmentOffset, &value); } -void gpu_set_matrix3(iron_gpu_constant_location_t location, iron_matrix3x3_t *value) { - if (location.impl.vertexOffset >= 0) - iron_gpu_constant_buffer_set_matrix3(&vertexConstantBuffer, location.impl.vertexOffset, value); - if (location.impl.fragmentOffset >= 0) - iron_gpu_constant_buffer_set_matrix3(&fragmentConstantBuffer, location.impl.fragmentOffset, value); +void gpu_set_matrix3(iron_gpu_constant_location_t *location, iron_matrix3x3_t value) { + if (location->impl.vertexOffset >= 0) + iron_gpu_constant_buffer_set_matrix3(&vertexConstantBuffer, location->impl.vertexOffset, &value); + if (location->impl.fragmentOffset >= 0) + iron_gpu_constant_buffer_set_matrix3(&fragmentConstantBuffer, location->impl.fragmentOffset, &value); } void gpu_set_texture_addressing(iron_gpu_texture_unit_t unit, gpu_texture_direction_t dir, gpu_texture_addressing_t addressing) { diff --git a/base/sources/iron_gpu.h b/base/sources/iron_gpu.h index 7229fc7b..49640fd4 100644 --- a/base/sources/iron_gpu.h +++ b/base/sources/iron_gpu.h @@ -113,19 +113,19 @@ void iron_gpu_draw_indexed_vertices(void); void iron_gpu_draw_indexed_vertices_from_to(int start, int count); void gpu_set_texture_addressing(struct iron_gpu_texture_unit unit, gpu_texture_direction_t dir, gpu_texture_addressing_t addressing); void iron_gpu_set_pipeline(struct iron_gpu_pipeline *pipeline); -void gpu_set_int(struct iron_gpu_constant_location location, int value); -void gpu_set_int2(struct iron_gpu_constant_location location, int value1, int value2); -void gpu_set_int3(struct iron_gpu_constant_location location, int value1, int value2, int value3); -void gpu_set_int4(struct iron_gpu_constant_location location, int value1, int value2, int value3, int value4); -void gpu_set_ints(struct iron_gpu_constant_location location, int *values, int count); -void gpu_set_float(struct iron_gpu_constant_location location, float value); -void gpu_set_float2(struct iron_gpu_constant_location location, float value1, float value2); -void gpu_set_float3(struct iron_gpu_constant_location location, float value1, float value2, float value3); -void gpu_set_float4(struct iron_gpu_constant_location location, float value1, float value2, float value3, float value4); -void gpu_set_floats(struct iron_gpu_constant_location location, float *values, int count); -void gpu_set_bool(struct iron_gpu_constant_location location, bool value); -void gpu_set_matrix3(struct iron_gpu_constant_location location, iron_matrix3x3_t *value); -void gpu_set_matrix4(struct iron_gpu_constant_location location, iron_matrix4x4_t *value); +void gpu_set_int(struct iron_gpu_constant_location *location, int value); +void gpu_set_int2(struct iron_gpu_constant_location *location, int value1, int value2); +void gpu_set_int3(struct iron_gpu_constant_location *location, int value1, int value2, int value3); +void gpu_set_int4(struct iron_gpu_constant_location *location, int value1, int value2, int value3, int value4); +void gpu_set_ints(struct iron_gpu_constant_location *location, int *values, int count); +void gpu_set_float(struct iron_gpu_constant_location *location, float value); +void gpu_set_float2(struct iron_gpu_constant_location *location, float value1, float value2); +void gpu_set_float3(struct iron_gpu_constant_location *location, float value1, float value2, float value3); +void gpu_set_float4(struct iron_gpu_constant_location *location, float value1, float value2, float value3, float value4); +void gpu_set_floats(struct iron_gpu_constant_location *location, f32_array_t *values); +void gpu_set_bool(struct iron_gpu_constant_location *location, bool value); +void gpu_set_matrix3(struct iron_gpu_constant_location *location, iron_matrix3x3_t value); +void gpu_set_matrix4(struct iron_gpu_constant_location *location, iron_matrix4x4_t value); void gpu_set_texture_magnification_filter(struct iron_gpu_texture_unit unit, gpu_texture_filter_t filter); void gpu_set_texture_minification_filter(struct iron_gpu_texture_unit unit, gpu_texture_filter_t filter); void gpu_set_texture_mipmap_filter(struct iron_gpu_texture_unit unit, gpu_mipmap_filter_t filter); diff --git a/base/sources/ts/export_texture.ts b/base/sources/ts/export_texture.ts index a53aeeba..e8529f33 100644 --- a/base/sources/ts/export_texture.ts +++ b/base/sources/ts/export_texture.ts @@ -250,12 +250,12 @@ function export_texture_run_layers(path: string, layers: slot_layer_t[], object_ _gpu_begin(layers_expa); iron_gpu_set_pipeline(pipes_merge); - _gpu_set_texture(pipes_tex0, l1.texpaint); - _gpu_set_texture(pipes_tex1, empty); - _gpu_set_texture(pipes_texmask, mask); - _gpu_set_texture(pipes_texa, layers_temp_image); - _gpu_set_float(pipes_opac, slot_layer_get_opacity(l1)); - _gpu_set_int(pipes_blending, layers.length > 1 ? l1.blending : 0); + gpu_set_texture(pipes_tex0, l1.texpaint); + gpu_set_texture(pipes_tex1, empty); + gpu_set_texture(pipes_texmask, mask); + gpu_set_texture(pipes_texa, layers_temp_image); + gpu_set_float(pipes_opac, slot_layer_get_opacity(l1)); + gpu_set_int(pipes_blending, layers.length > 1 ? l1.blending : 0); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw_indexed_vertices(); @@ -271,12 +271,12 @@ function export_texture_run_layers(path: string, layers: slot_layer_t[], object_ _gpu_begin(layers_expb); iron_gpu_set_pipeline(pipes_merge); - _gpu_set_texture(pipes_tex0, l1.texpaint); - _gpu_set_texture(pipes_tex1, l1.texpaint_nor); - _gpu_set_texture(pipes_texmask, mask); - _gpu_set_texture(pipes_texa, layers_temp_image); - _gpu_set_float(pipes_opac, slot_layer_get_opacity(l1)); - _gpu_set_int(pipes_blending, l1.paint_nor_blend ? -2 : -1); + gpu_set_texture(pipes_tex0, l1.texpaint); + gpu_set_texture(pipes_tex1, l1.texpaint_nor); + gpu_set_texture(pipes_texmask, mask); + gpu_set_texture(pipes_texa, layers_temp_image); + gpu_set_float(pipes_opac, slot_layer_get_opacity(l1)); + gpu_set_int(pipes_blending, l1.paint_nor_blend ? -2 : -1); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw_indexed_vertices(); diff --git a/base/sources/ts/import_envmap.ts b/base/sources/ts/import_envmap.ts index 4ca80fe4..f9212878 100644 --- a/base/sources/ts/import_envmap.ts +++ b/base/sources/ts/import_envmap.ts @@ -92,8 +92,8 @@ function import_envmap_get_radiance_mip(mip: iron_gpu_texture_t, level: i32, rad gpu_set_index_buffer(const_data_screen_aligned_ib); iron_gpu_set_pipeline(import_envmap_pipeline); import_envmap_params.x = 0.1 + level / 8; - _gpu_set_float4(import_envmap_params_loc, import_envmap_params.x, import_envmap_params.y, import_envmap_params.z, import_envmap_params.w); - _gpu_set_texture(import_envmap_radiance_loc, radiance); + gpu_set_float4(import_envmap_params_loc, import_envmap_params.x, import_envmap_params.y, import_envmap_params.z, import_envmap_params.w); + gpu_set_texture(import_envmap_radiance_loc, radiance); gpu_draw_indexed_vertices(); _gpu_end(); } diff --git a/base/sources/ts/iron/iron.ts b/base/sources/ts/iron/iron.ts index 824c55b6..7aa23eb1 100644 --- a/base/sources/ts/iron/iron.ts +++ b/base/sources/ts/iron/iron.ts @@ -242,18 +242,18 @@ declare function iron_copy_to_clipboard(text: string): void; declare function gpu_get_constant_location(pipeline: any, name: string): any; declare function gpu_get_texture_unit(pipeline: any, name: string): any; -declare function _gpu_set_texture(stage: any, texture: any): void; -declare function _gpu_set_texture_depth(unit: any, texture: any): void; +declare function gpu_set_texture(stage: any, texture: any): void; +declare function gpu_set_texture_depth(unit: any, texture: any): void; declare function gpu_set_texture_parameters(tex_unit: any, u_addr: i32, v_addr: i32, min_filter: i32, mag_filter: i32, mip_filter: i32): void; -declare function _gpu_set_bool(location: any, value: bool): void; -declare function _gpu_set_int(location: any, value: i32): void; -declare function _gpu_set_float(location: any, value: f32): void; -declare function _gpu_set_float2(location: any, value1: f32, value2: f32): void; -declare function _gpu_set_float3(location: any, value1: f32, value2: f32, value3: f32): void; -declare function _gpu_set_float4(location: any, value1: f32, value2: f32, value3: f32, value4: f32): void; -declare function _gpu_set_floats(location: any, values: f32_array_t): void; -declare function _gpu_set_matrix4(location: any, matrix: mat4_t): void; -declare function _gpu_set_matrix3(location: any, matrix: mat3_t): void; +declare function gpu_set_bool(location: any, value: bool): void; +declare function gpu_set_int(location: any, value: i32): void; +declare function gpu_set_float(location: any, value: f32): void; +declare function gpu_set_float2(location: any, value1: f32, value2: f32): void; +declare function gpu_set_float3(location: any, value1: f32, value2: f32, value3: f32): void; +declare function gpu_set_float4(location: any, value1: f32, value2: f32, value3: f32, value4: f32): void; +declare function gpu_set_floats(location: any, values: f32_array_t): void; +declare function gpu_set_matrix4(location: any, matrix: mat4_t): void; +declare function gpu_set_matrix3(location: any, matrix: mat3_t): void; declare function iron_time(): f32; declare function iron_window_width(): i32; diff --git a/base/sources/ts/iron/uniforms.ts b/base/sources/ts/iron/uniforms.ts index 7bc9134b..9ac5d77b 100644 --- a/base/sources/ts/iron/uniforms.ts +++ b/base/sources/ts/iron/uniforms.ts @@ -57,20 +57,20 @@ function uniforms_set_context_consts(context: shader_context_t, bind_params: str } if (char_at(tulink, 0) == "$") { // Link to embedded data - _gpu_set_texture(context._.tex_units[j], map_get(scene_embedded, substring(tulink, 1, tulink.length))); + gpu_set_texture(context._.tex_units[j], map_get(scene_embedded, substring(tulink, 1, tulink.length))); gpu_set_texture_parameters(context._.tex_units[j], tex_addressing_t.REPEAT, tex_addressing_t.REPEAT, tex_filter_t.LINEAR, tex_filter_t.LINEAR, mip_map_filter_t.NONE); } else if (tulink == "_envmap_radiance") { let w: world_data_t = scene_world; if (w != null) { - _gpu_set_texture(context._.tex_units[j], w._.radiance); + gpu_set_texture(context._.tex_units[j], w._.radiance); gpu_set_texture_parameters(context._.tex_units[j], tex_addressing_t.REPEAT, tex_addressing_t.REPEAT, tex_filter_t.LINEAR, tex_filter_t.LINEAR, mip_map_filter_t.LINEAR); } } else if (tulink == "_envmap") { let w: world_data_t = scene_world; if (w != null) { - _gpu_set_texture(context._.tex_units[j], w._.envmap); + gpu_set_texture(context._.tex_units[j], w._.envmap); gpu_set_texture_parameters(context._.tex_units[j], tex_addressing_t.REPEAT, tex_addressing_t.REPEAT, tex_filter_t.LINEAR, tex_filter_t.LINEAR, mip_map_filter_t.NONE); } } @@ -99,8 +99,8 @@ function uniforms_set_obj_consts(context: shader_context_t, object: object_t) { let image: iron_gpu_texture_t = uniforms_tex_links(object, current_material(object), tu.link); if (image != null) { ends_with(tu.link, "_depth") ? - _gpu_set_texture_depth(context._.tex_units[j], image) : - _gpu_set_texture(context._.tex_units[j], image); + gpu_set_texture_depth(context._.tex_units[j], image) : + gpu_set_texture(context._.tex_units[j], image); gpu_set_texture_parameters(context._.tex_units[j], tex_addressing_t.REPEAT, tex_addressing_t.REPEAT, tex_filter_t.LINEAR, tex_filter_t.LINEAR, mip_map_filter_t.NONE); } } @@ -119,10 +119,10 @@ function uniforms_bind_render_target(rt: render_target_t, context: shader_contex if (sampler_id == tus[j].name) { if (attach_depth) { - _gpu_set_texture_depth(context._.tex_units[j], rt._image); // sampler2D + gpu_set_texture_depth(context._.tex_units[j], rt._image); // sampler2D } else { - _gpu_set_texture(context._.tex_units[j], rt._image); // sampler2D + gpu_set_texture(context._.tex_units[j], rt._image); // sampler2D } if (rt.mipmaps) { @@ -191,7 +191,7 @@ function uniforms_set_context_const(location: iron_gpu_constant_location_t, c: s return false; } - _gpu_set_matrix4(location, m); + gpu_set_matrix4(location, m); return true; } else if (c.type == "vec4") { @@ -202,10 +202,10 @@ function uniforms_set_context_const(location: iron_gpu_constant_location_t, c: s // } if (!vec4_isnan(v)) { - _gpu_set_float4(location, v.x, v.y, v.z, v.w); + gpu_set_float4(location, v.x, v.y, v.z, v.w); } else { - _gpu_set_float4(location, 0, 0, 0, 0); + gpu_set_float4(location, 0, 0, 0, 0); } return true; } @@ -223,10 +223,10 @@ function uniforms_set_context_const(location: iron_gpu_constant_location_t, c: s } if (!vec4_isnan(v)) { - _gpu_set_float3(location, v.x, v.y, v.z); + gpu_set_float3(location, v.x, v.y, v.z); } else { - _gpu_set_float3(location, 0.0, 0.0, 0.0); + gpu_set_float3(location, 0.0, 0.0, 0.0); } return true; } @@ -292,10 +292,10 @@ function uniforms_set_context_const(location: iron_gpu_constant_location_t, c: s } if (!vec4_isnan(v)) { - _gpu_set_float2(location, v.x, v.y); + gpu_set_float2(location, v.x, v.y); } else { - _gpu_set_float2(location, 0.0, 0.0); + gpu_set_float2(location, 0.0, 0.0); } return true; } @@ -312,7 +312,7 @@ function uniforms_set_context_const(location: iron_gpu_constant_location_t, c: s return false; } - _gpu_set_float(location, f); + gpu_set_float(location, f); return true; } else if (c.type == "floats") { @@ -323,7 +323,7 @@ function uniforms_set_context_const(location: iron_gpu_constant_location_t, c: s } if (fa != null) { - _gpu_set_floats(location, fa); + gpu_set_floats(location, fa); return true; } } @@ -338,7 +338,7 @@ function uniforms_set_context_const(location: iron_gpu_constant_location_t, c: s return false; } - _gpu_set_int(location, i); + gpu_set_int(location, i); return true; } return false; @@ -379,7 +379,7 @@ function uniforms_set_obj_const(obj: object_t, loc: iron_gpu_constant_location_t if (mat4_isnan(m)) { return; } - _gpu_set_matrix4(loc, m); + gpu_set_matrix4(loc, m); } else if (c.type == "mat3") { let m: mat3_t = mat3_nan(); @@ -396,7 +396,7 @@ function uniforms_set_obj_const(obj: object_t, loc: iron_gpu_constant_location_t if (mat3_isnan(m)) { return; } - _gpu_set_matrix3(loc, m); + gpu_set_matrix3(loc, m); } else if (c.type == "vec4") { let v: vec4_t = vec4_nan(); @@ -408,7 +408,7 @@ function uniforms_set_obj_const(obj: object_t, loc: iron_gpu_constant_location_t if (vec4_isnan(v)) { return; } - _gpu_set_float4(loc, v.x, v.y, v.z, v.w); + gpu_set_float4(loc, v.x, v.y, v.z, v.w); } else if (c.type == "vec3") { let v: vec4_t = vec4_nan(); @@ -430,7 +430,7 @@ function uniforms_set_obj_const(obj: object_t, loc: iron_gpu_constant_location_t if (vec4_isnan(v)) { return; } - _gpu_set_float3(loc, v.x, v.y, v.z); + gpu_set_float3(loc, v.x, v.y, v.z); } else if (c.type == "vec2") { let v: vec2_t = vec2_nan(); @@ -442,7 +442,7 @@ function uniforms_set_obj_const(obj: object_t, loc: iron_gpu_constant_location_t if (vec2_isnan(v)) { return; } - _gpu_set_float2(loc, v.x, v.y); + gpu_set_float2(loc, v.x, v.y); } else if (c.type == "float") { let f: f32 = f32_nan(); @@ -469,7 +469,7 @@ function uniforms_set_obj_const(obj: object_t, loc: iron_gpu_constant_location_t if (f32_isnan(f)) { return; } - _gpu_set_float(loc, f); + gpu_set_float(loc, f); } else if (c.type == "floats") { let fa: f32_array_t = null; @@ -488,7 +488,7 @@ function uniforms_set_obj_const(obj: object_t, loc: iron_gpu_constant_location_t if (fa == null) { return; } - _gpu_set_floats(loc, fa); + gpu_set_floats(loc, fa); } else if (c.type == "int") { let i: i32 = INT_MAX; @@ -504,7 +504,7 @@ function uniforms_set_obj_const(obj: object_t, loc: iron_gpu_constant_location_t return; } - _gpu_set_int(loc, i); + gpu_set_int(loc, i); } } @@ -536,7 +536,7 @@ function uniforms_set_material_consts(context: shader_context_t, material_contex for (let j: i32 = 0; j < context._.tex_units.length; ++j) { let sname: string = context.texture_units[j].name; if (mname == sname) { - _gpu_set_texture(context._.tex_units[j], material_context._.textures[i]); + gpu_set_texture(context._.tex_units[j], material_context._.textures[i]); // After texture sampler have been assigned, set texture parameters material_context_set_tex_params(material_context, i, context, j); break; @@ -558,21 +558,21 @@ function current_material(object: object_t): material_data_t { function uniforms_set_material_const(location: iron_gpu_constant_location_t, shader_const: shader_const_t, material_const: bind_const_t) { if (shader_const.type == "vec4") { - _gpu_set_float4(location, material_const.vec[0], material_const.vec[1], material_const.vec[2], material_const.vec[3]); + gpu_set_float4(location, material_const.vec[0], material_const.vec[1], material_const.vec[2], material_const.vec[3]); } else if (shader_const.type == "vec3") { - _gpu_set_float3(location, material_const.vec[0], material_const.vec[1], material_const.vec[2]); + gpu_set_float3(location, material_const.vec[0], material_const.vec[1], material_const.vec[2]); } else if (shader_const.type == "vec2") { - _gpu_set_float2(location, material_const.vec[0], material_const.vec[1]); + gpu_set_float2(location, material_const.vec[0], material_const.vec[1]); } else if (shader_const.type == "float") { - _gpu_set_float(location, material_const.vec[0]); + gpu_set_float(location, material_const.vec[0]); } else if (shader_const.type == "bool") { - _gpu_set_bool(location, material_const.vec[0] > 0.0); + gpu_set_bool(location, material_const.vec[0] > 0.0); } else if (shader_const.type == "int") { - _gpu_set_int(location, math_floor(material_const.vec[0])); + gpu_set_int(location, math_floor(material_const.vec[0])); } } diff --git a/base/sources/ts/layers.ts b/base/sources/ts/layers.ts index 4b809ec8..09e3e828 100644 --- a/base/sources/ts/layers.ts +++ b/base/sources/ts/layers.ts @@ -257,8 +257,8 @@ function layers_apply_mask(l: slot_layer_t, m: slot_layer_t) { // Apply mask _gpu_begin(l.texpaint); iron_gpu_set_pipeline(pipes_apply_mask); - _gpu_set_texture(pipes_tex0_mask, layers_temp_image); - _gpu_set_texture(pipes_texa_mask, m.texpaint); + gpu_set_texture(pipes_tex0_mask, layers_temp_image); + gpu_set_texture(pipes_texa_mask, m.texpaint); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw_indexed_vertices(); @@ -268,12 +268,12 @@ function layers_apply_mask(l: slot_layer_t, m: slot_layer_t) { function layers_commands_merge_pack(pipe: iron_gpu_pipeline_t, i0: iron_gpu_texture_t, i1: iron_gpu_texture_t, i1pack: iron_gpu_texture_t, i1mask_opacity: f32, i1texmask: iron_gpu_texture_t, i1blending: i32 = -1) { _gpu_begin(i0); iron_gpu_set_pipeline(pipe); - _gpu_set_texture(pipes_tex0, i1); - _gpu_set_texture(pipes_tex1, i1pack); - _gpu_set_texture(pipes_texmask, i1texmask); - _gpu_set_texture(pipes_texa, layers_temp_image); - _gpu_set_float(pipes_opac, i1mask_opacity); - _gpu_set_int(pipes_blending, i1blending); + gpu_set_texture(pipes_tex0, i1); + gpu_set_texture(pipes_tex1, i1pack); + gpu_set_texture(pipes_texmask, i1texmask); + gpu_set_texture(pipes_texa, layers_temp_image); + gpu_set_float(pipes_opac, i1mask_opacity); + gpu_set_int(pipes_blending, i1blending); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw_indexed_vertices(); @@ -731,10 +731,10 @@ function layers_merge_layer(l0 : slot_layer_t, l1: slot_layer_t, use_mask: bool if (slot_layer_is_mask(l1)) { _gpu_begin(l0.texpaint); iron_gpu_set_pipeline(pipes_merge_mask); - _gpu_set_texture(pipes_tex0_merge_mask, l1.texpaint); - _gpu_set_texture(pipes_texa_merge_mask, layers_temp_image); - _gpu_set_float(pipes_opac_merge_mask, slot_layer_get_opacity(l1)); - _gpu_set_int(pipes_blending_merge_mask, l1.blending); + gpu_set_texture(pipes_tex0_merge_mask, l1.texpaint); + gpu_set_texture(pipes_texa_merge_mask, layers_temp_image); + gpu_set_float(pipes_opac_merge_mask, slot_layer_get_opacity(l1)); + gpu_set_int(pipes_blending_merge_mask, l1.blending); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw_indexed_vertices(); @@ -745,12 +745,12 @@ function layers_merge_layer(l0 : slot_layer_t, l1: slot_layer_t, use_mask: bool if (l1.paint_base) { _gpu_begin(l0.texpaint); iron_gpu_set_pipeline(pipes_merge); - _gpu_set_texture(pipes_tex0, l1.texpaint); - _gpu_set_texture(pipes_tex1, empty); - _gpu_set_texture(pipes_texmask, mask); - _gpu_set_texture(pipes_texa, layers_temp_image); - _gpu_set_float(pipes_opac, slot_layer_get_opacity(l1)); - _gpu_set_int(pipes_blending, l1.blending); + gpu_set_texture(pipes_tex0, l1.texpaint); + gpu_set_texture(pipes_tex1, empty); + gpu_set_texture(pipes_texmask, mask); + gpu_set_texture(pipes_texa, layers_temp_image); + gpu_set_float(pipes_opac, slot_layer_get_opacity(l1)); + gpu_set_int(pipes_blending, l1.blending); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw_indexed_vertices(); @@ -767,12 +767,12 @@ function layers_merge_layer(l0 : slot_layer_t, l1: slot_layer_t, use_mask: bool if (l1.paint_nor) { _gpu_begin(l0.texpaint_nor); iron_gpu_set_pipeline(pipes_merge); - _gpu_set_texture(pipes_tex0, l1.texpaint); - _gpu_set_texture(pipes_tex1, l1.texpaint_nor); - _gpu_set_texture(pipes_texmask, mask); - _gpu_set_texture(pipes_texa, layers_temp_image); - _gpu_set_float(pipes_opac, slot_layer_get_opacity(l1)); - _gpu_set_int(pipes_blending, l1.paint_nor_blend ? -2 : -1); + gpu_set_texture(pipes_tex0, l1.texpaint); + gpu_set_texture(pipes_tex1, l1.texpaint_nor); + gpu_set_texture(pipes_texmask, mask); + gpu_set_texture(pipes_texa, layers_temp_image); + gpu_set_float(pipes_opac, slot_layer_get_opacity(l1)); + gpu_set_int(pipes_blending, l1.paint_nor_blend ? -2 : -1); gpu_set_vertex_buffer(const_data_screen_aligned_vb); gpu_set_index_buffer(const_data_screen_aligned_ib); gpu_draw_indexed_vertices(); diff --git a/base/sources/ts/line_draw.ts b/base/sources/ts/line_draw.ts index 2fa7fe01..ad2559e7 100644 --- a/base/sources/ts/line_draw.ts +++ b/base/sources/ts/line_draw.ts @@ -236,8 +236,8 @@ function line_draw_end(overlay: bool = false) { let camera: camera_object_t = scene_camera; line_draw_vp = mat4_clone(camera.v); line_draw_vp = mat4_mult_mat(line_draw_vp, camera.p); - _gpu_set_matrix4(line_draw_vp_loc, line_draw_vp); - _gpu_set_float3(line_draw_color_loc, + gpu_set_matrix4(line_draw_vp_loc, line_draw_vp); + gpu_set_float3(line_draw_color_loc, color_get_rb(line_draw_color) / 255, color_get_gb(line_draw_color) / 255, color_get_bb(line_draw_color) / 255 @@ -278,8 +278,8 @@ function shape_draw_sphere(mat: mat4_t) { line_draw_vp = mat4_scale(line_draw_vp, vec4_create(f, f, f)); line_draw_vp = mat4_mult_mat(line_draw_vp, camera.v); line_draw_vp = mat4_mult_mat(line_draw_vp, camera.p); - _gpu_set_matrix4(line_draw_vp_loc, line_draw_vp); - _gpu_set_float3(line_draw_color_loc, + gpu_set_matrix4(line_draw_vp_loc, line_draw_vp); + gpu_set_float3(line_draw_color_loc, color_get_rb(line_draw_color) / 255, color_get_gb(line_draw_color) / 255, color_get_bb(line_draw_color) / 255 diff --git a/base/sources/ts/tab_fonts.ts b/base/sources/ts/tab_fonts.ts index 4669d1b3..f1c64566 100644 --- a/base/sources/ts/tab_fonts.ts +++ b/base/sources/ts/tab_fonts.ts @@ -80,7 +80,7 @@ function tab_fonts_draw(htab: ui_handle_t) { let state: ui_state_t = ui_state_t.IDLE; if (project_fonts[i].preview_ready) { // draw_set_pipeline(pipe); // L8 - // _gpu_set_int(channel_location, 1); + // gpu_set_int(channel_location, 1); state = _ui_image(img); // draw_set_pipeline(null); } diff --git a/base/sources/ts/tab_layers.ts b/base/sources/ts/tab_layers.ts index a8b48a39..af64670e 100644 --- a/base/sources/ts/tab_layers.ts +++ b/base/sources/ts/tab_layers.ts @@ -654,7 +654,7 @@ function tab_layers_draw_layer_icon(l: slot_layer_t, i: i32, uix: f32, uiy: f32, } if (l.fill_layer == null && slot_layer_is_mask(l)) { draw_set_pipeline(ui_view2d_pipe); - _gpu_set_int(ui_view2d_channel_loc, 1); + gpu_set_int(ui_view2d_channel_loc, 1); } let state: ui_state_t = _ui_image(icon, 0xffffffff, icon_h); @@ -1008,7 +1008,7 @@ function tab_layers_make_mask_preview_rgba32(l: slot_layer_t) { let l: slot_layer_t = tab_layers_l; draw_begin(context_raw.mask_preview_rgba32); draw_set_pipeline(ui_view2d_pipe); - _gpu_set_int(ui_view2d_channel_loc, 1); + gpu_set_int(ui_view2d_channel_loc, 1); draw_image(l.texpaint_preview, 0, 0); draw_end(); draw_set_pipeline(null); diff --git a/base/sources/ts/ui_nodes.ts b/base/sources/ts/ui_nodes.ts index 1a574c96..b2ad5d6c 100644 --- a/base/sources/ts/ui_nodes.ts +++ b/base/sources/ts/ui_nodes.ts @@ -1110,7 +1110,7 @@ function ui_nodes_render() { ///if (is_paint || is_sculpt) if (single_channel) { draw_set_pipeline(ui_view2d_pipe); - _gpu_set_int(ui_view2d_channel_loc, 1); + gpu_set_int(ui_view2d_channel_loc, 1); } ///end diff --git a/base/sources/ts/ui_view2d.ts b/base/sources/ts/ui_view2d.ts index 548e7ea8..b01afa77 100644 --- a/base/sources/ts/ui_view2d.ts +++ b/base/sources/ts/ui_view2d.ts @@ -223,7 +223,7 @@ function ui_view2d_render() { if (!context_raw.texture_filter) { draw_set_bilinear_filter(false); } - _gpu_set_int(ui_view2d_channel_loc, channel); + gpu_set_int(ui_view2d_channel_loc, channel); } ///end