|
|
@@ -2516,7 +2516,7 @@ namespace bgfx
|
|
|
const Memory* mem;
|
|
|
_cmdbuf.read(mem);
|
|
|
|
|
|
- uint32_t flags;
|
|
|
+ uint64_t flags;
|
|
|
_cmdbuf.read(flags);
|
|
|
|
|
|
uint8_t skip;
|
|
|
@@ -2642,10 +2642,13 @@ namespace bgfx
|
|
|
uint16_t height;
|
|
|
_cmdbuf.read(height);
|
|
|
|
|
|
+ TextureFormat::Enum format;
|
|
|
+ _cmdbuf.read(format);
|
|
|
+
|
|
|
TextureFormat::Enum depthFormat;
|
|
|
_cmdbuf.read(depthFormat);
|
|
|
|
|
|
- m_renderCtx->createFrameBuffer(handle, nwh, width, height, depthFormat);
|
|
|
+ m_renderCtx->createFrameBuffer(handle, nwh, width, height, format, depthFormat);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -3603,7 +3606,7 @@ error:
|
|
|
s_ctx->destroyProgram(_handle);
|
|
|
}
|
|
|
|
|
|
- static void isTextureValid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, bx::Error* _err)
|
|
|
+ static void isTextureValid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, TextureFormat::Enum _format, uint64_t _flags, bx::Error* _err)
|
|
|
{
|
|
|
BX_ERROR_SCOPE(_err);
|
|
|
|
|
|
@@ -3712,7 +3715,7 @@ error:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- bool isTextureValid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags)
|
|
|
+ bool isTextureValid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, TextureFormat::Enum _format, uint64_t _flags)
|
|
|
{
|
|
|
bx::Error err;
|
|
|
isTextureValid(_depth, _cubeMap, _numLayers, _format, _flags, &err);
|
|
|
@@ -3724,7 +3727,7 @@ error:
|
|
|
bimg::imageGetSize( (bimg::TextureInfo*)&_info, _width, _height, _depth, _cubeMap, _hasMips, _numLayers, bimg::TextureFormat::Enum(_format) );
|
|
|
}
|
|
|
|
|
|
- TextureHandle createTexture(const Memory* _mem, uint32_t _flags, uint8_t _skip, TextureInfo* _info)
|
|
|
+ TextureHandle createTexture(const Memory* _mem, uint64_t _flags, uint8_t _skip, TextureInfo* _info)
|
|
|
{
|
|
|
BX_CHECK(NULL != _mem, "_mem can't be NULL");
|
|
|
return s_ctx->createTexture(_mem, _flags, _skip, _info, BackbufferRatio::Count, false);
|
|
|
@@ -3748,7 +3751,7 @@ error:
|
|
|
_height = bx::max<uint16_t>(1, _height);
|
|
|
}
|
|
|
|
|
|
- static TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
|
|
|
+ static TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint64_t _flags, const Memory* _mem)
|
|
|
{
|
|
|
bx::Error err;
|
|
|
isTextureValid(0, false, _numLayers, _format, _flags, &err);
|
|
|
@@ -3801,19 +3804,19 @@ error:
|
|
|
return s_ctx->createTexture(mem, _flags, 0, NULL, _ratio, NULL != _mem);
|
|
|
}
|
|
|
|
|
|
- TextureHandle createTexture2D(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
|
|
|
+ TextureHandle createTexture2D(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint64_t _flags, const Memory* _mem)
|
|
|
{
|
|
|
BX_CHECK(_width > 0 && _height > 0, "Invalid texture size (width %d, height %d).", _width, _height);
|
|
|
return createTexture2D(BackbufferRatio::Count, _width, _height, _hasMips, _numLayers, _format, _flags, _mem);
|
|
|
}
|
|
|
|
|
|
- TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags)
|
|
|
+ TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint64_t _flags)
|
|
|
{
|
|
|
BX_CHECK(_ratio < BackbufferRatio::Count, "Invalid back buffer ratio.");
|
|
|
return createTexture2D(_ratio, 0, 0, _hasMips, _numLayers, _format, _flags, NULL);
|
|
|
}
|
|
|
|
|
|
- TextureHandle createTexture3D(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
|
|
|
+ TextureHandle createTexture3D(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, TextureFormat::Enum _format, uint64_t _flags, const Memory* _mem)
|
|
|
{
|
|
|
bx::Error err;
|
|
|
isTextureValid(_depth, false, 1, _format, _flags, &err);
|
|
|
@@ -3854,7 +3857,7 @@ error:
|
|
|
return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count, NULL != _mem);
|
|
|
}
|
|
|
|
|
|
- TextureHandle createTextureCube(uint16_t _size, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
|
|
|
+ TextureHandle createTextureCube(uint16_t _size, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint64_t _flags, const Memory* _mem)
|
|
|
{
|
|
|
bx::Error err;
|
|
|
isTextureValid(0, true, _numLayers, _format, _flags, &err);
|
|
|
@@ -3964,14 +3967,14 @@ error:
|
|
|
return s_ctx->readTexture(_handle, _data, _mip);
|
|
|
}
|
|
|
|
|
|
- FrameBufferHandle createFrameBuffer(uint16_t _width, uint16_t _height, TextureFormat::Enum _format, uint32_t _textureFlags)
|
|
|
+ FrameBufferHandle createFrameBuffer(uint16_t _width, uint16_t _height, TextureFormat::Enum _format, uint64_t _textureFlags)
|
|
|
{
|
|
|
_textureFlags |= _textureFlags&BGFX_TEXTURE_RT_MSAA_MASK ? 0 : BGFX_TEXTURE_RT;
|
|
|
TextureHandle th = createTexture2D(_width, _height, false, 1, _format, _textureFlags);
|
|
|
return createFrameBuffer(1, &th, true);
|
|
|
}
|
|
|
|
|
|
- FrameBufferHandle createFrameBuffer(BackbufferRatio::Enum _ratio, TextureFormat::Enum _format, uint32_t _textureFlags)
|
|
|
+ FrameBufferHandle createFrameBuffer(BackbufferRatio::Enum _ratio, TextureFormat::Enum _format, uint64_t _textureFlags)
|
|
|
{
|
|
|
BX_CHECK(_ratio < BackbufferRatio::Count, "Invalid back buffer ratio.");
|
|
|
_textureFlags |= _textureFlags&BGFX_TEXTURE_RT_MSAA_MASK ? 0 : BGFX_TEXTURE_RT;
|
|
|
@@ -4004,7 +4007,7 @@ error:
|
|
|
return s_ctx->createFrameBuffer(_num, _attachment, _destroyTextures);
|
|
|
}
|
|
|
|
|
|
- FrameBufferHandle createFrameBuffer(void* _nwh, uint16_t _width, uint16_t _height, TextureFormat::Enum _depthFormat)
|
|
|
+ FrameBufferHandle createFrameBuffer(void* _nwh, uint16_t _width, uint16_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat)
|
|
|
{
|
|
|
BGFX_CHECK_CAPS(BGFX_CAPS_SWAP_CHAIN, "Swap chain is not supported!");
|
|
|
BX_WARN(_width > 0 && _height > 0
|
|
|
@@ -4012,10 +4015,19 @@ error:
|
|
|
, _width
|
|
|
, _height
|
|
|
);
|
|
|
+ BX_CHECK(_format == TextureFormat::Count || bimg::isColor(bimg::TextureFormat::Enum(_format) )
|
|
|
+ , "Invalid texture format for color (%s)."
|
|
|
+ , bimg::getName(bimg::TextureFormat::Enum(_format) )
|
|
|
+ );
|
|
|
+ BX_CHECK(_format == TextureFormat::Count || bimg::isDepth(bimg::TextureFormat::Enum(_depthFormat) )
|
|
|
+ , "Invalid texture format for depth (%s)."
|
|
|
+ , bimg::getName(bimg::TextureFormat::Enum(_depthFormat) )
|
|
|
+ );
|
|
|
return s_ctx->createFrameBuffer(
|
|
|
_nwh
|
|
|
, bx::max<uint16_t>(_width, 1)
|
|
|
, bx::max<uint16_t>(_height, 1)
|
|
|
+ , _format
|
|
|
, _depthFormat
|
|
|
);
|
|
|
}
|
|
|
@@ -5103,7 +5115,7 @@ BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle)
|
|
|
bgfx::destroy(handle.cpp);
|
|
|
}
|
|
|
|
|
|
-BGFX_C_API bool bgfx_is_texture_valid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags)
|
|
|
+BGFX_C_API bool bgfx_is_texture_valid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags)
|
|
|
{
|
|
|
return bgfx::isTextureValid(_depth, _cubeMap, _numLayers, bgfx::TextureFormat::Enum(_format), _flags);
|
|
|
}
|
|
|
@@ -5114,7 +5126,7 @@ BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _wid
|
|
|
bgfx::calcTextureSize(info, _width, _height, _depth, _cubeMap, _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format) );
|
|
|
}
|
|
|
|
|
|
-BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info)
|
|
|
+BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint64_t _flags, uint8_t _skip, bgfx_texture_info_t* _info)
|
|
|
{
|
|
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
|
|
|
bgfx::TextureInfo* info = (bgfx::TextureInfo*)_info;
|
|
|
@@ -5122,28 +5134,28 @@ BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem,
|
|
|
return handle.c;
|
|
|
}
|
|
|
|
|
|
-BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
|
|
|
+BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem)
|
|
|
{
|
|
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
|
|
|
handle.cpp = bgfx::createTexture2D(_width, _height, _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
|
|
|
return handle.c;
|
|
|
}
|
|
|
|
|
|
-BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags)
|
|
|
+BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags)
|
|
|
{
|
|
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
|
|
|
handle.cpp = bgfx::createTexture2D(bgfx::BackbufferRatio::Enum(_ratio), _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format), _flags);
|
|
|
return handle.c;
|
|
|
}
|
|
|
|
|
|
-BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
|
|
|
+BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem)
|
|
|
{
|
|
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
|
|
|
handle.cpp = bgfx::createTexture3D(_width, _height, _depth, _hasMips, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
|
|
|
return handle.c;
|
|
|
}
|
|
|
|
|
|
-BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
|
|
|
+BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem)
|
|
|
{
|
|
|
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
|
|
|
handle.cpp = bgfx::createTextureCube(_size, _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
|
|
|
@@ -5192,14 +5204,14 @@ BGFX_C_API void bgfx_destroy_texture(bgfx_texture_handle_t _handle)
|
|
|
bgfx::destroy(handle.cpp);
|
|
|
}
|
|
|
|
|
|
-BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags)
|
|
|
+BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint64_t _textureFlags)
|
|
|
{
|
|
|
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
|
|
|
handle.cpp = bgfx::createFrameBuffer(_width, _height, bgfx::TextureFormat::Enum(_format), _textureFlags);
|
|
|
return handle.c;
|
|
|
}
|
|
|
|
|
|
-BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags)
|
|
|
+BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint64_t _textureFlags)
|
|
|
{
|
|
|
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
|
|
|
handle.cpp = bgfx::createFrameBuffer(bgfx::BackbufferRatio::Enum(_ratio), bgfx::TextureFormat::Enum(_format), _textureFlags);
|
|
|
@@ -5220,10 +5232,10 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(u
|
|
|
return handle.c;
|
|
|
}
|
|
|
|
|
|
-BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _depthFormat)
|
|
|
+BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat)
|
|
|
{
|
|
|
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
|
|
|
- handle.cpp = bgfx::createFrameBuffer(_nwh, _width, _height, bgfx::TextureFormat::Enum(_depthFormat) );
|
|
|
+ handle.cpp = bgfx::createFrameBuffer(_nwh, _width, _height, bgfx::TextureFormat::Enum(_format), bgfx::TextureFormat::Enum(_depthFormat) );
|
|
|
return handle.c;
|
|
|
}
|
|
|
|