mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 09:33:49 +02:00
Fix the problem with the cursor and scattering,
This commit is contained in:
parent
26000288d7
commit
25edb44b75
3 changed files with 33 additions and 11 deletions
|
@ -45,11 +45,22 @@ GLTexture* GL41Backend::syncGPUObject(const TexturePointer& texturePointer) {
|
|||
|
||||
// If the object hasn't been created, or the object definition is out of date, drop and re-create
|
||||
GL41Texture* object = Backend::getGPUObject<GL41Texture>(texture);
|
||||
|
||||
if (!object || object->_storageStamp < texture.getStamp()) {
|
||||
// This automatically any previous texture
|
||||
object = new GL41Texture(shared_from_this(), texture);
|
||||
}
|
||||
object->withPreservedTexture([&] {
|
||||
if (object->_contentStamp <= texture.getDataStamp()) {
|
||||
// FIXME implement synchronous texture transfer here
|
||||
object->syncContent();
|
||||
}
|
||||
|
||||
if (object->_samplerStamp <= texture.getSamplerStamp()) {
|
||||
object->syncSampler();
|
||||
}
|
||||
});
|
||||
}
|
||||
/*
|
||||
// FIXME internalize to GL41Texture 'sync' function
|
||||
if (object->isOutdated()) {
|
||||
object->withPreservedTexture([&] {
|
||||
|
@ -62,7 +73,7 @@ GLTexture* GL41Backend::syncGPUObject(const TexturePointer& texturePointer) {
|
|||
object->syncSampler();
|
||||
}
|
||||
});
|
||||
}
|
||||
}*/
|
||||
|
||||
return object;
|
||||
}
|
||||
|
@ -93,6 +104,13 @@ GL41Texture::GL41Texture(const std::weak_ptr<GLBackend>& backend, const Texture&
|
|||
++face;
|
||||
}
|
||||
}
|
||||
glTexParameteri(_target, GL_TEXTURE_BASE_LEVEL, 0);
|
||||
glTexParameteri(_target, GL_TEXTURE_MAX_LEVEL, numMips - 1);
|
||||
|
||||
if (texture.isAutogenerateMips()) {
|
||||
glGenerateMipmap(_target);
|
||||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -111,6 +129,7 @@ bool GL41Texture::isOutdated() const {
|
|||
}
|
||||
|
||||
void GL41Texture::withPreservedTexture(std::function<void()> f) const {
|
||||
GLint transferUnit = 32;
|
||||
GLint boundTex = -1;
|
||||
switch (_target) {
|
||||
case GL_TEXTURE_2D:
|
||||
|
@ -126,9 +145,12 @@ void GL41Texture::withPreservedTexture(std::function<void()> f) const {
|
|||
}
|
||||
(void)CHECK_GL_ERROR();
|
||||
|
||||
glActiveTexture(GL_TEXTURE0 + transferUnit);
|
||||
(void)CHECK_GL_ERROR();
|
||||
|
||||
glBindTexture(_target, _texture);
|
||||
f();
|
||||
glBindTexture(_target, boundTex);
|
||||
glBindTexture(_target, 0);
|
||||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ void Context::incrementBufferGPUCount() {
|
|||
auto total = ++_bufferGPUCount;
|
||||
if (total > max.load()) {
|
||||
max = total;
|
||||
qCDebug(gpulogging) << "New max GPU buffers " << total;
|
||||
// qCDebug(gpulogging) << "New max GPU buffers " << total;
|
||||
}
|
||||
}
|
||||
void Context::decrementBufferGPUCount() {
|
||||
|
@ -299,7 +299,7 @@ void Context::incrementTextureGPUCount() {
|
|||
auto total = ++_textureGPUCount;
|
||||
if (total > max.load()) {
|
||||
max = total;
|
||||
qCDebug(gpulogging) << "New max GPU textures " << total;
|
||||
// qCDebug(gpulogging) << "New max GPU textures " << total;
|
||||
}
|
||||
}
|
||||
void Context::decrementTextureGPUCount() {
|
||||
|
@ -311,7 +311,7 @@ void Context::incrementTextureGPUSparseCount() {
|
|||
auto total = ++_textureGPUSparseCount;
|
||||
if (total > max.load()) {
|
||||
max = total;
|
||||
qCDebug(gpulogging) << "New max GPU textures " << total;
|
||||
// qCDebug(gpulogging) << "New max GPU textures " << total;
|
||||
}
|
||||
}
|
||||
void Context::decrementTextureGPUSparseCount() {
|
||||
|
@ -378,7 +378,7 @@ void Context::incrementTextureGPUTransferCount() {
|
|||
auto total = ++_textureGPUTransferCount;
|
||||
if (total > max.load()) {
|
||||
max = total;
|
||||
qCDebug(gpulogging) << "New max GPU textures transfers" << total;
|
||||
// qCDebug(gpulogging) << "New max GPU textures transfers" << total;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,17 +21,17 @@ out vec4 outLinearDepth;
|
|||
out vec4 outNormal;
|
||||
|
||||
void main(void) {
|
||||
// Gather 2 by 2 quads from texture
|
||||
// Gather 2 by 2 quads from texture and downsample
|
||||
|
||||
// Try different filters for Z
|
||||
//vec4 Zeyes = textureGather(linearDepthMap, varTexCoord0, 0);
|
||||
//float Zeye = min(min(Zeyes.x, Zeyes.y), min(Zeyes.z, Zeyes.w));
|
||||
float Zeye = texture(linearDepthMap, varTexCoord0).x;
|
||||
vec4 Zeyes = textureGather(linearDepthMap, varTexCoord0, 0);
|
||||
// float Zeye = texture(linearDepthMap, varTexCoord0).x;
|
||||
|
||||
vec4 rawNormalsX = textureGather(normalMap, varTexCoord0, 0);
|
||||
vec4 rawNormalsY = textureGather(normalMap, varTexCoord0, 1);
|
||||
vec4 rawNormalsZ = textureGather(normalMap, varTexCoord0, 2);
|
||||
|
||||
float Zeye = min(min(Zeyes.x, Zeyes.y), min(Zeyes.z, Zeyes.w));
|
||||
|
||||
vec3 normal = vec3(0.0);
|
||||
normal += unpackNormal(vec3(rawNormalsX[0], rawNormalsY[0], rawNormalsZ[0]));
|
||||
|
|
Loading…
Reference in a new issue