mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Fixed constant buffer allocation logic.
This commit is contained in:
parent
14a71bd477
commit
51d8daf762
3 changed files with 28 additions and 9 deletions
|
@ -2218,8 +2218,6 @@ RENDERDOC_IMPORT
|
|||
|
||||
if (0 < count)
|
||||
{
|
||||
m_constantBuffer = ConstantBuffer::create(1024);
|
||||
|
||||
for (uint32_t ii = 0; ii < count; ++ii)
|
||||
{
|
||||
uint8_t nameSize;
|
||||
|
@ -2258,6 +2256,11 @@ RENDERDOC_IMPORT
|
|||
|
||||
if (NULL != info)
|
||||
{
|
||||
if (NULL == m_constantBuffer)
|
||||
{
|
||||
m_constantBuffer = ConstantBuffer::create(1024);
|
||||
}
|
||||
|
||||
kind = "user";
|
||||
m_constantBuffer->writeUniformHandle( (UniformType::Enum)(type|fragmentBit), regIndex, info->m_handle, regCount);
|
||||
}
|
||||
|
@ -2274,7 +2277,10 @@ RENDERDOC_IMPORT
|
|||
BX_UNUSED(kind);
|
||||
}
|
||||
|
||||
m_constantBuffer->finish();
|
||||
if (NULL != m_constantBuffer)
|
||||
{
|
||||
m_constantBuffer->finish();
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t shaderSize;
|
||||
|
|
|
@ -1916,8 +1916,6 @@ namespace bgfx
|
|||
|
||||
if (0 < count)
|
||||
{
|
||||
m_constantBuffer = ConstantBuffer::create(1024);
|
||||
|
||||
for (uint32_t ii = 0; ii < count; ++ii)
|
||||
{
|
||||
uint8_t nameSize;
|
||||
|
@ -1956,6 +1954,11 @@ namespace bgfx
|
|||
BX_CHECK(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name);
|
||||
if (NULL != info)
|
||||
{
|
||||
if (NULL == m_constantBuffer)
|
||||
{
|
||||
m_constantBuffer = ConstantBuffer::create(1024);
|
||||
}
|
||||
|
||||
kind = "user";
|
||||
m_constantBuffer->writeUniformHandle( (UniformType::Enum)(type|fragmentBit), regIndex, info->m_handle, regCount);
|
||||
}
|
||||
|
@ -1972,7 +1975,10 @@ namespace bgfx
|
|||
BX_UNUSED(kind);
|
||||
}
|
||||
|
||||
m_constantBuffer->finish();
|
||||
if (NULL != m_constantBuffer)
|
||||
{
|
||||
m_constantBuffer->finish();
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t shaderSize;
|
||||
|
|
|
@ -2555,7 +2555,6 @@ namespace bgfx
|
|||
}
|
||||
|
||||
m_numPredefined = 0;
|
||||
m_constantBuffer = ConstantBuffer::create(1024);
|
||||
m_numSamplers = 0;
|
||||
|
||||
struct VariableInfo
|
||||
|
@ -2653,6 +2652,11 @@ namespace bgfx
|
|||
const UniformInfo* info = s_renderGL->m_uniformReg.find(name);
|
||||
if (NULL != info)
|
||||
{
|
||||
if (NULL == m_constantBuffer)
|
||||
{
|
||||
m_constantBuffer = ConstantBuffer::create(1024);
|
||||
}
|
||||
|
||||
UniformType::Enum type = convertGlType(gltype);
|
||||
m_constantBuffer->writeUniformHandle(type, 0, info->m_handle, num);
|
||||
m_constantBuffer->write(loc);
|
||||
|
@ -2671,6 +2675,11 @@ namespace bgfx
|
|||
BX_UNUSED(offset);
|
||||
}
|
||||
|
||||
if (NULL != m_constantBuffer)
|
||||
{
|
||||
m_constantBuffer->finish();
|
||||
}
|
||||
|
||||
if (s_extension[Extension::ARB_program_interface_query].m_supported
|
||||
|| BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31) )
|
||||
{
|
||||
|
@ -2710,8 +2719,6 @@ namespace bgfx
|
|||
}
|
||||
}
|
||||
|
||||
m_constantBuffer->finish();
|
||||
|
||||
memset(m_attributes, 0xff, sizeof(m_attributes) );
|
||||
uint32_t used = 0;
|
||||
for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
|
||||
|
|
Loading…
Reference in a new issue