Merge pull request #239 from lioncash/line

CLineRenderer: Minor changes
This commit is contained in:
Luke Street 2020-03-18 00:58:46 -04:00 committed by GitHub
commit 18ef68df2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View File

@ -40,10 +40,11 @@ CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitive
break; break;
} }
if (bool(texture)) if (texture) {
m_vertBufTex = s_vertPoolTex.allocateBlock(CGraphics::g_BooFactory, maxTriVerts); m_vertBufTex = s_vertPoolTex.allocateBlock(CGraphics::g_BooFactory, maxTriVerts);
else } else {
m_vertBufNoTex = s_vertPoolNoTex.allocateBlock(CGraphics::g_BooFactory, maxTriVerts); m_vertBufNoTex = s_vertPoolNoTex.allocateBlock(CGraphics::g_BooFactory, maxTriVerts);
}
m_uniformBuf = s_uniformPool.allocateBlock(CGraphics::g_BooFactory); m_uniformBuf = s_uniformPool.allocateBlock(CGraphics::g_BooFactory);
@ -70,10 +71,11 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const boo::ObjTo
break; break;
} }
if (bool(texture)) if (texture) {
m_vertBufTex = s_vertPoolTex.allocateBlock(CGraphics::g_BooFactory, maxTriVerts); m_vertBufTex = s_vertPoolTex.allocateBlock(CGraphics::g_BooFactory, maxTriVerts);
else } else {
m_vertBufNoTex = s_vertPoolNoTex.allocateBlock(CGraphics::g_BooFactory, maxTriVerts); m_vertBufNoTex = s_vertPoolNoTex.allocateBlock(CGraphics::g_BooFactory, maxTriVerts);
}
m_uniformBuf = s_uniformPool.allocateBlock(CGraphics::g_BooFactory); m_uniformBuf = s_uniformPool.allocateBlock(CGraphics::g_BooFactory);

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <array>
#include "Runtime/RetroTypes.hpp" #include "Runtime/RetroTypes.hpp"
#include "Runtime/rstl.hpp" #include "Runtime/rstl.hpp"
#include "Runtime/Graphics/CGraphics.hpp" #include "Runtime/Graphics/CGraphics.hpp"
@ -68,7 +70,7 @@ public:
hecl::VertexBufferPool<SDrawVertTex>::Token m_vertBufTex; hecl::VertexBufferPool<SDrawVertTex>::Token m_vertBufTex;
hecl::VertexBufferPool<SDrawVertNoTex>::Token m_vertBufNoTex; hecl::VertexBufferPool<SDrawVertNoTex>::Token m_vertBufNoTex;
hecl::UniformBufferPool<SDrawUniform>::Token m_uniformBuf; hecl::UniformBufferPool<SDrawUniform>::Token m_uniformBuf;
boo::ObjToken<boo::IShaderDataBinding> m_shaderBind[2]; std::array<boo::ObjToken<boo::IShaderDataBinding>, 2> m_shaderBind;
CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitiveMode mode, u32 maxVerts, CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitiveMode mode, u32 maxVerts,
const boo::ObjToken<boo::ITexture>& texture, bool additive, bool zTest = false, bool zGEqual = false); const boo::ObjToken<boo::ITexture>& texture, bool additive, bool zTest = false, bool zGEqual = false);

View File

@ -111,7 +111,7 @@ void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Con
const std::array<size_t, 1> ubufOffs{size_t(ubufInfo.second)}; const std::array<size_t, 1> ubufOffs{size_t(ubufInfo.second)};
const std::array<size_t, 1> ubufSizes{sizeof(CLineRenderer::SDrawUniform)}; const std::array<size_t, 1> ubufSizes{sizeof(CLineRenderer::SDrawUniform)};
for (size_t i = 0; i < std::size(renderer.m_shaderBind); ++i) { for (size_t i = 0; i < renderer.m_shaderBind.size(); ++i) {
renderer.m_shaderBind[i] = ctx.newShaderDataBinding( renderer.m_shaderBind[i] = ctx.newShaderDataBinding(
(*pipeline)[i], vbufInfo.first.get(), nullptr, nullptr, uniforms.size(), uniforms.data(), stages.data(), (*pipeline)[i], vbufInfo.first.get(), nullptr, nullptr, uniforms.size(), uniforms.data(), stages.data(),
ubufOffs.data(), ubufSizes.data(), texCount, textures.data(), nullptr, nullptr, vbufInfo.second); ubufOffs.data(), ubufSizes.data(), texCount, textures.data(), nullptr, nullptr, vbufInfo.second);