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// 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#include <map>
16
17namespace rx
18{
19
20namespace d3d11
21{
22
23typedef std::map<std::pair<GLenum, GLenum>, ColorCopyFunction> FastCopyFunctionMap;
24
25struct DXGIFormat
26{
27    DXGIFormat();
28
29    GLuint pixelBytes;
30    GLuint blockWidth;
31    GLuint blockHeight;
32
33    GLuint depthBits;
34    GLuint depthOffset;
35    GLuint stencilBits;
36    GLuint stencilOffset;
37
38    GLenum internalFormat;
39    GLenum componentType;
40
41    MipGenerationFunction mipGenerationFunction;
42    ColorReadFunction colorReadFunction;
43
44    FastCopyFunctionMap fastCopyFunctions;
45    ColorCopyFunction getFastCopyFunction(GLenum format, GLenum type) const;
46};
47const DXGIFormat &GetDXGIFormatInfo(DXGI_FORMAT format);
48
49struct TextureFormat
50{
51    TextureFormat();
52
53    DXGI_FORMAT texFormat;
54    DXGI_FORMAT srvFormat;
55    DXGI_FORMAT rtvFormat;
56    DXGI_FORMAT dsvFormat;
57    DXGI_FORMAT renderFormat;
58
59    DXGI_FORMAT swizzleTexFormat;
60    DXGI_FORMAT swizzleSRVFormat;
61    DXGI_FORMAT swizzleRTVFormat;
62
63    InitializeTextureDataFunction dataInitializerFunction;
64
65    typedef std::map<GLenum, LoadImageFunction> LoadFunctionMap;
66    LoadFunctionMap loadFunctions;
67};
68const TextureFormat &GetTextureFormatInfo(GLenum internalFormat);
69
70struct VertexFormat
71{
72    VertexFormat();
73
74    VertexConversionType conversionType;
75    DXGI_FORMAT nativeFormat;
76    VertexCopyFunction copyFunction;
77};
78const VertexFormat &GetVertexFormatInfo(const gl::VertexFormat &vertexFormat);
79
80}
81
82}
83
84#endif // LIBGLESV2_RENDERER_FORMATUTILS11_H_
85