blob: e8883c6f36b7f9a3250471768ca32546de9969bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Format:
// A universal description of texture storage. Across multiple
// renderer back-ends, there are common formats and some distinct
// permutations, this enum encapsulates them all.
#include "libANGLE/renderer/Format.h"
#include "image_util/copyimage.h"
using namespace rx;
namespace angle
{
namespace
{
const FastCopyFunctionMap &GetFastCopyFunctionsMap(Format::ID formatID)
{
switch (formatID)
{
case Format::ID::B8G8R8A8_UNORM:
{
static FastCopyFunctionMap fastCopyMap;
if (fastCopyMap.empty())
{
fastCopyMap[gl::FormatType(GL_RGBA, GL_UNSIGNED_BYTE)] = CopyBGRA8ToRGBA8;
}
return fastCopyMap;
}
default:
{
static FastCopyFunctionMap emptyMap;
return emptyMap;
}
}
}
} // anonymous namespace
Format::Format(ID id,
GLenum glFormat,
GLenum fboFormat,
MipGenerationFunction mipGen,
ColorReadFunction colorRead)
: id(id),
glInternalFormat(glFormat),
fboImplementationInternalFormat(fboFormat),
mipGenerationFunction(mipGen),
colorReadFunction(colorRead),
fastCopyFunctions(GetFastCopyFunctionsMap(id))
{
}
} // namespace angle
|