|
|
@@ -2950,7 +2950,7 @@ namespace bgfx
|
|
|
, _handle.idx
|
|
|
, _width
|
|
|
, _height
|
|
|
- , getName(TextureFormat::Enum(textureRef.m_format) )
|
|
|
+ , bgfx::getName(TextureFormat::Enum(textureRef.m_format) )
|
|
|
);
|
|
|
|
|
|
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::ResizeTexture);
|
|
|
@@ -3359,6 +3359,15 @@ namespace bgfx
|
|
|
BGFX_CHECK_HANDLE("setUniform", m_uniformHandle, _handle);
|
|
|
UniformRef& uniform = m_uniformRef[_handle.idx];
|
|
|
BX_CHECK(uniform.m_num >= _num, "Truncated uniform update. %d (max: %d)", _num, uniform.m_num);
|
|
|
+ if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) )
|
|
|
+ {
|
|
|
+ BX_CHECK(m_uniformSet.end() == m_uniformSet.find(_handle.idx)
|
|
|
+ , "Uniform %d (%s) was already set for this draw call."
|
|
|
+ , _handle.idx
|
|
|
+ , getName(_handle)
|
|
|
+ );
|
|
|
+ m_uniformSet.insert(_handle.idx);
|
|
|
+ }
|
|
|
m_submit->writeUniform(uniform.m_type, _handle, _value, bx::uint16_min(uniform.m_num, _num) );
|
|
|
}
|
|
|
|
|
|
@@ -3446,6 +3455,10 @@ namespace bgfx
|
|
|
BGFX_API_FUNC(uint32_t submit(uint8_t _id, ProgramHandle _handle, int32_t _depth) )
|
|
|
{
|
|
|
BGFX_CHECK_HANDLE_INVALID_OK("submit", m_programHandle, _handle);
|
|
|
+ if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) )
|
|
|
+ {
|
|
|
+ m_uniformSet.clear();
|
|
|
+ }
|
|
|
return m_submit->submit(_id, _handle, _depth);
|
|
|
}
|
|
|
|
|
|
@@ -3453,6 +3466,10 @@ namespace bgfx
|
|
|
{
|
|
|
BGFX_CHECK_HANDLE_INVALID_OK("submit", m_programHandle, _handle);
|
|
|
BGFX_CHECK_HANDLE("submit", m_vertexBufferHandle, _indirectHandle);
|
|
|
+ if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) )
|
|
|
+ {
|
|
|
+ m_uniformSet.clear();
|
|
|
+ }
|
|
|
return m_submit->submit(_id, _handle, _indirectHandle, _start, _num, _depth);
|
|
|
}
|
|
|
|
|
|
@@ -3515,16 +3532,28 @@ namespace bgfx
|
|
|
|
|
|
BGFX_API_FUNC(uint32_t dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags) )
|
|
|
{
|
|
|
+ if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) )
|
|
|
+ {
|
|
|
+ m_uniformSet.clear();
|
|
|
+ }
|
|
|
return m_submit->dispatch(_id, _handle, _numX, _numY, _numZ, _flags);
|
|
|
}
|
|
|
|
|
|
BGFX_API_FUNC(uint32_t dispatch(uint8_t _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) )
|
|
|
{
|
|
|
+ if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) )
|
|
|
+ {
|
|
|
+ m_uniformSet.clear();
|
|
|
+ }
|
|
|
return m_submit->dispatch(_id, _handle, _indirectHandle, _start, _num, _flags);
|
|
|
}
|
|
|
|
|
|
BGFX_API_FUNC(void discard() )
|
|
|
{
|
|
|
+ if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) )
|
|
|
+ {
|
|
|
+ m_uniformSet.clear();
|
|
|
+ }
|
|
|
m_submit->discard();
|
|
|
}
|
|
|
|
|
|
@@ -3535,6 +3564,7 @@ namespace bgfx
|
|
|
void freeAllHandles(Frame* _frame);
|
|
|
void frameNoRenderWait();
|
|
|
void swap();
|
|
|
+ const char* getName(UniformHandle _handle) const;
|
|
|
|
|
|
// render thread
|
|
|
bool renderFrame();
|
|
|
@@ -3676,6 +3706,8 @@ namespace bgfx
|
|
|
|
|
|
typedef stl::unordered_map<stl::string, UniformHandle> UniformHashMap;
|
|
|
UniformHashMap m_uniformHashMap;
|
|
|
+ typedef stl::unordered_set<uint16_t> UniformSet;
|
|
|
+ UniformSet m_uniformSet;
|
|
|
UniformRef m_uniformRef[BGFX_CONFIG_MAX_UNIFORMS];
|
|
|
|
|
|
ShaderRef m_shaderRef[BGFX_CONFIG_MAX_SHADERS];
|