1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Do not create DepthImageTexture when N64DepthCompare option is off.

This commit is contained in:
Sergey Lipskiy 2015-01-27 20:18:18 +06:00
parent 12a2b3741e
commit fca44abb5f
3 changed files with 7 additions and 11 deletions

View File

@ -43,7 +43,7 @@ DepthBuffer::~DepthBuffer()
void DepthBuffer::initDepthImageTexture(FrameBuffer * _pBuffer)
{
#ifdef GL_IMAGE_TEXTURES_SUPPORT
if (m_pDepthImageTexture != NULL)
if (!video().getRender().isImageTexturesSupported() || config.frameBufferEmulation.N64DepthCompare == 0 || m_pDepthImageTexture != NULL)
return;
m_pDepthImageTexture = textureCache().addFrameBufferTexture();
@ -233,7 +233,7 @@ void DepthBufferList::saveBuffer(u32 _address)
void DepthBufferList::clearBuffer()
{
#ifdef GL_IMAGE_TEXTURES_SUPPORT
if (!video().getRender().isImageTexturesSupported())
if (!video().getRender().isImageTexturesSupported() || config.frameBufferEmulation.N64DepthCompare == 0)
return;
if (m_pCurrent == NULL || m_pCurrent->m_FBO == 0)
return;

View File

@ -312,7 +312,7 @@ void FrameBufferList::attachDepthBuffer()
pDepthBuffer->initDepthBufferTexture(m_pCurrent);
m_pCurrent->m_pDepthBuffer = pDepthBuffer;
pDepthBuffer->setDepthAttachment();
if (video().getRender().isImageTexturesSupported())
if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
pDepthBuffer->bindDepthImageTexture();
} else
m_pCurrent->m_pDepthBuffer = NULL;

View File

@ -196,7 +196,7 @@ void InitShaderCombiner()
assert(check_shader_compile_status(g_test_alpha_shader_object));
#ifdef GL_IMAGE_TEXTURES_SUPPORT
if (video().getRender().isImageTexturesSupported()) {
if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0) {
g_calc_depth_shader_object = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(g_calc_depth_shader_object, 1, &depth_compare_shader_float, NULL);
glCompileShader(g_calc_depth_shader_object);
@ -467,12 +467,8 @@ ShaderCombiner::ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCo
" } \n"
);
if (video().getRender().isImageTexturesSupported()) {
if (config.frameBufferEmulation.N64DepthCompare)
strFragmentShader.append(" if (!depth_compare()) discard; \n");
else
strFragmentShader.append(" depth_compare(); \n");
}
if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
strFragmentShader.append(" if (!depth_compare()) discard; \n");
#ifdef USE_TOONIFY
strFragmentShader.append(" toonify(intensity); \n");
@ -516,7 +512,7 @@ ShaderCombiner::ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCo
if (bUseLod)
glAttachShader(m_program, g_calc_mipmap_shader_object);
glAttachShader(m_program, g_test_alpha_shader_object);
if (video().getRender().isImageTexturesSupported())
if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
glAttachShader(m_program, g_calc_depth_shader_object);
glAttachShader(m_program, g_calc_noise_shader_object);
#endif