This commit is contained in:
bjorn 2023-06-24 11:26:09 -07:00
parent ad5d00fb2f
commit 116d14cdf8
3 changed files with 18 additions and 10 deletions

View File

@ -80,16 +80,16 @@ layout(location = 0) out vec4 PixelColor;
#ifdef GL_VERTEX_SHADER
layout(location = 10) out vec3 PositionWorld;
layout(location = 11) out vec3 Normal;
layout(location = 12) out vec4 Color;
layout(location = 13) out vec2 UV;
layout(location = 12) out vec2 UV;
layout(location = 13) out vec4 Color;
layout(location = 14) out vec3 Tangent;
#endif
#ifdef GL_FRAGMENT_SHADER
layout(location = 10) in vec3 PositionWorld;
layout(location = 11) in vec3 Normal;
layout(location = 12) in vec4 Color;
layout(location = 13) in vec2 UV;
layout(location = 12) in vec2 UV;
layout(location = 13) in vec4 Color;
layout(location = 14) in vec3 Tangent;
#endif

View File

@ -2857,11 +2857,18 @@ bool lovrShaderHasStage(Shader* shader, ShaderStage stage) {
}
bool lovrShaderHasAttribute(Shader* shader, const char* name, uint32_t location) {
uint32_t hash = name ? (uint32_t) hash64(name, strlen(name)) : 0;
for (uint32_t i = 0; i < shader->attributeCount; i++) {
ShaderAttribute* attribute = &shader->attributes[i];
if (name ? (attribute->hash == hash) : (attribute->location == location)) {
return true;
if (name) {
uint32_t hash = (uint32_t) hash64(name, strlen(name));
for (uint32_t i = 0; i < shader->attributeCount; i++) {
if (shader->attributes[i].hash == hash) {
return true;
}
}
} else {
for (uint32_t i = 0; i < shader->attributeCount; i++) {
if (shader->attributes[i].location == location) {
return true;
}
}
}
return false;

View File

@ -148,7 +148,8 @@ typedef enum {
TYPE_MAT3,
TYPE_MAT4,
TYPE_INDEX16,
TYPE_INDEX32
TYPE_INDEX32,
TYPE_COUNT
} DataType;
typedef enum {