41 lines
862 B
C++
41 lines
862 B
C++
|
|
#include "Resources/Shader.h"
|
||
|
|
|
||
|
|
namespace XCEngine {
|
||
|
|
namespace Resources {
|
||
|
|
|
||
|
|
Shader::Shader() = default;
|
||
|
|
|
||
|
|
Shader::~Shader() = default;
|
||
|
|
|
||
|
|
void Shader::Release() {
|
||
|
|
m_sourceCode.Clear();
|
||
|
|
m_compiledBinary.Clear();
|
||
|
|
m_uniforms.Clear();
|
||
|
|
m_attributes.Clear();
|
||
|
|
m_rhiResource = nullptr;
|
||
|
|
m_isValid = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
void Shader::SetSourceCode(const Containers::String& source) {
|
||
|
|
m_sourceCode = source;
|
||
|
|
}
|
||
|
|
|
||
|
|
void Shader::SetCompiledBinary(const Containers::Array<Core::uint8>& binary) {
|
||
|
|
m_compiledBinary = binary;
|
||
|
|
}
|
||
|
|
|
||
|
|
void Shader::AddUniform(const ShaderUniform& uniform) {
|
||
|
|
m_uniforms.PushBack(uniform);
|
||
|
|
}
|
||
|
|
|
||
|
|
void Shader::AddAttribute(const ShaderAttribute& attribute) {
|
||
|
|
m_attributes.PushBack(attribute);
|
||
|
|
}
|
||
|
|
|
||
|
|
void Shader::SetRHIResource(class IRHIShader* resource) {
|
||
|
|
m_rhiResource = resource;
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace Resources
|
||
|
|
} // namespace XCEngine
|