@@ -427,7 +427,7 @@ bool GLMGenTexels( GLMGenTexelParams *params )
427427 DebuggerBreak ();
428428 return FALSE ;
429429 }
430-
430+
431431 // verify that the amount you want to write will not exceed the limit byte count
432432 unsigned long destByteCount = chunksize * params->m_chunkCount ;
433433
@@ -3828,7 +3828,7 @@ void CGLMTex::Lock( GLMTexLockParams *params, char** addressOut, int* yStrideOut
38283828 // d - the params of the lock request have been saved in the lock table (in the context)
38293829
38303830 // so step 1 is unambiguous. If there's no backing storage, make some.
3831- if (!m_backing)
3831+ if (!m_backing && !(m_layout-> m_key . m_texFlags & kGLMTexDynamic ) )
38323832 {
38333833 if ( gl_pow2_tempmem.GetBool () )
38343834 {
@@ -3940,7 +3940,7 @@ void CGLMTex::Lock( GLMTexLockParams *params, char** addressOut, int* yStrideOut
39403940
39413941 desc->m_sliceRegionOffset = offsetInSlice + desc->m_sliceBaseOffset ;
39423942
3943- if ( copyout && ( ( m_layout->m_key .m_texFlags & kGLMTexDynamic ) || params->m_readonly ) )
3943+ if ( ( m_layout->m_key .m_texFlags & kGLMTexDynamic ) || ( params->m_readonly && copyout ) )
39443944 {
39453945 // read the whole slice
39463946 // (odds are we'll never request anything but a whole slice to be read..)
@@ -4080,7 +4080,7 @@ void CGLMTex::Unlock( GLMTexLockParams *params )
40804080 // because it reuploads the whole thing each slice; we only use 3D textures
40814081 // for the 32x32x32 colorpsace conversion lookups and debugging the problem
40824082 // would not save any more memory.
4083- if ( !m_texClientStorage && ( m_texGLTarget == GL_TEXTURE_2D ) )
4083+ if ( !m_texClientStorage && ( m_texGLTarget == GL_TEXTURE_2D ) && m_backing )
40844084 {
40854085 free (m_backing);
40864086 m_backing = NULL ;
0 commit comments