2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-10 11:47:42 +00:00

Graphics/Shaders: Use std::array where applicable

Makes the arrays strongly typed and impervious to array->pointer decay.
This also allows simplifying some operations (such as being able to call
fill() instead of needing to use std::fill, etc).
This commit is contained in:
Lioncash
2019-09-28 22:22:12 -04:00
parent 417506572c
commit 136a229a1a
36 changed files with 530 additions and 347 deletions

View File

@@ -26,11 +26,14 @@ void CRadarPaintShader::draw(const std::vector<Instance>& instances, const CText
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx) {
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Instance), m_maxInsts);
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CMatrix4f), 1);
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {m_uniBuf.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
boo::ObjToken<boo::ITexture> texs[] = {m_tex->GetBooTexture()};
m_dataBind = ctx.newShaderDataBinding(s_Pipeline, nullptr, m_vbo.get(), nullptr, 1, bufs, stages, nullptr,
nullptr, 1, texs, nullptr, nullptr);
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> bufs{m_uniBuf.get()};
constexpr std::array<boo::PipelineStage, 1> stages{boo::PipelineStage::Vertex};
const std::array<boo::ObjToken<boo::ITexture>, 1> texs{m_tex->GetBooTexture()};
m_dataBind =
ctx.newShaderDataBinding(s_Pipeline, nullptr, m_vbo.get(), nullptr, bufs.size(), bufs.data(), stages.data(),
nullptr, nullptr, texs.size(), texs.data(), nullptr, nullptr);
return true;
} BooTrace);
}