summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render/bgfx/valueuniform.cpp
blob: e36ee3cbca8805290f2be5660b47cc6c1186e9ce (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
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
//  valueuniform.cpp - BGFX shader chain fixed uniform
//
//  Represents the mapping between a fixed value and a chain
//  shader uniform for a given entry
//
//============================================================

#include "valueuniform.h"

#include <algorithm>
#include <cassert>


bgfx_value_uniform::bgfx_value_uniform(bgfx_uniform* uniform, const float* values, const int count)
	: bgfx_entry_uniform(uniform)
	, m_count(count)
{
	assert(count <= std::size(m_values));
	std::copy_n(values, count, m_values);
}

void bgfx_value_uniform::bind()
{
	m_uniform->set(m_values, sizeof(float) * m_count);
}