This commit is contained in:
Branimir Karadžić 2017-01-15 16:22:47 -08:00
Родитель b526c8175a
Коммит f63553fecc
12 изменённых файлов: 87 добавлений и 74 удалений

Просмотреть файл

@ -935,40 +935,40 @@ namespace bgfx
/// Swizzle RGBA8 image to BGRA8.
///
/// @param[in] _dst Destination image. Must be the same size as input image.
/// _dst might be pointer to the same memory as _src.
/// @param[in] _width Width of input image (pixels).
/// @param[in] _height Height of input image (pixels).
/// @param[in] _pitch Pitch of input image (bytes).
/// @param[in] _src Source image.
/// @param[in] _dst Destination image. Must be the same size as input image.
/// _dst might be pointer to the same memory as _src.
///
/// @attention C99 equivalent is `bgfx_image_swizzle_bgra8`.
///
void imageSwizzleBgra8(
uint32_t _width
void* _dst
, uint32_t _width
, uint32_t _height
, uint32_t _pitch
, const void* _src
, void* _dst
);
/// Downsample RGBA8 image with 2x2 pixel average filter.
///
/// @param[in] _dst Destination image. Must be at least quarter size of
/// input image. _dst might be pointer to the same memory as _src.
/// @param[in] _width Width of input image (pixels).
/// @param[in] _height Height of input image (pixels).
/// @param[in] _pitch Pitch of input image (bytes).
/// @param[in] _src Source image.
/// @param[in] _dst Destination image. Must be at least quarter size of
/// input image. _dst might be pointer to the same memory as _src.
///
/// @attention C99 equivalent is `bgfx_image_rgba8_downsample_2x2`.
///
void imageRgba8Downsample2x2(
uint32_t _width
void* _dst
, uint32_t _width
, uint32_t _height
, uint32_t _pitch
, const void* _src
, void* _dst
);
/// Returns supported backend API renderers.

Просмотреть файл

@ -549,10 +549,10 @@ BGFX_C_API uint32_t bgfx_topology_convert(bgfx_topology_convert_t _conversion, v
BGFX_C_API void bgfx_topology_sort_tri_list(bgfx_topology_sort_t _sort, void* _dst, uint32_t _dstSize, const float _dir[3], const float _pos[3], const void* _vertices, uint32_t _stride, const void* _indices, uint32_t _numIndices, bool _index32);
/**/
BGFX_C_API void bgfx_image_swizzle_bgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
BGFX_C_API void bgfx_image_swizzle_bgra8(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src);
/**/
BGFX_C_API void bgfx_image_rgba8_downsample_2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
BGFX_C_API void bgfx_image_rgba8_downsample_2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src);
/**/
BGFX_C_API uint8_t bgfx_get_supported_renderers(uint8_t _max, bgfx_renderer_type_t* _enum);

Просмотреть файл

@ -80,8 +80,8 @@ typedef struct bgfx_interface_vtbl
uint16_t (*weld_vertices)(uint16_t* _output, const bgfx_vertex_decl_t* _decl, const void* _data, uint16_t _num, float _epsilon);
uint32_t (*topology_convert)(bgfx_topology_convert_t _conversion, void* _dst, uint32_t _dstSize, const void* _indices, uint32_t _numIndices, bool _index32);
void (*topology_sort_tri_list)(bgfx_topology_sort_t _sort, void* _dst, uint32_t _dstSize, const float _dir[3], const float _pos[3], const void* _vertices, uint32_t _stride, const void* _indices, uint32_t _numIndices, bool _index32);
void (*image_swizzle_bgra8)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
void (*image_rgba8_downsample_2x2)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
void (*image_swizzle_bgra8)(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src);
void (*image_rgba8_downsample_2x2)(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src);
uint8_t (*get_supported_renderers)(uint8_t _max, bgfx_renderer_type_t* _enum);
const char* (*get_renderer_name)(bgfx_renderer_type_t _type);
bool (*init)(bgfx_renderer_type_t _type, uint16_t _vendorId, uint16_t _deviceId, bgfx_callback_interface_t* _callback, bgfx_allocator_interface_t* _allocator);

Просмотреть файл

@ -6,7 +6,7 @@
#ifndef BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_API_VERSION UINT32_C(34)
#define BGFX_API_VERSION UINT32_C(35)
///
#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.

Просмотреть файл

@ -4071,14 +4071,14 @@ void bgfx_topology_sort_tri_list(bgfx_topology_sort_t _sort, void* _dst, uint32_
bgfx::topologySortTriList(bgfx::TopologySort::Enum(_sort), _dst, _dstSize, _dir, _pos, _vertices, _stride, _indices, _numIndices, _index32);
}
BGFX_C_API void bgfx_image_swizzle_bgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
BGFX_C_API void bgfx_image_swizzle_bgra8(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src)
{
bgfx::imageSwizzleBgra8(_width, _height, _pitch, _src, _dst);
bgfx::imageSwizzleBgra8(_dst, _width, _height, _pitch, _src);
}
BGFX_C_API void bgfx_image_rgba8_downsample_2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
BGFX_C_API void bgfx_image_rgba8_downsample_2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src)
{
bgfx::imageRgba8Downsample2x2(_width, _height, _pitch, _src, _dst);
bgfx::imageRgba8Downsample2x2(_dst, _width, _height, _pitch, _src);
}
BGFX_C_API uint8_t bgfx_get_supported_renderers(uint8_t _max, bgfx_renderer_type_t* _enum)

Просмотреть файл

@ -298,7 +298,7 @@ namespace bgfx
return size * _numLayers;
}
void imageSolid(uint32_t _width, uint32_t _height, uint32_t _solid, void* _dst)
void imageSolid(void* _dst, uint32_t _width, uint32_t _height, uint32_t _solid)
{
uint32_t* dst = (uint32_t*)_dst;
for (uint32_t ii = 0, num = _width*_height; ii < num; ++ii)
@ -307,7 +307,7 @@ namespace bgfx
}
}
void imageCheckerboard(uint32_t _width, uint32_t _height, uint32_t _step, uint32_t _0, uint32_t _1, void* _dst)
void imageCheckerboard(void* _dst, uint32_t _width, uint32_t _height, uint32_t _step, uint32_t _0, uint32_t _1)
{
uint32_t* dst = (uint32_t*)_dst;
for (uint32_t yy = 0; yy < _height; ++yy)
@ -320,7 +320,7 @@ namespace bgfx
}
}
void imageRgba8Downsample2x2Ref(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
void imageRgba8Downsample2x2Ref(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src)
{
const uint32_t dstwidth = _width/2;
const uint32_t dstheight = _height/2;
@ -371,7 +371,7 @@ namespace bgfx
}
}
void imageRgba8Downsample2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
void imageRgba8Downsample2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src)
{
const uint32_t dstwidth = _width/2;
const uint32_t dstheight = _height/2;
@ -492,7 +492,7 @@ namespace bgfx
}
}
void imageRgba32fLinearDownsample2x2Ref(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
void imageRgba32fLinearDownsample2x2Ref(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src)
{
const uint32_t dstwidth = _width/2;
const uint32_t dstheight = _height/2;
@ -541,12 +541,12 @@ namespace bgfx
}
}
void imageRgba32fLinearDownsample2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
void imageRgba32fLinearDownsample2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src)
{
imageRgba32fLinearDownsample2x2Ref(_width, _height, _pitch, _src, _dst);
imageRgba32fLinearDownsample2x2Ref(_dst, _width, _height, _pitch, _src);
}
void imageRgba32fDownsample2x2NormalMapRef(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
void imageRgba32fDownsample2x2NormalMapRef(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src)
{
const uint32_t dstwidth = _width/2;
const uint32_t dstheight = _height/2;
@ -584,12 +584,12 @@ namespace bgfx
}
}
void imageRgba32fDownsample2x2NormalMap(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
void imageRgba32fDownsample2x2NormalMap(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src)
{
imageRgba32fDownsample2x2NormalMapRef(_width, _height, _pitch, _src, _dst);
imageRgba32fDownsample2x2NormalMapRef(_dst, _width, _height, _pitch, _src);
}
void imageSwizzleBgra8Ref(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
void imageSwizzleBgra8Ref(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src)
{
const uint8_t* src = (uint8_t*) _src;
const uint8_t* next = src + _pitch;
@ -611,7 +611,7 @@ namespace bgfx
}
}
void imageSwizzleBgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
void imageSwizzleBgra8(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src)
{
// Test can we do four 4-byte pixels at the time.
if (0 != (_width&0x3)
@ -623,7 +623,7 @@ namespace bgfx
BX_WARN(bx::isPtrAligned(_src, 16), "Source %p is not 16-byte aligned.", _src);
BX_WARN(bx::isPtrAligned(_dst, 16), "Destination %p is not 16-byte aligned.", _dst);
BX_WARN(_width < 4, "Image width must be multiple of 4 (width %d).", _width);
imageSwizzleBgra8Ref(_width, _height, _pitch, _src, _dst);
imageSwizzleBgra8Ref(_dst, _width, _height, _pitch, _src);
return;
}
@ -653,7 +653,7 @@ namespace bgfx
}
}
void imageCopy(uint32_t _height, uint32_t _srcPitch, const void* _src, uint32_t _dstPitch, void* _dst)
void imageCopy(void* _dst, uint32_t _height, uint32_t _srcPitch, const void* _src, uint32_t _dstPitch)
{
const uint32_t pitch = bx::uint32_min(_srcPitch, _dstPitch);
const uint8_t* src = (uint8_t*)_src;
@ -665,10 +665,10 @@ namespace bgfx
}
}
void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _pitch, const void* _src, void* _dst)
void imageCopy(void* _dst, uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _pitch, const void* _src)
{
const uint32_t dstPitch = _width*_bpp/8;
imageCopy(_height, _pitch, _src, dstPitch, _dst);
imageCopy(_dst, _height, _pitch, _src, dstPitch);
}
struct PackUnpack
@ -2655,22 +2655,22 @@ namespace bgfx
case TextureFormat::ETC2A:
BX_WARN(false, "ETC2A decoder is not implemented.");
imageCheckerboard(_width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xff00ff00), _dst);
imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xff00ff00) );
break;
case TextureFormat::ETC2A1:
BX_WARN(false, "ETC2A1 decoder is not implemented.");
imageCheckerboard(_width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffff0000), _dst);
imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffff0000) );
break;
case TextureFormat::PTC12:
BX_WARN(false, "PTC12 decoder is not implemented.");
imageCheckerboard(_width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffff00ff), _dst);
imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffff00ff) );
break;
case TextureFormat::PTC12A:
BX_WARN(false, "PTC12A decoder is not implemented.");
imageCheckerboard(_width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffff00), _dst);
imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffff00) );
break;
case TextureFormat::PTC14:
@ -2707,16 +2707,16 @@ namespace bgfx
case TextureFormat::PTC22:
BX_WARN(false, "PTC22 decoder is not implemented.");
imageCheckerboard(_width, _height, 16, UINT32_C(0xff00ff00), UINT32_C(0xff0000ff), _dst);
imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff00ff00), UINT32_C(0xff0000ff) );
break;
case TextureFormat::PTC24:
BX_WARN(false, "PTC24 decoder is not implemented.");
imageCheckerboard(_width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffffff), _dst);
imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffffff) );
break;
case TextureFormat::RGBA8:
imageSwizzleBgra8(_width, _height, _pitch, _src, _dst);
imageSwizzleBgra8(_dst, _width, _height, _pitch, _src);
break;
case TextureFormat::BGRA8:
@ -2730,7 +2730,7 @@ namespace bgfx
if (!imageConvert(_dst, TextureFormat::BGRA8, _src, _format, _width, _height, srcPitch) )
{
// Failed to convert, just make ugly red-yellow checkerboard texture.
imageCheckerboard(_width, _height, 16, UINT32_C(0xffff0000), UINT32_C(0xffffff00), _dst);
imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xffff0000), UINT32_C(0xffffff00) );
}
}
break;
@ -2746,12 +2746,12 @@ namespace bgfx
break;
case TextureFormat::BGRA8:
imageSwizzleBgra8(_width, _height, _pitch, _src, _dst);
imageSwizzleBgra8(_dst, _width, _height, _pitch, _src);
break;
default:
imageDecodeToBgra8(_dst, _src, _width, _height, _pitch, _format);
imageSwizzleBgra8(_width, _height, _width*4, _dst, _dst);
imageSwizzleBgra8(_dst, _width, _height, _width*4, _dst);
break;
}
}

Просмотреть файл

@ -102,13 +102,13 @@ namespace bgfx
);
///
void imageSolid(uint32_t _width, uint32_t _height, uint32_t _solid, void* _dst);
void imageSolid(void* _dst, uint32_t _width, uint32_t _height, uint32_t _solid);
///
void imageCheckerboard(uint32_t _width, uint32_t _height, uint32_t _step, uint32_t _0, uint32_t _1, void* _dst);
void imageCheckerboard(void* _dst, uint32_t _width, uint32_t _height, uint32_t _step, uint32_t _0, uint32_t _1);
///
void imageRgba8Downsample2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
void imageRgba8Downsample2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src);
///
void imageRgba32fToLinear(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src);
@ -117,19 +117,19 @@ namespace bgfx
void imageRgba32fToGamma(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src);
///
void imageRgba32fLinearDownsample2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
void imageRgba32fLinearDownsample2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src);
///
void imageRgba32fDownsample2x2NormalMap(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
void imageRgba32fDownsample2x2NormalMap(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src);
///
void imageSwizzleBgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
void imageSwizzleBgra8(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src);
///
void imageCopy(uint32_t _height, uint32_t _srcPitch, const void* _src, uint32_t _dstPitch, void* _dst);
void imageCopy(void* _dst, uint32_t _height, uint32_t _srcPitch, const void* _src, uint32_t _dstPitch);
///
void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _pitch, const void* _src, void* _dst);
void imageCopy(void* _dst, uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _pitch, const void* _src);
///
bool imageConvert(TextureFormat::Enum _dstFormat, TextureFormat::Enum _srcFormat);

Просмотреть файл

@ -2021,11 +2021,12 @@ BX_PRAGMA_DIAGNOSTIC_POP();
D3D11_MAPPED_SUBRESOURCE mapped;
DX_CHECK(m_deviceCtx->Map(texture, 0, D3D11_MAP_READ, 0, &mapped) );
imageSwizzleBgra8(backBufferDesc.Width
imageSwizzleBgra8(
mapped.pData
, backBufferDesc.Width
, backBufferDesc.Height
, mapped.RowPitch
, mapped.pData
, mapped.pData
);
g_callback->screenShot(_filePath
, backBufferDesc.Width
@ -3283,11 +3284,12 @@ BX_PRAGMA_DIAGNOSTIC_POP();
D3D11_MAPPED_SUBRESOURCE mapped;
DX_CHECK(m_deviceCtx->Map(m_captureTexture, 0, D3D11_MAP_READ, 0, &mapped) );
imageSwizzleBgra8(getBufferWidth()
imageSwizzleBgra8(
mapped.pData
, getBufferWidth()
, getBufferHeight()
, mapped.RowPitch
, mapped.pData
, mapped.pData
);
g_callback->captureFrame(mapped.pData, getBufferHeight()*mapped.RowPitch);
@ -4402,7 +4404,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
if (swizzle)
{
// imageSwizzleBgra8(width, height, mip.m_width*4, data, temp);
// imageSwizzleBgra8(temp, width, height, mip.m_width*4, data);
}
srd[kk].SysMemSlicePitch = mip.m_height*srd[kk].SysMemPitch;

Просмотреть файл

@ -1604,11 +1604,12 @@ namespace bgfx { namespace d3d12
void* data;
readback->Map(0, NULL, (void**)&data);
imageSwizzleBgra8(width
imageSwizzleBgra8(
data
, width
, height
, (uint32_t)pitch
, data
, data
);
g_callback->screenShot(_filePath
, width
@ -4070,11 +4071,11 @@ data.NumQualityLevels = 0;
uint32_t slice = bx::strideAlign( (mip.m_height/blockInfo.blockHeight)*pitch, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT);
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, slice);
imageCopy(mip.m_height/blockInfo.blockHeight
imageCopy(temp
, mip.m_height/blockInfo.blockHeight
, (mip.m_width /blockInfo.blockWidth )*mip.m_blockSize
, mip.m_data
, pitch
, temp
);
srd[kk].pData = temp;
@ -4088,11 +4089,11 @@ data.NumQualityLevels = 0;
const uint32_t slice = bx::strideAlign(pitch * mip.m_height, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT);
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, slice);
imageCopy(mip.m_height
imageCopy(temp
, mip.m_height
, mip.m_width*mip.m_bpp / 8
, mip.m_data
, pitch
, temp
);
srd[kk].pData = temp;
@ -4103,7 +4104,7 @@ data.NumQualityLevels = 0;
if (swizzle)
{
// imageSwizzleBgra8(width, height, mip.m_width*4, data, temp);
// imageSwizzleBgra8(temp, width, height, mip.m_width*4, data);
}
srd[kk].SlicePitch = mip.m_height*srd[kk].RowPitch;

Просмотреть файл

@ -2539,7 +2539,7 @@ namespace bgfx { namespace gl
if (GL_RGBA == m_readPixelsFmt)
{
imageSwizzleBgra8(width, height, width*4, data, data);
imageSwizzleBgra8(data, width, height, width*4, data);
}
g_callback->screenShot(_filePath
@ -3101,7 +3101,7 @@ namespace bgfx { namespace gl
if (GL_RGBA == m_readPixelsFmt)
{
imageSwizzleBgra8(m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, m_capture, m_capture);
imageSwizzleBgra8(m_capture, m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, m_capture);
}
g_callback->captureFrame(m_capture, m_captureSize);
@ -5086,7 +5086,7 @@ namespace bgfx { namespace gl
if (!unpackRowLength)
{
imageCopy(width, height, bpp, srcpitch, data, temp);
imageCopy(temp, width, height, bpp, srcpitch, data);
data = temp;
}
@ -5117,7 +5117,7 @@ namespace bgfx { namespace gl
if (!unpackRowLength
&& !convert)
{
imageCopy(width, height, bpp, srcpitch, data, temp);
imageCopy(temp, width, height, bpp, srcpitch, data);
data = temp;
}

Просмотреть файл

@ -1223,7 +1223,9 @@ namespace bgfx { namespace mtl
if (NULL != m_capture)
{
if (NULL == m_screenshotTarget)
{
return;
}
m_renderCommandEncoder.endEncoding();
@ -1239,7 +1241,13 @@ namespace bgfx { namespace mtl
if (m_screenshotTarget.pixelFormat() == MTLPixelFormatRGBA8Uint)
{
imageSwizzleBgra8(m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, m_capture, m_capture);
imageSwizzleBgra8(
m_capture
, m_resolution.m_width
, m_resolution.m_height
, m_resolution.m_width*4
, m_capture
);
}
g_callback->captureFrame(m_capture, m_captureSize);
@ -1247,12 +1255,14 @@ namespace bgfx { namespace mtl
RenderPassDescriptor renderPassDescriptor = newRenderPassDescriptor();
setFrameBuffer(renderPassDescriptor, m_renderCommandEncoderFrameBufferHandle);
for(uint32_t ii = 0; ii < g_caps.limits.maxFBAttachments; ++ii)
for (uint32_t ii = 0; ii < g_caps.limits.maxFBAttachments; ++ii)
{
MTLRenderPassColorAttachmentDescriptor* desc = renderPassDescriptor.colorAttachments[ii];
if ( desc.texture != NULL)
if (NULL != desc.texture)
{
desc.loadAction = MTLLoadActionLoad;
}
}
RenderPassDepthAttachmentDescriptor depthAttachment = renderPassDescriptor.depthAttachment;
if (NULL != depthAttachment.texture)

Просмотреть файл

@ -318,7 +318,7 @@ namespace bgfx
return true;
case TextureFormat::BGRA8:
imageSwizzleBgra8(_width, _height, _width*4, _src, _dst);
imageSwizzleBgra8(_dst, _width, _height, _width*4, _src);
return true;
case TextureFormat::RGBA8:
@ -684,7 +684,7 @@ int main(int _argc, const char* _argv[])
for (uint8_t lod = 1; lod < numMips; ++lod)
{
imageRgba32fDownsample2x2NormalMap(dstMip.m_width, dstMip.m_height, dstMip.m_width*16, rgba, rgba);
imageRgba32fDownsample2x2NormalMap(rgba, dstMip.m_width, dstMip.m_height, dstMip.m_width*16, rgba);
imageRgba32f11to01(rgbaDst, dstMip.m_width, dstMip.m_height, dstMip.m_width*16, rgba);
imageGetRawData(imageContainer, 0, lod, output->data, output->size, dstMip);
uint8_t* data = const_cast<uint8_t*>(dstMip.m_data);
@ -737,7 +737,7 @@ int main(int _argc, const char* _argv[])
for (uint8_t lod = 1; lod < numMips; ++lod)
{
imageRgba32fLinearDownsample2x2(dstMip.m_width, dstMip.m_height, dstMip.m_width*16, rgba, rgba);
imageRgba32fLinearDownsample2x2(rgba, dstMip.m_width, dstMip.m_height, dstMip.m_width*16, rgba);
imageGetRawData(imageContainer, 0, lod, output->data, output->size, dstMip);
uint8_t* data = const_cast<uint8_t*>(dstMip.m_data);
@ -797,7 +797,7 @@ int main(int _argc, const char* _argv[])
for (uint8_t lod = 1; lod < numMips; ++lod)
{
imageRgba8Downsample2x2(dstMip.m_width, dstMip.m_height, dstMip.m_width*4, rgba, rgba);
imageRgba8Downsample2x2(rgba, dstMip.m_width, dstMip.m_height, dstMip.m_width*4, rgba);
imageGetRawData(imageContainer, 0, lod, output->data, output->size, dstMip);
uint8_t* data = const_cast<uint8_t*>(dstMip.m_data);
imageEncodeFromRgba8(data, rgba, dstMip.m_width, dstMip.m_height, format);