mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-02-17 20:31:57 -05:00
D3D9: Fixed RGBA8 texture format.
This commit is contained in:
parent
a3a1ed112b
commit
c69f29cb36
2 changed files with 14 additions and 4 deletions
|
@ -2122,6 +2122,10 @@ namespace bgfx
|
|||
imageCheckerboard(_width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffffff), _dst);
|
||||
break;
|
||||
|
||||
case TextureFormat::RGBA8:
|
||||
imageSwizzleBgra8(_width, _height, _pitch, _src, _dst);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Decompression not implemented... Make ugly red-yellow checkerboard texture.
|
||||
imageCheckerboard(_width, _height, 16, UINT32_C(0xffff0000), UINT32_C(0xffffff00), _dst);
|
||||
|
|
|
@ -2389,10 +2389,8 @@ namespace bgfx { namespace d3d9
|
|||
m_textureFormat = imageContainer.m_format;
|
||||
|
||||
const TextureFormatInfo& tfi = s_textureFormat[m_requestedFormat];
|
||||
const bool convert = D3DFMT_UNKNOWN == tfi.m_fmt;
|
||||
|
||||
uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) );
|
||||
if (convert)
|
||||
if (D3DFMT_UNKNOWN == tfi.m_fmt)
|
||||
{
|
||||
m_textureFormat = (uint8_t)TextureFormat::BGRA8;
|
||||
bpp = 32;
|
||||
|
@ -2434,6 +2432,8 @@ namespace bgfx { namespace d3d9
|
|||
&& imageContainer.m_format != TextureFormat::BC5
|
||||
;
|
||||
|
||||
const bool convert = m_textureFormat != m_requestedFormat;
|
||||
|
||||
for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
|
||||
{
|
||||
uint32_t width = textureWidth;
|
||||
|
@ -2466,7 +2466,13 @@ namespace bgfx { namespace d3d9
|
|||
uint32_t srcpitch = mipWidth*bpp/8;
|
||||
|
||||
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, srcpitch*mipHeight);
|
||||
imageDecodeToBgra8(temp, mip.m_data, mip.m_width, mip.m_height, srcpitch, mip.m_format);
|
||||
imageDecodeToBgra8(temp
|
||||
, mip.m_data
|
||||
, mip.m_width
|
||||
, mip.m_height
|
||||
, srcpitch
|
||||
, mip.m_format
|
||||
);
|
||||
|
||||
uint32_t dstpitch = pitch;
|
||||
for (uint32_t yy = 0; yy < height; ++yy)
|
||||
|
|
Loading…
Reference in a new issue