1 // 2 // Copyright 2013 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // formatutils11.h: Queries for GL image formats and their translations to D3D11 8 // formats. 9 10 #ifndef LIBANGLE_RENDERER_D3D_D3D11_FORMATUTILS11_H_ 11 #define LIBANGLE_RENDERER_D3D_D3D11_FORMATUTILS11_H_ 12 13 #include <map> 14 15 #include "common/platform.h" 16 #include "libANGLE/angletypes.h" 17 #include "libANGLE/formatutils.h" 18 #include "libANGLE/renderer/copyvertex.h" 19 #include "libANGLE/renderer/d3d/formatutilsD3D.h" 20 #include "libANGLE/renderer/dxgi_format_map.h" 21 #include "libANGLE/renderer/renderer_utils.h" 22 23 namespace rx 24 { 25 struct Renderer11DeviceCaps; 26 27 namespace d3d11 28 { 29 30 // A texture might be stored as DXGI_FORMAT_R16_TYPELESS but store integer components, 31 // which are accessed through an DXGI_FORMAT_R16_SINT view. It's easy to write code which queries 32 // information about the wrong format. Therefore, use of this should be avoided where possible. 33 34 bool SupportsMipGen(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel); 35 36 struct DXGIFormatSize 37 { 38 DXGIFormatSize(GLuint pixelBits, GLuint blockWidth, GLuint blockHeight); 39 40 GLuint pixelBytes; 41 GLuint blockWidth; 42 GLuint blockHeight; 43 }; 44 const DXGIFormatSize &GetDXGIFormatSizeInfo(DXGI_FORMAT format); 45 46 struct VertexFormat : private angle::NonCopyable 47 { 48 constexpr VertexFormat(); 49 constexpr VertexFormat(VertexConversionType conversionType, 50 DXGI_FORMAT nativeFormat, 51 VertexCopyFunction copyFunction); 52 53 VertexConversionType conversionType; 54 DXGI_FORMAT nativeFormat; 55 VertexCopyFunction copyFunction; 56 }; 57 58 const VertexFormat &GetVertexFormatInfo(angle::FormatID vertexFormatID, 59 D3D_FEATURE_LEVEL featureLevel); 60 } // namespace d3d11 61 62 } // namespace rx 63 64 #endif // LIBANGLE_RENDERER_D3D_D3D11_FORMATUTILS11_H_ 65