Commit 522095f7 by Jamie Madill Committed by Commit Bot

Rename "color" functions to "pixel" functions.

This extends of the copy, read and write functions to cover depth and stencil formats. Refactoring change only. Bug: angleproject:2673 Change-Id: I4b0b2f4cf8621051cacd95cdbd6d70f94ca612e2 Reviewed-on: https://chromium-review.googlesource.com/1147152Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent b436aac3
...@@ -25,8 +25,8 @@ struct Format final : private angle::NonCopyable ...@@ -25,8 +25,8 @@ struct Format final : private angle::NonCopyable
GLenum fboFormat, GLenum fboFormat,
rx::MipGenerationFunction mipGen, rx::MipGenerationFunction mipGen,
const rx::FastCopyFunctionMap &fastCopyFunctions, const rx::FastCopyFunctionMap &fastCopyFunctions,
rx::ColorReadFunction colorRead, rx::PixelReadFunction colorRead,
rx::ColorWriteFunction colorWrite, rx::PixelWriteFunction colorWrite,
GLenum componentType, GLenum componentType,
GLuint redBits, GLuint redBits,
GLuint greenBits, GLuint greenBits,
...@@ -56,8 +56,8 @@ struct Format final : private angle::NonCopyable ...@@ -56,8 +56,8 @@ struct Format final : private angle::NonCopyable
GLenum fboImplementationInternalFormat; GLenum fboImplementationInternalFormat;
rx::MipGenerationFunction mipGenerationFunction; rx::MipGenerationFunction mipGenerationFunction;
rx::ColorReadFunction colorReadFunction; rx::PixelReadFunction pixelReadFunction;
rx::ColorWriteFunction colorWriteFunction; rx::PixelWriteFunction pixelWriteFunction;
// A map from a gl::FormatType to a fast pixel copy function for this format. // A map from a gl::FormatType to a fast pixel copy function for this format.
const rx::FastCopyFunctionMap &fastCopyFunctions; const rx::FastCopyFunctionMap &fastCopyFunctions;
...@@ -81,8 +81,8 @@ constexpr Format::Format(FormatID id, ...@@ -81,8 +81,8 @@ constexpr Format::Format(FormatID id,
GLenum fboFormat, GLenum fboFormat,
rx::MipGenerationFunction mipGen, rx::MipGenerationFunction mipGen,
const rx::FastCopyFunctionMap &fastCopyFunctions, const rx::FastCopyFunctionMap &fastCopyFunctions,
rx::ColorReadFunction colorRead, rx::PixelReadFunction colorRead,
rx::ColorWriteFunction colorWrite, rx::PixelWriteFunction colorWrite,
GLenum componentType, GLenum componentType,
GLuint redBits, GLuint redBits,
GLuint greenBits, GLuint greenBits,
...@@ -96,8 +96,8 @@ constexpr Format::Format(FormatID id, ...@@ -96,8 +96,8 @@ constexpr Format::Format(FormatID id,
glInternalFormat(glFormat), glInternalFormat(glFormat),
fboImplementationInternalFormat(fboFormat), fboImplementationInternalFormat(fboFormat),
mipGenerationFunction(mipGen), mipGenerationFunction(mipGen),
colorReadFunction(colorRead), pixelReadFunction(colorRead),
colorWriteFunction(colorWrite), pixelWriteFunction(colorWrite),
fastCopyFunctions(fastCopyFunctions), fastCopyFunctions(fastCopyFunctions),
componentType(componentType), componentType(componentType),
redBits(redBits), redBits(redBits),
......
...@@ -118,8 +118,8 @@ gl::Error Image11::CopyImage(const gl::Context *context, ...@@ -118,8 +118,8 @@ gl::Error Image11::CopyImage(const gl::Context *context,
destOffset.y * destMapped.RowPitch; destOffset.y * destMapped.RowPitch;
CopyImageCHROMIUM(sourceData, srcMapped.RowPitch, sourcePixelBytes, CopyImageCHROMIUM(sourceData, srcMapped.RowPitch, sourcePixelBytes,
sourceFormat.colorReadFunction, destData, destMapped.RowPitch, destPixelBytes, sourceFormat.pixelReadFunction, destData, destMapped.RowPitch, destPixelBytes,
destFormat.colorWriteFunction, destUnsizedFormat, destFormat.pixelWriteFunction, destUnsizedFormat,
destFormatInfo.componentType, sourceRect.width, sourceRect.height, destFormatInfo.componentType, sourceRect.width, sourceRect.height,
unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha); unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
......
...@@ -226,8 +226,8 @@ gl::Error Image9::CopyImage(const gl::Context *context, ...@@ -226,8 +226,8 @@ gl::Error Image9::CopyImage(const gl::Context *context,
ASSERT(sourceData && destData); ASSERT(sourceData && destData);
CopyImageCHROMIUM(sourceData, sourceLocked.Pitch, sourceD3DFormatInfo.pixelBytes, CopyImageCHROMIUM(sourceData, sourceLocked.Pitch, sourceD3DFormatInfo.pixelBytes,
sourceD3DFormatInfo.info().colorReadFunction, destData, destLocked.Pitch, sourceD3DFormatInfo.info().pixelReadFunction, destData, destLocked.Pitch,
destD3DFormatInfo.pixelBytes, destD3DFormatInfo.info().colorWriteFunction, destD3DFormatInfo.pixelBytes, destD3DFormatInfo.info().pixelWriteFunction,
gl::GetUnsizedFormat(dest->getInternalFormat()), gl::GetUnsizedFormat(dest->getInternalFormat()),
destD3DFormatInfo.info().componentType, sourceRect.width, sourceRect.height, destD3DFormatInfo.info().componentType, sourceRect.width, sourceRect.height,
unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha); unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
......
...@@ -607,7 +607,7 @@ gl::Error BlitGL::copySubTextureCPUReadback(const gl::Context *context, ...@@ -607,7 +607,7 @@ gl::Error BlitGL::copySubTextureCPUReadback(const gl::Context *context,
uint8_t *destMemory = buffer->data() + sourceBufferSize; uint8_t *destMemory = buffer->data() + sourceBufferSize;
GLenum readPixelsFormat = GL_NONE; GLenum readPixelsFormat = GL_NONE;
ColorReadFunction readFunction = nullptr; PixelReadFunction readFunction = nullptr;
if (sourceComponentType == GL_UNSIGNED_INT) if (sourceComponentType == GL_UNSIGNED_INT)
{ {
readPixelsFormat = GL_RGBA_INTEGER; readPixelsFormat = GL_RGBA_INTEGER;
...@@ -633,7 +633,7 @@ gl::Error BlitGL::copySubTextureCPUReadback(const gl::Context *context, ...@@ -633,7 +633,7 @@ gl::Error BlitGL::copySubTextureCPUReadback(const gl::Context *context,
CopyImageCHROMIUM( CopyImageCHROMIUM(
sourceMemory, sourceArea.width * sourcePixelSize, sourcePixelSize, readFunction, destMemory, sourceMemory, sourceArea.width * sourcePixelSize, sourcePixelSize, readFunction, destMemory,
sourceArea.width * destInternalFormatInfo.pixelBytes, destInternalFormatInfo.pixelBytes, sourceArea.width * destInternalFormatInfo.pixelBytes, destInternalFormatInfo.pixelBytes,
destFormatInfo.colorWriteFunction, destInternalFormatInfo.format, destFormatInfo.pixelWriteFunction, destInternalFormatInfo.format,
destInternalFormatInfo.componentType, sourceArea.width, sourceArea.height, unpackFlipY, destInternalFormatInfo.componentType, sourceArea.width, sourceArea.height, unpackFlipY,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha); unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
......
...@@ -84,7 +84,7 @@ void ClipChannelsNoOp(gl::ColorF *color) ...@@ -84,7 +84,7 @@ void ClipChannelsNoOp(gl::ColorF *color)
} }
void WriteUintColor(const gl::ColorF &color, void WriteUintColor(const gl::ColorF &color,
ColorWriteFunction colorWriteFunction, PixelWriteFunction colorWriteFunction,
uint8_t *destPixelData) uint8_t *destPixelData)
{ {
gl::ColorUI destColor( gl::ColorUI destColor(
...@@ -94,7 +94,7 @@ void WriteUintColor(const gl::ColorF &color, ...@@ -94,7 +94,7 @@ void WriteUintColor(const gl::ColorF &color,
} }
void WriteFloatColor(const gl::ColorF &color, void WriteFloatColor(const gl::ColorF &color,
ColorWriteFunction colorWriteFunction, PixelWriteFunction colorWriteFunction,
uint8_t *destPixelData) uint8_t *destPixelData)
{ {
colorWriteFunction(reinterpret_cast<const uint8_t *>(&color), destPixelData); colorWriteFunction(reinterpret_cast<const uint8_t *>(&color), destPixelData);
...@@ -211,7 +211,7 @@ void PackPixels(const PackPixelsParams &params, ...@@ -211,7 +211,7 @@ void PackPixels(const PackPixelsParams &params,
return; return;
} }
ColorCopyFunction fastCopyFunc = sourceFormat.fastCopyFunctions.get(params.destFormat->id); PixelCopyFunction fastCopyFunc = sourceFormat.fastCopyFunctions.get(params.destFormat->id);
if (fastCopyFunc) if (fastCopyFunc)
{ {
...@@ -230,8 +230,8 @@ void PackPixels(const PackPixelsParams &params, ...@@ -230,8 +230,8 @@ void PackPixels(const PackPixelsParams &params,
return; return;
} }
ColorWriteFunction colorWriteFunction = params.destFormat->colorWriteFunction; PixelWriteFunction pixelWriteFunction = params.destFormat->pixelWriteFunction;
ASSERT(colorWriteFunction != nullptr); ASSERT(pixelWriteFunction != nullptr);
// Maximum size of any Color<T> type used. // Maximum size of any Color<T> type used.
uint8_t temp[16]; uint8_t temp[16];
...@@ -240,8 +240,8 @@ void PackPixels(const PackPixelsParams &params, ...@@ -240,8 +240,8 @@ void PackPixels(const PackPixelsParams &params,
sizeof(temp) >= sizeof(angle::DepthStencil), sizeof(temp) >= sizeof(angle::DepthStencil),
"Unexpected size of pixel struct."); "Unexpected size of pixel struct.");
ColorReadFunction colorReadFunction = sourceFormat.colorReadFunction; PixelReadFunction pixelReadFunction = sourceFormat.pixelReadFunction;
ASSERT(colorReadFunction != nullptr); ASSERT(pixelReadFunction != nullptr);
for (int y = 0; y < params.area.height; ++y) for (int y = 0; y < params.area.height; ++y)
{ {
...@@ -253,8 +253,8 @@ void PackPixels(const PackPixelsParams &params, ...@@ -253,8 +253,8 @@ void PackPixels(const PackPixelsParams &params,
// readFunc and writeFunc will be using the same type of color, CopyTexImage // readFunc and writeFunc will be using the same type of color, CopyTexImage
// will not allow the copy otherwise. // will not allow the copy otherwise.
colorReadFunction(src, temp); pixelReadFunction(src, temp);
colorWriteFunction(temp, dest); pixelWriteFunction(temp, dest);
} }
} }
} }
...@@ -264,7 +264,7 @@ bool FastCopyFunctionMap::has(angle::FormatID formatID) const ...@@ -264,7 +264,7 @@ bool FastCopyFunctionMap::has(angle::FormatID formatID) const
return (get(formatID) != nullptr); return (get(formatID) != nullptr);
} }
ColorCopyFunction FastCopyFunctionMap::get(angle::FormatID formatID) const PixelCopyFunction FastCopyFunctionMap::get(angle::FormatID formatID) const
{ {
for (size_t index = 0; index < mSize; ++index) for (size_t index = 0; index < mSize; ++index)
{ {
...@@ -307,11 +307,11 @@ bool ShouldUseVirtualizedContexts(const egl::AttributeMap &attribs, bool default ...@@ -307,11 +307,11 @@ bool ShouldUseVirtualizedContexts(const egl::AttributeMap &attribs, bool default
void CopyImageCHROMIUM(const uint8_t *sourceData, void CopyImageCHROMIUM(const uint8_t *sourceData,
size_t sourceRowPitch, size_t sourceRowPitch,
size_t sourcePixelBytes, size_t sourcePixelBytes,
ColorReadFunction colorReadFunction, PixelReadFunction pixelReadFunction,
uint8_t *destData, uint8_t *destData,
size_t destRowPitch, size_t destRowPitch,
size_t destPixelBytes, size_t destPixelBytes,
ColorWriteFunction colorWriteFunction, PixelWriteFunction pixelWriteFunction,
GLenum destUnsizedFormat, GLenum destUnsizedFormat,
GLenum destComponentType, GLenum destComponentType,
size_t width, size_t width,
...@@ -363,7 +363,7 @@ void CopyImageCHROMIUM(const uint8_t *sourceData, ...@@ -363,7 +363,7 @@ void CopyImageCHROMIUM(const uint8_t *sourceData,
const uint8_t *sourcePixelData = sourceData + y * sourceRowPitch + x * sourcePixelBytes; const uint8_t *sourcePixelData = sourceData + y * sourceRowPitch + x * sourcePixelBytes;
gl::ColorF sourceColor; gl::ColorF sourceColor;
colorReadFunction(sourcePixelData, reinterpret_cast<uint8_t *>(&sourceColor)); pixelReadFunction(sourcePixelData, reinterpret_cast<uint8_t *>(&sourceColor));
conversionFunction(&sourceColor); conversionFunction(&sourceColor);
clipChannelsFunction(&sourceColor); clipChannelsFunction(&sourceColor);
...@@ -380,7 +380,7 @@ void CopyImageCHROMIUM(const uint8_t *sourceData, ...@@ -380,7 +380,7 @@ void CopyImageCHROMIUM(const uint8_t *sourceData,
} }
uint8_t *destPixelData = destData + destY * destRowPitch + x * destPixelBytes; uint8_t *destPixelData = destData + destY * destRowPitch + x * destPixelBytes;
writeFunction(sourceColor, colorWriteFunction, destPixelData); writeFunction(sourceColor, pixelWriteFunction, destPixelData);
} }
} }
} }
......
...@@ -122,9 +122,9 @@ using MipGenerationFunction = void (*)(size_t sourceWidth, ...@@ -122,9 +122,9 @@ using MipGenerationFunction = void (*)(size_t sourceWidth,
size_t destRowPitch, size_t destRowPitch,
size_t destDepthPitch); size_t destDepthPitch);
typedef void (*ColorReadFunction)(const uint8_t *source, uint8_t *dest); typedef void (*PixelReadFunction)(const uint8_t *source, uint8_t *dest);
typedef void (*ColorWriteFunction)(const uint8_t *source, uint8_t *dest); typedef void (*PixelWriteFunction)(const uint8_t *source, uint8_t *dest);
typedef void (*ColorCopyFunction)(const uint8_t *source, uint8_t *dest); typedef void (*PixelCopyFunction)(const uint8_t *source, uint8_t *dest);
class FastCopyFunctionMap class FastCopyFunctionMap
{ {
...@@ -132,7 +132,7 @@ class FastCopyFunctionMap ...@@ -132,7 +132,7 @@ class FastCopyFunctionMap
struct Entry struct Entry
{ {
angle::FormatID formatID; angle::FormatID formatID;
ColorCopyFunction func; PixelCopyFunction func;
}; };
constexpr FastCopyFunctionMap() : FastCopyFunctionMap(nullptr, 0) {} constexpr FastCopyFunctionMap() : FastCopyFunctionMap(nullptr, 0) {}
...@@ -140,7 +140,7 @@ class FastCopyFunctionMap ...@@ -140,7 +140,7 @@ class FastCopyFunctionMap
constexpr FastCopyFunctionMap(const Entry *data, size_t size) : mSize(size), mData(data) {} constexpr FastCopyFunctionMap(const Entry *data, size_t size) : mSize(size), mData(data) {}
bool has(angle::FormatID formatID) const; bool has(angle::FormatID formatID) const;
ColorCopyFunction get(angle::FormatID formatID) const; PixelCopyFunction get(angle::FormatID formatID) const;
private: private:
size_t mSize; size_t mSize;
...@@ -208,11 +208,11 @@ bool ShouldUseVirtualizedContexts(const egl::AttributeMap &attribs, bool default ...@@ -208,11 +208,11 @@ bool ShouldUseVirtualizedContexts(const egl::AttributeMap &attribs, bool default
void CopyImageCHROMIUM(const uint8_t *sourceData, void CopyImageCHROMIUM(const uint8_t *sourceData,
size_t sourceRowPitch, size_t sourceRowPitch,
size_t sourcePixelBytes, size_t sourcePixelBytes,
ColorReadFunction readFunction, PixelReadFunction pixelReadFunction,
uint8_t *destData, uint8_t *destData,
size_t destRowPitch, size_t destRowPitch,
size_t destPixelBytes, size_t destPixelBytes,
ColorWriteFunction colorWriteFunction, PixelWriteFunction pixelWriteFunction,
GLenum destUnsizedFormat, GLenum destUnsizedFormat,
GLenum destComponentType, GLenum destComponentType,
size_t width, size_t width,
......
...@@ -669,8 +669,8 @@ gl::Error TextureVk::copySubTextureImpl(ContextVk *contextVk, ...@@ -669,8 +669,8 @@ gl::Error TextureVk::copySubTextureImpl(ContextVk *contextVk,
GLuint destDataRowPitch = sourceArea.width * destAngleFormat.pixelBytes; GLuint destDataRowPitch = sourceArea.width * destAngleFormat.pixelBytes;
CopyImageCHROMIUM(sourceData, sourceDataRowPitch, sourceAngleFormat.pixelBytes, CopyImageCHROMIUM(sourceData, sourceDataRowPitch, sourceAngleFormat.pixelBytes,
sourceAngleFormat.colorReadFunction, destData, destDataRowPitch, sourceAngleFormat.pixelReadFunction, destData, destDataRowPitch,
destAngleFormat.pixelBytes, destAngleFormat.colorWriteFunction, destAngleFormat.pixelBytes, destAngleFormat.pixelWriteFunction,
destFormat.format, destFormat.componentType, sourceArea.width, destFormat.format, destFormat.componentType, sourceArea.width,
sourceArea.height, unpackFlipY, unpackPremultiplyAlpha, sourceArea.height, unpackFlipY, unpackPremultiplyAlpha,
unpackUnmultiplyAlpha); unpackUnmultiplyAlpha);
......
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