Dawn/src/dawn/display/shader/IShader.cpp

47 lines
1.1 KiB
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "display/shader/Shader.hpp"
#include "assert/assert.hpp"
#include "display/Color.hpp"
#include "display/Texture.hpp"
using namespace Dawn;
size_t shaderParameterTypeGetSize(const enum ShaderParameterType type) {
switch(type) {
case ShaderParameterType::VEC2:
return sizeof(glm::vec2);
case ShaderParameterType::VEC3:
return sizeof(glm::vec3);
case ShaderParameterType::VEC4:
return sizeof(glm::vec4);
case ShaderParameterType::MAT3:
return sizeof(glm::mat3);
case ShaderParameterType::MAT4:
return sizeof(glm::mat4);
case ShaderParameterType::COLOR:
return sizeof(struct Color);
case ShaderParameterType::FLOAT:
return sizeof(float);
case ShaderParameterType::INT:
return sizeof(int32_t);
case ShaderParameterType::TEXTURE:
return sizeof(shadertexturebinding_t);
default:
assertUnreachable("Unknown ShaderParameterType");
return 0;
}
}