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 // formatutils11.h: Queries for GL image formats and their translations to D3D11 8 // formats. 9 10 #ifndef LIBGLESV2_RENDERER_FORMATUTILS11_H_ 11 #define LIBGLESV2_RENDERER_FORMATUTILS11_H_ 12 13 #include "libGLESv2/formatutils.h" 14 15 namespace rx 16 { 17 18 class Renderer; 19 20 namespace d3d11 21 { 22 23 typedef std::set<DXGI_FORMAT> DXGIFormatSet; 24 25 MipGenerationFunction GetMipGenerationFunction(DXGI_FORMAT format); 26 LoadImageFunction GetImageLoadFunction(GLenum internalFormat, GLenum type, GLuint clientVersion); 27 28 GLuint GetFormatPixelBytes(DXGI_FORMAT format); 29 GLuint GetBlockWidth(DXGI_FORMAT format); 30 GLuint GetBlockHeight(DXGI_FORMAT format); 31 GLenum GetComponentType(DXGI_FORMAT format); 32 33 GLuint GetDepthBits(DXGI_FORMAT format); 34 GLuint GetDepthOffset(DXGI_FORMAT format); 35 GLuint GetStencilBits(DXGI_FORMAT format); 36 GLuint GetStencilOffset(DXGI_FORMAT format); 37 38 void MakeValidSize(bool isImage, DXGI_FORMAT format, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset); 39 40 const DXGIFormatSet &GetAllUsedDXGIFormats(); 41 42 ColorReadFunction GetColorReadFunction(DXGI_FORMAT format); 43 ColorCopyFunction GetFastCopyFunction(DXGI_FORMAT sourceFormat, GLenum destFormat, GLenum destType); 44 45 } 46 47 namespace gl_d3d11 48 { 49 50 DXGI_FORMAT GetTexFormat(GLenum internalFormat, GLuint clientVersion); 51 DXGI_FORMAT GetSRVFormat(GLenum internalFormat, GLuint clientVersion); 52 DXGI_FORMAT GetRTVFormat(GLenum internalFormat, GLuint clientVersion); 53 DXGI_FORMAT GetDSVFormat(GLenum internalFormat, GLuint clientVersion); 54 DXGI_FORMAT GetRenderableFormat(GLenum internalFormat, GLuint clientVersion); 55 56 DXGI_FORMAT GetSwizzleTexFormat(GLint internalFormat, const Renderer *renderer); 57 DXGI_FORMAT GetSwizzleSRVFormat(GLint internalFormat, const Renderer *renderer); 58 DXGI_FORMAT GetSwizzleRTVFormat(GLint internalFormat, const Renderer *renderer); 59 60 bool RequiresTextureDataInitialization(GLint internalFormat); 61 InitializeTextureDataFunction GetTextureDataInitializationFunction(GLint internalFormat); 62 63 VertexCopyFunction GetVertexCopyFunction(const gl::VertexFormat &vertexFormat); 64 size_t GetVertexElementSize(const gl::VertexFormat &vertexFormat); 65 VertexConversionType GetVertexConversionType(const gl::VertexFormat &vertexFormat); 66 DXGI_FORMAT GetNativeVertexFormat(const gl::VertexFormat &vertexFormat); 67 68 } 69 70 namespace d3d11_gl 71 { 72 73 GLenum GetInternalFormat(DXGI_FORMAT format, GLuint clientVersion); 74 75 } 76 77 } 78 79 #endif // LIBGLESV2_RENDERER_FORMATUTILS11_H_ 80