Skip to content

Commit 4991ebb

Browse files
committed
Updated context state validation to be more complete
1 parent ff15d24 commit 4991ebb

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

source/lib/ffgl/FFGL.cpp

+22-2
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ FFUInt32 getDefaultParameterVisibility( unsigned int index )
576576

577577
extern "C" __declspec( dllexport ) FFMixed __stdcall plugMain( FFUInt32 functionCode, FFMixed inputValue, FFInstanceID instanceID )
578578

579-
#elif defined( FFGL_MACOS )
579+
#elif defined( FFGL_MACOS )
580580

581581
FFMixed plugMain( FFUInt32 functionCode, FFMixed inputValue, FFInstanceID instanceID )
582582

@@ -931,7 +931,7 @@ FFMixed plugMain( FFUInt32 functionCode, FFMixed inputValue, FFInstanceID instan
931931
*/
932932
void ValidateContextState()
933933
{
934-
#if defined( _DEBUG )
934+
#if defined( FFGL_DEBUG )
935935
GLint glInt[ 4 ];
936936
GLboolean glBool[ 4 ];
937937

@@ -967,16 +967,32 @@ void ValidateContextState()
967967
{
968968
for( GLint sampler = 0; sampler < numSamplers; ++sampler )
969969
{
970+
glActiveTexture( GL_TEXTURE0 + sampler );
970971
//Please use the ScopedTextureBinding to automatically unbind textures after you're done with them.
971972
glGetIntegerv( pair.binding, glInt );
972973
assert( glInt[ 0 ] == 0 );
973974
}
974975
}
976+
glActiveTexture( GL_TEXTURE0 );
975977

976978
//Please use the ScopedVBOBinding to automatically unbind your vertex buffers.
977979
glGetIntegerv( GL_ARRAY_BUFFER_BINDING, glInt );
978980
assert( glInt[ 0 ] == 0 );
979981

982+
//Uncommonly used bindings. You can use the ScopedBufferBinding base class for these.
983+
glGetIntegerv( GL_COPY_READ_BUFFER_BINDING, glInt );
984+
assert( glInt[ 0 ] == 0 );
985+
glGetIntegerv( GL_COPY_WRITE_BUFFER_BINDING, glInt );
986+
assert( glInt[ 0 ] == 0 );
987+
glGetIntegerv( GL_DRAW_INDIRECT_BUFFER_BINDING, glInt );
988+
assert( glInt[ 0 ] == 0 );
989+
glGetIntegerv( GL_PIXEL_PACK_BUFFER_BINDING, glInt );
990+
assert( glInt[ 0 ] == 0 );
991+
glGetIntegerv( GL_PIXEL_UNPACK_BUFFER_BINDING, glInt );
992+
assert( glInt[ 0 ] == 0 );
993+
glGetIntegerv( GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, glInt );
994+
assert( glInt[ 0 ] == 0 );
995+
980996
//Please use the ScopedIBOBinding to automatically unbind your index buffers.
981997
glGetIntegerv( GL_ELEMENT_ARRAY_BUFFER_BINDING, glInt );
982998
assert( glInt[ 0 ] == 0 );
@@ -985,6 +1001,10 @@ void ValidateContextState()
9851001
glGetIntegerv( GL_UNIFORM_BUFFER_BINDING, glInt );
9861002
assert( glInt[ 0 ] == 0 );
9871003

1004+
//Please use the ScopedVAOBinding to automatically unbind your uniform buffers.
1005+
glGetIntegerv( GL_VERTEX_ARRAY_BINDING, glInt );
1006+
assert( glInt[ 0 ] == 0 );
1007+
9881008
//We have no scoped bindings for the render state. You need to manually return these to the context default state.
9891009
glGetIntegerv( GL_POLYGON_MODE, glInt );
9901010
assert( glInt[ 0 ] == GL_FILL );

0 commit comments

Comments
 (0)