Flip Y coordinates on textures on UIShader

This commit is contained in:
2023-12-14 11:20:14 -06:00
parent d2c057cd53
commit f180e81bc4
9 changed files with 120 additions and 44 deletions

View File

@ -6,5 +6,6 @@
# Sources
target_sources(${DAWN_TARGET_NAME}
PRIVATE
IShader.cpp
IShaderStage.cpp
)

View File

@ -0,0 +1,46 @@
// 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;
}
}

View File

@ -75,4 +75,12 @@ namespace Dawn {
}
};
}
}
/**
* Returns the size of the ShaderParameterType.
*
* @param type The type to get the size of.
* @return Size of the type.
*/
size_t shaderParameterTypeGetSize(const enum Dawn::ShaderParameterType type);