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

Simplify TextureCache::_loadDepthTexture : do not convert unsigned shorts to floats

This commit is contained in:
Sergey Lipskiy 2017-04-02 10:41:30 +07:00
parent b92af6ddad
commit 226cd6e4a3

View File

@ -973,14 +973,6 @@ void TextureCache::_loadDepthTexture(CachedTexture * _pTexture, u16* _pDest)
if (!gfxContext.isSupported(SpecialFeatures::FragmentDepthWrite)) if (!gfxContext.isSupported(SpecialFeatures::FragmentDepthWrite))
return; return;
const u32 numTexels = _pTexture->realWidth * _pTexture->realHeight;
_pTexture->textureBytes = numTexels * sizeof(f32);
f32 * pDestF = (f32*)malloc(_pTexture->textureBytes);
assert(pDestF != nullptr);
for (u32 t = 0; t < numTexels; ++t)
pDestF[t] = _pDest[t] / 65535.0f;
Context::InitTextureParams params; Context::InitTextureParams params;
params.handle = _pTexture->name; params.handle = _pTexture->name;
params.mipMapLevel = 0; params.mipMapLevel = 0;
@ -989,10 +981,9 @@ void TextureCache::_loadDepthTexture(CachedTexture * _pTexture, u16* _pDest)
params.height = _pTexture->realHeight; params.height = _pTexture->realHeight;
params.internalFormat = internalcolorFormat::RED; params.internalFormat = internalcolorFormat::RED;
params.format = colorFormat::RED; params.format = colorFormat::RED;
params.dataType = datatype::FLOAT; params.dataType = datatype::UNSIGNED_SHORT;
params.data = pDestF; params.data = _pDest;
gfxContext.init2DTexture(params); gfxContext.init2DTexture(params);
free(pDestF);
} }
/* /*