Cleanup.
This commit is contained in:
parent
681be37f73
commit
d804ca9023
@ -152,13 +152,15 @@ typedef enum bgfx_uniform_type
|
|||||||
|
|
||||||
typedef enum bgfx_backbuffer_ratio
|
typedef enum bgfx_backbuffer_ratio
|
||||||
{
|
{
|
||||||
BGFX_BACKBUFFER_RATIO_NONE,
|
|
||||||
BGFX_BACKBUFFER_RATIO_EQUAL,
|
BGFX_BACKBUFFER_RATIO_EQUAL,
|
||||||
BGFX_BACKBUFFER_RATIO_HALF,
|
BGFX_BACKBUFFER_RATIO_HALF,
|
||||||
BGFX_BACKBUFFER_RATIO_QUARTER,
|
BGFX_BACKBUFFER_RATIO_QUARTER,
|
||||||
BGFX_BACKBUFFER_RATIO_EIGHTH,
|
BGFX_BACKBUFFER_RATIO_EIGHTH,
|
||||||
BGFX_BACKBUFFER_RATIO_SIXTEENTH,
|
BGFX_BACKBUFFER_RATIO_SIXTEENTH,
|
||||||
BGFX_BACKBUFFER_RATIO_DOUBLE
|
BGFX_BACKBUFFER_RATIO_DOUBLE,
|
||||||
|
|
||||||
|
BGFX_BACKBUFFER_RATIO_COUNT
|
||||||
|
|
||||||
} bgfx_backbuffer_ratio_t;
|
} bgfx_backbuffer_ratio_t;
|
||||||
|
|
||||||
#define BGFX_HANDLE_T(_name) \
|
#define BGFX_HANDLE_T(_name) \
|
||||||
|
@ -193,13 +193,14 @@ namespace bgfx
|
|||||||
{
|
{
|
||||||
enum Enum
|
enum Enum
|
||||||
{
|
{
|
||||||
None,
|
|
||||||
Equal,
|
Equal,
|
||||||
Half,
|
Half,
|
||||||
Quarter,
|
Quarter,
|
||||||
Eighth,
|
Eighth,
|
||||||
Sixteenth,
|
Sixteenth,
|
||||||
Double,
|
Double,
|
||||||
|
|
||||||
|
Count
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
12
src/bgfx.cpp
12
src/bgfx.cpp
@ -2407,7 +2407,7 @@ again:
|
|||||||
{
|
{
|
||||||
BGFX_CHECK_MAIN_THREAD();
|
BGFX_CHECK_MAIN_THREAD();
|
||||||
BX_CHECK(NULL != _mem, "_mem can't be NULL");
|
BX_CHECK(NULL != _mem, "_mem can't be NULL");
|
||||||
return s_ctx->createTexture(_mem, _flags, _skip, _info, BackbufferRatio::None);
|
return s_ctx->createTexture(_mem, _flags, _skip, _info, BackbufferRatio::Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void getTextureSizeFromRatio(BackbufferRatio::Enum _ratio, uint16_t& _width, uint16_t& _height)
|
void getTextureSizeFromRatio(BackbufferRatio::Enum _ratio, uint16_t& _width, uint16_t& _height)
|
||||||
@ -2453,7 +2453,7 @@ again:
|
|||||||
uint32_t magic = BGFX_CHUNK_MAGIC_TEX;
|
uint32_t magic = BGFX_CHUNK_MAGIC_TEX;
|
||||||
bx::write(&writer, magic);
|
bx::write(&writer, magic);
|
||||||
|
|
||||||
if (BackbufferRatio::None != _ratio)
|
if (BackbufferRatio::Count != _ratio)
|
||||||
{
|
{
|
||||||
_width = uint16_t(s_ctx->m_frame->m_resolution.m_width);
|
_width = uint16_t(s_ctx->m_frame->m_resolution.m_width);
|
||||||
_height = uint16_t(s_ctx->m_frame->m_resolution.m_height);
|
_height = uint16_t(s_ctx->m_frame->m_resolution.m_height);
|
||||||
@ -2477,11 +2477,12 @@ again:
|
|||||||
|
|
||||||
TextureHandle createTexture2D(uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
|
TextureHandle createTexture2D(uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
|
||||||
{
|
{
|
||||||
return createTexture2D(BackbufferRatio::None, _width, _height, _numMips, _format, _flags, _mem);
|
return createTexture2D(BackbufferRatio::Count, _width, _height, _numMips, _format, _flags, _mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags)
|
TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags)
|
||||||
{
|
{
|
||||||
|
BX_CHECK(_ratio < BackbufferRatio::Count, "Invalid back buffer ratio.");
|
||||||
return createTexture2D(_ratio, 0, 0, _numMips, _format, _flags, NULL);
|
return createTexture2D(_ratio, 0, 0, _numMips, _format, _flags, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2523,7 +2524,7 @@ again:
|
|||||||
tc.m_mem = _mem;
|
tc.m_mem = _mem;
|
||||||
bx::write(&writer, tc);
|
bx::write(&writer, tc);
|
||||||
|
|
||||||
return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::None);
|
return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureHandle createTextureCube(uint16_t _size, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
|
TextureHandle createTextureCube(uint16_t _size, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
|
||||||
@ -2563,7 +2564,7 @@ again:
|
|||||||
tc.m_mem = _mem;
|
tc.m_mem = _mem;
|
||||||
bx::write(&writer, tc);
|
bx::write(&writer, tc);
|
||||||
|
|
||||||
return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::None);
|
return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyTexture(TextureHandle _handle)
|
void destroyTexture(TextureHandle _handle)
|
||||||
@ -2628,6 +2629,7 @@ again:
|
|||||||
|
|
||||||
FrameBufferHandle createFrameBuffer(BackbufferRatio::Enum _ratio, TextureFormat::Enum _format, uint32_t _textureFlags)
|
FrameBufferHandle createFrameBuffer(BackbufferRatio::Enum _ratio, TextureFormat::Enum _format, uint32_t _textureFlags)
|
||||||
{
|
{
|
||||||
|
BX_CHECK(_ratio < BackbufferRatio::Count, "Invalid back buffer ratio.");
|
||||||
_textureFlags |= _textureFlags&BGFX_TEXTURE_RT_MSAA_MASK ? 0 : BGFX_TEXTURE_RT;
|
_textureFlags |= _textureFlags&BGFX_TEXTURE_RT_MSAA_MASK ? 0 : BGFX_TEXTURE_RT;
|
||||||
TextureHandle th = createTexture2D(_ratio, 1, _format, _textureFlags);
|
TextureHandle th = createTexture2D(_ratio, 1, _format, _textureFlags);
|
||||||
return createFrameBuffer(1, &th, true);
|
return createFrameBuffer(1, &th, true);
|
||||||
|
@ -1921,7 +1921,7 @@ namespace bgfx
|
|||||||
{
|
{
|
||||||
uint16_t textureIdx = m_textureHandle.getHandleAt(ii);
|
uint16_t textureIdx = m_textureHandle.getHandleAt(ii);
|
||||||
const TextureRef& textureRef = m_textureRef[textureIdx];
|
const TextureRef& textureRef = m_textureRef[textureIdx];
|
||||||
if (BackbufferRatio::None != textureRef.m_bbRatio)
|
if (BackbufferRatio::Count != textureRef.m_bbRatio)
|
||||||
{
|
{
|
||||||
TextureHandle handle = { textureIdx };
|
TextureHandle handle = { textureIdx };
|
||||||
resizeTexture(handle
|
resizeTexture(handle
|
||||||
@ -2795,7 +2795,7 @@ namespace bgfx
|
|||||||
void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height)
|
void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height)
|
||||||
{
|
{
|
||||||
const TextureRef& textureRef = m_textureRef[_handle.idx];
|
const TextureRef& textureRef = m_textureRef[_handle.idx];
|
||||||
BX_CHECK(BackbufferRatio::None != textureRef.m_bbRatio, "");
|
BX_CHECK(BackbufferRatio::Count != textureRef.m_bbRatio, "");
|
||||||
|
|
||||||
getTextureSizeFromRatio(BackbufferRatio::Enum(textureRef.m_bbRatio), _width, _height);
|
getTextureSizeFromRatio(BackbufferRatio::Enum(textureRef.m_bbRatio), _width, _height);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user