Mip generation texture slot is higher and doesn't interfere anymore

This commit is contained in:
Olivier Prat 2018-10-16 09:39:32 +02:00
parent 9bc85b3e5d
commit 6abffceb43
4 changed files with 28 additions and 5 deletions

View file

@ -86,9 +86,14 @@ void GLBackend::do_generateTextureMipsWithPipeline(const Batch& batch, size_t pa
return;
}
// Do not transfer the texture, this call is expected for rendering texture
// Always make sure the GLObject is in sync
GLTexture* object = syncGPUObject(resourceTexture);
if (!object) {
if (object) {
GLuint to = object->_texture;
glActiveTexture(GL_TEXTURE0 + gpu::slot::texture::MipCreationInput);
glBindTexture(object->_target, to);
(void)CHECK_GL_ERROR();
} else {
return;
}

View file

@ -418,8 +418,6 @@ void Batch::generateTextureMips(const TexturePointer& texture) {
}
void Batch::generateTextureMipsWithPipeline(const TexturePointer& texture, int numMips) {
setResourceTexture(gpu::slot::texture::MipCreationInput, texture);
ADD_COMMAND(generateTextureMipsWithPipeline);
_params.emplace_back(_textures.cache(texture));

View file

@ -0,0 +1,20 @@
<!
// MipGeneration.slh
// libraries/gpu/src
//
// Created by Olivier Prat on 10/16/18.
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
!>
<@if not MIP_GENERATION_SLH@>
<@def MIP_GENERATION_SLH@>
<@include gpu/ShaderConstants.h@>
layout(binding=GPU_TEXTURE_MIP_CREATION_INPUT) uniform sampler2D texMap;
in vec2 varTexCoord0;
<@endif@>

View file

@ -22,7 +22,7 @@
#define GPU_TEXTURE_TRANSFORM_OBJECT 31
// Mip creation
#define GPU_TEXTURE_MIP_CREATION_INPUT 0
#define GPU_TEXTURE_MIP_CREATION_INPUT 30
#define GPU_STORAGE_TRANSFORM_OBJECT 7