Skip to content

Commit

Permalink
[font] fixed an issue where the performance metrics, car metrics and …
Browse files Browse the repository at this point in the history
…input guide would not render correctly in the forest world
  • Loading branch information
PanosK92 committed Jan 23, 2025
1 parent fdbcb76 commit 8dfdfa9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 45 deletions.
4 changes: 2 additions & 2 deletions runtime/Game/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ namespace spartan
{
// create material
shared_ptr<Material> material = make_shared<Material>();
material->SetTexture(MaterialTextureType::Color, "project\\models\\wheel\\albedo.jpeg");
material->SetTexture(MaterialTextureType::Normal, "project\\models\\wheel\\normal.png");
material->SetTexture(MaterialTextureType::Color, "project\\models\\wheel\\albedo.jpeg");
material->SetTexture(MaterialTextureType::Normal, "project\\models\\wheel\\normal.png");
material->SetTexture(MaterialTextureType::Roughness, "project\\models\\wheel\\roughness.png");
material->SetTexture(MaterialTextureType::Metalness, "project\\models\\wheel\\metalness.png");

Expand Down
5 changes: 0 additions & 5 deletions runtime/RHI/Vulkan/Vulkan_CommandList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1635,11 +1635,6 @@ namespace spartan
{
void* mapped_data = static_cast<char*>(buffer->GetMappedData()) + offset;
memcpy(mapped_data, data, size);

if (buffer->GetType() != RHI_Buffer_Type::Storage)
{
SP_LOG_WARNING("Updated a non-storage buffer with memcpy. Consider using vkCmdUpdateBuffer for synchronized updates.");
}
}
}

Expand Down
44 changes: 6 additions & 38 deletions runtime/Rendering/Font/Font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,45 +224,13 @@ namespace spartan
cmd_list->InsertBarrierBufferReadWrite(m_buffer_vertex.get());
cmd_list->InsertBarrierBufferReadWrite(m_buffer_index.get());

// update vertex buffer in chunks
{
const size_t vertex_size = sizeof(m_vertices[0]);
size_t size = m_vertices.size() * vertex_size;
size_t offset = 0;

// zero out
memset(m_buffer_vertex->GetMappedData(), 0, m_buffer_vertex->GetObjectSize());

// update
while (offset < size)
{
size_t current_chunk_size = min(static_cast<size_t>(rhi_max_buffer_update_size), size - offset);

cmd_list->UpdateBuffer(m_buffer_vertex.get(), offset, current_chunk_size, &m_vertices[offset / vertex_size]);

offset += current_chunk_size;
}
}
// update vertex buffer
memset(m_buffer_vertex->GetMappedData(), 0, m_buffer_vertex->GetObjectSize());
cmd_list->UpdateBuffer(m_buffer_vertex.get(), 0, m_buffer_vertex->GetObjectSize(), &m_vertices[0]);

// update index buffer in chunks
{
const size_t index_size = sizeof(m_indices[0]);
size_t size = m_indices.size() * index_size;
size_t offset = 0;

// zero out
memset(m_buffer_index->GetMappedData(), 0, m_buffer_index->GetObjectSize());

// update
while (offset < size)
{
size_t current_chunk_size = min(static_cast<size_t>(rhi_max_buffer_update_size), size - offset);

cmd_list->UpdateBuffer(m_buffer_index.get(), offset, current_chunk_size, &m_indices[offset / index_size]);

offset += current_chunk_size;
}
}
// update index buffer
memset(m_buffer_index->GetMappedData(), 0, m_buffer_index->GetObjectSize());
cmd_list->UpdateBuffer(m_buffer_index.get(), 0, m_buffer_index->GetObjectSize(), &m_indices[0]);

m_font_data.clear();
}
Expand Down

0 comments on commit 8dfdfa9

Please sign in to comment.