Added shader param buffer support

This commit is contained in:
2023-05-24 23:07:09 -07:00
parent 66c4755ac5
commit a2669f6eb9
9 changed files with 213 additions and 10 deletions

View File

@ -0,0 +1,33 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
namespace Dawn {
template<typename T, typename L>
class IShaderParameterBuffer {
public:
/**
* Initializes this shader parameter buffer.
*/
virtual void init() = 0;
/**
* Basic buffer method. Buffers the entire contents of the data struct to
* this shader parameter buffer.
*
* @param data Data to buffer to the parameter.
*/
virtual void buffer(T *data) = 0;
/**
* Bind this shader buffer to the supplied location.
*
* @param location Location to bind this buffer to.
*/
virtual void bind(L location) = 0;
};
}

View File

@ -5,9 +5,9 @@
#pragma once
#include "display/Texture.hpp"
#include "display/shader/ShaderParameterBuffer.hpp"
namespace Dawn {
template<typename T>
class IShaderProgram {
public:
@ -16,6 +16,15 @@ namespace Dawn {
*/
virtual void bind() = 0;
/**
* Binds a shader buffer to a specific slot.
*
* @param slot Slot to bind the buffer to.
* @param buffer Buffer to bind.
*/
template<typename J>
void setParameterBuffer(shaderbufferslot_t slot, ShaderParameterBuffer<J> *buffer);
/**
* Set's a specific shader parameter to a matrix.
*