Commit d0146e07 by Ian Elliott Committed by Commit Bot

Vulkan: Rename SurfaceRotationType to SurfaceRotation

Follow-on CL per request in https://chromium-review.googlesource.com/c/angle/angle/+/2191425/3/src/libANGLE/renderer/renderer_utils.h#48 Bug: angleproject:4436 Change-Id: I2ee8c65a0dbcf2eee4c9c7f4252abf16a578cad3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2197614 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent c4734bf6
......@@ -212,7 +212,7 @@ PackPixelsParams::PackPixelsParams()
outputPitch(0),
packBuffer(nullptr),
offset(0),
orientation(SurfaceRotationType::Identity)
rotation(SurfaceRotation::Identity)
{}
PackPixelsParams::PackPixelsParams(const gl::Rectangle &areaIn,
......@@ -227,7 +227,7 @@ PackPixelsParams::PackPixelsParams(const gl::Rectangle &areaIn,
packBuffer(packBufferIn),
reverseRowOrder(reverseRowOrderIn),
offset(offsetIn),
orientation(SurfaceRotationType::Identity)
rotation(SurfaceRotation::Identity)
{}
void PackPixels(const PackPixelsParams &params,
......@@ -244,9 +244,9 @@ void PackPixels(const PackPixelsParams &params,
int destHeight = params.area.height;
int xAxisPitch = 0;
int yAxisPitch = 0;
switch (params.orientation)
switch (params.rotation)
{
case SurfaceRotationType::Identity:
case SurfaceRotation::Identity:
// The source image is not rotated (i.e. matches the device's orientation), and may or
// may not be y-flipped. The image is row-major. Each source row (one step along the
// y-axis for each step in the dest y-axis) is inputPitch past the previous row. Along
......@@ -266,7 +266,7 @@ void PackPixels(const PackPixelsParams &params,
yAxisPitch = inputPitchIn;
}
break;
case SurfaceRotationType::Rotated90Degrees:
case SurfaceRotation::Rotated90Degrees:
// The source image is rotated 90 degrees counter-clockwise. Y-flip is always applied
// to rotated images. The image is column-major. Each source column (one step along
// the source x-axis for each step in the dest y-axis) is inputPitch past the previous
......@@ -277,7 +277,7 @@ void PackPixels(const PackPixelsParams &params,
destWidth = params.area.height;
destHeight = params.area.width;
break;
case SurfaceRotationType::Rotated180Degrees:
case SurfaceRotation::Rotated180Degrees:
// The source image is rotated 180 degrees. Y-flip is always applied to rotated
// images. The image is row-major, but upside down. Each source row (one step along
// the y-axis for each step in the dest y-axis) is inputPitch after the previous row.
......@@ -287,7 +287,7 @@ void PackPixels(const PackPixelsParams &params,
yAxisPitch = inputPitchIn;
source += sourceFormat.pixelBytes * (params.area.width - 1);
break;
case SurfaceRotationType::Rotated270Degrees:
case SurfaceRotation::Rotated270Degrees:
// The source image is rotated 270 degrees counter-clockwise (or 90 degrees clockwise).
// Y-flip is always applied to rotated images. The image is column-major, where each
// column (one step in the source x-axis for one step in the dest y-axis) is inputPitch
......@@ -306,7 +306,7 @@ void PackPixels(const PackPixelsParams &params,
break;
}
if (params.orientation == SurfaceRotationType::Identity && sourceFormat == *params.destFormat)
if (params.rotation == SurfaceRotation::Identity && sourceFormat == *params.destFormat)
{
// Direct copy possible
for (int y = 0; y < params.area.height; ++y)
......
......@@ -45,7 +45,7 @@ class ContextImpl;
// The possible rotations of the surface/draw framebuffer, particularly for the Vulkan back-end on
// Android.
enum class SurfaceRotationType
enum class SurfaceRotation
{
Identity,
Rotated90Degrees,
......@@ -111,7 +111,7 @@ struct PackPixelsParams
gl::Buffer *packBuffer;
bool reverseRowOrder;
ptrdiff_t offset;
SurfaceRotationType orientation;
SurfaceRotation rotation;
};
void PackPixels(const PackPixelsParams &params,
......
......@@ -193,36 +193,36 @@ void ApplySampleCoverage(const gl::State &glState,
//
// Note: these are mat2's that are appropriately padded (4 floats per row).
using PreRotationMatrixValues = std::array<float, 8>;
constexpr angle::PackedEnumMap<rx::SurfaceRotationType,
constexpr angle::PackedEnumMap<rx::SurfaceRotation,
PreRotationMatrixValues,
angle::EnumSize<rx::SurfaceRotationType>()>
angle::EnumSize<rx::SurfaceRotation>()>
kPreRotationMatrices = {
{{rx::SurfaceRotationType::Identity, {{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f}}},
{rx::SurfaceRotationType::Rotated90Degrees,
{{rx::SurfaceRotation::Identity, {{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f}}},
{rx::SurfaceRotation::Rotated90Degrees,
{{0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f}}},
{rx::SurfaceRotationType::Rotated180Degrees,
{rx::SurfaceRotation::Rotated180Degrees,
{{-1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f}}},
{rx::SurfaceRotationType::Rotated270Degrees,
{rx::SurfaceRotation::Rotated270Degrees,
{{0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f}}},
{rx::SurfaceRotationType::FlippedIdentity,
{rx::SurfaceRotation::FlippedIdentity,
{{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f}}},
{rx::SurfaceRotationType::FlippedRotated90Degrees,
{rx::SurfaceRotation::FlippedRotated90Degrees,
{{0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f}}},
{rx::SurfaceRotationType::FlippedRotated180Degrees,
{rx::SurfaceRotation::FlippedRotated180Degrees,
{{-1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f}}},
{rx::SurfaceRotationType::FlippedRotated270Degrees,
{rx::SurfaceRotation::FlippedRotated270Degrees,
{{0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f}}}}};
bool IsRotatedAspectRatio(SurfaceRotationType rotation)
bool IsRotatedAspectRatio(SurfaceRotation rotation)
{
return ((rotation == SurfaceRotationType::Rotated90Degrees) ||
(rotation == SurfaceRotationType::Rotated270Degrees) ||
(rotation == SurfaceRotationType::FlippedRotated90Degrees) ||
(rotation == SurfaceRotationType::FlippedRotated270Degrees));
return ((rotation == SurfaceRotation::Rotated90Degrees) ||
(rotation == SurfaceRotation::Rotated270Degrees) ||
(rotation == SurfaceRotation::FlippedRotated90Degrees) ||
(rotation == SurfaceRotation::FlippedRotated270Degrees));
}
SurfaceRotationType DetermineSurfaceRotation(gl::Framebuffer *framebuffer,
WindowSurfaceVk *windowSurface)
SurfaceRotation DetermineSurfaceRotation(gl::Framebuffer *framebuffer,
WindowSurfaceVk *windowSurface)
{
if (windowSurface && framebuffer->isDefault())
{
......@@ -230,29 +230,29 @@ SurfaceRotationType DetermineSurfaceRotation(gl::Framebuffer *framebuffer,
{
case VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR:
// Do not rotate gl_Position (surface matches the device's orientation):
return SurfaceRotationType::Identity;
return SurfaceRotation::Identity;
case VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR:
// Rotate gl_Position 90 degrees:
return SurfaceRotationType::Rotated90Degrees;
return SurfaceRotation::Rotated90Degrees;
case VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR:
// Rotate gl_Position 180 degrees:
return SurfaceRotationType::Rotated180Degrees;
return SurfaceRotation::Rotated180Degrees;
case VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR:
// Rotate gl_Position 270 degrees:
return SurfaceRotationType::Rotated270Degrees;
return SurfaceRotation::Rotated270Degrees;
default:
UNREACHABLE();
return SurfaceRotationType::Identity;
return SurfaceRotation::Identity;
}
}
else
{
// Do not rotate gl_Position (offscreen framebuffer):
return SurfaceRotationType::Identity;
return SurfaceRotation::Identity;
}
}
void RotateRectangle(const SurfaceRotationType rotation,
void RotateRectangle(const SurfaceRotation rotation,
const bool flipY,
const int framebufferWidth,
const int framebufferHeight,
......@@ -262,28 +262,28 @@ void RotateRectangle(const SurfaceRotationType rotation,
// GLES's y-axis points up; Vulkan's points down.
switch (rotation)
{
case SurfaceRotationType::Identity:
case SurfaceRotation::Identity:
// Do not rotate gl_Position (surface matches the device's orientation):
outgoing->x = incoming.x;
outgoing->y = flipY ? framebufferHeight - incoming.y - incoming.height : incoming.y;
outgoing->width = incoming.width;
outgoing->height = incoming.height;
break;
case SurfaceRotationType::Rotated90Degrees:
case SurfaceRotation::Rotated90Degrees:
// Rotate gl_Position 90 degrees:
outgoing->x = incoming.y;
outgoing->y = flipY ? incoming.x : framebufferWidth - incoming.x - incoming.width;
outgoing->width = incoming.height;
outgoing->height = incoming.width;
break;
case SurfaceRotationType::Rotated180Degrees:
case SurfaceRotation::Rotated180Degrees:
// Rotate gl_Position 180 degrees:
outgoing->x = framebufferWidth - incoming.x - incoming.width;
outgoing->y = flipY ? incoming.y : framebufferHeight - incoming.y - incoming.height;
outgoing->width = incoming.width;
outgoing->height = incoming.height;
break;
case SurfaceRotationType::Rotated270Degrees:
case SurfaceRotation::Rotated270Degrees:
// Rotate gl_Position 270 degrees:
outgoing->x = framebufferHeight - incoming.y - incoming.height;
outgoing->y = flipY ? framebufferWidth - incoming.x - incoming.width : incoming.x;
......@@ -622,8 +622,8 @@ ContextVk::ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk
mCurrentComputePipeline(nullptr),
mCurrentDrawMode(gl::PrimitiveMode::InvalidEnum),
mCurrentWindowSurface(nullptr),
mCurrentRotationDrawFramebuffer(SurfaceRotationType::Identity),
mCurrentRotationReadFramebuffer(SurfaceRotationType::Identity),
mCurrentRotationDrawFramebuffer(SurfaceRotation::Identity),
mCurrentRotationReadFramebuffer(SurfaceRotation::Identity),
mVertexArray(nullptr),
mDrawFramebuffer(nullptr),
mProgram(nullptr),
......@@ -2422,12 +2422,12 @@ bool ContextVk::isRotatedAspectRatioForReadFBO() const
return IsRotatedAspectRatio(mCurrentRotationReadFramebuffer);
}
SurfaceRotationType ContextVk::getRotationDrawFramebuffer() const
SurfaceRotation ContextVk::getRotationDrawFramebuffer() const
{
return mCurrentRotationDrawFramebuffer;
}
SurfaceRotationType ContextVk::getRotationReadFramebuffer() const
SurfaceRotation ContextVk::getRotationReadFramebuffer() const
{
return mCurrentRotationReadFramebuffer;
}
......
......@@ -211,8 +211,8 @@ class ContextVk : public ContextImpl, public vk::Context
// render area must be swapped.
bool isRotatedAspectRatioForDrawFBO() const;
bool isRotatedAspectRatioForReadFBO() const;
SurfaceRotationType getRotationDrawFramebuffer() const;
SurfaceRotationType getRotationReadFramebuffer() const;
SurfaceRotation getRotationDrawFramebuffer() const;
SurfaceRotation getRotationReadFramebuffer() const;
void invalidateProgramBindingHelper(const gl::State &glState);
angle::Result invalidateProgramExecutableHelper(const gl::Context *context);
......@@ -801,8 +801,8 @@ class ContextVk : public ContextImpl, public vk::Context
WindowSurfaceVk *mCurrentWindowSurface;
// Records the current rotation of the surface (draw/read) framebuffer, derived from
// mCurrentWindowSurface->getPreTransform().
SurfaceRotationType mCurrentRotationDrawFramebuffer;
SurfaceRotationType mCurrentRotationReadFramebuffer;
SurfaceRotation mCurrentRotationDrawFramebuffer;
SurfaceRotation mCurrentRotationReadFramebuffer;
// Keep a cached pipeline description structure that can be used to query the pipeline cache.
// Kept in a pointer so allocations can be aligned, and structs can be portably packed.
......
......@@ -471,29 +471,29 @@ angle::Result FramebufferVk::readPixels(const gl::Context *context,
&outputSkipBytes));
bool flipY = contextVk->isViewportFlipEnabledForReadFBO();
switch (params.orientation = contextVk->getRotationReadFramebuffer())
switch (params.rotation = contextVk->getRotationReadFramebuffer())
{
case SurfaceRotationType::Identity:
case SurfaceRotation::Identity:
// Do not rotate gl_Position (surface matches the device's orientation):
if (flipY)
{
params.area.y = fbRect.height - clippedArea.y - clippedArea.height;
}
break;
case SurfaceRotationType::Rotated90Degrees:
case SurfaceRotation::Rotated90Degrees:
// Rotate gl_Position 90 degrees:
params.area.x = clippedArea.y;
params.area.y =
flipY ? clippedArea.x : fbRect.width - clippedArea.x - clippedArea.width;
std::swap(params.area.width, params.area.height);
break;
case SurfaceRotationType::Rotated180Degrees:
case SurfaceRotation::Rotated180Degrees:
// Rotate gl_Position 180 degrees:
params.area.x = fbRect.width - clippedArea.x - clippedArea.width;
params.area.y =
flipY ? clippedArea.y : fbRect.height - clippedArea.y - clippedArea.height;
break;
case SurfaceRotationType::Rotated270Degrees:
case SurfaceRotation::Rotated270Degrees:
// Rotate gl_Position 270 degrees:
params.area.x = fbRect.height - clippedArea.y - clippedArea.height;
params.area.y =
......
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