This commit is contained in:
Branimir Karadžić 2015-04-26 11:34:33 -07:00
parent 681be37f73
commit d804ca9023
4 changed files with 15 additions and 10 deletions

View File

@ -152,13 +152,15 @@ typedef enum bgfx_uniform_type
typedef enum bgfx_backbuffer_ratio
{
BGFX_BACKBUFFER_RATIO_NONE,
BGFX_BACKBUFFER_RATIO_EQUAL,
BGFX_BACKBUFFER_RATIO_HALF,
BGFX_BACKBUFFER_RATIO_QUARTER,
BGFX_BACKBUFFER_RATIO_EIGHTH,
BGFX_BACKBUFFER_RATIO_SIXTEENTH,
BGFX_BACKBUFFER_RATIO_DOUBLE
BGFX_BACKBUFFER_RATIO_DOUBLE,
BGFX_BACKBUFFER_RATIO_COUNT
} bgfx_backbuffer_ratio_t;
#define BGFX_HANDLE_T(_name) \

View File

@ -193,13 +193,14 @@ namespace bgfx
{
enum Enum
{
None,
Equal,
Half,
Quarter,
Eighth,
Sixteenth,
Double,
Count
};
};

View File

@ -2407,7 +2407,7 @@ again:
{
BGFX_CHECK_MAIN_THREAD();
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)
@ -2453,7 +2453,7 @@ again:
uint32_t magic = BGFX_CHUNK_MAGIC_TEX;
bx::write(&writer, magic);
if (BackbufferRatio::None != _ratio)
if (BackbufferRatio::Count != _ratio)
{
_width = uint16_t(s_ctx->m_frame->m_resolution.m_width);
_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)
{
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)
{
BX_CHECK(_ratio < BackbufferRatio::Count, "Invalid back buffer ratio.");
return createTexture2D(_ratio, 0, 0, _numMips, _format, _flags, NULL);
}
@ -2523,7 +2524,7 @@ again:
tc.m_mem = _mem;
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)
@ -2563,7 +2564,7 @@ again:
tc.m_mem = _mem;
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)
@ -2628,6 +2629,7 @@ again:
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;
TextureHandle th = createTexture2D(_ratio, 1, _format, _textureFlags);
return createFrameBuffer(1, &th, true);

View File

@ -1921,7 +1921,7 @@ namespace bgfx
{
uint16_t textureIdx = m_textureHandle.getHandleAt(ii);
const TextureRef& textureRef = m_textureRef[textureIdx];
if (BackbufferRatio::None != textureRef.m_bbRatio)
if (BackbufferRatio::Count != textureRef.m_bbRatio)
{
TextureHandle handle = { textureIdx };
resizeTexture(handle
@ -2795,7 +2795,7 @@ namespace bgfx
void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height)
{
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);