Capture/Replay: Set FBO ID when generated on bind

GLES allows FBO ID's to be reserved on bind, so if a FBO is bound with
and ID that was not yet reserved by a glGenFramebuffers call, update the
resource tracking and the resource map to account for this resources
that was created on bind.

Bug: angleproject:6425
Change-Id: I343fc17bfbbfd9c8c47d6fe207a4f3817acb835d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3190970
Commit-Queue: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
This commit is contained in:
Gert Wollny 2021-11-09 11:16:24 +01:00 коммит произвёл Angle LUCI CQ
Родитель b9e96af0a8
Коммит 1d555687bc
5 изменённых файлов: 67 добавлений и 4 удалений

Просмотреть файл

@ -4985,6 +4985,7 @@ void FrameCaptureShared::maybeCapturePreCallUpdates(
}
case EntryPoint::GLGenFramebuffers:
case EntryPoint::GLGenFramebuffersOES:
{
GLsizei count = call.params.getParam("n", ParamType::TGLsizei, 0).value.GLsizeiVal;
const gl::FramebufferID *framebufferIDs =
@ -4996,6 +4997,13 @@ void FrameCaptureShared::maybeCapturePreCallUpdates(
}
break;
}
case EntryPoint::GLBindFramebuffer:
case EntryPoint::GLBindFramebufferOES:
maybeGenResourceOnBind<gl::FramebufferID>(call, "framebufferPacked",
ParamType::TFramebufferID);
break;
case EntryPoint::GLGenTextures:
{
GLsizei count = call.params.getParam("n", ParamType::TGLsizei, 0).value.GLsizeiVal;
@ -5359,6 +5367,32 @@ void FrameCaptureShared::maybeCapturePreCallUpdates(
updateResourceCounts(call);
}
template <typename ParamValueType>
void FrameCaptureShared::maybeGenResourceOnBind(CallCapture &call,
const char *paramName,
ParamType paramType)
{
const ParamCapture &param = call.params.getParam(paramName, paramType, 1);
const ParamValueType id = AccessParamValue<ParamValueType>(paramType, param.value);
// Don't inject the default resource or resources that are already generated
if (id.value != 0 && !resourceIsGenerated(id))
{
handleGennedResource(id);
ResourceIDType resourceIDType = GetResourceIDTypeFromParamType(param.type);
const char *resourceName = GetResourceIDTypeName(resourceIDType);
std::stringstream updateFuncNameStr;
updateFuncNameStr << "Set" << resourceName << "ID";
std::string updateFuncName = updateFuncNameStr.str();
ParamBuffer params;
params.addValueParam("id", ParamType::TGLuint, id.value);
mFrameCalls.emplace_back(updateFuncName, std::move(params));
}
}
void FrameCaptureShared::updateResourceCounts(const CallCapture &call)
{
for (const ParamCapture &param : call.params.getParamCaptures())
@ -5927,6 +5961,11 @@ void TrackedResource::setGennedResource(GLuint id)
}
}
bool TrackedResource::resourceIsGenerated(GLuint id)
{
return mNewResources.find(id) != mNewResources.end();
}
void TrackedResource::setDeletedResource(GLuint id)
{
if (id == 0)

Просмотреть файл

@ -236,6 +236,7 @@ class TrackedResource final : angle::NonCopyable
void setGennedResource(GLuint id);
void setDeletedResource(GLuint id);
void setModifiedResource(GLuint id);
bool resourceIsGenerated(GLuint id);
ResourceCalls &getResourceRegenCalls() { return mResourceRegenCalls; }
ResourceCalls &getResourceRestoreCalls() { return mResourceRestoreCalls; }
@ -486,6 +487,14 @@ class FrameCaptureShared final : angle::NonCopyable
}
}
template <typename ResourceType>
bool resourceIsGenerated(ResourceType resourceID)
{
ResourceIDType idType = GetResourceIDTypeFromType<ResourceType>::IDType;
TrackedResource &tracker = mResourceTracker.getTrackedResource(idType);
return tracker.resourceIsGenerated(resourceID.value);
}
template <typename ResourceType>
void handleDeletedResource(ResourceType resourceID)
{
@ -518,6 +527,8 @@ class FrameCaptureShared final : angle::NonCopyable
CallCapture &call,
std::vector<CallCapture> *shareGroupSetupCalls,
ResourceIDToSetupCallsMap *resourceIDToSetupCalls);
template <typename ParamValueType>
void maybeGenResourceOnBind(CallCapture &call, const char *paramName, ParamType paramType);
void maybeCapturePostCallUpdates(const gl::Context *context);
void maybeCaptureDrawArraysClientData(const gl::Context *context,
CallCapture &call,

Просмотреть файл

@ -406,6 +406,21 @@ void UpdateVertexArrayID2(GLuint id, GLsizei readBufferOffset)
UpdateResourceMap2(gVertexArrayMap2, id, readBufferOffset);
}
void SetResourceID(GLuint *map, GLuint id)
{
if (map[id] != 0)
{
fprintf(stderr, "%s: resource ID %d is already reserved\n", __func__, id);
exit(1);
}
map[id] = id;
}
void SetFramebufferID(GLuint id)
{
SetResourceID(gFramebufferMap2, id);
}
void ValidateSerializedState(const char *serializedState, const char *fileName, uint32_t line)
{
if (gValidateSerializedStateCallback)

Просмотреть файл

@ -176,6 +176,8 @@ void UpdateTextureID2(GLuint id, GLsizei readBufferOffset);
void UpdateTransformFeedbackID2(GLuint id, GLsizei readBufferOffset);
void UpdateVertexArrayID2(GLuint id, GLsizei readBufferOffset);
void SetFramebufferID(GLuint id);
void ValidateSerializedState(const char *serializedState, const char *fileName, uint32_t line);
#define VALIDATE_CHECKPOINT(STATE) ValidateSerializedState(STATE, __FILE__, __LINE__)

Просмотреть файл

@ -119,10 +119,6 @@
6286 : ImageTestES3.Source2DTarget2DTargetTextureRespecifyLevel/ES3_Vulkan_SwiftShader = FAIL
6286 : ImageTestES3.Source2DTargetExternalESSL3/ES3_Vulkan_SwiftShader = FAIL
6286 : ImageTestES3.SourceRenderbufferTargetTextureExternalESSL3/ES3_Vulkan_SwiftShader = FAIL
6425 : ObjectAllocationTest.BindFramebufferAfterGen/ES3_Vulkan_SwiftShader = FAIL
6425 : ObjectAllocationTest.BindFramebufferBeforeGen/ES3_Vulkan_SwiftShader = FAIL
6425 : ObjectAllocationTestES3.BindFramebufferAfterGen/ES3_Vulkan_SwiftShader = FAIL
6425 : ObjectAllocationTestES3.BindFramebufferBeforeGen/ES3_Vulkan_SwiftShader = FAIL
6512 : RobustResourceInitTestES3.BindTexImage/ES3_Vulkan_SwiftShader = FAIL
6180 WIN : TransformFeedbackTest.DrawWithoutTransformFeedbackThenWith/ES3_Vulkan_SwiftShader = FLAKY
6513 : TransformFeedbackTest.MultiContext/ES3_Vulkan_SwiftShader = FLAKY