diff --git a/armorlab/shaders/inpaint_preview.kong b/armorlab/shaders/inpaint_preview.kong index e9e797bf..2258a0d8 100644 --- a/armorlab/shaders/inpaint_preview.kong +++ b/armorlab/shaders/inpaint_preview.kong @@ -1,4 +1,9 @@ +#[set(everything)] +const constants: { + empty: float4; +}; + #[set(everything)] const sampler_linear: sampler; diff --git a/armorlab/shaders/layer_copy_rrrr.kong b/armorlab/shaders/layer_copy_rrrr.kong index b0183f43..a81ccf86 100644 --- a/armorlab/shaders/layer_copy_rrrr.kong +++ b/armorlab/shaders/layer_copy_rrrr.kong @@ -1,4 +1,9 @@ +#[set(everything)] +const constants: { + empty: float4; +}; + #[set(everything)] const sampler_linear: sampler; diff --git a/armorpaint/shaders/dilate_map.kong b/armorpaint/shaders/dilate_map.kong index de32138f..fdf8d0a7 100644 --- a/armorpaint/shaders/dilate_map.kong +++ b/armorpaint/shaders/dilate_map.kong @@ -10,6 +10,11 @@ struct vert_out { dummy: float; } +#[set(everything)] +const constants: { + empty: float; +}; + fun dilate_map_vert(input: vert_in): vert_out { var output: vert_out; var tex_coord: float2 = float2(input.tex.x * 2.0 - 1.0, (1.0 - input.tex.y) * 2.0 - 1.0); diff --git a/armorpaint/shaders/mask_colorid.kong b/armorpaint/shaders/mask_colorid.kong index f79c4fd5..1f2bfc52 100644 --- a/armorpaint/shaders/mask_colorid.kong +++ b/armorpaint/shaders/mask_colorid.kong @@ -1,6 +1,11 @@ // Turn picked color id into mask +#[set(everything)] +const constants: { + empty: float4; +}; + #[set(everything)] const sampler_linear: sampler; diff --git a/base/shaders/copy_mrt3_pass.kong b/base/shaders/copy_mrt3_pass.kong index 9ba8f8d5..ca383016 100644 --- a/base/shaders/copy_mrt3_pass.kong +++ b/base/shaders/copy_mrt3_pass.kong @@ -1,4 +1,9 @@ +#[set(everything)] +const constants: { + empty: float4; +}; + #[set(everything)] const sampler_linear: sampler; diff --git a/base/shaders/copy_pass.kong b/base/shaders/copy_pass.kong index 838bcee5..9704a524 100644 --- a/base/shaders/copy_pass.kong +++ b/base/shaders/copy_pass.kong @@ -1,4 +1,9 @@ +#[set(everything)] +const constants: { + empty: float4; +}; + #[set(everything)] const sampler_linear: sampler; diff --git a/base/shaders/histogram_pass.kong b/base/shaders/histogram_pass.kong index ba6640e5..b8694398 100644 --- a/base/shaders/histogram_pass.kong +++ b/base/shaders/histogram_pass.kong @@ -1,4 +1,9 @@ +#[set(everything)] +const constants: { + empty: float4; +}; + #[set(everything)] const sampler_linear: sampler; diff --git a/base/shaders/mask_apply.kong b/base/shaders/mask_apply.kong index 1ca63a24..19ff6ce6 100644 --- a/base/shaders/mask_apply.kong +++ b/base/shaders/mask_apply.kong @@ -1,4 +1,9 @@ +#[set(everything)] +const constants: { + empty: float4; +}; + #[set(everything)] const sampler_linear: sampler; diff --git a/base/sources/backends/direct3d12_gpu.c b/base/sources/backends/direct3d12_gpu.c index c196e0e4..1748c1a4 100644 --- a/base/sources/backends/direct3d12_gpu.c +++ b/base/sources/backends/direct3d12_gpu.c @@ -859,9 +859,6 @@ void iron_gpu_pipeline_compile(iron_gpu_pipeline_t *pipe) { case IRON_GPU_VERTEX_DATA_F32_4X: vertexDesc[i].Format = DXGI_FORMAT_R32G32B32A32_FLOAT; break; - case IRON_GPU_VERTEX_DATA_U8_4X_NORM: - vertexDesc[i].Format = DXGI_FORMAT_R8G8B8A8_UNORM; - break; case IRON_GPU_VERTEX_DATA_I16_2X_NORM: vertexDesc[i].Format = DXGI_FORMAT_R16G16_SNORM; break; @@ -1485,14 +1482,13 @@ void iron_gpu_render_target_set_depth_from(iron_gpu_texture_t *render_target, ir void iron_gpu_vertex_buffer_init(iron_gpu_buffer_t *buffer, int count, iron_gpu_vertex_structure_t *structure, bool gpuMemory) { buffer->myCount = count; - buffer->impl.myCount = count; buffer->impl.myStride = 0; for (int i = 0; i < structure->size; ++i) { buffer->impl.myStride += iron_gpu_vertex_data_size(structure->elements[i].data); } - int uploadBufferSize = buffer->impl.myStride * buffer->impl.myCount; + int uploadBufferSize = buffer->impl.myStride * buffer-.myCount; D3D12_HEAP_PROPERTIES heapProperties = { .Type = D3D12_HEAP_TYPE_UPLOAD, @@ -1562,7 +1558,7 @@ int iron_gpu_internal_vertex_buffer_set(iron_gpu_buffer_t *buffer) { } int iron_gpu_vertex_buffer_count(iron_gpu_buffer_t *buffer) { - return buffer->impl.myCount; + return buffer->myCount; } int iron_gpu_vertex_buffer_stride(iron_gpu_buffer_t *buffer) { @@ -2254,10 +2250,10 @@ void iron_gpu_raytrace_acceleration_structure_build(iron_gpu_raytrace_accelerati #ifdef is_forge create_srv_ib(_ib_full, _ib_full->impl.count, 0); - create_srv_vb(_vb_full, _vb_full->impl.myCount, vb[0]->impl.myStride); + create_srv_vb(_vb_full, _vb_full->myCount, vb[0]->impl.myStride); #else create_srv_ib(ib[0], ib[0]->impl.count, 0); - create_srv_vb(vb[0], vb[0]->impl.myCount, vb[0]->impl.myStride); + create_srv_vb(vb[0], vb[0]->myCount, vb[0]->impl.myStride); #endif // Reset the command list for the acceleration structure construction @@ -2288,14 +2284,14 @@ void iron_gpu_raytrace_acceleration_structure_build(iron_gpu_raytrace_accelerati .Triangles.IndexFormat = DXGI_FORMAT_R32_UINT, .Triangles.Transform3x4 = 0, .Triangles.VertexFormat = DXGI_FORMAT_R16G16B16A16_SNORM, - .Triangles.VertexCount = vb[i]->impl.myCount, + .Triangles.VertexCount = vb[i]->myCount, }; D3D12_RESOURCE_DESC desc; vb[i]->impl.uploadBuffer->lpVtbl->GetDesc(vb[i]->impl.uploadBuffer, &desc); geometryDesc.Triangles.VertexBuffer.StartAddress = vb[i]->impl.uploadBuffer->lpVtbl->GetGPUVirtualAddress(vb[i]->impl.uploadBuffer); - geometryDesc.Triangles.VertexBuffer.StrideInBytes = desc.Width / vb[i]->impl.myCount; + geometryDesc.Triangles.VertexBuffer.StrideInBytes = desc.Width / vb[i]->myCount; geometryDesc.Flags = D3D12_RAYTRACING_GEOMETRY_FLAG_OPAQUE; geometryDescs[i] = geometryDesc; diff --git a/base/sources/backends/direct3d12_gpu.h b/base/sources/backends/direct3d12_gpu.h index 3b48fcf0..031ef2dc 100644 --- a/base/sources/backends/direct3d12_gpu.h +++ b/base/sources/backends/direct3d12_gpu.h @@ -119,7 +119,6 @@ struct D3D12IindexBufferView { typedef struct { struct ID3D12Resource *uploadBuffer; struct D3D12VertexBufferView view; - int myCount; int myStride; int lastStart; int lastCount; diff --git a/base/sources/backends/metal_gpu.h b/base/sources/backends/metal_gpu.h index b288d52a..91cde34a 100644 --- a/base/sources/backends/metal_gpu.h +++ b/base/sources/backends/metal_gpu.h @@ -44,13 +44,11 @@ typedef struct { void *_tex; void *data; bool has_mipmaps; - void *_texReadback; void *_depthTex; } gpu_texture_impl_t; typedef struct { - int myCount; int myStride; void *metal_buffer; int count; diff --git a/base/sources/backends/metal_gpu.m b/base/sources/backends/metal_gpu.m index 4bd7509a..20d19084 100644 --- a/base/sources/backends/metal_gpu.m +++ b/base/sources/backends/metal_gpu.m @@ -20,7 +20,7 @@ static id argument_encoder = nil; static id argument_buffer = nil; static int argument_buffer_step; static id drawable; -static id depth_texture; +static id framebuffer_depth; static int depth_bits; static bool has_depth = false; static int framebuffer_count = 0; @@ -266,7 +266,10 @@ void iron_gpu_begin(iron_gpu_texture_t *target) { CAMetalLayer *layer = getMetalLayer(); drawable = [layer nextDrawable]; - if (depth_bits > 0 && (depth_texture == nil || depth_texture.width != drawable.texture.width || depth_texture.height != drawable.texture.height)) { + if (depth_bits > 0 && (framebuffer_depth == nil || framebuffer_depth.width != drawable.texture.width || framebuffer_depth.height != drawable.texture.height)) { + if (framebuffer_depth != nil) { + framebuffer_depth = nil; + } MTLTextureDescriptor *desc = [MTLTextureDescriptor new]; desc.textureType = MTLTextureType2D; desc.width = drawable.texture.width; @@ -278,12 +281,9 @@ void iron_gpu_begin(iron_gpu_texture_t *target) { desc.resourceOptions = MTLResourceStorageModePrivate; desc.usage = MTLTextureUsageRenderTarget; id device = getMetalDevice(); - depth_texture = [device newTextureWithDescriptor:desc]; - has_depth = true; - } - else { - has_depth = false; + framebuffer_depth = [device newTextureWithDescriptor:desc]; } + has_depth = (depth_bits > 0 && framebuffer_depth != nil); } void iron_gpu_end() { @@ -401,6 +401,12 @@ void iron_gpu_command_list_set_index_buffer(iron_gpu_command_list_t *list, iron_ } void iron_gpu_command_list_set_render_targets(iron_gpu_command_list_t *list, iron_gpu_texture_t **targets, int count, unsigned flags, unsigned color, float depth) { + if (command_buffer != nil && command_encoder != nil) { + [command_encoder endEncoding]; + [command_buffer commit]; + [command_buffer waitUntilCompleted]; + } + if (targets[0]->framebuffer_index >= 0) { for (int i = 0; i < 8; ++i) { render_targets[i] = NULL; @@ -412,23 +418,14 @@ void iron_gpu_command_list_set_render_targets(iron_gpu_command_list_t *list, iro for (int i = 0; i < count; ++i) { render_targets[i] = targets[i]; } - for (int i = count; i < 8; ++i) { - render_targets[i] = NULL; - } - } - - if (command_buffer != nil && command_encoder != nil) { - [command_encoder endEncoding]; - [command_buffer commit]; - [command_buffer waitUntilCompleted]; } MTLRenderPassDescriptor *desc = [MTLRenderPassDescriptor renderPassDescriptor]; for (int i = 0; i < count; ++i) { if (targets == NULL) { desc.colorAttachments[i].texture = drawable.texture; - desc.depthAttachment.texture = depth_texture; - has_depth = depth_texture != nil; + desc.depthAttachment.texture = framebuffer_depth; + has_depth = framebuffer_depth != nil; } else { desc.colorAttachments[i].texture = (__bridge id)targets[i]->impl._tex; @@ -559,8 +556,6 @@ void iron_gpu_pipeline_init(iron_gpu_pipeline_t *pipeline) { } void iron_gpu_pipeline_destroy(iron_gpu_pipeline_t *pipeline) { - pipeline->impl._depthStencil = NULL; - id pipe = (__bridge_transfer id)pipeline->impl._pipeline; pipe = nil; pipeline->impl._pipeline = NULL; @@ -579,7 +574,6 @@ void iron_gpu_pipeline_destroy(iron_gpu_pipeline_t *pipeline) { } void iron_gpu_pipeline_compile(iron_gpu_pipeline_t *pipeline) { - id device = getMetalDevice(); NSError *error = nil; id library = [device newLibraryWithSource:[[NSString alloc] initWithBytes:pipeline->vertex_shader->impl.source length:pipeline->vertex_shader->impl.length encoding:NSUTF8StringEncoding] options:nil error:&error]; @@ -620,35 +614,29 @@ void iron_gpu_pipeline_compile(iron_gpu_pipeline_t *pipeline) { MTLVertexDescriptor *vertexDescriptor = [[MTLVertexDescriptor alloc] init]; for (int i = 0; i < pipeline->input_layout->size; ++i) { - int index = i; - vertexDescriptor.attributes[index].bufferIndex = 0; - vertexDescriptor.attributes[index].offset = offset; - + vertexDescriptor.attributes[i].bufferIndex = 0; + vertexDescriptor.attributes[i].offset = offset; offset += iron_gpu_vertex_data_size(pipeline->input_layout->elements[i].data); - if (index >= 0) { - switch (pipeline->input_layout->elements[i].data) { - case IRON_GPU_VERTEX_DATA_F32_1X: - vertexDescriptor.attributes[index].format = MTLVertexFormatFloat; - break; - case IRON_GPU_VERTEX_DATA_F32_2X: - vertexDescriptor.attributes[index].format = MTLVertexFormatFloat2; - break; - case IRON_GPU_VERTEX_DATA_F32_3X: - vertexDescriptor.attributes[index].format = MTLVertexFormatFloat3; - break; - case IRON_GPU_VERTEX_DATA_F32_4X: - vertexDescriptor.attributes[index].format = MTLVertexFormatFloat4; - break; - case IRON_GPU_VERTEX_DATA_U8_4X_NORM: - vertexDescriptor.attributes[index].format = MTLVertexFormatUChar4Normalized; - break; - case IRON_GPU_VERTEX_DATA_I16_2X_NORM: - vertexDescriptor.attributes[index].format = MTLVertexFormatShort2Normalized; - break; - case IRON_GPU_VERTEX_DATA_I16_4X_NORM: - vertexDescriptor.attributes[index].format = MTLVertexFormatShort4Normalized; - break; - } + + switch (pipeline->input_layout->elements[i].data) { + case IRON_GPU_VERTEX_DATA_F32_1X: + vertexDescriptor.attributes[i].format = MTLVertexFormatFloat; + break; + case IRON_GPU_VERTEX_DATA_F32_2X: + vertexDescriptor.attributes[i].format = MTLVertexFormatFloat2; + break; + case IRON_GPU_VERTEX_DATA_F32_3X: + vertexDescriptor.attributes[i].format = MTLVertexFormatFloat3; + break; + case IRON_GPU_VERTEX_DATA_F32_4X: + vertexDescriptor.attributes[i].format = MTLVertexFormatFloat4; + break; + case IRON_GPU_VERTEX_DATA_I16_2X_NORM: + vertexDescriptor.attributes[i].format = MTLVertexFormatShort2Normalized; + break; + case IRON_GPU_VERTEX_DATA_I16_4X_NORM: + vertexDescriptor.attributes[i].format = MTLVertexFormatShort4Normalized; + break; } } @@ -940,7 +928,7 @@ void iron_gpu_render_target_set_depth_from(iron_gpu_texture_t *target, iron_gpu_ void iron_gpu_vertex_buffer_init(iron_gpu_buffer_t *buffer, int count, iron_gpu_vertex_structure_t *structure, bool gpu_memory) { memset(&buffer->impl, 0, sizeof(buffer->impl)); - buffer->impl.myCount = count; + buffer->myCount = count; buffer->impl.gpu_memory = gpu_memory; for (int i = 0; i < structure->size; ++i) { iron_gpu_vertex_element_t element = structure->elements[i]; @@ -971,7 +959,7 @@ void iron_gpu_vertex_buffer_unlock(iron_gpu_buffer_t *buf) { } int iron_gpu_vertex_buffer_count(iron_gpu_buffer_t *buffer) { - return buffer->impl.myCount; + return buffer->myCount; } int iron_gpu_vertex_buffer_stride(iron_gpu_buffer_t *buffer) { diff --git a/base/sources/backends/vulkan_gpu.c b/base/sources/backends/vulkan_gpu.c index b26ec3c1..efe4262c 100644 --- a/base/sources/backends/vulkan_gpu.c +++ b/base/sources/backends/vulkan_gpu.c @@ -2447,9 +2447,6 @@ void iron_gpu_pipeline_compile(iron_gpu_pipeline_t *pipeline) { case IRON_GPU_VERTEX_DATA_F32_4X: vi_attrs[attr].format = VK_FORMAT_R32G32B32A32_SFLOAT; break; - case IRON_GPU_VERTEX_DATA_U8_4X_NORM: - vi_attrs[attr].format = VK_FORMAT_R8G8B8A8_UNORM; - break; case IRON_GPU_VERTEX_DATA_I16_2X_NORM: vi_attrs[attr].format = VK_FORMAT_R16G16_SNORM; break; @@ -3257,8 +3254,7 @@ void iron_gpu_render_target_set_depth_from(iron_gpu_texture_t *target, iron_gpu_ } void iron_gpu_vertex_buffer_init(iron_gpu_buffer_t *buffer, int vertexCount, iron_gpu_vertex_structure_t *structure, bool gpuMemory) { - buffer->myCount = count; - buffer->impl.myCount = vertexCount; + buffer->myCount = vertexCount; buffer->impl.myStride = 0; for (int i = 0; i < structure->size; ++i) { iron_gpu_vertex_element_t element = structure->elements[i]; @@ -3320,7 +3316,7 @@ void iron_gpu_vertex_buffer_destroy(iron_gpu_buffer_t *buffer) { float *iron_gpu_vertex_buffer_lock(iron_gpu_buffer_t *buffer) { int start = 0; - int count = buffer->impl.myCount; + int count = buffer->myCount; vkMapMemory(vk_ctx.device, buffer->impl.mem, start * buffer->impl.myStride, count * buffer->impl.myStride, 0, (void **)&buffer->impl.data); return buffer->impl.data; } @@ -3334,7 +3330,7 @@ int iron_gpu_internal_vertex_buffer_set(iron_gpu_buffer_t *buffer) { } int iron_gpu_vertex_buffer_count(iron_gpu_buffer_t *buffer) { - return buffer->impl.myCount; + return buffer->myCount; } int iron_gpu_vertex_buffer_stride(iron_gpu_buffer_t *buffer) { @@ -3402,7 +3398,7 @@ int iron_gpu_constant_buffer_size(iron_gpu_buffer_t *buffer) { } void iron_gpu_index_buffer_init(iron_gpu_buffer_t *buffer, int indexCount, bool gpuMemory) { - buffer->impl.myCount = indexCount; + buffer->myCount = indexCount; VkBufferCreateInfo buf_info = { .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, @@ -3469,7 +3465,7 @@ void iron_gpu_index_buffer_unlock(iron_gpu_buffer_t *buffer) { } int iron_gpu_index_buffer_count(iron_gpu_buffer_t *buffer) { - return buffer->impl.myCount; + return buffer->myCount; } static const int INDEX_RAYGEN = 0; @@ -3942,8 +3938,8 @@ void iron_gpu_raytrace_acceleration_structure_build(iron_gpu_raytrace_accelerati if (build_bottom) { for (int i = 0; i < vb_count; ++i) { - uint32_t prim_count = ib[i]->impl.myCount / 3; - uint32_t vert_count = vb[i]->impl.myCount; + uint32_t prim_count = ib[i]->myCount / 3; + uint32_t vert_count = vb[i]->myCount; VkDeviceOrHostAddressConstKHR vertex_data_device_address = {0}; VkDeviceOrHostAddressConstKHR index_data_device_address = {0}; @@ -3959,7 +3955,7 @@ void iron_gpu_raytrace_acceleration_structure_build(iron_gpu_raytrace_accelerati .geometry.triangles.vertexFormat = VK_FORMAT_R16G16B16A16_SNORM, .geometry.triangles.vertexData.deviceAddress = vertex_data_device_address.deviceAddress, .geometry.triangles.vertexStride = vb[i]->impl.myStride, - .geometry.triangles.maxVertex = vb[i]->impl.myCount, + .geometry.triangles.maxVertex = vb[i]->myCount, .geometry.triangles.indexType = VK_INDEX_TYPE_UINT32, .geometry.triangles.indexData.deviceAddress = index_data_device_address.deviceAddress, }; @@ -4180,7 +4176,7 @@ void iron_gpu_raytrace_acceleration_structure_build(iron_gpu_raytrace_accelerati int ib_off = 0; for (int j = 0; j < instances[i].i; ++j) { - ib_off += ib[j]->impl.myCount * 4; + ib_off += ib[j]->myCount * 4; } instance.instanceCustomIndex = ib_off; diff --git a/base/sources/backends/webgpu_gpu.c b/base/sources/backends/webgpu_gpu.c index d6953b86..7a3e4b22 100644 --- a/base/sources/backends/webgpu_gpu.c +++ b/base/sources/backends/webgpu_gpu.c @@ -259,9 +259,6 @@ void iron_gpu_pipeline_compile(iron_gpu_pipeline_t *pipe) { case IRON_GPU_VERTEX_DATA_F32_4X: vaDesc[i].format = WGPUVertexFormat_Float32x4; break; - case IRON_GPU_VERTEX_DATA_U8_4X_NORM: - vaDesc[i].format = WGPUVertexFormat_Unorm8x4; - break; case IRON_GPU_VERTEX_DATA_I16_2X_NORM: vaDesc[i].format = WGPUVertexFormat_Snorm16x2; break; diff --git a/base/sources/iron_draw.c b/base/sources/iron_draw.c index 22f8da89..8edf6ff1 100644 --- a/base/sources/iron_draw.c +++ b/base/sources/iron_draw.c @@ -550,10 +550,12 @@ void draw_string(const char *text, float x, float y) { if (draw_font_get_baked_quad(draw_font, draw_font_size, &q, codepoint, xpos, ypos)) { xpos += q.xadvance; + // gpu_set_pipeline(draw_custom_pipeline != NULL ? draw_custom_pipeline : _draw_current != NULL ? &text_pipeline_rt : &text_pipeline); gpu_set_vertex_buffer(&rect_vertex_buffer); gpu_set_index_buffer(&rect_index_buffer); gpu_set_texture(&text_tex_unit, tex); + // gpu_set_float4(&text_pos_loc, q.x0 / vw(), q.y0 / vh(), (q.x1 - q.x0) / vw(), (q.y1 - q.y0) / vh()); gpu_set_float4(&text_tex_loc, q.s0, q.t0, q.s1 - q.s0, q.t1 - q.t0); diff --git a/base/sources/iron_gpu.h b/base/sources/iron_gpu.h index 21dca208..104fda1c 100644 --- a/base/sources/iron_gpu.h +++ b/base/sources/iron_gpu.h @@ -45,7 +45,6 @@ typedef enum iron_gpu_vertex_data { IRON_GPU_VERTEX_DATA_F32_2X, IRON_GPU_VERTEX_DATA_F32_3X, IRON_GPU_VERTEX_DATA_F32_4X, - IRON_GPU_VERTEX_DATA_U8_4X_NORM, IRON_GPU_VERTEX_DATA_I16_2X_NORM, IRON_GPU_VERTEX_DATA_I16_4X_NORM, } iron_gpu_vertex_data_t; @@ -292,8 +291,6 @@ static inline int iron_gpu_vertex_data_size(iron_gpu_vertex_data_t data) { return 3 * 4; case IRON_GPU_VERTEX_DATA_F32_4X: return 4 * 4; - case IRON_GPU_VERTEX_DATA_U8_4X_NORM: - return 4 * 1; case IRON_GPU_VERTEX_DATA_I16_2X_NORM: return 2 * 2; case IRON_GPU_VERTEX_DATA_I16_4X_NORM: diff --git a/base/sources/ts/iron/const_data.ts b/base/sources/ts/iron/const_data.ts index dc85406a..43254772 100644 --- a/base/sources/ts/iron/const_data.ts +++ b/base/sources/ts/iron/const_data.ts @@ -9,7 +9,6 @@ function const_data_create_screen_aligned_data() { let data: f32[] = [-1.0, -1.0, 3.0, -1.0, -1.0, 3.0]; let indices: i32[] = [0, 1, 2]; - // Mandatory vertex data names and sizes let structure: iron_gpu_vertex_structure_t = gpu_vertex_struct_create(); gpu_vertex_struct_add(structure, "pos", vertex_data_t.F32_2X); const_data_screen_aligned_vb = gpu_create_vertex_buffer(math_floor(data.length / math_floor(iron_gpu_vertex_struct_size(structure) / 4)), structure, usage_t.STATIC); diff --git a/base/sources/ts/iron/iron.ts b/base/sources/ts/iron/iron.ts index 15dc2843..28af3a10 100644 --- a/base/sources/ts/iron/iron.ts +++ b/base/sources/ts/iron/iron.ts @@ -665,7 +665,6 @@ enum vertex_data_t { F32_2X, F32_3X, F32_4X, - U8_4X_NORM, I16_2X_NORM, I16_4X_NORM, } diff --git a/base/sources/ts/node_shader.ts b/base/sources/ts/node_shader.ts index e295a53a..a5c97601 100644 --- a/base/sources/ts/node_shader.ts +++ b/base/sources/ts/node_shader.ts @@ -182,15 +182,18 @@ function node_shader_get(raw: node_shader_t): string { } s += "}\n\n"; + s += "#[set(everything)]\n"; + s += "const constants: {\n"; if (raw.constants.length > 0) { - s += "#[set(everything)]\n"; - s += "const constants: {\n"; for (let i: i32 = 0; i < raw.constants.length; ++i) { let a: string = raw.constants[i]; s += "\t" + a + ";\n"; } - s += "};\n\n"; } + else { + s += "\tempty: float4;\n"; + } + s += "};\n\n"; if (raw.textures.length > 0) { s += "#[set(everything)]\n"; diff --git a/base/sources/ts/render_path_base.ts b/base/sources/ts/render_path_base.ts index d6d1be33..3d7f5b58 100644 --- a/base/sources/ts/render_path_base.ts +++ b/base/sources/ts/render_path_base.ts @@ -350,9 +350,6 @@ function render_path_base_draw_taa(bufa: string, bufb: string) { function render_path_base_draw_gbuffer() { render_path_set_target("gbuffer0", null, clear_flag_t.DEPTH, 0, 1.0); // Only clear gbuffer0 - if (make_mesh_layer_pass_count == 1) { - render_path_set_target("gbuffer2", null, clear_flag_t.COLOR, 0xff000000); - } let additional: string[] = ["gbuffer1", "gbuffer2"]; render_path_set_target("gbuffer0", additional); render_path_paint_bind_layers();