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