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/renderer_utils.h" 21 22 namespace rx 23 { 24 struct Renderer11DeviceCaps; 25 26 namespace d3d11 27 { 28 29 // A texture might be stored as DXGI_FORMAT_R16_TYPELESS but store integer components, 30 // which are accessed through an DXGI_FORMAT_R16_SINT view. It's easy to write code which queries 31 // information about the wrong format. Therefore, use of this should be avoided where possible. 32 33 bool SupportsMipGen(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel); 34 35 struct DXGIFormatSize 36 { 37 DXGIFormatSize(GLuint pixelBits, GLuint blockWidth, GLuint blockHeight); 38 39 GLuint pixelBytes; 40 GLuint blockWidth; 41 GLuint blockHeight; 42 }; 43 const DXGIFormatSize &GetDXGIFormatSizeInfo(DXGI_FORMAT format); 44 45 struct VertexFormat : private angle::NonCopyable 46 { 47 constexpr VertexFormat(); 48 constexpr VertexFormat(VertexConversionType conversionType, 49 DXGI_FORMAT nativeFormat, 50 VertexCopyFunction copyFunction); 51 52 VertexConversionType conversionType; 53 DXGI_FORMAT nativeFormat; 54 VertexCopyFunction copyFunction; 55 }; 56 57 const VertexFormat &GetVertexFormatInfo(angle::FormatID vertexFormatID, 58 D3D_FEATURE_LEVEL featureLevel); 59 60 // Auto-generated in dxgi_format_map_autogen.cpp. 61 GLenum GetComponentType(DXGI_FORMAT dxgiFormat); 62 63 } // namespace d3d11 64 65 namespace d3d11_angle 66 { 67 const angle::Format &GetFormat(DXGI_FORMAT dxgiFormat); 68 } 69 70 } // namespace rx 71 72 #endif // LIBANGLE_RENDERER_D3D_D3D11_FORMATUTILS11_H_ 73