mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Minor code cleanup.
This commit is contained in:
parent
b9453474b6
commit
d7407d58f9
|
@ -153,28 +153,28 @@ void DepthBuffer::_initDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture
|
||||||
_pTexture->textureBytes = _pTexture->realWidth * _pTexture->realHeight * fbTexFormat.depthFormatBytes;
|
_pTexture->textureBytes = _pTexture->realWidth * _pTexture->realHeight * fbTexFormat.depthFormatBytes;
|
||||||
textureCache().addFrameBufferTextureSize(_pTexture->textureBytes);
|
textureCache().addFrameBufferTextureSize(_pTexture->textureBytes);
|
||||||
|
|
||||||
{
|
Context::InitTextureParams initParams;
|
||||||
Context::InitTextureParams params;
|
initParams.handle = _pTexture->name;
|
||||||
params.handle = _pTexture->name;
|
initParams.msaaLevel = _multisample ? config.video.multisampling : 0U;
|
||||||
params.msaaLevel = _multisample ? config.video.multisampling : 0U;
|
initParams.width = _pTexture->realWidth;
|
||||||
params.width = _pTexture->realWidth;
|
initParams.height = _pTexture->realHeight;
|
||||||
params.height = _pTexture->realHeight;
|
initParams.internalFormat = fbTexFormat.depthInternalFormat;
|
||||||
params.internalFormat = fbTexFormat.depthInternalFormat;
|
initParams.format = fbTexFormat.depthFormat;
|
||||||
params.format = fbTexFormat.depthFormat;
|
initParams.dataType = fbTexFormat.depthType;
|
||||||
params.dataType = fbTexFormat.depthType;
|
gfxContext.init2DTexture(initParams);
|
||||||
gfxContext.init2DTexture(params);
|
|
||||||
}
|
|
||||||
_pTexture->frameBufferTexture = _multisample ? CachedTexture::fbMultiSample : CachedTexture::fbOneSample;
|
|
||||||
if (!_multisample) {
|
|
||||||
Context::TexParameters params;
|
|
||||||
params.handle = _pTexture->name;
|
|
||||||
params.target = textureTarget::TEXTURE_2D;
|
|
||||||
params.textureUnitIndex = textureIndices::Tex[0];
|
|
||||||
params.minFilter = textureParameters::FILTER_NEAREST;
|
|
||||||
params.magFilter = textureParameters::FILTER_NEAREST;
|
|
||||||
gfxContext.setTextureParameters(params);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!_multisample) {
|
||||||
|
_pTexture->frameBufferTexture = CachedTexture::fbOneSample;
|
||||||
|
Context::TexParameters texParams;
|
||||||
|
texParams.handle = _pTexture->name;
|
||||||
|
texParams.target = textureTarget::TEXTURE_2D;
|
||||||
|
texParams.textureUnitIndex = textureIndices::Tex[0];
|
||||||
|
texParams.minFilter = textureParameters::FILTER_NEAREST;
|
||||||
|
texParams.magFilter = textureParameters::FILTER_NEAREST;
|
||||||
|
gfxContext.setTextureParameters(texParams);
|
||||||
|
} else {
|
||||||
|
_pTexture->frameBufferTexture = CachedTexture::fbMultiSample;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DepthBuffer::_initDepthBufferRenderbuffer(FrameBuffer * _pBuffer)
|
void DepthBuffer::_initDepthBufferRenderbuffer(FrameBuffer * _pBuffer)
|
||||||
|
|
|
@ -85,37 +85,35 @@ void FrameBuffer::_initTexture(u16 _width, u16 _height, u16 _format, u16 _size,
|
||||||
|
|
||||||
void FrameBuffer::_setAndAttachTexture(ObjectHandle _fbo, CachedTexture *_pTexture, u32 _t, bool _multisampling)
|
void FrameBuffer::_setAndAttachTexture(ObjectHandle _fbo, CachedTexture *_pTexture, u32 _t, bool _multisampling)
|
||||||
{
|
{
|
||||||
{
|
|
||||||
const FramebufferTextureFormats & fbTexFormat = gfxContext.getFramebufferTextureFormats();
|
const FramebufferTextureFormats & fbTexFormat = gfxContext.getFramebufferTextureFormats();
|
||||||
Context::InitTextureParams params;
|
Context::InitTextureParams initParams;
|
||||||
params.handle = _pTexture->name;
|
initParams.handle = _pTexture->name;
|
||||||
params.textureUnitIndex = textureIndices::Tex[_t];
|
initParams.textureUnitIndex = textureIndices::Tex[_t];
|
||||||
if (_multisampling)
|
if (_multisampling)
|
||||||
params.msaaLevel = config.video.multisampling;
|
initParams.msaaLevel = config.video.multisampling;
|
||||||
params.width = _pTexture->realWidth;
|
initParams.width = _pTexture->realWidth;
|
||||||
params.height = _pTexture->realHeight;
|
initParams.height = _pTexture->realHeight;
|
||||||
if (_pTexture->size > G_IM_SIZ_8b) {
|
if (_pTexture->size > G_IM_SIZ_8b) {
|
||||||
params.internalFormat = fbTexFormat.colorInternalFormat;
|
initParams.internalFormat = fbTexFormat.colorInternalFormat;
|
||||||
params.format = fbTexFormat.colorFormat;
|
initParams.format = fbTexFormat.colorFormat;
|
||||||
params.dataType = fbTexFormat.colorType;
|
initParams.dataType = fbTexFormat.colorType;
|
||||||
}
|
} else {
|
||||||
else {
|
initParams.internalFormat = fbTexFormat.monochromeInternalFormat;
|
||||||
params.internalFormat = fbTexFormat.monochromeInternalFormat;
|
initParams.format = fbTexFormat.monochromeFormat;
|
||||||
params.format = fbTexFormat.monochromeFormat;
|
initParams.dataType = fbTexFormat.monochromeType;
|
||||||
params.dataType = fbTexFormat.monochromeType;
|
|
||||||
}
|
|
||||||
gfxContext.init2DTexture(params);
|
|
||||||
}
|
}
|
||||||
|
gfxContext.init2DTexture(initParams);
|
||||||
|
|
||||||
if (!_multisampling) {
|
if (!_multisampling) {
|
||||||
Context::TexParameters params;
|
Context::TexParameters texParams;
|
||||||
params.handle = _pTexture->name;
|
texParams.handle = _pTexture->name;
|
||||||
params.target = textureTarget::TEXTURE_2D;
|
texParams.target = textureTarget::TEXTURE_2D;
|
||||||
params.textureUnitIndex = textureIndices::Tex[_t];
|
texParams.textureUnitIndex = textureIndices::Tex[_t];
|
||||||
params.minFilter = textureParameters::FILTER_NEAREST;
|
texParams.minFilter = textureParameters::FILTER_NEAREST;
|
||||||
params.magFilter = textureParameters::FILTER_NEAREST;
|
texParams.magFilter = textureParameters::FILTER_NEAREST;
|
||||||
gfxContext.setTextureParameters(params);
|
gfxContext.setTextureParameters(texParams);
|
||||||
}
|
}
|
||||||
{
|
|
||||||
Context::FrameBufferRenderTarget bufTarget;
|
Context::FrameBufferRenderTarget bufTarget;
|
||||||
bufTarget.bufferHandle = _fbo;
|
bufTarget.bufferHandle = _fbo;
|
||||||
bufTarget.bufferTarget = bufferTarget::FRAMEBUFFER;
|
bufTarget.bufferTarget = bufferTarget::FRAMEBUFFER;
|
||||||
|
@ -123,7 +121,6 @@ void FrameBuffer::_setAndAttachTexture(ObjectHandle _fbo, CachedTexture *_pTextu
|
||||||
bufTarget.textureTarget = _multisampling ? textureTarget::TEXTURE_2D_MULTISAMPLE : textureTarget::TEXTURE_2D;
|
bufTarget.textureTarget = _multisampling ? textureTarget::TEXTURE_2D_MULTISAMPLE : textureTarget::TEXTURE_2D;
|
||||||
bufTarget.textureHandle = _pTexture->name;
|
bufTarget.textureHandle = _pTexture->name;
|
||||||
gfxContext.addFrameBufferRenderTarget(bufTarget);
|
gfxContext.addFrameBufferRenderTarget(bufTarget);
|
||||||
}
|
|
||||||
assert(!gfxContext.isFramebufferError());
|
assert(!gfxContext.isFramebufferError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user