summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render/bgfx/chainentry.cpp
blob: c0b8845cdd3148bbc13fb347056aae2d0c0eb876 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
//  chainentry.cpp - BGFX shader post-processing node
//
//  Represents a single entry in a list of post-processing
//  passes to be applied to a screen quad or buffer.
//
//============================================================

#include "emu.h"

#include <bgfx/bgfx.h>

#include "effect.h"
#include "texture.h"
#include "target.h"
#include "chainentry.h"

bgfx_chain_entry::bgfx_chain_entry(std::string name, bgfx_effect* effect, std::vector<bgfx_input_pair>& inputs, bgfx_target* output)
	: m_name(name)
	, m_effect(effect)
	, m_output(output)
{
	for (bgfx_input_pair input : inputs)
	{
		m_inputs.push_back(input);
	}
}

bgfx_chain_entry::~bgfx_chain_entry()
{
}

void bgfx_chain_entry::submit(render_primitive* prim, int view)
{
	for (bgfx_input_pair input : m_inputs)
	{
		input.bind(m_effect);
	}
	bgfx::setViewFrameBuffer(view, m_output->target());
	m_effect->submit(view);
}