mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:18:38 +02:00
Because attempting to compile the new voxel texture shader causes my system
(Ubuntu LTS, Intel graphics) to hang, change it to compile lazily when activated.
This commit is contained in:
parent
b7b46b0a3b
commit
21ba9bf410
2 changed files with 20 additions and 12 deletions
|
@ -499,17 +499,7 @@ void VoxelSystem::initVoxelMemory() {
|
||||||
_memoryUsageRAM += (sizeof(GLubyte) * vertexPointsPerVoxel * _maxVoxels);
|
_memoryUsageRAM += (sizeof(GLubyte) * vertexPointsPerVoxel * _maxVoxels);
|
||||||
|
|
||||||
// create our simple fragment shader if we're the first system to init
|
// create our simple fragment shader if we're the first system to init
|
||||||
if (!_perlinModulateProgram.isLinked()) {
|
if (!_shadowMapProgram.isLinked()) {
|
||||||
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath()
|
|
||||||
+ "shaders/perlin_modulate.vert");
|
|
||||||
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath()
|
|
||||||
+ "shaders/perlin_modulate.frag");
|
|
||||||
_perlinModulateProgram.link();
|
|
||||||
|
|
||||||
_perlinModulateProgram.bind();
|
|
||||||
_perlinModulateProgram.setUniformValue("permutationNormalTexture", 0);
|
|
||||||
_perlinModulateProgram.release();
|
|
||||||
|
|
||||||
_shadowMapProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
_shadowMapProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||||
Application::resourcesPath() + "shaders/shadow_map.vert");
|
Application::resourcesPath() + "shaders/shadow_map.vert");
|
||||||
_shadowMapProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
_shadowMapProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||||
|
@ -1509,7 +1499,7 @@ void VoxelSystem::applyScaleAndBindProgram(bool texture) {
|
||||||
glBindTexture(GL_TEXTURE_2D, Application::getInstance()->getTextureCache()->getShadowDepthTextureID());
|
glBindTexture(GL_TEXTURE_2D, Application::getInstance()->getTextureCache()->getShadowDepthTextureID());
|
||||||
|
|
||||||
} else if (texture) {
|
} else if (texture) {
|
||||||
_perlinModulateProgram.bind();
|
bindPerlinModulateProgram();
|
||||||
glBindTexture(GL_TEXTURE_2D, Application::getInstance()->getTextureCache()->getPermutationNormalTextureID());
|
glBindTexture(GL_TEXTURE_2D, Application::getInstance()->getTextureCache()->getPermutationNormalTextureID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2159,6 +2149,22 @@ unsigned long VoxelSystem::getVoxelMemoryUsageGPU() {
|
||||||
return (_initialMemoryUsageGPU - currentFreeMemory);
|
return (_initialMemoryUsageGPU - currentFreeMemory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VoxelSystem::bindPerlinModulateProgram() {
|
||||||
|
if (!_perlinModulateProgram.isLinked()) {
|
||||||
|
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||||
|
Application::resourcesPath() + "shaders/perlin_modulate.vert");
|
||||||
|
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||||
|
Application::resourcesPath() + "shaders/perlin_modulate.frag");
|
||||||
|
_perlinModulateProgram.link();
|
||||||
|
|
||||||
|
_perlinModulateProgram.bind();
|
||||||
|
_perlinModulateProgram.setUniformValue("permutationNormalTexture", 0);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_perlinModulateProgram.bind();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Swizzle value of bit pairs of the value of index
|
// Swizzle value of bit pairs of the value of index
|
||||||
unsigned short VoxelSystem::_sSwizzledOcclusionBits[64] = {
|
unsigned short VoxelSystem::_sSwizzledOcclusionBits[64] = {
|
||||||
0x0000, // 00000000
|
0x0000, // 00000000
|
||||||
|
|
|
@ -236,6 +236,8 @@ private:
|
||||||
static ProgramObject _cascadedShadowMapProgram;
|
static ProgramObject _cascadedShadowMapProgram;
|
||||||
static int _shadowDistancesLocation;
|
static int _shadowDistancesLocation;
|
||||||
|
|
||||||
|
static void bindPerlinModulateProgram();
|
||||||
|
|
||||||
int _hookID;
|
int _hookID;
|
||||||
std::vector<glBufferIndex> _freeIndexes;
|
std::vector<glBufferIndex> _freeIndexes;
|
||||||
QMutex _freeIndexLock;
|
QMutex _freeIndexLock;
|
||||||
|
|
Loading…
Reference in a new issue