Difference between revisions of "Nomenclature/Direct State Access"

From OpenGL Wiki
Jump to navigation Jump to search
(Adding page about DSA nomenclature. It's a subpage so that it can be included in the nomenclature article as well as the DSA page.)
 
("Prefix" is the wrong term for these things, due to proper OpenGL nomenclature.)
Line 1: Line 1:
The {{pagelink|Nomenclature}} for {{pagelink|Direct State Access}} is a bit more consistent than the non-DSA naming. Just as with functions that modify objects through the context, DSA functions apply an object-specific prefix to the function name. Unlike the context functions, ''all'' DSA functions consistently use the object prefix (even if it makes the function name unwieldy).
+
The {{pagelink|Nomenclature}} for {{pagelink|Direct State Access}} is a bit more consistent than the non-DSA naming. As with non-DSA functions, they follow the standard Verb-Object-Command syntax. However, there were several non-DSA functions that affected some object's state without naming the Object type in its function. In the case of DSA, ''all'' DSA functions consistently use this nomenclature (even if it makes the function name unwieldy).
  
The unusual bit with DSA functions is that some of the prefixes will use {{code|Named}} as part of the prefix, while others do not. Fortunately, all functions within a particular object group will consistently use the same convention.
+
The difference is that DSA functions use a different Object name from the non-DSA functions. What is inconsistent is that some DSA functions will prefix the Object name with {{code|Named}}, while others do not. Fortunately, all functions within a particular object group will consistently use the same convention.
  
 
{|class="wikitable"
 
{|class="wikitable"
 
!OpenGL Object Type
 
!OpenGL Object Type
!Context Prefix
+
!Context Object Name
!DSA Prefix
+
!DSA Object Name
 
|-
 
|-
 
|[[Texture|Texture Object]]
 
|[[Texture|Texture Object]]
Line 37: Line 37:
 
|}
 
|}
  
:<sup>1</sup>: Transform feedback state consists only of the buffers bound to {{enum|GL_TRANSFORM_FEEDBACK_BUFFER}} with {{apifunc|glBindBufferRange}}, as well as a captured primitive count. As such, they never needed an object-based prefix. Direct state access gives transform feedback buffer attachment their own calls, so they need a prefix.</br>
+
:<sup>1</sup>: Transform feedback state consists only of the buffers bound to {{enum|GL_TRANSFORM_FEEDBACK_BUFFER}} with {{apifunc|glBindBufferRange}}, as well as a captured primitive count. As such, they did not need a formal object name. DSA creates functions specifically for setting their state, so they do need an object name.</br>
 
:<sup>2</sup>: These object types already used DSA-style functions.
 
:<sup>2</sup>: These object types already used DSA-style functions.
 
While these conventions are followed, there are functions where the object prefix does not come first in a function's name. All {{code|glGet}} functions put the object prefix after the "Get". This is also true for "Invalidate", "Map", "Unmap", "FlushMapped", "Enable", "Disable", "Clear", "Blit", "Copy", "Check", and "Compressed".
 

Revision as of 06:03, 11 May 2015

The Nomenclature for Direct State Access is a bit more consistent than the non-DSA naming. As with non-DSA functions, they follow the standard Verb-Object-Command syntax. However, there were several non-DSA functions that affected some object's state without naming the Object type in its function. In the case of DSA, all DSA functions consistently use this nomenclature (even if it makes the function name unwieldy).

The difference is that DSA functions use a different Object name from the non-DSA functions. What is inconsistent is that some DSA functions will prefix the Object name with Named, while others do not. Fortunately, all functions within a particular object group will consistently use the same convention.

OpenGL Object Type Context Object Name DSA Object Name
Texture Object "Tex" "Texture"
Framebuffer Object "Framebuffer" "NamedFramebuffer"
Buffer Object "Buffer" "NamedBuffer"
Transform Feedback Object N/A1 "TransformFeedback"
Vertex Array Object "VertexAttrib" "VertexArray"
Sampler Object N/A2 "Sampler"
Query Object N/A2 "Query"
1: Transform feedback state consists only of the buffers bound to GL_TRANSFORM_FEEDBACK_BUFFER with glBindBufferRange, as well as a captured primitive count. As such, they did not need a formal object name. DSA creates functions specifically for setting their state, so they do need an object name.
2: These object types already used DSA-style functions.