diff --git a/engine/source/runtime/function/render/passes/directional_light_pass.cpp b/engine/source/runtime/function/render/passes/directional_light_pass.cpp index ca0dccf5f..837473ee9 100644 --- a/engine/source/runtime/function/render/passes/directional_light_pass.cpp +++ b/engine/source/runtime/function/render/passes/directional_light_pass.cpp @@ -555,7 +555,7 @@ namespace Piccolo RHIBuffer* vertex_buffers[] = {mesh->mesh_vertex_position_buffer}; RHIDeviceSize offsets[] = {0}; m_rhi->cmdBindVertexBuffersPFN(m_rhi->getCurrentCommandBuffer(), 0, 1, vertex_buffers, offsets); - m_rhi->cmdBindIndexBufferPFN(m_rhi->getCurrentCommandBuffer(), mesh->mesh_index_buffer, 0, RHI_INDEX_TYPE_UINT16); + m_rhi->cmdBindIndexBufferPFN(m_rhi->getCurrentCommandBuffer(), mesh->mesh_index_buffer, 0, RHI_INDEX_TYPE_UINT32); uint32_t drawcall_max_instance_count = (sizeof(MeshDirectionalLightShadowPerdrawcallStorageBufferObject::mesh_instances) / diff --git a/engine/source/runtime/function/render/passes/main_camera_pass.cpp b/engine/source/runtime/function/render/passes/main_camera_pass.cpp index 3300e4638..6d592b7ea 100644 --- a/engine/source/runtime/function/render/passes/main_camera_pass.cpp +++ b/engine/source/runtime/function/render/passes/main_camera_pass.cpp @@ -2202,7 +2202,8 @@ namespace Piccolo (sizeof(vertex_buffers) / sizeof(vertex_buffers[0])), vertex_buffers, offsets); - m_rhi->cmdBindIndexBufferPFN(m_rhi->getCurrentCommandBuffer(), mesh.mesh_index_buffer, 0, RHI_INDEX_TYPE_UINT16); + m_rhi->cmdBindIndexBufferPFN( + m_rhi->getCurrentCommandBuffer(), mesh.mesh_index_buffer, 0, RHI_INDEX_TYPE_UINT32); uint32_t drawcall_max_instance_count = (sizeof(MeshPerdrawcallStorageBufferObject::mesh_instances) / @@ -2474,7 +2475,7 @@ namespace Piccolo (sizeof(vertex_buffers) / sizeof(vertex_buffers[0])), vertex_buffers, offsets); - m_rhi->cmdBindIndexBufferPFN(m_rhi->getCurrentCommandBuffer(), mesh.mesh_index_buffer, 0, RHI_INDEX_TYPE_UINT16); + m_rhi->cmdBindIndexBufferPFN(m_rhi->getCurrentCommandBuffer(), mesh.mesh_index_buffer, 0, RHI_INDEX_TYPE_UINT32); uint32_t drawcall_max_instance_count = (sizeof(MeshPerdrawcallStorageBufferObject::mesh_instances) / @@ -2697,7 +2698,7 @@ namespace Piccolo m_rhi->cmdBindIndexBufferPFN(m_rhi->getCurrentCommandBuffer(), m_visiable_nodes.p_axis_node->ref_mesh->mesh_index_buffer, 0, - RHI_INDEX_TYPE_UINT16); + RHI_INDEX_TYPE_UINT32); (*reinterpret_cast(reinterpret_cast( m_global_render_resource->_storage_buffer._axis_inefficient_storage_buffer_memory_pointer))) = m_axis_storage_buffer_object; diff --git a/engine/source/runtime/function/render/passes/pick_pass.cpp b/engine/source/runtime/function/render/passes/pick_pass.cpp index 90ad4a1a6..62ba31fa6 100644 --- a/engine/source/runtime/function/render/passes/pick_pass.cpp +++ b/engine/source/runtime/function/render/passes/pick_pass.cpp @@ -577,7 +577,7 @@ namespace Piccolo m_rhi->cmdBindIndexBufferPFN(m_rhi->getCurrentCommandBuffer(), mesh.mesh_index_buffer, 0, - RHI_INDEX_TYPE_UINT16); + RHI_INDEX_TYPE_UINT32); uint32_t drawcall_max_instance_count = (sizeof(MeshInefficientPickPerdrawcallStorageBufferObject::model_matrices) / diff --git a/engine/source/runtime/function/render/passes/point_light_pass.cpp b/engine/source/runtime/function/render/passes/point_light_pass.cpp index e503cb1ca..a6cce3088 100644 --- a/engine/source/runtime/function/render/passes/point_light_pass.cpp +++ b/engine/source/runtime/function/render/passes/point_light_pass.cpp @@ -568,7 +568,7 @@ namespace Piccolo m_rhi->cmdBindVertexBuffersPFN( m_rhi->getCurrentCommandBuffer(), 0, 1, vertex_buffers, offsets); m_rhi->cmdBindIndexBufferPFN( - m_rhi->getCurrentCommandBuffer(), mesh.mesh_index_buffer, 0, RHI_INDEX_TYPE_UINT16); + m_rhi->getCurrentCommandBuffer(), mesh.mesh_index_buffer, 0, RHI_INDEX_TYPE_UINT32); uint32_t drawcall_max_instance_count = (sizeof(MeshPointLightShadowPerdrawcallStorageBufferObject::mesh_instances) / diff --git a/engine/source/runtime/function/render/render_resource_base.cpp b/engine/source/runtime/function/render/render_resource_base.cpp index 09199d5ca..adc94495a 100644 --- a/engine/source/runtime/function/render/render_resource_base.cpp +++ b/engine/source/runtime/function/render/render_resource_base.cpp @@ -70,11 +70,10 @@ namespace Piccolo if (!texture->m_pixels) return nullptr; - texture->m_width = iw; - texture->m_height = ih; - texture->m_format = (is_srgb) ? RHIFormat::RHI_FORMAT_R8G8B8A8_SRGB : - RHIFormat::RHI_FORMAT_R8G8B8A8_UNORM; - texture->m_depth = 1; + texture->m_width = iw; + texture->m_height = ih; + texture->m_format = (is_srgb) ? RHIFormat::RHI_FORMAT_R8G8B8A8_SRGB : RHIFormat::RHI_FORMAT_R8G8B8A8_UNORM; + texture->m_depth = 1; texture->m_array_layers = 1; texture->m_mip_levels = 1; texture->m_type = PICCOLO_IMAGE_TYPE::PICCOLO_IMAGE_TYPE_2D; @@ -121,12 +120,12 @@ namespace Piccolo } // index buffer - size_t index_size = bind_data->index_buffer.size() * sizeof(uint16_t); + size_t index_size = bind_data->index_buffer.size() * sizeof(uint32_t); ret.m_static_mesh_data.m_index_buffer = std::make_shared(index_size); - uint16_t* index = (uint16_t*)ret.m_static_mesh_data.m_index_buffer->m_data; + uint32_t* index = (uint32_t*)ret.m_static_mesh_data.m_index_buffer->m_data; for (size_t i = 0; i < bind_data->index_buffer.size(); i++) { - index[i] = static_cast(bind_data->index_buffer[i]); + index[i] = static_cast(bind_data->index_buffer[i]); } // skeleton binding buffer @@ -325,17 +324,17 @@ namespace Piccolo uint32_t stride = sizeof(MeshVertexDataDefinition); mesh_data.m_vertex_buffer = std::make_shared(mesh_vertices.size() * stride); - mesh_data.m_index_buffer = std::make_shared(mesh_vertices.size() * sizeof(uint16_t)); + mesh_data.m_index_buffer = std::make_shared(mesh_vertices.size() * sizeof(uint32_t)); - assert(mesh_vertices.size() <= std::numeric_limits::max()); // take care of the index range, should be + assert(mesh_vertices.size() <= std::numeric_limits::max()); // take care of the index range, should be // consistent with the index range used by // vulkan - uint16_t* indices = (uint16_t*)mesh_data.m_index_buffer->m_data; + uint32_t* indices = (uint32_t*)mesh_data.m_index_buffer->m_data; for (size_t i = 0; i < mesh_vertices.size(); i++) { ((MeshVertexDataDefinition*)(mesh_data.m_vertex_buffer->m_data))[i] = mesh_vertices[i]; - indices[i] = static_cast(i); + indices[i] = static_cast(i); } return mesh_data;