Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5cd6b39

Browse files
committed
Add Rhi::RenderCommandList additional unit-tests
1 parent44713a2 commit5cd6b39

File tree

7 files changed

+339
-35
lines changed

7 files changed

+339
-35
lines changed

‎Modules/Graphics/RHI/Base/Sources/Methane/Graphics/Base/RenderCommandList.cpp‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,17 @@ void RenderCommandList::DrawIndexed(Primitive primitive_type, uint32_t index_cou
215215
if (m_is_validation_enabled)
216216
{
217217
const DrawingState& drawing_state =GetDrawingState();
218+
META_CHECK_NOT_NULL_DESCR(drawing_state.render_state_ptr,"render state must be set before indexed draw call");
219+
META_CHECK_NOT_NULL_DESCR(drawing_state.view_state_ptr,"view state must be set before indexed draw call");
218220
META_CHECK_NOT_NULL_DESCR(drawing_state.index_buffer_ptr,"index buffer must be set before indexed draw call");
219221
META_CHECK_NOT_NULL_DESCR(drawing_state.vertex_buffer_set_ptr,"vertex buffers must be set before draw call");
220222

221223
constuint32_t formatted_items_count = drawing_state.index_buffer_ptr->GetFormattedItemsCount();
222224
META_CHECK_NOT_ZERO_DESCR(formatted_items_count,"can not draw with index buffer which contains no formatted vertices");
223225
META_CHECK_NOT_ZERO_DESCR(index_count,"can not draw zero index/vertex count");
224226
META_CHECK_NOT_ZERO_DESCR(instance_count,"can not draw zero instances");
225-
META_CHECK_LESS_DESCR(start_index, formatted_items_count - index_count +1U,"ending index is out of buffer bounds");
227+
META_CHECK_LESS_OR_EQUAL_DESCR(index_count, formatted_items_count,"can not draw more indices than available in the index buffer");
228+
META_CHECK_LESS_OR_EQUAL_DESCR(start_index, formatted_items_count - index_count,"ending index is out of buffer bounds");
226229

227230
ValidateDrawVertexBuffers(start_vertex);
228231
}
@@ -245,6 +248,7 @@ void RenderCommandList::Draw(Primitive primitive_type, uint32_t vertex_count, ui
245248
{
246249
const DrawingState& drawing_state =GetDrawingState();
247250
META_CHECK_NOT_NULL_DESCR(drawing_state.render_state_ptr,"render state must be set before draw call");
251+
META_CHECK_NOT_NULL_DESCR(drawing_state.view_state_ptr,"view state must be set before draw call");
248252
constsize_t input_buffers_count = drawing_state.render_state_ptr->GetSettings().program_ptr->GetSettings().input_buffer_layouts.size();
249253
META_CHECK_TRUE_DESCR(!input_buffers_count || drawing_state.vertex_buffer_set_ptr,
250254
"vertex buffers must be set when program has non empty input buffer layouts");
@@ -322,10 +326,13 @@ void RenderCommandList::ValidateDrawVertexBuffers(uint32_t draw_start_vertex, ui
322326
const Rhi::IBuffer& vertex_buffer = (*m_drawing_state.vertex_buffer_set_ptr)[vertex_buffer_index];
323327
constuint32_t vertex_count = vertex_buffer.GetFormattedItemsCount();
324328
META_UNUSED(vertex_count);
325-
META_CHECK_LESS_DESCR(draw_start_vertex, vertex_count - draw_vertex_count +1U,
326-
"can not draw starting from vertex {}{} which is out of bounds for vertex buffer '{}' with vertex count {}",
327-
draw_start_vertex, draw_vertex_count ?fmt::format(" with {} vertex count", draw_vertex_count) :"",
328-
vertex_buffer.GetName(), vertex_count);
329+
META_CHECK_LESS_OR_EQUAL_DESCR(draw_vertex_count, vertex_count,
330+
"vertex count to draw is out of bounds of initialized vertex size for buffer '{}'",
331+
vertex_buffer.GetName());
332+
META_CHECK_LESS_OR_EQUAL_DESCR(draw_start_vertex, vertex_count - draw_vertex_count,
333+
"can not draw starting from vertex {}{} which is out of bounds for vertex buffer '{}' with vertex count {}",
334+
draw_start_vertex, draw_vertex_count ?fmt::format(" with {} vertex count", draw_vertex_count) :"",
335+
vertex_buffer.GetName(), vertex_count);
329336
}
330337
}
331338

‎Modules/Graphics/RHI/Null/Include/Methane/Graphics/Null/RenderCommandList.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class RenderCommandList final // NOSONAR - inheritance hierarchy is greater than
5454
uint32_t instance_count,uint32_t start_instance)override;
5555

5656
using Base::RenderCommandList::GetDrawingState;
57+
using Base::CommandList::GetCommandState;
5758
};
5859

5960
}// namespace Methane::Graphics::Null

‎Modules/Graphics/RHI/Null/Include/Methane/Graphics/Null/Resource.hpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ class Resource // NOSONAR - can not comply with rule of Zero: destructor is requ
7373

7474
voidRestoreDescriptorViews(const DescriptorByViewId&)final
7575
{/* Intentionally unimplemented*/ }
76+
77+
using Base::Resource::SetInitializedDataSize;
7678
};
7779

7880
}// namespace Methane::Graphics::Null

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp