Vulkan refactoring - Removed OpenGL state mirroring code
This commit is contained in:
@@ -116,8 +116,6 @@ using std::queue;
|
|||||||
#define KRAKEN_HAVE_BLAS 1
|
#define KRAKEN_HAVE_BLAS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define KRENGINE_MAX_TEXTURE_UNITS 8
|
|
||||||
|
|
||||||
|
|
||||||
#if !defined(__i386__) && defined(__arm__)
|
#if !defined(__i386__) && defined(__arm__)
|
||||||
#define KRAKEN_USE_ARM_NEON
|
#define KRAKEN_USE_ARM_NEON
|
||||||
|
|||||||
@@ -467,11 +467,12 @@ void KRLight::allocateShadowBuffers(int cBuffers)
|
|||||||
GLDEBUG(glBindFramebuffer(GL_FRAMEBUFFER, shadowFramebuffer[iShadow]));
|
GLDEBUG(glBindFramebuffer(GL_FRAMEBUFFER, shadowFramebuffer[iShadow]));
|
||||||
|
|
||||||
// ----- Create Depth Texture for shadowFramebuffer -----
|
// ----- 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(glBindTexture(GL_TEXTURE_2D, shadowDepthTexture[iShadow]));
|
||||||
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
|
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
|
||||||
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_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()->_setWrapModeS(shadowDepthTexture[iShadow], GL_CLAMP_TO_EDGE);
|
||||||
m_pContext->getTextureManager()->_setWrapModeT(shadowDepthTexture[iShadow], GL_CLAMP_TO_EDGE);
|
// m_pContext->getTextureManager()->_setWrapModeT(shadowDepthTexture[iShadow], GL_CLAMP_TO_EDGE);
|
||||||
#if GL_EXT_shadow_samplers
|
#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_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
|
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_EXT, GL_LEQUAL)); // TODO - Detect GL_EXT_shadow_samplers and only activate if available
|
||||||
|
|||||||
@@ -651,31 +651,27 @@ bool KRPipeline::bind(VkCommandBuffer& commandBuffer, KRCamera& camera, const KR
|
|||||||
if (light_directional_count == 0) {
|
if (light_directional_count == 0) {
|
||||||
int cShadowBuffers = directional_light->getShadowBufferCount();
|
int cShadowBuffers = directional_light->getShadowBufferCount();
|
||||||
if (hasPushConstant(PushConstant::shadowtexture1) && cShadowBuffers > 0) {
|
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])) {
|
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_MIN_FILTER, GL_LINEAR));
|
||||||
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_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) {
|
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])) {
|
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_MIN_FILTER, GL_LINEAR));
|
||||||
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_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) {
|
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])) {
|
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_MIN_FILTER, GL_LINEAR));
|
||||||
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_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;
|
Matrix4 matBias;
|
||||||
|
|||||||
@@ -46,8 +46,6 @@ KRTextureManager::KRTextureManager(KRContext& context) : KRResourceManager(conte
|
|||||||
|
|
||||||
m_memoryTransferredThisFrame = 0;
|
m_memoryTransferredThisFrame = 0;
|
||||||
m_streamerComplete = true;
|
m_streamerComplete = true;
|
||||||
|
|
||||||
_clearGLState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRTextureManager::destroy()
|
void KRTextureManager::destroy()
|
||||||
@@ -64,27 +62,11 @@ KRTextureManager::~KRTextureManager()
|
|||||||
assert(m_textures.empty());
|
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)
|
void KRTextureManager::setMaxAnisotropy(float max_anisotropy)
|
||||||
{
|
{
|
||||||
m_maxAnisotropy = 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)
|
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)
|
void KRTextureManager::startFrame(float deltaTime)
|
||||||
{
|
{
|
||||||
_clearGLState();
|
|
||||||
|
|
||||||
// TODO - Implement proper double-buffering to reduce copy operations
|
// TODO - Implement proper double-buffering to reduce copy operations
|
||||||
m_streamerFenceMutex.lock();
|
m_streamerFenceMutex.lock();
|
||||||
|
|
||||||
|
|||||||
@@ -75,10 +75,6 @@ public:
|
|||||||
|
|
||||||
std::set<KRTexture*>& getActiveTextures();
|
std::set<KRTexture*>& getActiveTextures();
|
||||||
|
|
||||||
void _setWrapModeS(GLuint i, GLuint wrap_mode);
|
|
||||||
void _setWrapModeT(GLuint i, GLuint wrap_mode);
|
|
||||||
|
|
||||||
void _clearGLState();
|
|
||||||
void setMaxAnisotropy(float max_anisotropy);
|
void setMaxAnisotropy(float max_anisotropy);
|
||||||
|
|
||||||
void doStreaming(long& memoryRemaining, long& memoryRemainingThisFrame);
|
void doStreaming(long& memoryRemaining, long& memoryRemainingThisFrame);
|
||||||
|
|||||||
Reference in New Issue
Block a user