Added ability to sample stencil part of depth/stencil texture.

This commit is contained in:
Branimir Karadžić
2018-08-23 17:59:47 -07:00
parent 444b2d72c5
commit f40bf8e862
23 changed files with 192 additions and 157 deletions

View File

@@ -2723,7 +2723,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
m_program[_handle.idx].destroy();
}
void* createTexture(TextureHandle _handle, const Memory* _mem, uint32_t _flags, uint8_t _skip) override
void* createTexture(TextureHandle _handle, const Memory* _mem, uint64_t _flags, uint8_t _skip) override
{
m_textures[_handle.idx].create(_mem, _flags, _skip);
return NULL;
@@ -2865,11 +2865,11 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
m_frameBuffers[_handle.idx].create(_num, _attachment);
}
void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) override
void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) override
{
uint16_t denseIdx = m_numWindows++;
m_windows[denseIdx] = _handle;
m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _depthFormat);
m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _format, _depthFormat);
}
void destroyFrameBuffer(FrameBufferHandle _handle) override
@@ -4535,7 +4535,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
GL_CHECK(glDeleteBuffers(1, &m_id) );
}
bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, uint32_t _flags)
bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, uint64_t _flags)
{
m_target = _target;
m_numMips = _numMips;
@@ -4621,7 +4621,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
}
}
setSamplerState(_flags, NULL);
setSamplerState(uint32_t(_flags), NULL);
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
&& TextureFormat::BGRA8 == m_requestedFormat
@@ -4681,7 +4681,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
return true;
}
void TextureGL::create(const Memory* _mem, uint32_t _flags, uint8_t _skip)
void TextureGL::create(const Memory* _mem, uint64_t _flags, uint8_t _skip)
{
bimg::ImageContainer imageContainer;
@@ -5150,7 +5150,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
{
const uint32_t flags = 0 == (BGFX_SAMPLER_INTERNAL_DEFAULT & _flags)
? _flags
: m_flags
: uint32_t(m_flags)
;
const uint32_t index = (flags & BGFX_SAMPLER_BORDER_COLOR_MASK) >> BGFX_SAMPLER_BORDER_COLOR_SHIFT;
@@ -5988,9 +5988,9 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
}
}
void FrameBufferGL::create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat)
void FrameBufferGL::create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat)
{
BX_UNUSED(_depthFormat);
BX_UNUSED(_format, _depthFormat);
m_swapChain = s_renderGL->m_glctx.createSwapChain(_nwh);
m_width = _width;
m_height = _height;
@@ -6514,7 +6514,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
if (Access::Read == bind.m_un.m_compute.m_access)
{
TextureGL& texture = m_textures[bind.m_idx];
texture.commit(ii, texture.m_flags, _render->m_colorPalette);
texture.commit(ii, uint32_t(texture.m_flags), _render->m_colorPalette);
}
else
{