diff --git a/kraken/KREngine-common.h b/kraken/KREngine-common.h index 56c5f87..cc0b71c 100755 --- a/kraken/KREngine-common.h +++ b/kraken/KREngine-common.h @@ -116,8 +116,6 @@ using std::queue; #define KRAKEN_HAVE_BLAS 1 #endif -#define KRENGINE_MAX_TEXTURE_UNITS 8 - #if !defined(__i386__) && defined(__arm__) #define KRAKEN_USE_ARM_NEON diff --git a/kraken/KRLight.cpp b/kraken/KRLight.cpp index fbf6ce7..aece174 100755 --- a/kraken/KRLight.cpp +++ b/kraken/KRLight.cpp @@ -467,11 +467,12 @@ void KRLight::allocateShadowBuffers(int cBuffers) GLDEBUG(glBindFramebuffer(GL_FRAMEBUFFER, shadowFramebuffer[iShadow])); // ----- Create Depth Texture for shadowFramebuffer ----- + // TODO - Vulkan Refactoring. Note: shadowDepthTexture Sampler needs clamp-to-edge and linear filtering GLDEBUG(glBindTexture(GL_TEXTURE_2D, shadowDepthTexture[iShadow])); GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)); GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)); - m_pContext->getTextureManager()->_setWrapModeS(shadowDepthTexture[iShadow], GL_CLAMP_TO_EDGE); - m_pContext->getTextureManager()->_setWrapModeT(shadowDepthTexture[iShadow], GL_CLAMP_TO_EDGE); + // m_pContext->getTextureManager()->_setWrapModeS(shadowDepthTexture[iShadow], GL_CLAMP_TO_EDGE); + // m_pContext->getTextureManager()->_setWrapModeT(shadowDepthTexture[iShadow], GL_CLAMP_TO_EDGE); #if GL_EXT_shadow_samplers GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_EXT, GL_COMPARE_REF_TO_TEXTURE_EXT)); // TODO - Detect GL_EXT_shadow_samplers and only activate if available GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_EXT, GL_LEQUAL)); // TODO - Detect GL_EXT_shadow_samplers and only activate if available diff --git a/kraken/KRPipeline.cpp b/kraken/KRPipeline.cpp index 31c9f41..7bc4f48 100644 --- a/kraken/KRPipeline.cpp +++ b/kraken/KRPipeline.cpp @@ -651,31 +651,27 @@ bool KRPipeline::bind(VkCommandBuffer& commandBuffer, KRCamera& camera, const KR if (light_directional_count == 0) { int cShadowBuffers = directional_light->getShadowBufferCount(); if (hasPushConstant(PushConstant::shadowtexture1) && cShadowBuffers > 0) { + // TODO - Vulkan Refactoring. Note: Sampler needs clamp-to-edge and linear filtering if (m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 3, directional_light->getShadowTextures()[0])) { GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); } - - m_pContext->getTextureManager()->_setWrapModeS(3, GL_CLAMP_TO_EDGE); - m_pContext->getTextureManager()->_setWrapModeT(3, GL_CLAMP_TO_EDGE); } if (hasPushConstant(PushConstant::shadowtexture2) && cShadowBuffers > 1 && camera.settings.m_cShadowBuffers > 1) { + // TODO - Vulkan Refactoring. Note: Sampler needs clamp-to-edge and linear filtering if (m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 4, directional_light->getShadowTextures()[1])) { GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); } - m_pContext->getTextureManager()->_setWrapModeS(4, GL_CLAMP_TO_EDGE); - m_pContext->getTextureManager()->_setWrapModeT(4, GL_CLAMP_TO_EDGE); } if (hasPushConstant(PushConstant::shadowtexture3) && cShadowBuffers > 2 && camera.settings.m_cShadowBuffers > 2) { + // TODO - Vulkan Refactoring. Note: Sampler needs clamp-to-edge and linear filtering if (m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 5, directional_light->getShadowTextures()[2])) { GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); } - m_pContext->getTextureManager()->_setWrapModeS(5, GL_CLAMP_TO_EDGE); - m_pContext->getTextureManager()->_setWrapModeT(5, GL_CLAMP_TO_EDGE); } Matrix4 matBias; diff --git a/kraken/KRTextureManager.cpp b/kraken/KRTextureManager.cpp index d51c54f..a520479 100755 --- a/kraken/KRTextureManager.cpp +++ b/kraken/KRTextureManager.cpp @@ -46,8 +46,6 @@ KRTextureManager::KRTextureManager(KRContext& context) : KRResourceManager(conte m_memoryTransferredThisFrame = 0; m_streamerComplete = true; - - _clearGLState(); } void KRTextureManager::destroy() @@ -64,27 +62,11 @@ KRTextureManager::~KRTextureManager() assert(m_textures.empty()); } -void KRTextureManager::_clearGLState() -{ - for (int i = 0; i < KRENGINE_MAX_TEXTURE_UNITS; i++) { - m_maxAnisotropy = -1.0f; - } -} - -void KRTextureManager::_setWrapModeS(GLuint i, GLuint wrap_mode) -{ -} - void KRTextureManager::setMaxAnisotropy(float max_anisotropy) { m_maxAnisotropy = max_anisotropy; } -void KRTextureManager::_setWrapModeT(GLuint i, GLuint wrap_mode) -{ -} - - KRResource* KRTextureManager::loadResource(const std::string& name, const std::string& extension, KRDataBlock* data) { /* @@ -236,8 +218,6 @@ long KRTextureManager::getMemActive() void KRTextureManager::startFrame(float deltaTime) { - _clearGLState(); - // TODO - Implement proper double-buffering to reduce copy operations m_streamerFenceMutex.lock(); diff --git a/kraken/KRTextureManager.h b/kraken/KRTextureManager.h index 1833cae..4453e85 100755 --- a/kraken/KRTextureManager.h +++ b/kraken/KRTextureManager.h @@ -75,10 +75,6 @@ public: std::set& getActiveTextures(); - void _setWrapModeS(GLuint i, GLuint wrap_mode); - void _setWrapModeT(GLuint i, GLuint wrap_mode); - - void _clearGLState(); void setMaxAnisotropy(float max_anisotropy); void doStreaming(long& memoryRemaining, long& memoryRemainingThisFrame);