Скачиваний:
47
Добавлен:
17.03.2015
Размер:
2.46 Mб
Скачать

2.15. VERTEX SHADERS

88

A shader should not fail to compile, and a program object should not fail to link due to lack of instruction space or lack of temporary variables. Implementations should ensure that all valid shaders and program objects may be successfully compiled, linked and executed.

Undefined Behavior

When using array or matrix variables in a shader, it is possible to access a variable with an index computed at run time that is outside the declared extent of the variable. Such out-of-bounds reads will return undefined values; out-of-bounds writes will have undefined results and could corrupt other variables used by shader or the GL. The level of protection provided against such errors in the shader is implementation-dependent.

2.15.5 Required State

The GL maintains state to indicate which shader and program object names are in use. Initially, no shader or program objects exist, and no names are in use.

The state required per shader object consists of:

An unsigned integer specifying the shader object name.

An integer holding the value of SHADER TYPE.

A boolean holding the delete status, initially FALSE.

A boolean holding the status of the last compile, initially FALSE.

An array of type char containing the information log, initially empty.

An integer holding the length of the information log.

An array of type char containing the concatenated shader string, initially empty.

An integer holding the length of the concatenated shader string.

The state required per program object consists of:

An unsigned integer indicating the program object object name.

A boolean holding the delete status, initially FALSE.

A boolean holding the status of the last link attempt, initially FALSE.

Version 2.0 - October 22, 2004

2.15. VERTEX SHADERS

89

A boolean holding the status of the last validation attempt, initally FALSE.

An integer holding the number of attached shader objects.

A list of unsigned integers to keep track of the names of the shader objects attached.

An array of type char containing the information log, initially empty.

An integer holding the length of the information log.

An integer holding the number of active uniforms.

For each active uniform, three integers, holding its location, size, and type, and an array of type char holding its name.

An array of words that hold the values of each active uniform.

An integer holding the number of active attributes.

For each active attbribute, three integers holding its location, size, and type, and an array of type char holding its name.

Additional state required to support vertex shaders consists of:

A bit indicating whether or not vertex program two-sided color mode is enabled, initially disabled.

A bit indicating whether or not vertex program point size mode (section 3.3.1) is enabled, initially disabled.

Additionally, one unsigned integer is required to hold the name of the current program object, if any.

Version 2.0 - October 22, 2004

Соседние файлы в папке OpenGL