ATOM-15859 AuxGeom rendering in editor is too expensive (#1582)

* ATOM-15859 AuxGeom rendering in editor is too expensive
- The OrphanBuffer calls is the main reason that AuxGeom FP render is slow.
- Switched to use DynamicBuffer for buffers used in DynamicPrimitiveProcessor
- Added some profiling marks.
- Removed DynamicPrimitiveProcessor per view which was added because of OrphanBuffer can only be called once per frame.
This commit is contained in:
Qing Tao
2021-06-25 11:45:07 -07:00
committed by GitHub
parent 185dfeb410
commit 9ccb65aac4
11 changed files with 63 additions and 204 deletions
@@ -41,7 +41,7 @@ namespace AZ
public:
//! Write data to the DyanmicBuffer. The write size can't be larger than this buffer's size
bool Write(void* data, uint32_t size);
bool Write(const void* data, uint32_t size);
//! Get the buffer's size
uint32_t GetSize();
@@ -141,11 +141,11 @@ namespace AZ
//! Draw Indexed primitives with vertex and index data and per draw srg
//! The per draw srg need to be provided if it's required by shader.
void DrawIndexed(void* vertexData, uint32_t vertexCount, void* indexData, uint32_t indexCount, RHI::IndexFormat indexFormat, Data::Instance < ShaderResourceGroup> drawSrg = nullptr);
void DrawIndexed(const void* vertexData, uint32_t vertexCount, const void* indexData, uint32_t indexCount, RHI::IndexFormat indexFormat, Data::Instance < ShaderResourceGroup> drawSrg = nullptr);
//! Draw linear indexed primitives with vertex data and per draw srg
//! The per draw srg need to be provided if it's required by shader.
void DrawLinear(void* vertexData, uint32_t vertexCount, Data::Instance<ShaderResourceGroup> drawSrg);
void DrawLinear(const void* vertexData, uint32_t vertexCount, Data::Instance<ShaderResourceGroup> drawSrg);
//! Get per vertex size. The size was evaluated when vertex format was set
uint32_t GetPerVertexDataSize();
@@ -12,7 +12,7 @@ namespace AZ
{
namespace RPI
{
bool DynamicBuffer::Write(void* data, uint32_t size)
bool DynamicBuffer::Write(const void* data, uint32_t size)
{
if (m_size >= size)
{
@@ -394,7 +394,7 @@ namespace AZ
m_currentShaderVariantId = shaderVariantId;
}
void DynamicDrawContext::DrawIndexed(void* vertexData, uint32_t vertexCount, void* indexData, uint32_t indexCount, RHI::IndexFormat indexFormat, Data::Instance < ShaderResourceGroup> drawSrg)
void DynamicDrawContext::DrawIndexed(const void* vertexData, uint32_t vertexCount, const void* indexData, uint32_t indexCount, RHI::IndexFormat indexFormat, Data::Instance < ShaderResourceGroup> drawSrg)
{
if (!m_initialized)
{
@@ -487,7 +487,7 @@ namespace AZ
m_cachedDrawItems.emplace_back(drawItemInfo);
}
void DynamicDrawContext::DrawLinear(void* vertexData, uint32_t vertexCount, Data::Instance<ShaderResourceGroup> drawSrg)
void DynamicDrawContext::DrawLinear(const void* vertexData, uint32_t vertexCount, Data::Instance<ShaderResourceGroup> drawSrg)
{
if (!m_initialized)
{