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() ...@@ -212,7 +212,7 @@ PackPixelsParams::PackPixelsParams()
outputPitch(0), outputPitch(0),
packBuffer(nullptr), packBuffer(nullptr),
offset(0), offset(0),
orientation(SurfaceRotationType::Identity) rotation(SurfaceRotation::Identity)
{} {}
PackPixelsParams::PackPixelsParams(const gl::Rectangle &areaIn, PackPixelsParams::PackPixelsParams(const gl::Rectangle &areaIn,
...@@ -227,7 +227,7 @@ PackPixelsParams::PackPixelsParams(const gl::Rectangle &areaIn, ...@@ -227,7 +227,7 @@ PackPixelsParams::PackPixelsParams(const gl::Rectangle &areaIn,
packBuffer(packBufferIn), packBuffer(packBufferIn),
reverseRowOrder(reverseRowOrderIn), reverseRowOrder(reverseRowOrderIn),
offset(offsetIn), offset(offsetIn),
orientation(SurfaceRotationType::Identity) rotation(SurfaceRotation::Identity)
{} {}
void PackPixels(const PackPixelsParams &params, void PackPixels(const PackPixelsParams &params,
...@@ -244,9 +244,9 @@ void PackPixels(const PackPixelsParams &params, ...@@ -244,9 +244,9 @@ void PackPixels(const PackPixelsParams &params,
int destHeight = params.area.height; int destHeight = params.area.height;
int xAxisPitch = 0; int xAxisPitch = 0;
int yAxisPitch = 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 // 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 // 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 // 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, ...@@ -266,7 +266,7 @@ void PackPixels(const PackPixelsParams &params,
yAxisPitch = inputPitchIn; yAxisPitch = inputPitchIn;
} }
break; break;
case SurfaceRotationType::Rotated90Degrees: case SurfaceRotation::Rotated90Degrees:
// The source image is rotated 90 degrees counter-clockwise. Y-flip is always applied // 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 // 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 // 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, ...@@ -277,7 +277,7 @@ void PackPixels(const PackPixelsParams &params,
destWidth = params.area.height; destWidth = params.area.height;
destHeight = params.area.width; destHeight = params.area.width;
break; break;
case SurfaceRotationType::Rotated180Degrees: case SurfaceRotation::Rotated180Degrees:
// The source image is rotated 180 degrees. Y-flip is always applied to rotated // 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 // 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. // 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, ...@@ -287,7 +287,7 @@ void PackPixels(const PackPixelsParams &params,
yAxisPitch = inputPitchIn; yAxisPitch = inputPitchIn;
source += sourceFormat.pixelBytes * (params.area.width - 1); source += sourceFormat.pixelBytes * (params.area.width - 1);
break; break;
case SurfaceRotationType::Rotated270Degrees: case SurfaceRotation::Rotated270Degrees:
// The source image is rotated 270 degrees counter-clockwise (or 90 degrees clockwise). // 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 // 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 // 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, ...@@ -306,7 +306,7 @@ void PackPixels(const PackPixelsParams &params,
break; break;
} }
if (params.orientation == SurfaceRotationType::Identity && sourceFormat == *params.destFormat) if (params.rotation == SurfaceRotation::Identity && sourceFormat == *params.destFormat)
{ {
// Direct copy possible // Direct copy possible
for (int y = 0; y < params.area.height; ++y) for (int y = 0; y < params.area.height; ++y)
......
...@@ -45,7 +45,7 @@ class ContextImpl; ...@@ -45,7 +45,7 @@ class ContextImpl;
// The possible rotations of the surface/draw framebuffer, particularly for the Vulkan back-end on // The possible rotations of the surface/draw framebuffer, particularly for the Vulkan back-end on
// Android. // Android.
enum class SurfaceRotationType enum class SurfaceRotation
{ {
Identity, Identity,
Rotated90Degrees, Rotated90Degrees,
...@@ -111,7 +111,7 @@ struct PackPixelsParams ...@@ -111,7 +111,7 @@ struct PackPixelsParams
gl::Buffer *packBuffer; gl::Buffer *packBuffer;
bool reverseRowOrder; bool reverseRowOrder;
ptrdiff_t offset; ptrdiff_t offset;
SurfaceRotationType orientation; SurfaceRotation rotation;
}; };
void PackPixels(const PackPixelsParams &params, void PackPixels(const PackPixelsParams &params,
......
...@@ -193,35 +193,35 @@ void ApplySampleCoverage(const gl::State &glState, ...@@ -193,35 +193,35 @@ void ApplySampleCoverage(const gl::State &glState,
// //
// Note: these are mat2's that are appropriately padded (4 floats per row). // Note: these are mat2's that are appropriately padded (4 floats per row).
using PreRotationMatrixValues = std::array<float, 8>; using PreRotationMatrixValues = std::array<float, 8>;
constexpr angle::PackedEnumMap<rx::SurfaceRotationType, constexpr angle::PackedEnumMap<rx::SurfaceRotation,
PreRotationMatrixValues, PreRotationMatrixValues,
angle::EnumSize<rx::SurfaceRotationType>()> angle::EnumSize<rx::SurfaceRotation>()>
kPreRotationMatrices = { kPreRotationMatrices = {
{{rx::SurfaceRotationType::Identity, {{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f}}}, {{rx::SurfaceRotation::Identity, {{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f}}},
{rx::SurfaceRotationType::Rotated90Degrees, {rx::SurfaceRotation::Rotated90Degrees,
{{0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f}}}, {{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}}}, {{-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}}}, {{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}}}, {{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}}}, {{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}}}, {{-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}}}}}; {{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) || return ((rotation == SurfaceRotation::Rotated90Degrees) ||
(rotation == SurfaceRotationType::Rotated270Degrees) || (rotation == SurfaceRotation::Rotated270Degrees) ||
(rotation == SurfaceRotationType::FlippedRotated90Degrees) || (rotation == SurfaceRotation::FlippedRotated90Degrees) ||
(rotation == SurfaceRotationType::FlippedRotated270Degrees)); (rotation == SurfaceRotation::FlippedRotated270Degrees));
} }
SurfaceRotationType DetermineSurfaceRotation(gl::Framebuffer *framebuffer, SurfaceRotation DetermineSurfaceRotation(gl::Framebuffer *framebuffer,
WindowSurfaceVk *windowSurface) WindowSurfaceVk *windowSurface)
{ {
if (windowSurface && framebuffer->isDefault()) if (windowSurface && framebuffer->isDefault())
...@@ -230,29 +230,29 @@ SurfaceRotationType DetermineSurfaceRotation(gl::Framebuffer *framebuffer, ...@@ -230,29 +230,29 @@ SurfaceRotationType DetermineSurfaceRotation(gl::Framebuffer *framebuffer,
{ {
case VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR: case VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR:
// Do not rotate gl_Position (surface matches the device's orientation): // 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: case VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR:
// Rotate gl_Position 90 degrees: // Rotate gl_Position 90 degrees:
return SurfaceRotationType::Rotated90Degrees; return SurfaceRotation::Rotated90Degrees;
case VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR: case VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR:
// Rotate gl_Position 180 degrees: // Rotate gl_Position 180 degrees:
return SurfaceRotationType::Rotated180Degrees; return SurfaceRotation::Rotated180Degrees;
case VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR: case VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR:
// Rotate gl_Position 270 degrees: // Rotate gl_Position 270 degrees:
return SurfaceRotationType::Rotated270Degrees; return SurfaceRotation::Rotated270Degrees;
default: default:
UNREACHABLE(); UNREACHABLE();
return SurfaceRotationType::Identity; return SurfaceRotation::Identity;
} }
} }
else else
{ {
// Do not rotate gl_Position (offscreen framebuffer): // 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 bool flipY,
const int framebufferWidth, const int framebufferWidth,
const int framebufferHeight, const int framebufferHeight,
...@@ -262,28 +262,28 @@ void RotateRectangle(const SurfaceRotationType rotation, ...@@ -262,28 +262,28 @@ void RotateRectangle(const SurfaceRotationType rotation,
// GLES's y-axis points up; Vulkan's points down. // GLES's y-axis points up; Vulkan's points down.
switch (rotation) switch (rotation)
{ {
case SurfaceRotationType::Identity: case SurfaceRotation::Identity:
// Do not rotate gl_Position (surface matches the device's orientation): // Do not rotate gl_Position (surface matches the device's orientation):
outgoing->x = incoming.x; outgoing->x = incoming.x;
outgoing->y = flipY ? framebufferHeight - incoming.y - incoming.height : incoming.y; outgoing->y = flipY ? framebufferHeight - incoming.y - incoming.height : incoming.y;
outgoing->width = incoming.width; outgoing->width = incoming.width;
outgoing->height = incoming.height; outgoing->height = incoming.height;
break; break;
case SurfaceRotationType::Rotated90Degrees: case SurfaceRotation::Rotated90Degrees:
// Rotate gl_Position 90 degrees: // Rotate gl_Position 90 degrees:
outgoing->x = incoming.y; outgoing->x = incoming.y;
outgoing->y = flipY ? incoming.x : framebufferWidth - incoming.x - incoming.width; outgoing->y = flipY ? incoming.x : framebufferWidth - incoming.x - incoming.width;
outgoing->width = incoming.height; outgoing->width = incoming.height;
outgoing->height = incoming.width; outgoing->height = incoming.width;
break; break;
case SurfaceRotationType::Rotated180Degrees: case SurfaceRotation::Rotated180Degrees:
// Rotate gl_Position 180 degrees: // Rotate gl_Position 180 degrees:
outgoing->x = framebufferWidth - incoming.x - incoming.width; outgoing->x = framebufferWidth - incoming.x - incoming.width;
outgoing->y = flipY ? incoming.y : framebufferHeight - incoming.y - incoming.height; outgoing->y = flipY ? incoming.y : framebufferHeight - incoming.y - incoming.height;
outgoing->width = incoming.width; outgoing->width = incoming.width;
outgoing->height = incoming.height; outgoing->height = incoming.height;
break; break;
case SurfaceRotationType::Rotated270Degrees: case SurfaceRotation::Rotated270Degrees:
// Rotate gl_Position 270 degrees: // Rotate gl_Position 270 degrees:
outgoing->x = framebufferHeight - incoming.y - incoming.height; outgoing->x = framebufferHeight - incoming.y - incoming.height;
outgoing->y = flipY ? framebufferWidth - incoming.x - incoming.width : incoming.x; outgoing->y = flipY ? framebufferWidth - incoming.x - incoming.width : incoming.x;
...@@ -622,8 +622,8 @@ ContextVk::ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk ...@@ -622,8 +622,8 @@ ContextVk::ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk
mCurrentComputePipeline(nullptr), mCurrentComputePipeline(nullptr),
mCurrentDrawMode(gl::PrimitiveMode::InvalidEnum), mCurrentDrawMode(gl::PrimitiveMode::InvalidEnum),
mCurrentWindowSurface(nullptr), mCurrentWindowSurface(nullptr),
mCurrentRotationDrawFramebuffer(SurfaceRotationType::Identity), mCurrentRotationDrawFramebuffer(SurfaceRotation::Identity),
mCurrentRotationReadFramebuffer(SurfaceRotationType::Identity), mCurrentRotationReadFramebuffer(SurfaceRotation::Identity),
mVertexArray(nullptr), mVertexArray(nullptr),
mDrawFramebuffer(nullptr), mDrawFramebuffer(nullptr),
mProgram(nullptr), mProgram(nullptr),
...@@ -2422,12 +2422,12 @@ bool ContextVk::isRotatedAspectRatioForReadFBO() const ...@@ -2422,12 +2422,12 @@ bool ContextVk::isRotatedAspectRatioForReadFBO() const
return IsRotatedAspectRatio(mCurrentRotationReadFramebuffer); return IsRotatedAspectRatio(mCurrentRotationReadFramebuffer);
} }
SurfaceRotationType ContextVk::getRotationDrawFramebuffer() const SurfaceRotation ContextVk::getRotationDrawFramebuffer() const
{ {
return mCurrentRotationDrawFramebuffer; return mCurrentRotationDrawFramebuffer;
} }
SurfaceRotationType ContextVk::getRotationReadFramebuffer() const SurfaceRotation ContextVk::getRotationReadFramebuffer() const
{ {
return mCurrentRotationReadFramebuffer; return mCurrentRotationReadFramebuffer;
} }
......
...@@ -211,8 +211,8 @@ class ContextVk : public ContextImpl, public vk::Context ...@@ -211,8 +211,8 @@ class ContextVk : public ContextImpl, public vk::Context
// render area must be swapped. // render area must be swapped.
bool isRotatedAspectRatioForDrawFBO() const; bool isRotatedAspectRatioForDrawFBO() const;
bool isRotatedAspectRatioForReadFBO() const; bool isRotatedAspectRatioForReadFBO() const;
SurfaceRotationType getRotationDrawFramebuffer() const; SurfaceRotation getRotationDrawFramebuffer() const;
SurfaceRotationType getRotationReadFramebuffer() const; SurfaceRotation getRotationReadFramebuffer() const;
void invalidateProgramBindingHelper(const gl::State &glState); void invalidateProgramBindingHelper(const gl::State &glState);
angle::Result invalidateProgramExecutableHelper(const gl::Context *context); angle::Result invalidateProgramExecutableHelper(const gl::Context *context);
...@@ -801,8 +801,8 @@ class ContextVk : public ContextImpl, public vk::Context ...@@ -801,8 +801,8 @@ class ContextVk : public ContextImpl, public vk::Context
WindowSurfaceVk *mCurrentWindowSurface; WindowSurfaceVk *mCurrentWindowSurface;
// Records the current rotation of the surface (draw/read) framebuffer, derived from // Records the current rotation of the surface (draw/read) framebuffer, derived from
// mCurrentWindowSurface->getPreTransform(). // mCurrentWindowSurface->getPreTransform().
SurfaceRotationType mCurrentRotationDrawFramebuffer; SurfaceRotation mCurrentRotationDrawFramebuffer;
SurfaceRotationType mCurrentRotationReadFramebuffer; SurfaceRotation mCurrentRotationReadFramebuffer;
// Keep a cached pipeline description structure that can be used to query the pipeline cache. // 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. // 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, ...@@ -471,29 +471,29 @@ angle::Result FramebufferVk::readPixels(const gl::Context *context,
&outputSkipBytes)); &outputSkipBytes));
bool flipY = contextVk->isViewportFlipEnabledForReadFBO(); 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): // Do not rotate gl_Position (surface matches the device's orientation):
if (flipY) if (flipY)
{ {
params.area.y = fbRect.height - clippedArea.y - clippedArea.height; params.area.y = fbRect.height - clippedArea.y - clippedArea.height;
} }
break; break;
case SurfaceRotationType::Rotated90Degrees: case SurfaceRotation::Rotated90Degrees:
// Rotate gl_Position 90 degrees: // Rotate gl_Position 90 degrees:
params.area.x = clippedArea.y; params.area.x = clippedArea.y;
params.area.y = params.area.y =
flipY ? clippedArea.x : fbRect.width - clippedArea.x - clippedArea.width; flipY ? clippedArea.x : fbRect.width - clippedArea.x - clippedArea.width;
std::swap(params.area.width, params.area.height); std::swap(params.area.width, params.area.height);
break; break;
case SurfaceRotationType::Rotated180Degrees: case SurfaceRotation::Rotated180Degrees:
// Rotate gl_Position 180 degrees: // Rotate gl_Position 180 degrees:
params.area.x = fbRect.width - clippedArea.x - clippedArea.width; params.area.x = fbRect.width - clippedArea.x - clippedArea.width;
params.area.y = params.area.y =
flipY ? clippedArea.y : fbRect.height - clippedArea.y - clippedArea.height; flipY ? clippedArea.y : fbRect.height - clippedArea.y - clippedArea.height;
break; break;
case SurfaceRotationType::Rotated270Degrees: case SurfaceRotation::Rotated270Degrees:
// Rotate gl_Position 270 degrees: // Rotate gl_Position 270 degrees:
params.area.x = fbRect.height - clippedArea.y - clippedArea.height; params.area.x = fbRect.height - clippedArea.y - clippedArea.height;
params.area.y = 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