Hash :
30712068
Author :
Date :
2016-08-09T11:10:36
Move fast copy functions into angle::Format. These tables were duplicated in D3D11 and D3D9, and would have to be further duplicated into Vulkan. BUG=angleproject:1455 Change-Id: Ice1b81417d7b14f933b61861c4a9997c260ef72e Reviewed-on: https://chromium-review.googlesource.com/367690 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
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