diff --git a/Apps/02-HelloCube/README.md b/Apps/02-HelloCube/README.md index 77a092823..3a77b095d 100644 --- a/Apps/02-HelloCube/README.md +++ b/Apps/02-HelloCube/README.md @@ -203,10 +203,10 @@ class HelloTriangleApp final : public GraphicsApp // Create index buffer for cube mesh m_index_buffer = GetRenderContext().CreateBuffer(Rhi::BufferSettings::ForIndexBuffer(m_cube_mesh.GetIndexDataSize(), GetIndexFormat(m_cube_mesh.GetIndex(0)))); - m_index_buffer.SetData( - { { reinterpret_cast(m_cube_mesh.GetIndices().data()), m_cube_mesh.GetIndexDataSize() } }, - m_render_cmd_queue - ); + m_index_buffer.SetData(m_render_cmd_queue, { + reinterpret_cast(m_cube_mesh.GetIndices().data()), + m_cube_mesh.GetIndexDataSize() + }); // Create per-frame command lists for(HelloCubeFrame& frame : GetFrames()) @@ -290,10 +290,10 @@ class HelloCubeApp final : public GraphicsApp const HelloCubeFrame& frame = GetCurrentFrame(); // Update vertex buffer with vertices in camera's projection view - frame.vertex_buffer_set[0].SetData( - { { reinterpret_cast(m_proj_vertices.data()), m_cube_mesh.GetVertexDataSize() } }, - m_render_cmd_queue - ); + frame.vertex_buffer_set[0].SetData(m_render_cmd_queue, { + reinterpret_cast(m_proj_vertices.data()), + m_cube_mesh.GetVertexDataSize() + }); // Issue commands for cube rendering META_DEBUG_GROUP_VAR(s_debug_group, "Cube Rendering"); @@ -544,10 +544,10 @@ class HelloCubeApp final : public GraphicsApp // Create constant vertex buffer Rhi::Buffer vertex_buffer = GetRenderContext().CreateBuffer(Rhi::BufferSettings::ForVertexBuffer(m_cube_mesh.GetVertexDataSize(), m_cube_mesh.GetVertexSize())); - vertex_buffer.SetData( - { { reinterpret_cast(m_cube_mesh.GetVertices().data()), m_cube_mesh.GetVertexDataSize() } }, - m_render_cmd_queue - ); + vertex_buffer.SetData(m_render_cmd_queue, { + reinterpret_cast(m_cube_mesh.GetVertices().data()), + m_cube_mesh.GetVertexDataSize() + }); m_vertex_buffer_set = Rhi::BufferSet(Rhi::BufferType::Vertex, { vertex_buffer }); const auto uniforms_data_size = static_cast(sizeof(m_shader_uniforms)); @@ -601,7 +601,7 @@ class HelloCubeApp final : public GraphicsApp const HelloCubeFrame& frame = GetCurrentFrame(); // Update uniforms buffer on GPU and apply model-view-projection transformation in vertex shader on GPU - frame.uniforms_buffer.SetData(m_shader_uniforms_subresources, m_render_cmd_queue); + frame.uniforms_buffer.SetData(m_render_cmd_queue, m_shader_uniforms_subresources); // Issue commands for cube rendering META_DEBUG_GROUP_VAR(s_debug_group, "Cube Rendering"); diff --git a/Apps/03-TexturedCube/README.md b/Apps/03-TexturedCube/README.md index d7a1ca716..d13572946 100644 --- a/Apps/03-TexturedCube/README.md +++ b/Apps/03-TexturedCube/README.md @@ -232,28 +232,28 @@ void TexturedCubeApp::Init() const Data::Size vertex_data_size = cube_mesh.GetVertexDataSize(); const Data::Size vertex_size = cube_mesh.GetVertexSize(); rhi::Buffer vertex_buffer = GetRenderContext().CreateBuffer(rhi::BufferSettings::ForVertexBuffer(vertex_data_size, vertex_size)); - vertex_buffer.SetData( - { { reinterpret_cast(cube_mesh.GetVertices().data()), vertex_data_size } }, - render_cmd_queue - ); + vertex_buffer.SetData(render_cmd_queue, { + reinterpret_cast(cube_mesh.GetVertices().data()), + vertex_data_size + }); m_vertex_buffer_set = rhi::BufferSet(rhi::BufferType::Vertex, { vertex_buffer }); // Create index buffer for cube mesh const Data::Size index_data_size = cube_mesh.GetIndexDataSize(); const gfx::PixelFormat index_format = gfx::GetIndexFormat(cube_mesh.GetIndex(0)); m_index_buffer = GetRenderContext().CreateBuffer(rhi::BufferSettings::ForIndexBuffer(index_data_size, index_format)); - m_index_buffer.SetData( - { { reinterpret_cast(cube_mesh.GetIndices().data()), index_data_size } }, - render_cmd_queue - ); + m_index_buffer.SetData(render_cmd_queue, { + reinterpret_cast(cube_mesh.GetIndices().data()), + index_data_size + }); // Create constants buffer for frame rendering const auto constants_data_size = static_cast(sizeof(m_shader_constants)); m_const_buffer = GetRenderContext().CreateBuffer(rhi::BufferSettings::ForConstantBuffer(constants_data_size)); - m_const_buffer.SetData( - { { reinterpret_cast(&m_shader_constants), constants_data_size } }, - render_cmd_queue - ); + m_const_buffer.SetData(render_cmd_queue, { + reinterpret_cast(&m_shader_constants), + constants_data_size + }); ... } @@ -449,7 +449,7 @@ bool TexturedCubeApp::Render() // Update uniforms buffer related to current frame const TexturedCubeFrame& frame = GetCurrentFrame(); const rhi::CommandQueue& render_cmd_queue = GetRenderContext().GetRenderCommandKit().GetQueue(); - frame.uniforms_buffer.SetData(m_shader_uniforms_subresources, render_cmd_queue); + frame.uniforms_buffer.SetData(render_cmd_queue, m_shader_uniforms_subresources); // Issue commands for cube rendering META_DEBUG_GROUP_VAR(s_debug_group, "Cube Rendering"); diff --git a/Apps/04-ShadowCube/README.md b/Apps/04-ShadowCube/README.md index 1c36e74c4..0ec31c1fd 100644 --- a/Apps/04-ShadowCube/README.md +++ b/Apps/04-ShadowCube/README.md @@ -67,7 +67,7 @@ struct MeshUniforms `TexturedMeshBuffers` which is managing vertex, index, uniforms buffers and texture with data for particular mesh drawing passed to constructor as a reference to [BaseMesh]((../../../Modules/Graphics/Primitives/Include/Methane/Graphics/Mesh/BaseMesh.hpp)) object. -Supplementary member `m_scene_uniforms_subresources` stores a pointer to the `m_scene_uniforms` in the `std::vector` +Supplementary member `m_scene_uniforms_subresource` stores a pointer to the `m_scene_uniforms` in the `std::vector` type `gfx::IResource::SubResources` which is passed to `Rhi::Buffer::SetData(...)` method to update the buffer data on GPU. Two `gfx::Camera` objects are used: one `m_view_camera` is usual perspective view camera, while the other `m_light_camera` @@ -149,7 +149,7 @@ private: 30.F // - light_specular_factor }; hlslpp::SceneUniforms m_scene_uniforms{ }; - rhi::SubResources m_scene_uniforms_subresources{ + rhi::SubResources m_scene_uniforms_subresource{ { reinterpret_cast(&m_scene_uniforms), sizeof(hlslpp::SceneUniforms) } // NOSONAR }; gfx::Camera m_view_camera; @@ -577,11 +577,11 @@ bool ShadowCubeApp::Render() // Upload uniform buffers to GPU const ShadowCubeFrame& frame = GetCurrentFrame(); const rhi::CommandQueue render_cmd_queue = GetRenderContext().GetRenderCommandKit().GetQueue(); - frame.scene_uniforms_buffer.SetData(m_scene_uniforms_subresources, render_cmd_queue); - frame.shadow_pass.floor.uniforms_buffer.SetData(m_floor_buffers_ptr->GetShadowPassUniformsSubresources(), render_cmd_queue); - frame.shadow_pass.cube.uniforms_buffer.SetData(m_cube_buffers_ptr->GetShadowPassUniformsSubresources(), render_cmd_queue); - frame.final_pass.floor.uniforms_buffer.SetData(m_floor_buffers_ptr->GetFinalPassUniformsSubresources(), render_cmd_queue); - frame.final_pass.cube.uniforms_buffer.SetData(m_cube_buffers_ptr->GetFinalPassUniformsSubresources(), render_cmd_queue); + frame.scene_uniforms_buffer.SetData(render_cmd_queue, m_scene_uniforms_subresource); + frame.shadow_pass.floor.uniforms_buffer.SetData(render_cmd_queue, m_floor_buffers_ptr->GetShadowPassUniformsSubresources()); + frame.shadow_pass.cube.uniforms_buffer.SetData(render_cmd_queue, m_cube_buffers_ptr->GetShadowPassUniformsSubresources()); + frame.final_pass.floor.uniforms_buffer.SetData(render_cmd_queue, m_floor_buffers_ptr->GetFinalPassUniformsSubresources()); + frame.final_pass.cube.uniforms_buffer.SetData(render_cmd_queue, m_cube_buffers_ptr->GetFinalPassUniformsSubresources()); // Record commands for shadow & final render passes RenderScene(m_shadow_pass, frame.shadow_pass);