mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 19:02:55 +02:00
ANd fixing the gl41 rendering
This commit is contained in:
parent
29545f0918
commit
bb15b8c701
3 changed files with 12 additions and 11 deletions
|
@ -64,7 +64,7 @@ namespace gpu {
|
||||||
glGenTextures(1, &_texBuffer);
|
glGenTextures(1, &_texBuffer);
|
||||||
glActiveTexture(GL_TEXTURE0 + GL41Backend::RESOURCE_BUFFER_TEXBUF_TEX_UNIT);
|
glActiveTexture(GL_TEXTURE0 + GL41Backend::RESOURCE_BUFFER_TEXBUF_TEX_UNIT);
|
||||||
glBindTexture(GL_TEXTURE_BUFFER, _texBuffer);
|
glBindTexture(GL_TEXTURE_BUFFER, _texBuffer);
|
||||||
glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, _texBuffer);
|
glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, _buffer);
|
||||||
glBindTexture(GL_TEXTURE_BUFFER, 0);
|
glBindTexture(GL_TEXTURE_BUFFER, 0);
|
||||||
(void)CHECK_GL_ERROR();
|
(void)CHECK_GL_ERROR();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ using namespace gpu::gl41;
|
||||||
|
|
||||||
// GLSL version
|
// GLSL version
|
||||||
std::string GL41Backend::getBackendShaderHeader() const {
|
std::string GL41Backend::getBackendShaderHeader() const {
|
||||||
return std::string("#version 410 core");
|
return std::string("#version 410 core\n#define GPU_GL410 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
int GL41Backend::makeResourceBufferSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,Shader::SlotSet& resourceBuffers) {
|
int GL41Backend::makeResourceBufferSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,Shader::SlotSet& resourceBuffers) {
|
||||||
|
@ -68,11 +68,12 @@ int GL41Backend::makeResourceBufferSlots(GLuint glprogram, const Shader::Binding
|
||||||
GLint requestedLoc = (*requestedBinding)._location + GL41Backend::RESOURCE_BUFFER_SLOT0_TEX_UNIT;
|
GLint requestedLoc = (*requestedBinding)._location + GL41Backend::RESOURCE_BUFFER_SLOT0_TEX_UNIT;
|
||||||
if (binding != requestedLoc) {
|
if (binding != requestedLoc) {
|
||||||
binding = requestedLoc;
|
binding = requestedLoc;
|
||||||
glProgramUniform1i(glprogram, location, binding);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
binding += GL41Backend::RESOURCE_BUFFER_SLOT0_TEX_UNIT;
|
binding += GL41Backend::RESOURCE_BUFFER_SLOT0_TEX_UNIT;
|
||||||
}
|
}
|
||||||
|
glProgramUniform1i(glprogram, location, binding);
|
||||||
|
|
||||||
ssboCount++;
|
ssboCount++;
|
||||||
resourceBuffers.insert(Shader::Slot(name, binding, elementResource._element, elementResource._resource));
|
resourceBuffers.insert(Shader::Slot(name, binding, elementResource._element, elementResource._resource));
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,14 +28,7 @@ struct ItemBound {
|
||||||
vec4 boundDim_s;
|
vec4 boundDim_s;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if __VERSION__ == 450
|
#if defined(GPU_GL410)
|
||||||
layout(std140) buffer ssbo0Buffer {
|
|
||||||
ItemBound bounds[];
|
|
||||||
};
|
|
||||||
ItemBound getItemBound(int i) {
|
|
||||||
return bounds[i];
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
uniform samplerBuffer ssbo0Buffer;
|
uniform samplerBuffer ssbo0Buffer;
|
||||||
ItemBound getItemBound(int i) {
|
ItemBound getItemBound(int i) {
|
||||||
int offset = 2 * i;
|
int offset = 2 * i;
|
||||||
|
@ -44,6 +37,13 @@ ItemBound getItemBound(int i) {
|
||||||
bound.boundDim_s = texelFetch(ssbo0Buffer, offset + 1);
|
bound.boundDim_s = texelFetch(ssbo0Buffer, offset + 1);
|
||||||
return bound;
|
return bound;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
layout(std140) buffer ssbo0Buffer {
|
||||||
|
ItemBound bounds[];
|
||||||
|
};
|
||||||
|
ItemBound getItemBound(int i) {
|
||||||
|
return bounds[i];
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue