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

Commit c55fbc4

Browse files
cnorthropCommit Bot
authored andcommitted
Capture/Replay: Fill out more ES 3.0 state in mid-execution capture
Test: Manhattan mid-execution capture working Bug: angleproject:3662 Bug: angleproject:4091 Change-Id: Id7f1a3f667229e4d5abedb3ada25d44db250605a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2080592 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 parent ca04de8 commit c55fbc4

File tree

2 files changed

+122
-7
lines changed

2 files changed

+122
-7
lines changed

src/libANGLE/FrameCapture.cpp

Lines changed: 121 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,12 +1429,12 @@ void CaptureMidExecutionSetup(const gl::Context *context,
14291429
}
14301430
}
14311431

1432-
// Set a pack alignment of 1.
1433-
gl::PixelPackState &currentPackState = replayState.getPackState();
1434-
if (currentPackState.alignment != 1)
1432+
// Set a unpack alignment of 1.
1433+
gl::PixelUnpackState &currentUnpackState = replayState.getUnpackState();
1434+
if (currentUnpackState.alignment != 1)
14351435
{
14361436
cap(CapturePixelStorei(replayState, true, GL_UNPACK_ALIGNMENT, 1));
1437-
currentPackState.alignment = 1;
1437+
currentUnpackState.alignment = 1;
14381438
}
14391439

14401440
// Capture Texture setup and data.
@@ -1470,6 +1470,10 @@ void CaptureMidExecutionSetup(const gl::Context *context,
14701470
cap(CaptureTexParameteri(replayState, true, texture->getType(), pname, param));
14711471
};
14721472

1473+
auto capTexParamf = [cap, &replayState, texture](GLenum pname, GLfloat param) {
1474+
cap(CaptureTexParameterf(replayState, true, texture->getType(), pname, param));
1475+
};
1476+
14731477
if (textureSamplerState.getMinFilter() != defaultSamplerState.getMinFilter())
14741478
{
14751479
capTexParam(GL_TEXTURE_MIN_FILTER, textureSamplerState.getMinFilter());
@@ -1495,6 +1499,48 @@ void CaptureMidExecutionSetup(const gl::Context *context,
14951499
capTexParam(GL_TEXTURE_WRAP_T, textureSamplerState.getWrapT());
14961500
}
14971501

1502+
if (textureSamplerState.getMinLod() != defaultSamplerState.getMinLod())
1503+
{
1504+
capTexParamf(GL_TEXTURE_MIN_LOD, textureSamplerState.getMinLod());
1505+
}
1506+
1507+
if (textureSamplerState.getMaxLod() != defaultSamplerState.getMaxLod())
1508+
{
1509+
capTexParamf(GL_TEXTURE_MAX_LOD, textureSamplerState.getMaxLod());
1510+
}
1511+
1512+
if (textureSamplerState.getCompareMode() != defaultSamplerState.getCompareMode())
1513+
{
1514+
capTexParam(GL_TEXTURE_COMPARE_MODE, textureSamplerState.getCompareMode());
1515+
}
1516+
1517+
if (textureSamplerState.getCompareFunc() != defaultSamplerState.getCompareFunc())
1518+
{
1519+
capTexParam(GL_TEXTURE_COMPARE_FUNC, textureSamplerState.getCompareFunc());
1520+
}
1521+
1522+
// Texture parameters
1523+
// TODO: Add immutable and base/max when TexStorage is handled (http://anglebug.com/3662)
1524+
if (texture->getSwizzleRed() != GL_RED)
1525+
{
1526+
capTexParam(GL_TEXTURE_SWIZZLE_R, texture->getSwizzleRed());
1527+
}
1528+
1529+
if (texture->getSwizzleGreen() != GL_GREEN)
1530+
{
1531+
capTexParam(GL_TEXTURE_SWIZZLE_G, texture->getSwizzleGreen());
1532+
}
1533+
1534+
if (texture->getSwizzleBlue() != GL_BLUE)
1535+
{
1536+
capTexParam(GL_TEXTURE_SWIZZLE_B, texture->getSwizzleBlue());
1537+
}
1538+
1539+
if (texture->getSwizzleAlpha() != GL_ALPHA)
1540+
{
1541+
capTexParam(GL_TEXTURE_SWIZZLE_A, texture->getSwizzleAlpha());
1542+
}
1543+
14981544
// Iterate texture levels and layers.
14991545
gl::ImageIndexIterator imageIter = gl::ImageIndexIterator::MakeGeneric(
15001546
texture->getType(), 0, texture->getMipmapMaxLevel() + 1, gl::ImageIndex::kEntireLevel,
@@ -2167,14 +2213,69 @@ void CaptureMidExecutionSetup(const gl::Context *context,
21672213
}
21682214

21692215
// Pixel storage states.
2170-
// TODO(jmadill): ES 3.x+ implementation. http://anglebug.com/3662
2216+
gl::PixelPackState &currentPackState = replayState.getPackState();
21712217
if (currentPackState.alignment != apiState.getPackAlignment())
21722218
{
2173-
cap(CapturePixelStorei(replayState, true, GL_UNPACK_ALIGNMENT,
2174-
apiState.getPackAlignment()));
2219+
cap(CapturePixelStorei(replayState, true, GL_PACK_ALIGNMENT, apiState.getPackAlignment()));
21752220
currentPackState.alignment = apiState.getPackAlignment();
21762221
}
21772222

2223+
if (currentPackState.rowLength != apiState.getPackRowLength())
2224+
{
2225+
cap(CapturePixelStorei(replayState, true, GL_PACK_ROW_LENGTH, apiState.getPackRowLength()));
2226+
currentPackState.rowLength = apiState.getPackRowLength();
2227+
}
2228+
2229+
if (currentPackState.skipRows != apiState.getPackSkipRows())
2230+
{
2231+
cap(CapturePixelStorei(replayState, true, GL_PACK_SKIP_ROWS, apiState.getPackSkipRows()));
2232+
currentPackState.skipRows = apiState.getPackSkipRows();
2233+
}
2234+
2235+
if (currentPackState.skipPixels != apiState.getPackSkipPixels())
2236+
{
2237+
cap(CapturePixelStorei(replayState, true, GL_PACK_SKIP_PIXELS,
2238+
apiState.getPackSkipPixels()));
2239+
currentPackState.skipPixels = apiState.getPackSkipPixels();
2240+
}
2241+
2242+
// We set unpack alignment above, no need to change it here
2243+
ASSERT(currentUnpackState.alignment == 1);
2244+
if (currentUnpackState.rowLength != apiState.getUnpackRowLength())
2245+
{
2246+
cap(CapturePixelStorei(replayState, true, GL_UNPACK_ROW_LENGTH,
2247+
apiState.getUnpackRowLength()));
2248+
currentUnpackState.rowLength = apiState.getUnpackRowLength();
2249+
}
2250+
2251+
if (currentUnpackState.skipRows != apiState.getUnpackSkipRows())
2252+
{
2253+
cap(CapturePixelStorei(replayState, true, GL_UNPACK_SKIP_ROWS,
2254+
apiState.getUnpackSkipRows()));
2255+
currentUnpackState.skipRows = apiState.getUnpackSkipRows();
2256+
}
2257+
2258+
if (currentUnpackState.skipPixels != apiState.getUnpackSkipPixels())
2259+
{
2260+
cap(CapturePixelStorei(replayState, true, GL_UNPACK_SKIP_PIXELS,
2261+
apiState.getUnpackSkipPixels()));
2262+
currentUnpackState.skipPixels = apiState.getUnpackSkipPixels();
2263+
}
2264+
2265+
if (currentUnpackState.imageHeight != apiState.getUnpackImageHeight())
2266+
{
2267+
cap(CapturePixelStorei(replayState, true, GL_UNPACK_IMAGE_HEIGHT,
2268+
apiState.getUnpackImageHeight()));
2269+
currentUnpackState.imageHeight = apiState.getUnpackImageHeight();
2270+
}
2271+
2272+
if (currentUnpackState.skipImages != apiState.getUnpackSkipImages())
2273+
{
2274+
cap(CapturePixelStorei(replayState, true, GL_UNPACK_SKIP_IMAGES,
2275+
apiState.getUnpackSkipImages()));
2276+
currentUnpackState.skipImages = apiState.getUnpackSkipImages();
2277+
}
2278+
21782279
// Clear state. Missing ES 3.x features.
21792280
// TODO(http://anglebug.com/3662): Complete state capture.
21802281
const gl::ColorF &currentClearColor = apiState.getColorClearValue();
@@ -2189,6 +2290,11 @@ void CaptureMidExecutionSetup(const gl::Context *context,
21892290
cap(CaptureClearDepthf(replayState, true, apiState.getDepthClearValue()));
21902291
}
21912292

2293+
if (apiState.getStencilClearValue() != 0)
2294+
{
2295+
cap(CaptureClearStencil(replayState, true, apiState.getStencilClearValue()));
2296+
}
2297+
21922298
// Viewport / scissor / clipping planes.
21932299
const gl::Rectangle &currentViewport = apiState.getViewport();
21942300
if (currentViewport != gl::Rectangle())
@@ -2214,6 +2320,14 @@ void CaptureMidExecutionSetup(const gl::Context *context,
22142320
currentScissor.width, currentScissor.height));
22152321
}
22162322

2323+
const gl::SyncManager &syncs = apiState.getSyncManagerForCapture();
2324+
for (const auto &syncIter : syncs)
2325+
{
2326+
// TODO: Create existing sync objects (http://anglebug.com/3662)
2327+
(void)syncIter;
2328+
UNIMPLEMENTED();
2329+
}
2330+
22172331
// Allow the replayState object to be destroyed conveniently.
22182332
replayState.setBufferBinding(context, gl::BufferBinding::Array, nullptr);
22192333
}

src/libANGLE/State.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@ class State : angle::NonCopyable
734734
{
735735
return *mShaderProgramManager;
736736
}
737+
const SyncManager &getSyncManagerForCapture() const { return *mSyncManager; }
737738
const SamplerManager &getSamplerManagerForCapture() const { return *mSamplerManager; }
738739
const SamplerBindingVector &getSamplerBindingsForCapture() const { return mSamplers; }
739740

0 commit comments

Comments
 (0)