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 // formatutils9.h: Queries for GL image formats and their translations to D3D9 8 // formats. 9 10 #ifndef LIBANGLE_RENDERER_D3D_D3D9_FORMATUTILS9_H_ 11 #define LIBANGLE_RENDERER_D3D_D3D9_FORMATUTILS9_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/Format.h" 19 #include "libANGLE/renderer/copyvertex.h" 20 #include "libANGLE/renderer/d3d/formatutilsD3D.h" 21 #include "libANGLE/renderer/renderer_utils.h" 22 23 namespace rx 24 { 25 26 class Renderer9; 27 28 namespace d3d9 29 { 30 31 struct D3DFormat 32 { 33 D3DFormat(); 34 D3DFormat(GLuint pixelBytes, 35 GLuint blockWidth, 36 GLuint blockHeight, 37 GLuint redBits, 38 GLuint greenBits, 39 GLuint blueBits, 40 GLuint alphaBits, 41 GLuint luminanceBits, 42 GLuint depthBits, 43 GLuint stencilBits, 44 angle::FormatID formatID); 45 infoD3DFormat46 const angle::Format &info() const { return angle::Format::Get(formatID); } 47 48 GLuint pixelBytes; 49 GLuint blockWidth; 50 GLuint blockHeight; 51 52 GLuint redBits; 53 GLuint greenBits; 54 GLuint blueBits; 55 GLuint alphaBits; 56 GLuint luminanceBits; 57 58 GLuint depthBits; 59 GLuint stencilBits; 60 61 angle::FormatID formatID; 62 }; 63 64 const D3DFormat &GetD3DFormatInfo(D3DFORMAT format); 65 66 struct VertexFormat 67 { 68 VertexFormat(); 69 70 VertexConversionType conversionType; 71 size_t outputElementSize; 72 VertexCopyFunction copyFunction; 73 D3DDECLTYPE nativeFormat; 74 GLenum componentType; 75 }; 76 const VertexFormat &GetVertexFormatInfo(DWORD supportedDeclTypes, angle::FormatID vertexFormatID); 77 78 struct TextureFormat 79 { 80 TextureFormat(); 81 82 D3DFORMAT texFormat; 83 D3DFORMAT renderFormat; 84 85 InitializeTextureDataFunction dataInitializerFunction; 86 87 LoadImageFunction loadFunction; 88 }; 89 const TextureFormat &GetTextureFormatInfo(GLenum internalFormat); 90 } // namespace d3d9 91 } // namespace rx 92 93 #endif // LIBANGLE_RENDERER_D3D_D3D9_FORMATUTILS9_H_ 94