metaforce/NESEmulator/CNESShader.cpp

33 lines
1.1 KiB
C++
Raw Normal View History

2018-02-01 23:19:34 +00:00
#include "CNESShader.hpp"
#include "Graphics/CGraphics.hpp"
2018-10-07 02:59:17 +00:00
#include "hecl/Pipeline.hpp"
2018-02-01 23:19:34 +00:00
namespace urde::MP1
{
boo::ObjToken<boo::IShaderPipeline> CNESShader::g_Pipeline;
2018-10-07 02:59:17 +00:00
void CNESShader::Initialize()
2018-02-01 23:19:34 +00:00
{
2018-10-07 02:59:17 +00:00
g_Pipeline = hecl::conv->convert(Shader_CNESShader{});
2018-02-01 23:19:34 +00:00
}
2018-10-07 02:59:17 +00:00
boo::ObjToken<boo::IShaderDataBinding> CNESShader::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
2018-02-01 23:19:34 +00:00
boo::ObjToken<boo::IGraphicsBufferS> vbo,
boo::ObjToken<boo::IGraphicsBufferD> uniBuf,
boo::ObjToken<boo::ITextureD> tex)
{
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {uniBuf.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
boo::ObjToken<boo::ITexture> texs[] = {tex.get()};
2018-10-07 02:59:17 +00:00
return ctx.newShaderDataBinding(g_Pipeline, vbo.get(), nullptr, nullptr,
2018-02-01 23:19:34 +00:00
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
void CNESShader::Shutdown()
{
g_Pipeline.reset();
}
}