diff options
Diffstat (limited to 'Gem/develop/include')
-rw-r--r-- | Gem/develop/include/Gem/Gem/ContextData.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Gem/develop/include/Gem/Gem/ContextData.h b/Gem/develop/include/Gem/Gem/ContextData.h index 74804da..94f51b3 100644 --- a/Gem/develop/include/Gem/Gem/ContextData.h +++ b/Gem/develop/include/Gem/Gem/ContextData.h @@ -53,6 +53,7 @@ template<class ContextDataType = int> ////////// // Constructor + /* coverity[uninit_member] we track the un-initialization ourselves */ ContextData(void) : m_haveDefaultValue(false) {;} ContextData(ContextDataType v) : m_haveDefaultValue(true), m_defaultValue(v) {;} @@ -66,9 +67,9 @@ template<class ContextDataType = int> * * @usage ContextData<GLenum>m_fun; m_fun=GL_FUNC_ADD; * - * @pre We are in a draw process. + * @pre We have a valid context. * @note Should only be called from the draw function. - * Results are un-defined for other functions. + * Results are un-defined if there is no valid context */ virtual operator ContextDataType() { @@ -78,17 +79,19 @@ template<class ContextDataType = int> /** * assigns a value to the correct context * - * @pre We are in a draw process. + * @pre We have a valid context. * @note Should only be called from the draw function. - * Results are un-defined for other functions. + * Results are un-defined if there is no valid context */ virtual ContextDataType&operator = (ContextDataType value) { /* simplistic approach to handle out-of-context assignments: * assign the value to all context instances + * and use it as default value for future contexts */ if(INVALID_CONTEXT==getCurContext()) { doSetAll(value); + m_defaultValue=value; m_haveDefaultValue=true; } return (*getPtrToCur()=value); @@ -120,7 +123,7 @@ template<class ContextDataType = int> /** * Returns a pointer to the correct data element in the current context. * - * @pre We are in the draw function. + * @pre We have a valid context. * @post Synchronized. * @note ASSERT: Same context is rendered by same thread each time. */ |