MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / validate

Method validate

OgreMain/src/OgreRootLayout.cpp:79–356  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

77 }
78 //-------------------------------------------------------------------------
79 void RootLayout::validate( const String &filename ) const
80 {
81 bool bakedSetsSeenTexTypes = false;
82 bool bakedSetsSeenSamplerTypes = false;
83 bool bakedSetsSeenUavTypes = false;
84
85 for( size_t i = 0u; i < OGRE_MAX_NUM_BOUND_DESCRIPTOR_SETS; ++i )
86 {
87 for( size_t j = 0u; j < DescBindingTypes::NumDescBindingTypes; ++j )
88 {
89 // Check start <= end
90 if( !mDescBindingRanges[i][j].isValid() )
91 {
92 char tmpBuffer[512];
93 LwString tmpStr( LwString::FromEmptyPointer( tmpBuffer, sizeof( tmpBuffer ) ) );
94
95 tmpStr.a( "Invalid descriptor start <= end must be true. Set ", (uint32)i,
96 " specifies ", c_rootLayoutVarNames[j], " in range [",
97 mDescBindingRanges[i][j].start );
98 tmpStr.a( ", ", mDescBindingRanges[i][j].end, ")" );
99
100 OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS,
101 "Error at file " + filename + ":\n" + tmpStr.c_str(),
102 "RootLayout::validate" );
103 }
104 }
105
106 if( !mBaked[i] )
107 {
108 if( mDescBindingRanges[i][DescBindingTypes::UavBuffer].isInUse() ||
109 mDescBindingRanges[i][DescBindingTypes::UavTexture].isInUse() )
110 {
111 OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS,
112 "Error at file " + filename +
113 ":\n"
114 "UAVs can only be used in baked sets",
115 "RootLayout::validate" );
116 }
117 }
118
119 // Ensure texture and texture buffer ranges don't overlap for compatibility with
120 // other APIs (we support it in Vulkan, but explicitly forbid it)
121 {
122 const DescBindingRange &bufferRange = mDescBindingRanges[i][DescBindingTypes::TexBuffer];
123 if( bufferRange.isInUse() )
124 {
125 for( size_t j = i; j < OGRE_MAX_NUM_BOUND_DESCRIPTOR_SETS; ++j )
126 {
127 const DescBindingRange &texRange =
128 mDescBindingRanges[j][DescBindingTypes::Texture];
129
130 if( texRange.isInUse() )
131 {
132 if( !( bufferRange.end <= texRange.start ||
133 bufferRange.start >= texRange.end ) )
134 {
135 OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS,
136 "Error at file " + filename +

Callers 2

setRootLayoutMethod · 0.80
gatherArrayedDescsMethod · 0.80

Calls 5

isValidMethod · 0.80
isInUseMethod · 0.80
c_strMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected