Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d0146e0

Browse files
ianelliottusCommit Bot
authored andcommitted
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 <[email protected]> Reviewed-by: Jamie Madill <[email protected]>
1 parent c4734bf commit d0146e0

File tree

5 files changed

+51
-51
lines changed

5 files changed

+51
-51
lines changed

src/libANGLE/renderer/renderer_utils.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ PackPixelsParams::PackPixelsParams()
212212
outputPitch(0),
213213
packBuffer(nullptr),
214214
offset(0),
215-
orientation(SurfaceRotationType::Identity)
215+
rotation(SurfaceRotation::Identity)
216216
{}
217217

218218
PackPixelsParams::PackPixelsParams(const gl::Rectangle &areaIn,
@@ -227,7 +227,7 @@ PackPixelsParams::PackPixelsParams(const gl::Rectangle &areaIn,
227227
packBuffer(packBufferIn),
228228
reverseRowOrder(reverseRowOrderIn),
229229
offset(offsetIn),
230-
orientation(SurfaceRotationType::Identity)
230+
rotation(SurfaceRotation::Identity)
231231
{}
232232

233233
void PackPixels(const PackPixelsParams &params,
@@ -244,9 +244,9 @@ void PackPixels(const PackPixelsParams &params,
244244
int destHeight = params.area.height;
245245
int xAxisPitch = 0;
246246
int yAxisPitch = 0;
247-
switch (params.orientation)
247+
switch (params.rotation)
248248
{
249-
case SurfaceRotationType::Identity:
249+
case SurfaceRotation::Identity:
250250
// The source image is not rotated (i.e. matches the device's orientation), and may or
251251
// may not be y-flipped. The image is row-major. Each source row (one step along the
252252
// 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,
266266
yAxisPitch = inputPitchIn;
267267
}
268268
break;
269-
case SurfaceRotationType::Rotated90Degrees:
269+
case SurfaceRotation::Rotated90Degrees:
270270
// The source image is rotated 90 degrees counter-clockwise. Y-flip is always applied
271271
// to rotated images. The image is column-major. Each source column (one step along
272272
// 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,
277277
destWidth = params.area.height;
278278
destHeight = params.area.width;
279279
break;
280-
case SurfaceRotationType::Rotated180Degrees:
280+
case SurfaceRotation::Rotated180Degrees:
281281
// The source image is rotated 180 degrees. Y-flip is always applied to rotated
282282
// images. The image is row-major, but upside down. Each source row (one step along
283283
// 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,
287287
yAxisPitch = inputPitchIn;
288288
source += sourceFormat.pixelBytes * (params.area.width - 1);
289289
break;
290-
case SurfaceRotationType::Rotated270Degrees:
290+
case SurfaceRotation::Rotated270Degrees:
291291
// The source image is rotated 270 degrees counter-clockwise (or 90 degrees clockwise).
292292
// Y-flip is always applied to rotated images. The image is column-major, where each
293293
// 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,
306306
break;
307307
}
308308

309-
if (params.orientation == SurfaceRotationType::Identity && sourceFormat == *params.destFormat)
309+
if (params.rotation == SurfaceRotation::Identity && sourceFormat == *params.destFormat)
310310
{
311311
// Direct copy possible
312312
for (int y = 0; y < params.area.height; ++y)

src/libANGLE/renderer/renderer_utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ContextImpl;
4545

4646
// The possible rotations of the surface/draw framebuffer, particularly for the Vulkan back-end on
4747
// Android.
48-
enum class SurfaceRotationType
48+
enum class SurfaceRotation
4949
{
5050
Identity,
5151
Rotated90Degrees,
@@ -111,7 +111,7 @@ struct PackPixelsParams
111111
gl::Buffer *packBuffer;
112112
bool reverseRowOrder;
113113
ptrdiff_t offset;
114-
SurfaceRotationType orientation;
114+
SurfaceRotation rotation;
115115
};
116116

117117
void PackPixels(const PackPixelsParams &params,

src/libANGLE/renderer/vulkan/ContextVk.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -193,66 +193,66 @@ void ApplySampleCoverage(const gl::State &glState,
193193
//
194194
// Note: these are mat2's that are appropriately padded (4 floats per row).
195195
using PreRotationMatrixValues = std::array<float, 8>;
196-
constexpr angle::PackedEnumMap<rx::SurfaceRotationType,
196+
constexpr angle::PackedEnumMap<rx::SurfaceRotation,
197197
PreRotationMatrixValues,
198-
angle::EnumSize<rx::SurfaceRotationType>()>
198+
angle::EnumSize<rx::SurfaceRotation>()>
199199
kPreRotationMatrices = {
200-
{{rx::SurfaceRotationType::Identity, {{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f}}},
201-
{rx::SurfaceRotationType::Rotated90Degrees,
200+
{{rx::SurfaceRotation::Identity, {{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f}}},
201+
{rx::SurfaceRotation::Rotated90Degrees,
202202
{{0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f}}},
203-
{rx::SurfaceRotationType::Rotated180Degrees,
203+
{rx::SurfaceRotation::Rotated180Degrees,
204204
{{-1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f}}},
205-
{rx::SurfaceRotationType::Rotated270Degrees,
205+
{rx::SurfaceRotation::Rotated270Degrees,
206206
{{0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f}}},
207-
{rx::SurfaceRotationType::FlippedIdentity,
207+
{rx::SurfaceRotation::FlippedIdentity,
208208
{{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f}}},
209-
{rx::SurfaceRotationType::FlippedRotated90Degrees,
209+
{rx::SurfaceRotation::FlippedRotated90Degrees,
210210
{{0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f}}},
211-
{rx::SurfaceRotationType::FlippedRotated180Degrees,
211+
{rx::SurfaceRotation::FlippedRotated180Degrees,
212212
{{-1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f}}},
213-
{rx::SurfaceRotationType::FlippedRotated270Degrees,
213+
{rx::SurfaceRotation::FlippedRotated270Degrees,
214214
{{0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f}}}}};
215215

216-
bool IsRotatedAspectRatio(SurfaceRotationType rotation)
216+
bool IsRotatedAspectRatio(SurfaceRotation rotation)
217217
{
218-
return ((rotation == SurfaceRotationType::Rotated90Degrees) ||
219-
(rotation == SurfaceRotationType::Rotated270Degrees) ||
220-
(rotation == SurfaceRotationType::FlippedRotated90Degrees) ||
221-
(rotation == SurfaceRotationType::FlippedRotated270Degrees));
218+
return ((rotation == SurfaceRotation::Rotated90Degrees) ||
219+
(rotation == SurfaceRotation::Rotated270Degrees) ||
220+
(rotation == SurfaceRotation::FlippedRotated90Degrees) ||
221+
(rotation == SurfaceRotation::FlippedRotated270Degrees));
222222
}
223223

224-
SurfaceRotationType DetermineSurfaceRotation(gl::Framebuffer *framebuffer,
225-
WindowSurfaceVk *windowSurface)
224+
SurfaceRotation DetermineSurfaceRotation(gl::Framebuffer *framebuffer,
225+
WindowSurfaceVk *windowSurface)
226226
{
227227
if (windowSurface && framebuffer->isDefault())
228228
{
229229
switch (windowSurface->getPreTransform())
230230
{
231231
case VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR:
232232
// Do not rotate gl_Position (surface matches the device's orientation):
233-
return SurfaceRotationType::Identity;
233+
return SurfaceRotation::Identity;
234234
case VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR:
235235
// Rotate gl_Position 90 degrees:
236-
return SurfaceRotationType::Rotated90Degrees;
236+
return SurfaceRotation::Rotated90Degrees;
237237
case VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR:
238238
// Rotate gl_Position 180 degrees:
239-
return SurfaceRotationType::Rotated180Degrees;
239+
return SurfaceRotation::Rotated180Degrees;
240240
case VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR:
241241
// Rotate gl_Position 270 degrees:
242-
return SurfaceRotationType::Rotated270Degrees;
242+
return SurfaceRotation::Rotated270Degrees;
243243
default:
244244
UNREACHABLE();
245-
return SurfaceRotationType::Identity;
245+
return SurfaceRotation::Identity;
246246
}
247247
}
248248
else
249249
{
250250
// Do not rotate gl_Position (offscreen framebuffer):
251-
return SurfaceRotationType::Identity;
251+
return SurfaceRotation::Identity;
252252
}
253253
}
254254

255-
void RotateRectangle(const SurfaceRotationType rotation,
255+
void RotateRectangle(const SurfaceRotation rotation,
256256
const bool flipY,
257257
const int framebufferWidth,
258258
const int framebufferHeight,
@@ -262,28 +262,28 @@ void RotateRectangle(const SurfaceRotationType rotation,
262262
// GLES's y-axis points up; Vulkan's points down.
263263
switch (rotation)
264264
{
265-
case SurfaceRotationType::Identity:
265+
case SurfaceRotation::Identity:
266266
// Do not rotate gl_Position (surface matches the device's orientation):
267267
outgoing->x = incoming.x;
268268
outgoing->y = flipY ? framebufferHeight - incoming.y - incoming.height : incoming.y;
269269
outgoing->width = incoming.width;
270270
outgoing->height = incoming.height;
271271
break;
272-
case SurfaceRotationType::Rotated90Degrees:
272+
case SurfaceRotation::Rotated90Degrees:
273273
// Rotate gl_Position 90 degrees:
274274
outgoing->x = incoming.y;
275275
outgoing->y = flipY ? incoming.x : framebufferWidth - incoming.x - incoming.width;
276276
outgoing->width = incoming.height;
277277
outgoing->height = incoming.width;
278278
break;
279-
case SurfaceRotationType::Rotated180Degrees:
279+
case SurfaceRotation::Rotated180Degrees:
280280
// Rotate gl_Position 180 degrees:
281281
outgoing->x = framebufferWidth - incoming.x - incoming.width;
282282
outgoing->y = flipY ? incoming.y : framebufferHeight - incoming.y - incoming.height;
283283
outgoing->width = incoming.width;
284284
outgoing->height = incoming.height;
285285
break;
286-
case SurfaceRotationType::Rotated270Degrees:
286+
case SurfaceRotation::Rotated270Degrees:
287287
// Rotate gl_Position 270 degrees:
288288
outgoing->x = framebufferHeight - incoming.y - incoming.height;
289289
outgoing->y = flipY ? framebufferWidth - incoming.x - incoming.width : incoming.x;
@@ -622,8 +622,8 @@ ContextVk::ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk
622622
mCurrentComputePipeline(nullptr),
623623
mCurrentDrawMode(gl::PrimitiveMode::InvalidEnum),
624624
mCurrentWindowSurface(nullptr),
625-
mCurrentRotationDrawFramebuffer(SurfaceRotationType::Identity),
626-
mCurrentRotationReadFramebuffer(SurfaceRotationType::Identity),
625+
mCurrentRotationDrawFramebuffer(SurfaceRotation::Identity),
626+
mCurrentRotationReadFramebuffer(SurfaceRotation::Identity),
627627
mVertexArray(nullptr),
628628
mDrawFramebuffer(nullptr),
629629
mProgram(nullptr),
@@ -2422,12 +2422,12 @@ bool ContextVk::isRotatedAspectRatioForReadFBO() const
24222422
return IsRotatedAspectRatio(mCurrentRotationReadFramebuffer);
24232423
}
24242424

2425-
SurfaceRotationType ContextVk::getRotationDrawFramebuffer() const
2425+
SurfaceRotation ContextVk::getRotationDrawFramebuffer() const
24262426
{
24272427
return mCurrentRotationDrawFramebuffer;
24282428
}
24292429

2430-
SurfaceRotationType ContextVk::getRotationReadFramebuffer() const
2430+
SurfaceRotation ContextVk::getRotationReadFramebuffer() const
24312431
{
24322432
return mCurrentRotationReadFramebuffer;
24332433
}

src/libANGLE/renderer/vulkan/ContextVk.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ class ContextVk : public ContextImpl, public vk::Context
211211
// render area must be swapped.
212212
bool isRotatedAspectRatioForDrawFBO() const;
213213
bool isRotatedAspectRatioForReadFBO() const;
214-
SurfaceRotationType getRotationDrawFramebuffer() const;
215-
SurfaceRotationType getRotationReadFramebuffer() const;
214+
SurfaceRotation getRotationDrawFramebuffer() const;
215+
SurfaceRotation getRotationReadFramebuffer() const;
216216

217217
void invalidateProgramBindingHelper(const gl::State &glState);
218218
angle::Result invalidateProgramExecutableHelper(const gl::Context *context);
@@ -801,8 +801,8 @@ class ContextVk : public ContextImpl, public vk::Context
801801
WindowSurfaceVk *mCurrentWindowSurface;
802802
// Records the current rotation of the surface (draw/read) framebuffer, derived from
803803
// mCurrentWindowSurface->getPreTransform().
804-
SurfaceRotationType mCurrentRotationDrawFramebuffer;
805-
SurfaceRotationType mCurrentRotationReadFramebuffer;
804+
SurfaceRotation mCurrentRotationDrawFramebuffer;
805+
SurfaceRotation mCurrentRotationReadFramebuffer;
806806

807807
// Keep a cached pipeline description structure that can be used to query the pipeline cache.
808808
// Kept in a pointer so allocations can be aligned, and structs can be portably packed.

src/libANGLE/renderer/vulkan/FramebufferVk.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -471,29 +471,29 @@ angle::Result FramebufferVk::readPixels(const gl::Context *context,
471471
&outputSkipBytes));
472472

473473
bool flipY = contextVk->isViewportFlipEnabledForReadFBO();
474-
switch (params.orientation = contextVk->getRotationReadFramebuffer())
474+
switch (params.rotation = contextVk->getRotationReadFramebuffer())
475475
{
476-
case SurfaceRotationType::Identity:
476+
case SurfaceRotation::Identity:
477477
// Do not rotate gl_Position (surface matches the device's orientation):
478478
if (flipY)
479479
{
480480
params.area.y = fbRect.height - clippedArea.y - clippedArea.height;
481481
}
482482
break;
483-
case SurfaceRotationType::Rotated90Degrees:
483+
case SurfaceRotation::Rotated90Degrees:
484484
// Rotate gl_Position 90 degrees:
485485
params.area.x = clippedArea.y;
486486
params.area.y =
487487
flipY ? clippedArea.x : fbRect.width - clippedArea.x - clippedArea.width;
488488
std::swap(params.area.width, params.area.height);
489489
break;
490-
case SurfaceRotationType::Rotated180Degrees:
490+
case SurfaceRotation::Rotated180Degrees:
491491
// Rotate gl_Position 180 degrees:
492492
params.area.x = fbRect.width - clippedArea.x - clippedArea.width;
493493
params.area.y =
494494
flipY ? clippedArea.y : fbRect.height - clippedArea.y - clippedArea.height;
495495
break;
496-
case SurfaceRotationType::Rotated270Degrees:
496+
case SurfaceRotation::Rotated270Degrees:
497497
// Rotate gl_Position 270 degrees:
498498
params.area.x = fbRect.height - clippedArea.y - clippedArea.height;
499499
params.area.y =

0 commit comments

Comments
 (0)