Commit dd4723e3 by Cody Northrop Committed by Commit Bot

Capture/Replay: More ES 3.1 support

This CL adds the following changes: * Support variable block sizes for ASTC * Support glMapBuffer * Additional param captures Test: Capture from beginning of Asphalt 8 and Aztec Ruins Bug: b/150484427 Bug: b/160808198 Change-Id: Ic1041011c3f51c32dbf7bf7105f41dffb9460b87 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2264832 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarManh Nguyen <nguyenmh@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 7ce16cda
...@@ -469,20 +469,34 @@ void WriteCppReplayForCall(const CallCapture &call, ...@@ -469,20 +469,34 @@ void WriteCppReplayForCall(const CallCapture &call,
callOut << "gSyncMap[" << SyncIndexValue(sync) << "] = "; callOut << "gSyncMap[" << SyncIndexValue(sync) << "] = ";
} }
// Depending on how a buffer is mapped, we may need to track its location for readback
bool trackBufferPointer = false;
if (call.entryPoint == gl::EntryPoint::MapBufferRange || if (call.entryPoint == gl::EntryPoint::MapBufferRange ||
call.entryPoint == gl::EntryPoint::MapBufferRangeEXT) call.entryPoint == gl::EntryPoint::MapBufferRangeEXT)
{ {
GLbitfield access = GLbitfield access =
call.params.getParam("access", ParamType::TGLbitfield, 3).value.GLbitfieldVal; call.params.getParam("access", ParamType::TGLbitfield, 3).value.GLbitfieldVal;
if (access & GL_MAP_WRITE_BIT) trackBufferPointer = access & GL_MAP_WRITE_BIT;
{ }
// Track the returned pointer so we update its data when unmapped
gl::BufferID bufferID = call.params.getMappedBufferID(); if (call.entryPoint == gl::EntryPoint::MapBuffer ||
callOut << "gMappedBufferData["; call.entryPoint == gl::EntryPoint::MapBufferOES)
WriteParamValueReplay<ParamType::TBufferID>(callOut, call, bufferID); {
callOut << "] = "; GLenum access = call.params.getParam("access", ParamType::TGLenum, 1).value.GLenumVal;
}
trackBufferPointer =
access == GL_WRITE_ONLY_OES || access == GL_WRITE_ONLY || access == GL_READ_WRITE;
}
if (trackBufferPointer)
{
// Track the returned pointer so we update its data when unmapped
gl::BufferID bufferID = call.params.getMappedBufferID();
callOut << "gMappedBufferData[";
WriteParamValueReplay<ParamType::TBufferID>(callOut, call, bufferID);
callOut << "] = ";
} }
callOut << call.name() << "("; callOut << call.name() << "(";
...@@ -2103,9 +2117,10 @@ void CaptureMidExecutionSetup(const gl::Context *context, ...@@ -2103,9 +2117,10 @@ void CaptureMidExecutionSetup(const gl::Context *context,
frameCapture->getResouceTracker().setStartingBufferMapped(buffer->id(), true); frameCapture->getResouceTracker().setStartingBufferMapped(buffer->id(), true);
frameCapture->trackBufferMapping( frameCapture->trackBufferMapping(&setupCalls->back(), buffer->id(),
&setupCalls->back(), buffer->id(), static_cast<GLsizeiptr>(buffer->getMapOffset()), static_cast<GLsizeiptr>(buffer->getMapOffset()),
static_cast<GLsizeiptr>(buffer->getMapLength()), buffer->getAccessFlags()); static_cast<GLsizeiptr>(buffer->getMapLength()),
(buffer->getAccessFlags() & GL_MAP_WRITE_BIT) != 0);
} }
else else
{ {
...@@ -3485,14 +3500,14 @@ void FrameCapture::captureCompressedTextureData(const gl::Context *context, cons ...@@ -3485,14 +3500,14 @@ void FrameCapture::captureCompressedTextureData(const gl::Context *context, cons
call.params.getParam("zoffset", ParamType::TGLint, zoffsetParamOffset).value.GLintVal; call.params.getParam("zoffset", ParamType::TGLint, zoffsetParamOffset).value.GLintVal;
} }
// Since we're dealing in 4x4 blocks, scale down the width/height pixel offsets. // Scale down the width/height pixel offsets to reflect block size
ASSERT(format.compressedBlockWidth == 4); int widthScale = static_cast<int>(format.compressedBlockWidth);
ASSERT(format.compressedBlockHeight == 4); int heightScale = static_cast<int>(format.compressedBlockHeight);
ASSERT(format.compressedBlockDepth == 1); ASSERT(format.compressedBlockDepth == 1);
pixelWidth >>= 2; pixelWidth /= widthScale;
pixelHeight >>= 2; pixelHeight /= heightScale;
xoffset >>= 2; xoffset /= widthScale;
yoffset >>= 2; yoffset /= heightScale;
// Update pixel data. // Update pixel data.
std::vector<uint8_t> &levelData = foundLevel->second; std::vector<uint8_t> &levelData = foundLevel->second;
...@@ -3501,8 +3516,8 @@ void FrameCapture::captureCompressedTextureData(const gl::Context *context, cons ...@@ -3501,8 +3516,8 @@ void FrameCapture::captureCompressedTextureData(const gl::Context *context, cons
GLint pixelRowPitch = pixelWidth * pixelBytes; GLint pixelRowPitch = pixelWidth * pixelBytes;
GLint pixelDepthPitch = pixelRowPitch * pixelHeight; GLint pixelDepthPitch = pixelRowPitch * pixelHeight;
GLint levelRowPitch = (levelExtents.width >> 2) * pixelBytes; GLint levelRowPitch = (levelExtents.width / widthScale) * pixelBytes;
GLint levelDepthPitch = levelRowPitch * (levelExtents.height >> 2); GLint levelDepthPitch = levelRowPitch * (levelExtents.height / heightScale);
for (GLint zindex = 0; zindex < pixelDepth; ++zindex) for (GLint zindex = 0; zindex < pixelDepth; ++zindex)
{ {
...@@ -3528,12 +3543,12 @@ void FrameCapture::trackBufferMapping(CallCapture *call, ...@@ -3528,12 +3543,12 @@ void FrameCapture::trackBufferMapping(CallCapture *call,
gl::BufferID id, gl::BufferID id,
GLintptr offset, GLintptr offset,
GLsizeiptr length, GLsizeiptr length,
GLbitfield accessFlags) bool writable)
{ {
// Track that the buffer was mapped // Track that the buffer was mapped
mResourceTracker.setBufferMapped(id); mResourceTracker.setBufferMapped(id);
if (accessFlags & GL_MAP_WRITE_BIT) if (writable)
{ {
// If this buffer was mapped writable, we don't have any visibility into what // If this buffer was mapped writable, we don't have any visibility into what
// happens to it. Therefore, remember the details about it, and we'll read it back // happens to it. Therefore, remember the details about it, and we'll read it back
...@@ -3725,15 +3740,27 @@ void FrameCapture::maybeCaptureClientData(const gl::Context *context, CallCaptur ...@@ -3725,15 +3740,27 @@ void FrameCapture::maybeCaptureClientData(const gl::Context *context, CallCaptur
} }
case gl::EntryPoint::MapBuffer: case gl::EntryPoint::MapBuffer:
{
UNIMPLEMENTED();
break;
}
case gl::EntryPoint::MapBufferOES: case gl::EntryPoint::MapBufferOES:
{ {
UNIMPLEMENTED(); gl::BufferBinding target =
call.params.getParam("targetPacked", ParamType::TBufferBinding, 0)
.value.BufferBindingVal;
GLbitfield access =
call.params.getParam("access", ParamType::TGLenum, 1).value.GLenumVal;
gl::Buffer *buffer = context->getState().getTargetBuffer(target);
GLintptr offset = 0;
GLsizeiptr length = static_cast<GLsizeiptr>(buffer->getSize());
bool writable =
access == GL_WRITE_ONLY_OES || access == GL_WRITE_ONLY || access == GL_READ_WRITE;
trackBufferMapping(&call, buffer->id(), offset, length, writable);
break; break;
} }
case gl::EntryPoint::UnmapNamedBuffer: case gl::EntryPoint::UnmapNamedBuffer:
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
...@@ -3755,7 +3782,7 @@ void FrameCapture::maybeCaptureClientData(const gl::Context *context, CallCaptur ...@@ -3755,7 +3782,7 @@ void FrameCapture::maybeCaptureClientData(const gl::Context *context, CallCaptur
.value.BufferBindingVal; .value.BufferBindingVal;
gl::Buffer *buffer = context->getState().getTargetBuffer(target); gl::Buffer *buffer = context->getState().getTargetBuffer(target);
trackBufferMapping(&call, buffer->id(), offset, length, access); trackBufferMapping(&call, buffer->id(), offset, length, access & GL_MAP_WRITE_BIT);
break; break;
} }
......
...@@ -284,7 +284,7 @@ class FrameCapture final : angle::NonCopyable ...@@ -284,7 +284,7 @@ class FrameCapture final : angle::NonCopyable
gl::BufferID id, gl::BufferID id,
GLintptr offset, GLintptr offset,
GLsizeiptr length, GLsizeiptr length,
GLbitfield accessFlags); bool writable);
ResourceTracker &getResouceTracker() { return mResourceTracker; } ResourceTracker &getResouceTracker() { return mResourceTracker; }
...@@ -389,6 +389,14 @@ void CaptureGetParameter(const gl::State &glState, ...@@ -389,6 +389,14 @@ void CaptureGetParameter(const gl::State &glState,
size_t typeSize, size_t typeSize,
ParamCapture *paramCapture); ParamCapture *paramCapture);
template <typename T>
void CaptureClearBufferValue(GLenum buffer, const T *value, ParamCapture *paramCapture)
{
// Per the spec, color buffers have a vec4, the rest a single value
uint32_t valueSize = (buffer == GL_COLOR) ? 4 : 1;
CaptureMemory(value, valueSize * sizeof(T), paramCapture);
}
void CaptureGenHandlesImpl(GLsizei n, GLuint *handles, ParamCapture *paramCapture); void CaptureGenHandlesImpl(GLsizei n, GLuint *handles, ParamCapture *paramCapture);
template <typename T> template <typename T>
......
...@@ -198,7 +198,7 @@ void CaptureGetActiveAttrib_length(const State &glState, ...@@ -198,7 +198,7 @@ void CaptureGetActiveAttrib_length(const State &glState,
GLchar *name, GLchar *name,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); paramCapture->readBufferSizeBytes = sizeof(GLsizei);
} }
void CaptureGetActiveAttrib_size(const State &glState, void CaptureGetActiveAttrib_size(const State &glState,
...@@ -212,7 +212,7 @@ void CaptureGetActiveAttrib_size(const State &glState, ...@@ -212,7 +212,7 @@ void CaptureGetActiveAttrib_size(const State &glState,
GLchar *name, GLchar *name,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); paramCapture->readBufferSizeBytes = sizeof(GLint);
} }
void CaptureGetActiveAttrib_type(const State &glState, void CaptureGetActiveAttrib_type(const State &glState,
...@@ -226,7 +226,7 @@ void CaptureGetActiveAttrib_type(const State &glState, ...@@ -226,7 +226,7 @@ void CaptureGetActiveAttrib_type(const State &glState,
GLchar *name, GLchar *name,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); paramCapture->readBufferSizeBytes = sizeof(GLenum);
} }
void CaptureGetActiveAttrib_name(const State &glState, void CaptureGetActiveAttrib_name(const State &glState,
......
...@@ -20,7 +20,7 @@ void CaptureClearBufferfv_value(const State &glState, ...@@ -20,7 +20,7 @@ void CaptureClearBufferfv_value(const State &glState,
const GLfloat *value, const GLfloat *value,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); CaptureClearBufferValue<GLfloat>(buffer, value, paramCapture);
} }
void CaptureClearBufferiv_value(const State &glState, void CaptureClearBufferiv_value(const State &glState,
...@@ -30,7 +30,7 @@ void CaptureClearBufferiv_value(const State &glState, ...@@ -30,7 +30,7 @@ void CaptureClearBufferiv_value(const State &glState,
const GLint *value, const GLint *value,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); CaptureClearBufferValue<GLint>(buffer, value, paramCapture);
} }
void CaptureClearBufferuiv_value(const State &glState, void CaptureClearBufferuiv_value(const State &glState,
...@@ -40,7 +40,7 @@ void CaptureClearBufferuiv_value(const State &glState, ...@@ -40,7 +40,7 @@ void CaptureClearBufferuiv_value(const State &glState,
const GLuint *value, const GLuint *value,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); CaptureClearBufferValue<GLuint>(buffer, value, paramCapture);
} }
void CaptureCompressedTexImage3D_data(const State &glState, void CaptureCompressedTexImage3D_data(const State &glState,
...@@ -291,7 +291,7 @@ void CaptureGetInteger64i_v_data(const State &glState, ...@@ -291,7 +291,7 @@ void CaptureGetInteger64i_v_data(const State &glState,
GLint64 *data, GLint64 *data,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); CaptureGetParameter(glState, target, sizeof(GLint64), paramCapture);
} }
void CaptureGetInteger64v_data(const State &glState, void CaptureGetInteger64v_data(const State &glState,
...@@ -300,7 +300,7 @@ void CaptureGetInteger64v_data(const State &glState, ...@@ -300,7 +300,7 @@ void CaptureGetInteger64v_data(const State &glState,
GLint64 *data, GLint64 *data,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); CaptureGetParameter(glState, pname, sizeof(GLint64), paramCapture);
} }
void CaptureGetIntegeri_v_data(const State &glState, void CaptureGetIntegeri_v_data(const State &glState,
...@@ -310,7 +310,7 @@ void CaptureGetIntegeri_v_data(const State &glState, ...@@ -310,7 +310,7 @@ void CaptureGetIntegeri_v_data(const State &glState,
GLint *data, GLint *data,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); CaptureGetParameter(glState, target, sizeof(GLint), paramCapture);
} }
void CaptureGetInternalformativ_params(const State &glState, void CaptureGetInternalformativ_params(const State &glState,
......
...@@ -171,7 +171,7 @@ void CaptureGetProgramResourceName_length(const State &glState, ...@@ -171,7 +171,7 @@ void CaptureGetProgramResourceName_length(const State &glState,
GLchar *name, GLchar *name,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); paramCapture->readBufferSizeBytes = sizeof(GLsizei);
} }
void CaptureGetProgramResourceName_name(const State &glState, void CaptureGetProgramResourceName_name(const State &glState,
...@@ -184,7 +184,7 @@ void CaptureGetProgramResourceName_name(const State &glState, ...@@ -184,7 +184,7 @@ void CaptureGetProgramResourceName_name(const State &glState,
GLchar *name, GLchar *name,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); CaptureString(name, paramCapture);
} }
void CaptureGetProgramResourceiv_props(const State &glState, void CaptureGetProgramResourceiv_props(const State &glState,
...@@ -199,7 +199,7 @@ void CaptureGetProgramResourceiv_props(const State &glState, ...@@ -199,7 +199,7 @@ void CaptureGetProgramResourceiv_props(const State &glState,
GLint *params, GLint *params,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); CaptureMemory(props, sizeof(GLenum) * propCount, paramCapture);
} }
void CaptureGetProgramResourceiv_length(const State &glState, void CaptureGetProgramResourceiv_length(const State &glState,
...@@ -214,7 +214,7 @@ void CaptureGetProgramResourceiv_length(const State &glState, ...@@ -214,7 +214,7 @@ void CaptureGetProgramResourceiv_length(const State &glState,
GLint *params, GLint *params,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); paramCapture->readBufferSizeBytes = sizeof(GLsizei);
} }
void CaptureGetProgramResourceiv_params(const State &glState, void CaptureGetProgramResourceiv_params(const State &glState,
...@@ -229,7 +229,18 @@ void CaptureGetProgramResourceiv_params(const State &glState, ...@@ -229,7 +229,18 @@ void CaptureGetProgramResourceiv_params(const State &glState,
GLint *params, GLint *params,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); // See QueryProgramResourceiv for details on how these are handled
for (int i = 0; i < propCount; ++i)
{
if (props[i] == GL_ACTIVE_VARIABLES)
{
// This appears to be the only property that isn't a single integer
UNIMPLEMENTED();
return;
}
}
CaptureMemory(props, sizeof(GLint) * propCount, paramCapture);
} }
void CaptureGetTexLevelParameterfv_params(const State &glState, void CaptureGetTexLevelParameterfv_params(const State &glState,
......
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