Commit 550bc069 by Manh Nguyen Committed by Commit Bot

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/+/2229069Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Manh Nguyen <nguyenmh@google.com>
parent be04c047
...@@ -61,8 +61,7 @@ class CaptureReplaySample : public SampleApplication ...@@ -61,8 +61,7 @@ class CaptureReplaySample : public SampleApplication
{ {
// Compute the current frame, looping from kReplayFrameStart to kReplayFrameEnd. // Compute the current frame, looping from kReplayFrameStart to kReplayFrameEnd.
uint32_t frame = uint32_t frame =
kReplayFrameStart + (mCurrentFrame % (kReplayFrameEnd - kReplayFrameStart)); kReplayFrameStart + (mCurrentFrame % ((kReplayFrameEnd - kReplayFrameStart) + 1));
if (mPreviousFrame > frame) if (mPreviousFrame > frame)
{ {
ResetContextReplay(); ResetContextReplay();
......
...@@ -932,7 +932,7 @@ void WriteCppReplayIndexFiles(bool compression, ...@@ -932,7 +932,7 @@ void WriteCppReplayIndexFiles(bool compression,
"callback);\n"; "callback);\n";
header << "void OnFramebufferChange(GLenum target, GLuint framebuffer);\n"; header << "void OnFramebufferChange(GLenum target, GLuint framebuffer);\n";
header << "\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"; header << "void " << FmtReplayFunction(contextId, frameIndex) << ";\n";
} }
...@@ -963,11 +963,14 @@ void WriteCppReplayIndexFiles(bool compression, ...@@ -963,11 +963,14 @@ void WriteCppReplayIndexFiles(bool compression,
source << "void UpdateResourceMap(ResourceMap *resourceMap, GLuint id, GLsizei " source << "void UpdateResourceMap(ResourceMap *resourceMap, GLuint id, GLsizei "
"readBufferOffset)\n"; "readBufferOffset)\n";
source << "{\n"; source << "{\n";
if (readBufferSize > 0)
{
source << " GLuint returnedID;\n"; source << " GLuint returnedID;\n";
std::string captureNamespace = !captureLabel.empty() ? captureLabel + "::" : ""; std::string captureNamespace = !captureLabel.empty() ? captureLabel + "::" : "";
source << " memcpy(&returnedID, &" << captureNamespace source << " memcpy(&returnedID, &" << captureNamespace
<< "gReadBuffer[readBufferOffset], sizeof(GLuint));\n"; << "gReadBuffer[readBufferOffset], sizeof(GLuint));\n";
source << " (*resourceMap)[id] = returnedID;\n"; source << " (*resourceMap)[id] = returnedID;\n";
}
source << "}\n"; source << "}\n";
source << "\n"; source << "\n";
source << "DecompressCallback gDecompressCallback;\n"; source << "DecompressCallback gDecompressCallback;\n";
...@@ -1041,7 +1044,7 @@ void WriteCppReplayIndexFiles(bool compression, ...@@ -1041,7 +1044,7 @@ void WriteCppReplayIndexFiles(bool compression,
source << "{\n"; source << "{\n";
source << " switch (frameIndex)\n"; source << " switch (frameIndex)\n";
source << " {\n"; source << " {\n";
for (uint32_t frameIndex = frameStart; frameIndex < frameEnd; ++frameIndex) for (uint32_t frameIndex = frameStart; frameIndex <= frameEnd; ++frameIndex)
{ {
source << " case " << frameIndex << ":\n"; source << " case " << frameIndex << ":\n";
source << " ReplayContext" << static_cast<int>(contextId) << "Frame" source << " ReplayContext" << static_cast<int>(contextId) << "Frame"
......
...@@ -307,7 +307,7 @@ void CaptureGetAttachedShaders_count(const State &glState, ...@@ -307,7 +307,7 @@ void CaptureGetAttachedShaders_count(const State &glState,
ShaderProgramID *shaders, ShaderProgramID *shaders,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); paramCapture->readBufferSizeBytes = sizeof(GLsizei);
} }
void CaptureGetAttachedShaders_shadersPacked(const State &glState, void CaptureGetAttachedShaders_shadersPacked(const State &glState,
...@@ -318,7 +318,7 @@ void CaptureGetAttachedShaders_shadersPacked(const State &glState, ...@@ -318,7 +318,7 @@ void CaptureGetAttachedShaders_shadersPacked(const State &glState,
ShaderProgramID *shaders, ShaderProgramID *shaders,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); paramCapture->readBufferSizeBytes = sizeof(ShaderProgramID) * maxCount;
} }
void CaptureGetAttribLocation_name(const State &glState, void CaptureGetAttribLocation_name(const State &glState,
...@@ -346,7 +346,7 @@ void CaptureGetBufferParameteriv_params(const State &glState, ...@@ -346,7 +346,7 @@ void CaptureGetBufferParameteriv_params(const State &glState,
GLint *params, GLint *params,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); paramCapture->readBufferSizeBytes = 8;
} }
void CaptureGetFloatv_data(const State &glState, void CaptureGetFloatv_data(const State &glState,
...@@ -423,7 +423,7 @@ void CaptureGetRenderbufferParameteriv_params(const State &glState, ...@@ -423,7 +423,7 @@ void CaptureGetRenderbufferParameteriv_params(const State &glState,
GLint *params, GLint *params,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); paramCapture->readBufferSizeBytes = sizeof(GLint);
} }
void CaptureGetShaderInfoLog_length(const State &glState, void CaptureGetShaderInfoLog_length(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