blob: ea11aaa74c44aa4804ccec6b6ed6b7d5a6d09e45 [file] [log] [blame]
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +00001//
Geoff Langcec35902014-04-16 10:52:36 -04002// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +00003// 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
Geoff Lang0b7eef72014-06-12 14:10:47 -040015#include <map>
16
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000017namespace rx
18{
19
20namespace d3d11
21{
22
Geoff Lang9aa00bb2014-07-07 12:33:25 -040023typedef std::map<std::pair<GLenum, GLenum>, ColorCopyFunction> FastCopyFunctionMap;
Geoff Lang61e49a52013-05-29 10:22:58 -040024
Geoff Lang9aa00bb2014-07-07 12:33:25 -040025struct DXGIFormat
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000026{
Geoff Lang9aa00bb2014-07-07 12:33:25 -040027 DXGIFormat();
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000028
Geoff Lang9aa00bb2014-07-07 12:33:25 -040029 GLuint pixelBytes;
30 GLuint blockWidth;
31 GLuint blockHeight;
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000032
Geoff Lang9aa00bb2014-07-07 12:33:25 -040033 GLuint depthBits;
34 GLuint depthOffset;
35 GLuint stencilBits;
36 GLuint stencilOffset;
Geoff Lang00f6bc32013-09-20 14:59:06 -040037
Geoff Lang9aa00bb2014-07-07 12:33:25 -040038 GLenum internalFormat;
39 GLenum componentType;
Geoff Lang0c99b1b2013-09-30 15:07:43 -040040
Geoff Lang9aa00bb2014-07-07 12:33:25 -040041 MipGenerationFunction mipGenerationFunction;
42 ColorReadFunction colorReadFunction;
Jamie Madill7ab02fa2014-02-04 16:04:08 -050043
Geoff Lang9aa00bb2014-07-07 12:33:25 -040044 FastCopyFunctionMap fastCopyFunctions;
45 ColorCopyFunction getFastCopyFunction(GLenum format, GLenum type) const;
46};
47const DXGIFormat &GetDXGIFormatInfo(DXGI_FORMAT format);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000048
Geoff Lang9aa00bb2014-07-07 12:33:25 -040049struct TextureFormat
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000050{
Geoff Lang9aa00bb2014-07-07 12:33:25 -040051 TextureFormat();
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000052
Geoff Lang9aa00bb2014-07-07 12:33:25 -040053 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);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000079
80}
81
82}
83
84#endif // LIBGLESV2_RENDERER_FORMATUTILS11_H_