Commit 6e4cfceb by Geoff Lang Committed by Commit Bot

Refactor ANGLE's image manipulation code into a static library.

Allows for chromium to make use of some of the functionality. BUG=612205 Change-Id: Ib4435ca44775a3a554b0fb3bd384bd4d31d7952d Reviewed-on: https://chromium-review.googlesource.com/351753Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 91d56945
......@@ -150,6 +150,29 @@ static_library("angle_common") {
]
}
config("angle_image_util_config") {
include_dirs = [
"include",
"src",
]
}
source_set("angle_image_util") {
sources = rebase_path(gles_gypi.libangle_image_util_sources, ".", "src")
configs -= angle_undefine_configs
configs += [
":internal_config",
"//build/config/compiler:no_chromium_code",
]
public_configs = [ ":angle_image_util_config" ]
public_deps = [
":angle_common",
]
}
static_library("translator_lib") {
sources = rebase_path(compiler_gypi.angle_translator_lib_sources, ".", "src")
defines = []
......@@ -292,6 +315,7 @@ static_library("libANGLE") {
":angle_common",
]
deps = [
":angle_image_util",
":commit_id",
":includes",
":translator_static",
......
......@@ -143,6 +143,33 @@
},
{
'target_name': 'angle_image_util',
'type': 'static_library',
'includes': [ '../build/common_defines.gypi', ],
'sources':
[
'<@(libangle_image_util_sources)',
],
'include_dirs':
[
'.',
'../include',
],
'dependencies':
[
'angle_common',
],
'direct_dependent_settings':
{
'include_dirs':
[
'<(angle_path)/include',
'<(angle_path)/src',
],
},
},
{
'target_name': 'copy_scripts',
'type': 'none',
'includes': [ '../build/common_defines.gypi', ],
......
//
// Copyright (c) 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.
//
// Color.h : Defines the Color type used throughout the ANGLE libraries
#ifndef COMMON_COLOR_H_
#define COMMON_COLOR_H_
namespace angle
{
template <typename T>
struct Color
{
T red;
T green;
T blue;
T alpha;
Color();
Color(T r, T g, T b, T a);
};
template <typename T>
bool operator==(const Color<T> &a, const Color<T> &b);
template <typename T>
bool operator!=(const Color<T> &a, const Color<T> &b);
typedef Color<float> ColorF;
typedef Color<int> ColorI;
typedef Color<unsigned int> ColorUI;
} // namespace angle
// TODO: Move this fully into the angle namespace
namespace gl
{
template <typename T>
using Color = angle::Color<T>;
using ColorF = angle::ColorF;
using ColorI = angle::ColorI;
using ColorUI = angle::ColorUI;
} // namespace gl
#include "Color.inl"
#endif // COMMON_COLOR_H_
//
// Copyright (c) 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.
//
// Color.inl : Inline definitions of some functions from Color.h
namespace angle
{
template <typename T>
Color<T>::Color() : Color(0, 0, 0, 0)
{
}
template <typename T>
Color<T>::Color(T r, T g, T b, T a) : red(r), green(g), blue(b), alpha(a)
{
}
template <typename T>
bool operator==(const Color<T> &a, const Color<T> &b)
{
return a.red == b.red &&
a.green == b.green &&
a.blue == b.blue &&
a.alpha == b.alpha;
}
template <typename T>
bool operator!=(const Color<T> &a, const Color<T> &b)
{
return !(a == b);
}
} // namespace angle
......@@ -798,8 +798,8 @@ inline uint16_t RotR16(uint16_t x, int8_t r)
return (x >> r) | (x << (16 - r));
}
#define ANGLE_ROTL(x,y) RotL(x,y)
#define ANGLE_ROTR16(x,y) RotR16(x,y)
#define ANGLE_ROTL(x, y) ::rx::RotL(x, y)
#define ANGLE_ROTR16(x, y) ::rx::RotR16(x, y)
#endif // namespace rx
......
......@@ -6,17 +6,17 @@
// copyimage.cpp: Defines image copying functions
#include "libANGLE/renderer/copyimage.h"
#include "image_util/copyimage.h"
namespace rx
namespace angle
{
void CopyBGRA8ToRGBA8(const uint8_t *source, uint8_t *dest)
{
uint32_t argb = *reinterpret_cast<const uint32_t *>(source);
uint32_t argb = *reinterpret_cast<const uint32_t *>(source);
*reinterpret_cast<uint32_t *>(dest) = (argb & 0xFF00FF00) | // Keep alpha and green
(argb & 0x00FF0000) >> 16 | // Move red to blue
(argb & 0x000000FF) << 16; // Move blue to red
}
} // namespace rx
} // namespace angle
......@@ -6,15 +6,16 @@
// copyimage.h: Defines image copying functions
#ifndef LIBANGLE_RENDERER_D3D_COPYIMAGE_H_
#define LIBANGLE_RENDERER_D3D_COPYIMAGE_H_
#ifndef IMAGEUTIL_COPYIMAGE_H_
#define IMAGEUTIL_COPYIMAGE_H_
#include "common/mathutil.h"
#include "libANGLE/angletypes.h"
#include "common/Color.h"
#include "image_util/imageformats.h"
#include <stdint.h>
namespace rx
namespace angle
{
template <typename sourceType, typename colorDataType>
......@@ -28,8 +29,8 @@ void CopyPixel(const uint8_t *source, uint8_t *dest);
void CopyBGRA8ToRGBA8(const uint8_t *source, uint8_t *dest);
} // namespace rx
} // namespace angle
#include "copyimage.inl"
#endif // LIBANGLE_RENDERER_D3D_COPYIMAGE_H_
#endif // IMAGEUTIL_COPYIMAGE_H_
......@@ -6,19 +6,21 @@
// copyimage.inl: Defines image copying functions
namespace rx
namespace angle
{
template <typename sourceType, typename colorDataType>
inline void ReadColor(const uint8_t *source, uint8_t *dest)
{
sourceType::readColor(reinterpret_cast<gl::Color<colorDataType>*>(dest), reinterpret_cast<const sourceType*>(source));
sourceType::readColor(reinterpret_cast<Color<colorDataType>*>(dest),
reinterpret_cast<const sourceType*>(source));
}
template <typename destType, typename colorDataType>
inline void WriteColor(const uint8_t *source, uint8_t *dest)
{
destType::writeColor(reinterpret_cast<destType*>(dest), reinterpret_cast<const gl::Color<colorDataType>*>(source));
destType::writeColor(reinterpret_cast<destType*>(dest),
reinterpret_cast<const Color<colorDataType>*>(source));
}
template <typename sourceType, typename destType, typename colorDataType>
......@@ -29,4 +31,4 @@ inline void CopyPixel(const uint8_t *source, uint8_t *dest)
WriteColor<destType, colorDataType>(&temp, dest);
}
}
} // namespace angle
//
// Copyright (c) 2002-2015 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.
//
// generatemip.h: Defines the GenerateMip function, templated on the format
// type of the image for which mip levels are being generated.
#ifndef IMAGEUTIL_GENERATEMIP_H_
#define IMAGEUTIL_GENERATEMIP_H_
#include <stddef.h>
#include <stdint.h>
namespace angle
{
template <typename T>
inline void GenerateMip(size_t sourceWidth,
size_t sourceHeight,
size_t sourceDepth,
const uint8_t *sourceData,
size_t sourceRowPitch,
size_t sourceDepthPitch,
uint8_t *destData,
size_t destRowPitch,
size_t destDepthPitch);
} // namespace angle
#include "generatemip.inl"
#endif // IMAGEUTIL_GENERATEMIP_H_
......@@ -9,7 +9,9 @@
#include "common/mathutil.h"
namespace rx
#include "image_util/imageformats.h"
namespace angle
{
namespace priv
......@@ -245,7 +247,7 @@ static MipGenerationFunction GetMipGenerationFunction(size_t sourceWidth, size_t
return NULL;
}
}
} // namespace priv
template <typename T>
inline void GenerateMip(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
......@@ -263,4 +265,4 @@ inline void GenerateMip(size_t sourceWidth, size_t sourceHeight, size_t sourceDe
mipWidth, mipHeight, mipDepth, destData, destRowPitch, destDepthPitch);
}
}
} // namespace angle
......@@ -6,7 +6,12 @@
#include "common/mathutil.h"
namespace rx
#include <string.h>
namespace angle
{
namespace priv
{
template <typename T>
......@@ -21,6 +26,8 @@ inline const T *OffsetDataPointer(const uint8_t *data, size_t y, size_t z, size_
return reinterpret_cast<const T*>(data + (y * rowPitch) + (z * depthPitch));
}
} // namespace priv
template <typename type, size_t componentCount>
inline void LoadToNative(size_t width, size_t height, size_t depth,
const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
......@@ -39,8 +46,8 @@ inline void LoadToNative(size_t width, size_t height, size_t depth,
{
for (size_t z = 0; z < depth; z++)
{
const type *source = OffsetDataPointer<type>(input, 0, z, inputRowPitch, inputDepthPitch);
type *dest = OffsetDataPointer<type>(output, 0, z, outputRowPitch, outputDepthPitch);
const type *source = priv::OffsetDataPointer<type>(input, 0, z, inputRowPitch, inputDepthPitch);
type *dest = priv::OffsetDataPointer<type>(output, 0, z, outputRowPitch, outputDepthPitch);
memcpy(dest, source, layerSize);
}
......@@ -51,8 +58,8 @@ inline void LoadToNative(size_t width, size_t height, size_t depth,
{
for (size_t y = 0; y < height; y++)
{
const type *source = OffsetDataPointer<type>(input, y, z, inputRowPitch, inputDepthPitch);
type *dest = OffsetDataPointer<type>(output, y, z, outputRowPitch, outputDepthPitch);
const type *source = priv::OffsetDataPointer<type>(input, y, z, inputRowPitch, inputDepthPitch);
type *dest = priv::OffsetDataPointer<type>(output, y, z, outputRowPitch, outputDepthPitch);
memcpy(dest, source, width * sizeof(type) * componentCount);
}
}
......@@ -70,8 +77,8 @@ inline void LoadToNative3To4(size_t width, size_t height, size_t depth,
{
for (size_t y = 0; y < height; y++)
{
const type *source = OffsetDataPointer<type>(input, y, z, inputRowPitch, inputDepthPitch);
type *dest = OffsetDataPointer<type>(output, y, z, outputRowPitch, outputDepthPitch);
const type *source = priv::OffsetDataPointer<type>(input, y, z, inputRowPitch, inputDepthPitch);
type *dest = priv::OffsetDataPointer<type>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < width; x++)
{
dest[x * 4 + 0] = source[x * 3 + 0];
......@@ -94,8 +101,8 @@ inline void Load32FTo16F(size_t width, size_t height, size_t depth,
{
for (size_t y = 0; y < height; y++)
{
const float *source = OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
uint16_t *dest = OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
const float *source = priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
uint16_t *dest = priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < elementWidth; x++)
{
......@@ -117,8 +124,8 @@ inline void LoadCompressedToNative(size_t width, size_t height, size_t depth,
{
for (size_t y = 0; y < rows; ++y)
{
const uint8_t *source = OffsetDataPointer<uint8_t>(input, y, z, inputRowPitch, inputDepthPitch);
uint8_t *dest = OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
const uint8_t *source = priv::OffsetDataPointer<uint8_t>(input, y, z, inputRowPitch, inputDepthPitch);
uint8_t *dest = priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
memcpy(dest, source, columns * blockSize);
}
}
......@@ -140,7 +147,7 @@ inline void Initialize4ComponentData(size_t width, size_t height, size_t depth,
{
for (size_t y = 0; y < height; y++)
{
type *destRow = OffsetDataPointer<type>(output, y, z, outputRowPitch, outputDepthPitch);
type *destRow = priv::OffsetDataPointer<type>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < width; x++)
{
type* destPixel = destRow + x * 4;
......@@ -153,4 +160,4 @@ inline void Initialize4ComponentData(size_t width, size_t height, size_t depth,
}
}
}
} // namespace angle
......@@ -6,12 +6,13 @@
// loadimage_etc.cpp: Decodes ETC and EAC encoded textures.
#include "libANGLE/renderer/d3d/loadimage_etc.h"
#include "image_util/loadimage.h"
#include "libANGLE/renderer/imageformats.h"
#include "libANGLE/renderer/d3d/loadimage.h"
#include "common/mathutil.h"
namespace rx
#include "image_util/imageformats.h"
namespace angle
{
namespace
{
......@@ -93,7 +94,7 @@ struct ETC2Block
const auto &block = u.idht.mode.idm.colors.diff;
int r = (block.R + block.dR);
int g = (block.G + block.dG);
int b = (block.B + block.dB);
int b = (block.B + block.dB);
if (r < 0 || r > 31)
{
decodeTBlock(dest, x, y, w, h, destRowPitch, alphaValues,
......@@ -138,7 +139,7 @@ struct ETC2Block
const auto &block = u.idht.mode.idm.colors.diff;
int r = (block.R + block.dR);
int g = (block.G + block.dG);
int b = (block.B + block.dB);
int b = (block.B + block.dB);
if (r < 0 || r > 31)
{
transcodeTBlockToBC1(dest, x, y, w, h, alphaValues, nonOpaquePunchThroughAlpha);
......@@ -165,18 +166,15 @@ struct ETC2Block
}
private:
union
{
union {
// Individual, differential, H and T modes
struct
{
union
{
union {
// Individual and differential modes
struct
{
union
{
union {
struct // Individual colors
{
unsigned char R2 : 4;
......@@ -286,8 +284,7 @@ struct ETC2Block
// Single channel block
struct
{
union
{
union {
unsigned char us;
signed char s;
} base_codeword;
......@@ -361,7 +358,7 @@ struct ETC2Block
int b1 = extend_4to8bits(block.B1);
int r2 = extend_4to8bits(block.R2);
int g2 = extend_4to8bits(block.G2);
int b2 = extend_4to8bits(block.B2);
int b2 = extend_4to8bits(block.B2);
decodeIndividualOrDifferentialBlock(dest, x, y, w, h, destRowPitch, r1, g1, b1, r2, g2, b2,
alphaValues, nonOpaquePunchThroughAlpha);
}
......@@ -381,7 +378,7 @@ struct ETC2Block
int r1 = extend_5to8bits(block.R);
int r2 = extend_5to8bits(block.R + block.dR);
int g2 = extend_5to8bits(block.G + block.dG);
int b2 = extend_5to8bits(block.B + block.dB);
int b2 = extend_5to8bits(block.B + block.dB);
decodeIndividualOrDifferentialBlock(dest, x, y, w, h, destRowPitch, r1, g1, b1, r2, g2, b2,
alphaValues, nonOpaquePunchThroughAlpha);
}
......@@ -529,7 +526,7 @@ struct ETC2Block
int b2 = extend_4to8bits(block.HB2);
static const int distance[8] = {3, 6, 11, 16, 23, 32, 41, 64};
const int d = distance[(block.Hda << 2) | (block.Hdb << 1) |
const int d = distance[(block.Hda << 2) | (block.Hdb << 1) |
((r1 << 16 | g1 << 8 | b1) >= (r2 << 16 | g2 << 8 | b2) ? 1 : 0)];
const R8G8B8A8 paintColors[4] = {
......@@ -599,7 +596,7 @@ struct ETC2Block
size_t bitIndex = x * 4 + y;
size_t bitOffset = bitIndex & 7;
size_t lsb = (u.idht.pixelIndexLSB[1 - (bitIndex >> 3)] >> bitOffset) & 1;
size_t msb = (u.idht.pixelIndexMSB[1 - (bitIndex >> 3)] >> bitOffset) & 1;
size_t msb = (u.idht.pixelIndexMSB[1 - (bitIndex >> 3)] >> bitOffset) & 1;
return (msb << 1) | lsb;
}
......@@ -821,7 +818,7 @@ struct ETC2Block
int b1 = extend_4to8bits(block.B1);
int r2 = extend_4to8bits(block.R2);
int g2 = extend_4to8bits(block.G2);
int b2 = extend_4to8bits(block.B2);
int b2 = extend_4to8bits(block.B2);
transcodeIndividualOrDifferentialBlockToBC1(dest, x, y, w, h, r1, g1, b1, r2, g2, b2,
alphaValues, nonOpaquePunchThroughAlpha);
}
......@@ -840,7 +837,7 @@ struct ETC2Block
int r1 = extend_5to8bits(block.R);
int r2 = extend_5to8bits(block.R + block.dR);
int g2 = extend_5to8bits(block.G + block.dG);
int b2 = extend_5to8bits(block.B + block.dB);
int b2 = extend_5to8bits(block.B + block.dB);
transcodeIndividualOrDifferentialBlockToBC1(dest, x, y, w, h, r1, g1, b1, r2, g2, b2,
alphaValues, nonOpaquePunchThroughAlpha);
}
......@@ -858,7 +855,7 @@ struct ETC2Block
size_t dxBegin = 0;
size_t dxEnd = 4;
size_t dyBegin = subblockIdx * 2;
size_t dyEnd = dyBegin + 2;
size_t dyEnd = dyBegin + 2;
if (!flipbit)
{
std::swap(dxBegin, dyBegin);
......@@ -948,7 +945,7 @@ struct ETC2Block
int vr, vg, vb;
static const float kDefaultLuminanceThreshold = 4.0f * 255;
static const float kQuantizeRange = 512.0f;
static const float kQuantizeRange = 512.0f;
if (eigenvalue < kDefaultLuminanceThreshold) // too small, default to luminance
{
// Luminance weights defined by ITU-R Recommendation BT.601, scaled by 1000
......@@ -1177,9 +1174,9 @@ void LoadR11EACToR8(size_t width,
for (size_t y = 0; y < height; y += 4)
{
const ETC2Block *sourceRow =
OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
priv::OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
uint8_t *destRow =
OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < width; x += 4)
{
......@@ -1209,9 +1206,9 @@ void LoadRG11EACToRG8(size_t width,
for (size_t y = 0; y < height; y += 4)
{
const ETC2Block *sourceRow =
OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
priv::OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
uint8_t *destRow =
OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < width; x += 4)
{
......@@ -1245,9 +1242,9 @@ void LoadETC2RGB8ToRGBA8(size_t width,
for (size_t y = 0; y < height; y += 4)
{
const ETC2Block *sourceRow =
OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
priv::OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
uint8_t *destRow =
OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < width; x += 4)
{
......@@ -1277,9 +1274,9 @@ void LoadETC2RGB8ToBC1(size_t width,
for (size_t y = 0; y < height; y += 4)
{
const ETC2Block *sourceRow =
OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
uint8_t *destRow =
OffsetDataPointer<uint8_t>(output, y / 4, z, outputRowPitch, outputDepthPitch);
priv::OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
uint8_t *destRow = priv::OffsetDataPointer<uint8_t>(output, y / 4, z, outputRowPitch,
outputDepthPitch);
for (size_t x = 0; x < width; x += 4)
{
......@@ -1311,9 +1308,9 @@ void LoadETC2RGBA8ToRGBA8(size_t width,
for (size_t y = 0; y < height; y += 4)
{
const ETC2Block *sourceRow =
OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
priv::OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
uint8_t *destRow =
OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < width; x += 4)
{
......@@ -1501,4 +1498,4 @@ void LoadETC2SRGBA8ToSRGBA8(size_t width,
outputRowPitch, outputDepthPitch, true);
}
} // namespace rx
} // namespace angle
......@@ -8,20 +8,27 @@
// in a separated file for GCC, which can enable SSE usage only per-file,
// not for code blocks that use SSE2 explicitly.
#include "libANGLE/renderer/d3d/loadimage.h"
#include "image_util/loadimage.h"
#include "common/mathutil.h"
#include "common/platform.h"
#ifdef ANGLE_USE_SSE
#include <emmintrin.h>
#endif
namespace rx
namespace angle
{
void LoadA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
void LoadA8ToBGRA8_SSE2(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch)
{
#if defined(ANGLE_USE_SSE)
__m128i zeroWide = _mm_setzero_si128();
......@@ -30,8 +37,10 @@ void LoadA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
{
for (size_t y = 0; y < height; y++)
{
const uint8_t *source = OffsetDataPointer<uint8_t>(input, y, z, inputRowPitch, inputDepthPitch);
uint32_t *dest = OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
const uint8_t *source =
priv::OffsetDataPointer<uint8_t>(input, y, z, inputRowPitch, inputDepthPitch);
uint32_t *dest =
priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
size_t x = 0;
......@@ -43,15 +52,15 @@ void LoadA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
for (; x + 7 < width; x += 8)
{
__m128i sourceData = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(&source[x]));
__m128i sourceData = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&source[x]));
// Interleave each byte to 16bit, make the lower byte to zero
sourceData = _mm_unpacklo_epi8(zeroWide, sourceData);
// Interleave each 16bit to 32bit, make the lower 16bit to zero
__m128i lo = _mm_unpacklo_epi16(zeroWide, sourceData);
__m128i hi = _mm_unpackhi_epi16(zeroWide, sourceData);
_mm_store_si128(reinterpret_cast<__m128i*>(&dest[x]), lo);
_mm_store_si128(reinterpret_cast<__m128i*>(&dest[x + 4]), hi);
_mm_store_si128(reinterpret_cast<__m128i *>(&dest[x]), lo);
_mm_store_si128(reinterpret_cast<__m128i *>(&dest[x + 4]), hi);
}
// Handle the remainder
......@@ -69,9 +78,15 @@ void LoadA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
#endif
}
void LoadRGBA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
void LoadRGBA8ToBGRA8_SSE2(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch)
{
#if defined(ANGLE_USE_SSE)
__m128i brMask = _mm_set1_epi32(0x00ff00ff);
......@@ -80,8 +95,10 @@ void LoadRGBA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
{
for (size_t y = 0; y < height; y++)
{
const uint32_t *source = OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch);
uint32_t *dest = OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
const uint32_t *source =
priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch);
uint32_t *dest =
priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
size_t x = 0;
......@@ -89,27 +106,29 @@ void LoadRGBA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
for (; ((reinterpret_cast<intptr_t>(&dest[x]) & 15) != 0) && x < width; x++)
{
uint32_t rgba = source[x];
dest[x] = (ANGLE_ROTL(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
dest[x] = (ANGLE_ROTL(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
}
for (; x + 3 < width; x += 4)
{
__m128i sourceData = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&source[x]));
__m128i sourceData = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&source[x]));
// Mask out g and a, which don't change
__m128i gaComponents = _mm_andnot_si128(brMask, sourceData);
// Mask out b and r
__m128i brComponents = _mm_and_si128(sourceData, brMask);
// Swap b and r
__m128i brSwapped = _mm_shufflehi_epi16(_mm_shufflelo_epi16(brComponents, _MM_SHUFFLE(2, 3, 0, 1)), _MM_SHUFFLE(2, 3, 0, 1));
__m128i brSwapped =
_mm_shufflehi_epi16(_mm_shufflelo_epi16(brComponents, _MM_SHUFFLE(2, 3, 0, 1)),
_MM_SHUFFLE(2, 3, 0, 1));
__m128i result = _mm_or_si128(gaComponents, brSwapped);
_mm_store_si128(reinterpret_cast<__m128i*>(&dest[x]), result);
_mm_store_si128(reinterpret_cast<__m128i *>(&dest[x]), result);
}
// Perform leftover writes
for (; x < width; x++)
{
uint32_t rgba = source[x];
dest[x] = (ANGLE_ROTL(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
dest[x] = (ANGLE_ROTL(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
}
}
}
......@@ -120,6 +139,4 @@ void LoadRGBA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
return;
#endif
}
}
......@@ -13,6 +13,7 @@
#include <memory>
#include "common/angleutils.h"
#include "common/Color.h"
#include "libANGLE/Debug.h"
#include "libANGLE/Program.h"
#include "libANGLE/RefCountObject.h"
......
......@@ -45,28 +45,6 @@ enum SamplerType
SAMPLER_VERTEX
};
template <typename T>
struct Color
{
T red;
T green;
T blue;
T alpha;
Color() : red(0), green(0), blue(0), alpha(0) { }
Color(T r, T g, T b, T a) : red(r), green(g), blue(b), alpha(a) { }
};
template <typename T>
bool operator==(const Color<T> &a, const Color<T> &b);
template <typename T>
bool operator!=(const Color<T> &a, const Color<T> &b);
typedef Color<float> ColorF;
typedef Color<int> ColorI;
typedef Color<unsigned int> ColorUI;
struct Rectangle
{
Rectangle() : x(0), y(0), width(0), height(0) {}
......
......@@ -9,21 +9,6 @@
namespace gl
{
template <typename T>
bool operator==(const Color<T> &a, const Color<T> &b)
{
return a.red == b.red &&
a.green == b.green &&
a.blue == b.blue &&
a.alpha == b.alpha;
}
template <typename T>
bool operator!=(const Color<T> &a, const Color<T> &b)
{
return !(a == b);
}
inline bool operator==(const Rectangle &a, const Rectangle &b)
{
return a.x == b.x &&
......
......@@ -12,6 +12,7 @@
#include <vector>
#include <cstdint>
#include "common/Color.h"
#include "common/Optional.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/renderer/FramebufferImpl.h"
......
......@@ -9,13 +9,14 @@
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
#include "image_util/copyimage.h"
#include "image_util/generatemip.h"
#include "image_util/loadimage.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/copyimage.h"
#include "libANGLE/renderer/d3d/d3d11/copyvertex.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/generatemip.h"
#include "libANGLE/renderer/d3d/loadimage.h"
namespace rx
{
......@@ -48,7 +49,7 @@ static const FastCopyFunctionMap &GetFastCopyFunctionMap(DXGI_FORMAT dxgiFormat)
static FastCopyFunctionMap fastCopyMap;
if (fastCopyMap.empty())
{
fastCopyMap[gl::FormatType(GL_RGBA, GL_UNSIGNED_BYTE)] = CopyBGRA8ToRGBA8;
fastCopyMap[gl::FormatType(GL_RGBA, GL_UNSIGNED_BYTE)] = angle::CopyBGRA8ToRGBA8;
}
return fastCopyMap;
}
......
......@@ -21,10 +21,15 @@ template = """// GENERATED FILE - DO NOT EDIT.
//
#include "libANGLE/renderer/d3d/d3d11/load_functions_table.h"
#include "image_util/copyimage.h"
#include "image_util/generatemip.h"
#include "image_util/loadimage.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
#include "libANGLE/renderer/d3d/loadimage.h"
#include "libANGLE/renderer/d3d/loadimage_etc.h"
using namespace angle;
namespace rx
{{
......
......@@ -51,12 +51,15 @@ template_texture_format_table_autogen_cpp = """// GENERATED FILE - DO NOT EDIT.
#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
#include "libANGLE/renderer/copyimage.h"
#include "image_util/copyimage.h"
#include "image_util/generatemip.h"
#include "image_util/loadimage.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
#include "libANGLE/renderer/d3d/d3d11/load_functions_table.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
#include "libANGLE/renderer/d3d/generatemip.h"
#include "libANGLE/renderer/d3d/loadimage.h"
using namespace angle;
namespace rx
{{
......
......@@ -10,10 +10,15 @@
//
#include "libANGLE/renderer/d3d/d3d11/load_functions_table.h"
#include "image_util/copyimage.h"
#include "image_util/generatemip.h"
#include "image_util/loadimage.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
#include "libANGLE/renderer/d3d/loadimage.h"
#include "libANGLE/renderer/d3d/loadimage_etc.h"
using namespace angle;
namespace rx
{
......
......@@ -14,7 +14,8 @@
#include <functional>
#include <vector>
#include "libANGLE/angletypes.h"
#include "common/Color.h"
#include "libANGLE/Caps.h"
#include "libANGLE/Error.h"
#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
......
......@@ -11,12 +11,15 @@
#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
#include "libANGLE/renderer/copyimage.h"
#include "image_util/copyimage.h"
#include "image_util/generatemip.h"
#include "image_util/loadimage.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
#include "libANGLE/renderer/d3d/d3d11/load_functions_table.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
#include "libANGLE/renderer/d3d/generatemip.h"
#include "libANGLE/renderer/d3d/loadimage.h"
using namespace angle;
namespace rx
{
......
......@@ -9,11 +9,12 @@
#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
#include "libANGLE/renderer/copyimage.h"
#include "image_util/copyimage.h"
#include "image_util/generatemip.h"
#include "image_util/loadimage.h"
#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
#include "libANGLE/renderer/d3d/d3d9/vertexconversion.h"
#include "libANGLE/renderer/d3d/generatemip.h"
#include "libANGLE/renderer/d3d/loadimage.h"
namespace rx
{
......@@ -49,7 +50,7 @@ static const FastCopyFunctionMap &GetFastCopyFunctionMap(D3DFORMAT d3dFormat)
static FastCopyFunctionMap fastCopyMap;
if (fastCopyMap.empty())
{
fastCopyMap[gl::FormatType(GL_RGBA, GL_UNSIGNED_BYTE)] = CopyBGRA8ToRGBA8;
fastCopyMap[gl::FormatType(GL_RGBA, GL_UNSIGNED_BYTE)] = angle::CopyBGRA8ToRGBA8;
}
return fastCopyMap;
}
......@@ -109,6 +110,8 @@ static inline void InsertD3DFormatInfo(D3D9FormatInfoMap *map, D3DFORMAT format,
static D3D9FormatInfoMap BuildD3D9FormatInfoMap()
{
using namespace angle; // For image reading and mipmap generation functions
D3D9FormatInfoMap map;
// | D3DFORMAT | S |W |H | R | G | B | A | L | D | S | Internal format | Mip generation function | Color read function |
......@@ -166,6 +169,8 @@ typedef std::map<GLint, InitializeTextureDataFunction> InternalFormatInitialzerM
static InternalFormatInitialzerMap BuildInternalFormatInitialzerMap()
{
using namespace angle; // For image initialization functions
InternalFormatInitialzerMap map;
map.insert(InternalFormatInitialzerPair(GL_RGB16F, Initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>));
......@@ -232,6 +237,8 @@ static inline void InsertD3D9FormatInfo(D3D9FormatMap *map, GLenum internalForma
static D3D9FormatMap BuildD3D9FormatMap()
{
using namespace angle; // For image loading functions
D3D9FormatMap map;
// | Internal format | Texture format | Render format | Load function |
......
......@@ -10,7 +10,7 @@
#ifndef LIBANGLE_RENDERER_D3D_D3D9_RENDERER9UTILS_H_
#define LIBANGLE_RENDERER_D3D_D3D9_RENDERER9UTILS_H_
#include "libANGLE/angletypes.h"
#include "common/Color.h"
#include "libANGLE/Caps.h"
#include "libANGLE/Error.h"
......
//
// Copyright (c) 2002-2015 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.
//
// generatemip.h: Defines the GenerateMip function, templated on the format
// type of the image for which mip levels are being generated.
#ifndef LIBANGLE_RENDERER_D3D_GENERATEMIP_H_
#define LIBANGLE_RENDERER_D3D_GENERATEMIP_H_
#include "libANGLE/angletypes.h"
#include "libANGLE/renderer/imageformats.h"
namespace rx
{
template <typename T>
inline void GenerateMip(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
uint8_t *destData, size_t destRowPitch, size_t destDepthPitch);
}
#include "generatemip.inl"
#endif // LIBANGLE_RENDERER_D3D_GENERATEMIP_H_
//
// Copyright (c) 2013-2015 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.
//
// loadimage_etc.h: Decodes ETC and EAC encoded textures.
#ifndef LIBANGLE_RENDERER_D3D_LOADIMAGE_ETC_H_
#define LIBANGLE_RENDERER_D3D_LOADIMAGE_ETC_H_
#include "libANGLE/angletypes.h"
#include <stdint.h>
namespace rx
{
void LoadETC1RGB8ToRGBA8(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadETC1RGB8ToBC1(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadEACR11ToR8(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadEACR11SToR8(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadEACRG11ToRG8(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadEACRG11SToRG8(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadETC2RGB8ToRGBA8(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadETC2SRGB8ToRGBA8(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadETC2RGB8A1ToRGBA8(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadETC2SRGB8A1ToRGBA8(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadETC2RGBA8ToRGBA8(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadETC2SRGBA8ToSRGBA8(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
}
#endif // LIBANGLE_RENDERER_D3D_LOADIMAGE_ETC_H_
......@@ -9,9 +9,12 @@
#include "libANGLE/renderer/renderer_utils.h"
#include "image_util/copyimage.h"
#include "image_util/imageformats.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/copyimage.h"
#include "libANGLE/renderer/imageformats.h"
#include <string.h>
namespace rx
{
......@@ -31,6 +34,8 @@ static inline void InsertFormatWriteFunctionMapping(FormatWriteFunctionMap *map,
static FormatWriteFunctionMap BuildFormatWriteFunctionMap()
{
using namespace angle; // For image writing functions
FormatWriteFunctionMap map;
// clang-format off
......
......@@ -11,6 +11,8 @@
'libangle_common_sources':
[
'common/BitSetIterator.h',
'common/Color.h',
'common/Color.inl',
'common/Float16ToFloat32.cpp',
'common/MemoryBuffer.cpp',
'common/MemoryBuffer.h',
......@@ -36,6 +38,21 @@
'common/utilities.h',
'common/version.h',
],
'libangle_image_util_sources':
[
'image_util/copyimage.cpp',
'image_util/copyimage.h',
'image_util/copyimage.inl',
'image_util/generatemip.h',
'image_util/generatemip.inl',
'image_util/imageformats.cpp',
'image_util/imageformats.h',
'image_util/loadimage.cpp',
'image_util/loadimage.h',
'image_util/loadimage.inl',
'image_util/loadimage_etc.cpp',
'image_util/loadimage_sse2.cpp',
],
'libangle_includes':
[
'../include/angle_gl.h',
......@@ -170,10 +187,6 @@
'libANGLE/renderer/TextureImpl.h',
'libANGLE/renderer/TransformFeedbackImpl.h',
'libANGLE/renderer/VertexArrayImpl.h',
'libANGLE/renderer/copyimage.cpp',
'libANGLE/renderer/copyimage.h',
'libANGLE/renderer/copyimage.inl',
'libANGLE/renderer/imageformats.h',
'libANGLE/renderer/renderer_utils.cpp',
'libANGLE/renderer/renderer_utils.h',
'libANGLE/signal_utils.cpp',
......@@ -206,8 +219,6 @@
'libANGLE/renderer/d3d/formatutilsD3D.h',
'libANGLE/renderer/d3d/FramebufferD3D.cpp',
'libANGLE/renderer/d3d/FramebufferD3D.h',
'libANGLE/renderer/d3d/generatemip.h',
'libANGLE/renderer/d3d/generatemip.inl',
'libANGLE/renderer/d3d/HLSLCompiler.cpp',
'libANGLE/renderer/d3d/HLSLCompiler.h',
'libANGLE/renderer/d3d/ImageD3D.cpp',
......@@ -216,12 +227,6 @@
'libANGLE/renderer/d3d/IndexBuffer.h',
'libANGLE/renderer/d3d/IndexDataManager.cpp',
'libANGLE/renderer/d3d/IndexDataManager.h',
'libANGLE/renderer/d3d/loadimage.cpp',
'libANGLE/renderer/d3d/loadimage.h',
'libANGLE/renderer/d3d/loadimage.inl',
'libANGLE/renderer/d3d/loadimageSSE2.cpp',
'libANGLE/renderer/d3d/loadimage_etc.cpp',
'libANGLE/renderer/d3d/loadimage_etc.h',
'libANGLE/renderer/d3d/NativeWindowD3D.cpp',
'libANGLE/renderer/d3d/NativeWindowD3D.h',
'libANGLE/renderer/d3d/ProgramD3D.cpp',
......@@ -642,6 +647,7 @@
'translator_static',
'commit_id',
'angle_common',
'angle_image_util',
],
'includes': [ '../build/common_defines.gypi', ],
'include_dirs':
......
......@@ -8,7 +8,7 @@
#include "test_utils/ANGLETest.h"
#include "libANGLE/renderer/imageformats.h"
#include "image_util/imageformats.h"
using namespace angle;
......@@ -135,7 +135,7 @@ TEST_P(D3DImageFormatConversionTest, WriteColorFunctionR4G4B4A4)
return;
}
runTest<rx::R4G4B4A4>(GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4);
runTest<R4G4B4A4>(GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4);
}
// Validation test for rx::R5G5B5A1's writeColor functions
......@@ -150,7 +150,7 @@ TEST_P(D3DImageFormatConversionTest, WriteColorFunctionR5G5B5A1)
return;
}
runTest<rx::R5G5B5A1>(GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1);
runTest<R5G5B5A1>(GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1);
}
// Validation test for rx::R5G6B5's writeColor functions
......@@ -165,7 +165,7 @@ TEST_P(D3DImageFormatConversionTest, WriteColorFunctionR5G6B5)
return;
}
runTest<rx::R5G6B5>(GL_RGB, GL_UNSIGNED_SHORT_5_6_5);
runTest<R5G6B5>(GL_RGB, GL_UNSIGNED_SHORT_5_6_5);
}
// Validation test for rx::R8G8B8A8's writeColor functions
......@@ -180,7 +180,7 @@ TEST_P(D3DImageFormatConversionTest, WriteColorFunctionR8G8B8A8)
return;
}
runTest<rx::R8G8B8A8>(GL_RGBA, GL_UNSIGNED_BYTE);
runTest<R8G8B8A8>(GL_RGBA, GL_UNSIGNED_BYTE);
}
// Validation test for rx::R8G8B8's writeColor functions
......@@ -196,7 +196,7 @@ TEST_P(D3DImageFormatConversionTest, WriteColorFunctionR8G8B8)
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
runTest<rx::R8G8B8>(GL_RGB, GL_UNSIGNED_BYTE);
runTest<R8G8B8>(GL_RGB, GL_UNSIGNED_BYTE);
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
......
......@@ -9,27 +9,27 @@
#include "test_utils/ANGLETest.h"
#include "test_utils/gl_raii.h"
#include "libANGLE/renderer/imageformats.h"
#include "image_util/imageformats.h"
using namespace angle;
namespace
{
GLColor Convert565(const rx::R5G6B5 &rgb565)
GLColor Convert565(const R5G6B5 &rgb565)
{
gl::ColorF colorf;
rx::R5G6B5::readColor(&colorf, &rgb565);
R5G6B5::readColor(&colorf, &rgb565);
Vector4 vecColor(colorf.red, colorf.green, colorf.blue, colorf.alpha);
return GLColor(vecColor);
}
rx::R5G6B5 Convert565(const GLColor &glColor)
R5G6B5 Convert565(const GLColor &glColor)
{
const Vector4 &vecColor = glColor.toNormalizedVector();
gl::ColorF colorf(vecColor.x, vecColor.y, vecColor.z, vecColor.w);
rx::R5G6B5 rgb565;
rx::R5G6B5::writeColor(&rgb565, &colorf);
R5G6B5 rgb565;
R5G6B5::writeColor(&rgb565, &colorf);
return rgb565;
}
......@@ -165,8 +165,8 @@ TEST_P(SixteenBppTextureTest, RGB565Validation)
GLuint test;
memcpy(&test, &GLColor::black, 4);
rx::R5G6B5 pixels[4] = {Convert565(GLColor::red), Convert565(GLColor::green),
Convert565(GLColor::blue), Convert565(GLColor::yellow)};
R5G6B5 pixels[4] = {Convert565(GLColor::red), Convert565(GLColor::green),
Convert565(GLColor::blue), Convert565(GLColor::yellow)};
glClearColor(0, 0, 0, 0);
......@@ -525,7 +525,7 @@ TEST_P(SixteenBppTextureTestES3, RGB565FramebufferReadback)
if (colorReadFormat == GL_RGB && colorReadType == GL_UNSIGNED_SHORT_5_6_5)
{
std::vector<rx::R5G6B5> readColors(w * h);
std::vector<R5G6B5> readColors(w * h);
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, readColors.data());
int hoffset = (h - 1) * w;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment