Fill in missing GL methods for MemorySizeTest

Implements captures of glGetRenderbufferParameteriv,
glGetBufferParameteriv, and glgetAttachedShader. Fix FrameCapture and
CaptureReplay sample so that it has single-frame capture and replay
capabilities.

Bug: angleproject:4681
Bug: angleproject:4682
Change-Id: I12c25a3857a88f2f40b3c3e8624da1379a950339
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2229069
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Commit-Queue: Manh Nguyen <nguyenmh@google.com>
This commit is contained in:
Manh Nguyen
2020-06-03 18:24:17 -04:00
committed by Commit Bot
parent be04c04729
commit 550bc06999
3 changed files with 15 additions and 13 deletions

View File

@@ -61,8 +61,7 @@ class CaptureReplaySample : public SampleApplication
{
// Compute the current frame, looping from kReplayFrameStart to kReplayFrameEnd.
uint32_t frame =
kReplayFrameStart + (mCurrentFrame % (kReplayFrameEnd - kReplayFrameStart));
kReplayFrameStart + (mCurrentFrame % ((kReplayFrameEnd - kReplayFrameStart) + 1));
if (mPreviousFrame > frame)
{
ResetContextReplay();

View File

@@ -932,7 +932,7 @@ void WriteCppReplayIndexFiles(bool compression,
"callback);\n";
header << "void OnFramebufferChange(GLenum target, GLuint framebuffer);\n";
header << "\n";
for (uint32_t frameIndex = frameStart; frameIndex < frameEnd; ++frameIndex)
for (uint32_t frameIndex = frameStart; frameIndex <= frameEnd; ++frameIndex)
{
header << "void " << FmtReplayFunction(contextId, frameIndex) << ";\n";
}
@@ -963,11 +963,14 @@ void WriteCppReplayIndexFiles(bool compression,
source << "void UpdateResourceMap(ResourceMap *resourceMap, GLuint id, GLsizei "
"readBufferOffset)\n";
source << "{\n";
source << " GLuint returnedID;\n";
std::string captureNamespace = !captureLabel.empty() ? captureLabel + "::" : "";
source << " memcpy(&returnedID, &" << captureNamespace
<< "gReadBuffer[readBufferOffset], sizeof(GLuint));\n";
source << " (*resourceMap)[id] = returnedID;\n";
if (readBufferSize > 0)
{
source << " GLuint returnedID;\n";
std::string captureNamespace = !captureLabel.empty() ? captureLabel + "::" : "";
source << " memcpy(&returnedID, &" << captureNamespace
<< "gReadBuffer[readBufferOffset], sizeof(GLuint));\n";
source << " (*resourceMap)[id] = returnedID;\n";
}
source << "}\n";
source << "\n";
source << "DecompressCallback gDecompressCallback;\n";
@@ -1041,7 +1044,7 @@ void WriteCppReplayIndexFiles(bool compression,
source << "{\n";
source << " switch (frameIndex)\n";
source << " {\n";
for (uint32_t frameIndex = frameStart; frameIndex < frameEnd; ++frameIndex)
for (uint32_t frameIndex = frameStart; frameIndex <= frameEnd; ++frameIndex)
{
source << " case " << frameIndex << ":\n";
source << " ReplayContext" << static_cast<int>(contextId) << "Frame"

View File

@@ -307,7 +307,7 @@ void CaptureGetAttachedShaders_count(const State &glState,
ShaderProgramID *shaders,
ParamCapture *paramCapture)
{
UNIMPLEMENTED();
paramCapture->readBufferSizeBytes = sizeof(GLsizei);
}
void CaptureGetAttachedShaders_shadersPacked(const State &glState,
@@ -318,7 +318,7 @@ void CaptureGetAttachedShaders_shadersPacked(const State &glState,
ShaderProgramID *shaders,
ParamCapture *paramCapture)
{
UNIMPLEMENTED();
paramCapture->readBufferSizeBytes = sizeof(ShaderProgramID) * maxCount;
}
void CaptureGetAttribLocation_name(const State &glState,
@@ -346,7 +346,7 @@ void CaptureGetBufferParameteriv_params(const State &glState,
GLint *params,
ParamCapture *paramCapture)
{
UNIMPLEMENTED();
paramCapture->readBufferSizeBytes = 8;
}
void CaptureGetFloatv_data(const State &glState,
@@ -423,7 +423,7 @@ void CaptureGetRenderbufferParameteriv_params(const State &glState,
GLint *params,
ParamCapture *paramCapture)
{
UNIMPLEMENTED();
paramCapture->readBufferSizeBytes = sizeof(GLint);
}
void CaptureGetShaderInfoLog_length(const State &glState,