mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01: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);
|
||||
|
||||
// create our simple fragment shader if we're the first system to init
|
||||
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);
|
||||
_perlinModulateProgram.release();
|
||||
|
||||
if (!_shadowMapProgram.isLinked()) {
|
||||
_shadowMapProgram.addShaderFromSourceFile(QGLShader::Vertex,
|
||||
Application::resourcesPath() + "shaders/shadow_map.vert");
|
||||
_shadowMapProgram.addShaderFromSourceFile(QGLShader::Fragment,
|
||||
|
@ -1509,7 +1499,7 @@ void VoxelSystem::applyScaleAndBindProgram(bool texture) {
|
|||
glBindTexture(GL_TEXTURE_2D, Application::getInstance()->getTextureCache()->getShadowDepthTextureID());
|
||||
|
||||
} else if (texture) {
|
||||
_perlinModulateProgram.bind();
|
||||
bindPerlinModulateProgram();
|
||||
glBindTexture(GL_TEXTURE_2D, Application::getInstance()->getTextureCache()->getPermutationNormalTextureID());
|
||||
}
|
||||
|
||||
|
@ -2159,6 +2149,22 @@ unsigned long VoxelSystem::getVoxelMemoryUsageGPU() {
|
|||
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
|
||||
unsigned short VoxelSystem::_sSwizzledOcclusionBits[64] = {
|
||||
0x0000, // 00000000
|
||||
|
|
|
@ -236,6 +236,8 @@ private:
|
|||
static ProgramObject _cascadedShadowMapProgram;
|
||||
static int _shadowDistancesLocation;
|
||||
|
||||
static void bindPerlinModulateProgram();
|
||||
|
||||
int _hookID;
|
||||
std::vector<glBufferIndex> _freeIndexes;
|
||||
QMutex _freeIndexLock;
|
||||
|
|
Loading…
Reference in a new issue