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 LIBGLESV2_RENDERER_FORMATUTILS9_H_
11#define LIBGLESV2_RENDERER_FORMATUTILS9_H_
12
13#include "libGLESv2/formatutils.h"
14
15#include <map>
16
17namespace rx
18{
19
20class Renderer9;
21
22namespace d3d9
23{
24
25typedef std::map<std::pair<GLenum, GLenum>, ColorCopyFunction> FastCopyFunctionMap;
26
27struct D3DFormat
28{
29    D3DFormat();
30
31    GLuint pixelBytes;
32    GLuint blockWidth;
33    GLuint blockHeight;
34
35    GLenum internalFormat;
36
37    MipGenerationFunction mipGenerationFunction;
38    ColorReadFunction colorReadFunction;
39
40    FastCopyFunctionMap fastCopyFunctions;
41    ColorCopyFunction getFastCopyFunction(GLenum format, GLenum type) const;
42};
43const D3DFormat &GetD3DFormatInfo(D3DFORMAT format);
44
45struct VertexFormat
46{
47    VertexFormat();
48
49    VertexConversionType conversionType;
50    size_t outputElementSize;
51    VertexCopyFunction copyFunction;
52    D3DDECLTYPE nativeFormat;
53    GLenum componentType;
54};
55const VertexFormat &GetVertexFormatInfo(DWORD supportedDeclTypes, const gl::VertexFormat &vertexFormat);
56
57struct TextureFormat
58{
59    TextureFormat();
60
61    D3DFORMAT texFormat;
62    D3DFORMAT renderFormat;
63
64    InitializeTextureDataFunction dataInitializerFunction;
65
66    LoadImageFunction loadFunction;
67};
68const TextureFormat &GetTextureFormatInfo(GLenum internalFormat);
69
70}
71
72}
73
74#endif // LIBGLESV2_RENDERER_FORMATUTILS9_H_
75