1 // 2 // Copyright (c) 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 LIBGLESV2_RENDERER_FORMATUTILS9_H_ 11 #define LIBGLESV2_RENDERER_FORMATUTILS9_H_ 12 13 #include "libGLESv2/formatutils.h" 14 15 namespace rx 16 { 17 18 class Renderer9; 19 20 namespace d3d9 21 { 22 23 typedef std::set<D3DFORMAT> D3DFormatSet; 24 25 MipGenerationFunction GetMipGenerationFunction(D3DFORMAT format); 26 LoadImageFunction GetImageLoadFunction(GLenum internalFormat, const Renderer9 *renderer); 27 28 GLuint GetFormatPixelBytes(D3DFORMAT format); 29 GLuint GetBlockWidth(D3DFORMAT format); 30 GLuint GetBlockHeight(D3DFORMAT format); 31 GLuint GetBlockSize(D3DFORMAT format, GLuint width, GLuint height); 32 33 void MakeValidSize(bool isImage, D3DFORMAT format, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset); 34 35 const D3DFormatSet &GetAllUsedD3DFormats(); 36 37 ColorReadFunction GetColorReadFunction(D3DFORMAT format); 38 ColorCopyFunction GetFastCopyFunction(D3DFORMAT sourceFormat, GLenum destFormat, GLenum destType, GLuint clientVersion); 39 40 VertexCopyFunction GetVertexCopyFunction(const gl::VertexFormat &vertexFormat); 41 size_t GetVertexElementSize(const gl::VertexFormat &vertexFormat); 42 VertexConversionType GetVertexConversionType(const gl::VertexFormat &vertexFormat); 43 D3DDECLTYPE GetNativeVertexFormat(const gl::VertexFormat &vertexFormat); 44 45 GLenum GetDeclTypeComponentType(D3DDECLTYPE declType); 46 int GetDeclTypeComponentCount(D3DDECLTYPE declType); 47 bool IsDeclTypeNormalized(D3DDECLTYPE declType); 48 49 void InitializeVertexTranslations(const rx::Renderer9 *renderer); 50 51 } 52 53 namespace gl_d3d9 54 { 55 56 D3DFORMAT GetTextureFormat(GLenum internalFormat, const Renderer9 *renderer); 57 D3DFORMAT GetRenderFormat(GLenum internalFormat, const Renderer9 *renderer); 58 59 D3DMULTISAMPLE_TYPE GetMultisampleType(GLsizei samples); 60 61 bool RequiresTextureDataInitialization(GLint internalFormat); 62 InitializeTextureDataFunction GetTextureDataInitializationFunction(GLint internalFormat); 63 64 } 65 66 namespace d3d9_gl 67 { 68 69 GLenum GetInternalFormat(D3DFORMAT format); 70 GLsizei GetSamplesCount(D3DMULTISAMPLE_TYPE type); 71 bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format, GLuint clientVersion); 72 73 } 74 75 } 76 77 #endif // LIBGLESV2_RENDERER_FORMATUTILS9_H_ 78