Constantbuffer now supports single bools

This commit is contained in:
Simon Lübeß
2021-05-30 19:38:08 +02:00
parent ae290936b9
commit 64579f9603
3 changed files with 10 additions and 0 deletions
@@ -27,6 +27,8 @@ namespace GlitchyEngine.Renderer
switch(shaderTypeDescription.Type) switch(shaderTypeDescription.Type)
{ {
case .Bool:
_type = .Bool;
case .Float: case .Float:
_type = .Float; _type = .Float;
default: default:
@@ -58,6 +58,13 @@ namespace GlitchyEngine.Renderer
Log.EngineLogger.Warning($"The types do not match: Expected \"{_type}\" but Received \"{type}\" instead. Variable: \"{_name}\" of buffer: \"{_constantBuffer.Name}\""); Log.EngineLogger.Warning($"The types do not match: Expected \"{_type}\" but Received \"{type}\" instead. Variable: \"{_name}\" of buffer: \"{_constantBuffer.Name}\"");
#endif #endif
} }
public void SetData(bool value)
{
EnsureTypeMatch(1, 1, .Bool);
*(bool*)firstByte = value;
}
public void SetData(float value) public void SetData(float value)
{ {
@@ -99,6 +99,7 @@ namespace GlitchyEngine.Renderer
public enum ShaderVariableType public enum ShaderVariableType
{ {
Bool,
Float, Float,
// todo // todo
} }