CC3ShaderSourceCodeLineNumberLocalizingVisitor Class Reference
Inherits from | CC3ShaderSourceCodeVisitor : NSObject |
Declared in | CC3Shaders.h |
Overview
Visits an assembly of nested CC3ShaderSourceCode instances to determine in which source code group a particular global line number exists.
The GLSL compiler treats the GLSL source code as a monolithic block, and errors are attributed to source code lines as if all of the submitted source code came from a single string or file.
When a GLSL compiler error is reported, this visitor can be used to map the global line number, reported by the compiler, to a local line number within a particular source code segment, taking into consideration any import nesting that has occurred during soruce code loading.
To keep track of line numbers within nested import/includes, this instance maintains a stack of line number offsets as it traverses the source code tree.
Properties
lineNumber
The line number of the source code line that originated the error.
@property (nonatomic, assign) GLuint lineNumber
Discussion
During instantiation, this line number is initialized to the global line number reported by the compiler. After the source code tree has been visited by this visitor, this property will contain the local line number, within the source code segment indicated by the localizedSourceCode property, at which the reported error occurred.
Declared In
CC3Shaders.h
lineNumberOffset
The line number offset of the beginning of the source code that originated the error.
@property (nonatomic, readonly) GLuint lineNumberOffset
Discussion
While traversing the source code stucture, this property is set to zero at the start of each shader source group. As each subsection of source bytes is traversed, this value is incremented by the line count.
When the subsection that contains the error is found, this offset value is added to the lineNumber to determine the actual line number in the original file.
Declared In
CC3Shaders.h
localizedSourceCode
The source code group that contains the line of code reported as bad by the compiler.
@property (nonatomic, retain) CC3ShaderSourceCode *localizedSourceCode
Discussion
The value of this property will be nil until the visitation run has finished, after which it will contain the source code group that contains the error.
Declared In
CC3Shaders.h
Instance Methods
addLineNumberOffset:
Adds the specified offset to the current line number offset at the top of the line number offsets stack.
- (void)addLineNumberOffset:(GLuint)offset
Discussion
This method is invoked for each section of source code that is traversed prior to the source code section that contains the error.
Declared In
CC3Shaders.h
initWithLineNumber:
Initializes this instance with the specified global line number, which is the line number reported by the compiler when a compilation error occurs.
- (id)initWithLineNumber:(GLuint)lineNumber
Declared In
CC3Shaders.h