29 static const GLenum PrimTopologyToGLTopologyMap[] =
40 VERIFY_EXPR(PrimTopology < _countof(PrimTopologyToGLTopologyMap));
41 auto GLTopology = PrimTopologyToGLTopologyMap[PrimTopology];
50 default: UNEXPECTED(
"Unexpected primitive topology");
56 static const GLenum TypeToGLTypeMap[] =
71 VERIFY_EXPR(Value < _countof(TypeToGLTypeMap));
72 auto GLType = TypeToGLTypeMap[Value];
76 case VT_INT8: VERIFY_EXPR(GLType == GL_BYTE);
break;
77 case VT_INT16: VERIFY_EXPR(GLType == GL_SHORT);
break;
78 case VT_INT32: VERIFY_EXPR(GLType == GL_INT);
break;
79 case VT_UINT8: VERIFY_EXPR(GLType == GL_UNSIGNED_BYTE);
break;
80 case VT_UINT16: VERIFY_EXPR(GLType == GL_UNSIGNED_SHORT);
break;
81 case VT_UINT32: VERIFY_EXPR(GLType == GL_UNSIGNED_INT);
break;
82 case VT_FLOAT32: VERIFY_EXPR(GLType == GL_FLOAT);
break;
83 default: UNEXPECTED(
"Unexpected value type");
89 inline GLenum UsageToGLUsage(
USAGE Usage)
98 default: UNEXPECTED(
"Unknow usage" );
return 0;
102 inline void FilterTypeToGLFilterType(
FILTER_TYPE Filter, GLenum &GLFilter, Bool &bIsAnisotropic, Bool &bIsComparison)
107 UNEXPECTED(
"Unspecified filter type" );
108 bIsAnisotropic =
false;
109 bIsComparison =
false;
110 GLFilter = GL_NEAREST;
114 bIsAnisotropic =
false;
115 bIsComparison =
false;
116 GLFilter = GL_NEAREST;
120 bIsAnisotropic =
false;
121 bIsComparison =
false;
122 GLFilter = GL_LINEAR;
126 bIsAnisotropic =
true;
127 bIsComparison =
false;
128 GLFilter = GL_LINEAR;
132 bIsAnisotropic =
false;
133 bIsComparison =
true;
134 GLFilter = GL_NEAREST;
138 bIsAnisotropic =
false;
139 bIsComparison =
true;
140 GLFilter = GL_LINEAR;
144 bIsAnisotropic =
true;
145 bIsComparison =
true;
146 GLFilter = GL_LINEAR;
150 bIsAnisotropic =
false;
151 bIsComparison =
false;
152 UNEXPECTED(
"Unknown filter type" );
153 GLFilter = GL_NEAREST;
158 GLenum TexFormatToGLInternalTexFormat(
TEXTURE_FORMAT TexFormat, Uint32 BindFlags = 0);
160 GLenum CorrectGLTexFormat(GLenum GLTexFormat, Uint32 BindFlags);
177 default: UNEXPECTED(
"Unknown texture address mode" );
return GL_CLAMP_TO_EDGE;
194 default: UNEXPECTED(
"Unknown comparison func" );
return GL_ALWAYS;
198 struct NativePixelAttribs
203 explicit NativePixelAttribs(GLenum _PixelFormat = 0, GLenum _DataType = 0, Bool _IsCompressed = False) :
204 PixelFormat(_PixelFormat),
206 IsCompressed(_IsCompressed)
210 inline Uint32 GetNumPixelFormatComponents(GLenum Format)
215 case GL_RGBA_INTEGER:
228 case GL_DEPTH_COMPONENT:
229 case GL_DEPTH_STENCIL:
232 default: UNEXPECTED(
"Unknonw pixel format" );
return 0;
236 inline Uint32 GetPixelTypeSize(GLenum Type)
240 case GL_FLOAT:
return sizeof(GLfloat);
242 case GL_UNSIGNED_INT_10_10_10_2:
243 case GL_UNSIGNED_INT_2_10_10_10_REV:
244 case GL_UNSIGNED_INT_10F_11F_11F_REV:
245 case GL_UNSIGNED_INT_24_8:
246 case GL_UNSIGNED_INT_5_9_9_9_REV:
247 case GL_UNSIGNED_INT:
return sizeof(GLuint);
249 case GL_INT:
return sizeof(GLint);
250 case GL_HALF_FLOAT:
return sizeof(GLhalf);
252 case GL_UNSIGNED_SHORT_5_6_5:
253 case GL_UNSIGNED_SHORT_5_6_5_REV:
254 case GL_UNSIGNED_SHORT_5_5_5_1:
255 case GL_UNSIGNED_SHORT_1_5_5_5_REV:
256 case GL_UNSIGNED_SHORT:
return sizeof(GLushort);
258 case GL_SHORT:
return sizeof(GLshort);
259 case GL_UNSIGNED_BYTE:
return sizeof(GLubyte);
260 case GL_BYTE:
return sizeof(GLbyte);
262 case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
return sizeof(GLfloat) +
sizeof(GLuint);
264 default: UNEXPECTED(
"Unknonw pixel type" );
return 0;
268 NativePixelAttribs GetNativePixelTransferAttribs(
TEXTURE_FORMAT TexFormat);
269 GLenum AccessFlags2GLAccess( Uint32 UAVAccessFlags );
270 GLenum TypeToGLTexFormat(
VALUE_TYPE ValType, Uint32 NumComponents, Bool bIsNormalized );
271 GLenum StencilOp2GlStencilOp(
STENCIL_OP StencilOp );
Interpret the vertex data as a list of points. D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_POINTLIST. OpenGL counterpart: GL_POINTS.
Definition: DeviceContext.h:71
Comparison passes if the source data is less than or equal to the destination data. Direct3D counterpart: D3D11_COMPARISON_LESS_EQUAL/D3D12_COMPARISON_FUNC_LESS_EQUAL. OpenGL counterpart: GL_LEQUAL.
Definition: GraphicsTypes.h:866
BLEND_OPERATION
Blending operation.
Definition: BlendState.h:130
TEXTURE_FORMAT
Texture formats.
Definition: GraphicsTypes.h:244
Unsigned 8-bit integer.
Definition: GraphicsTypes.h:45
Signed 8-bit integer.
Definition: GraphicsTypes.h:42
Comparison always passes. Direct3D counterpart: D3D11_COMPARISON_ALWAYS/D3D12_COMPARISON_FUNC_ALWAY...
Definition: GraphicsTypes.h:882
PRIMITIVE_TOPOLOGY
Input primitive topology.
Definition: DeviceContext.h:56
STENCIL_OP
Stencil operation.
Definition: DepthStencilState.h:42
Comparison passes if the source data is equal to the destination data. Direct3D counterpart: D3D11_C...
Definition: GraphicsTypes.h:862
Texture coordinates outside the range [0.0, 1.0] are set to the texture color at 0.0 or 1.0, respectively. Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_CLAMP/D3D12_TEXTURE_ADDRESS_MODE_CLAMP. OpenGL counterpart: GL_CLAMP_TO_EDGE.
Definition: GraphicsTypes.h:821
Comparison never passes. Direct3D counterpart: D3D11_COMPARISON_NEVER/D3D12_COMPARISON_FUNC_NEVER. OpenGL counterpart: GL_NEVER.
Definition: GraphicsTypes.h:854
Comparison-anisotropic filtering.
Definition: GraphicsTypes.h:788
Unsigned 16-bit integer.
Definition: GraphicsTypes.h:46
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
Comparison-point filtering.
Definition: GraphicsTypes.h:786
Comparison passes if the source data is greater than the destination data. Direct3D counterpart: 3D1...
Definition: GraphicsTypes.h:870
TEXTURE_ADDRESS_MODE
Texture address mode.
Definition: GraphicsTypes.h:805
Undefined topology.
Definition: DeviceContext.h:59
Signed 32-bit integer.
Definition: GraphicsTypes.h:44
Comparison-linear filtering.
Definition: GraphicsTypes.h:787
Comparison passes if the source data is less than the destination data. Direct3D counterpart: D3D11_...
Definition: GraphicsTypes.h:858
Interpret the vertex data as a list of lines. D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_LINELIST. OpenGL counterpart: GL_LINES.
Definition: DeviceContext.h:75
Tile the texture at every integer junction. Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_WRAP/D3D12_...
Definition: GraphicsTypes.h:812
Unknown filter type.
Definition: GraphicsTypes.h:782
Comparison passes if the source data is not equal to the destination data. Direct3D counterpart: D3D...
Definition: GraphicsTypes.h:874
A resource that requires read and write access by the GPU and can also be occasionally written by the...
Definition: GraphicsTypes.h:95
Signed 16-bit integer.
Definition: GraphicsTypes.h:43
Comparison passes if the source data is greater than or equal to the destination data. Direct3D counterpart: D3D11_COMPARISON_GREATER_EQUAL/D3D12_COMPARISON_FUNC_GREATER_EQUAL. OpenGL counterpart: GL_GEQUAL.
Definition: GraphicsTypes.h:878
A resource that can only be read by the GPU. It cannot be written by the GPU, and cannot be accessed ...
Definition: GraphicsTypes.h:90
VALUE_TYPE
Value type.
Definition: GraphicsTypes.h:39
Texture coordinates outside the range [0.0, 1.0] are set to the border color specified specified in S...
Definition: GraphicsTypes.h:826
Unknown comparison function.
Definition: GraphicsTypes.h:850
A resource that facilitates transferring data from GPU to CPU. D3D11 Counterpart: D3D11_USAGE_STAGI...
Definition: GraphicsTypes.h:103
Point filtering.
Definition: GraphicsTypes.h:783
USAGE
Resource usage.
Definition: GraphicsTypes.h:84
Unknown mode.
Definition: GraphicsTypes.h:808
Full-precision 32-bit floating point.
Definition: GraphicsTypes.h:49
FILTER_TYPE
Filter type.
Definition: GraphicsTypes.h:780
Interpret the vertex data as a triangle strip. D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP...
Definition: DeviceContext.h:67
Unsigned 32-bit integer.
Definition: GraphicsTypes.h:47
BLEND_FACTOR
Blend factors.
Definition: BlendState.h:43
Interpret the vertex data as a list of triangles. D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_TRIANGLELI...
Definition: DeviceContext.h:63
COMPARISON_FUNCTION
Comparison function.
Definition: GraphicsTypes.h:847
Flip the texture at every integer junction. Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_MIRROR/D3D1...
Definition: GraphicsTypes.h:816
A resource that can be read by the GPU and written at least once per frame by the CPU...
Definition: GraphicsTypes.h:99
Anisotropic filtering.
Definition: GraphicsTypes.h:785
Linear filtering.
Definition: GraphicsTypes.h:784
Similar to TEXTURE_ADDRESS_MIRROR and TEXTURE_ADDRESS_CLAMP. Takes the absolute value of the texture ...
Definition: GraphicsTypes.h:833