Added shader param buffer support
This commit is contained in:
33
src/dawn/display/shader/_ShaderParameterBuffer.hpp
Normal file
33
src/dawn/display/shader/_ShaderParameterBuffer.hpp
Normal 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;
|
||||
};
|
||||
}
|
@ -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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user