Commit 9bbcd86a by Jamie Madill Committed by Commit Bot

Capture/Replay: Fix instanced array client data.

Enables a bunch of self-tests. Bug: angleproject:5530 Change-Id: Idd14574ba0f3d44124e153ccb32fec7318baf217 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2647745Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 6689a54d
...@@ -450,4 +450,13 @@ std::ostream &FmtHex(std::ostream &os, T value) ...@@ -450,4 +450,13 @@ std::ostream &FmtHex(std::ostream &os, T value)
# define ANGLE_REENABLE_WEAK_TEMPLATE_VTABLES_WARNING # define ANGLE_REENABLE_WEAK_TEMPLATE_VTABLES_WARNING
#endif #endif
#if defined(__clang__)
# define ANGLE_DISABLE_UNUSED_FUNCTION_WARNING \
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wunused-function\"")
# define ANGLE_REENABLE_UNUSED_FUNCTION_WARNING _Pragma("clang diagnostic pop")
#else
# define ANGLE_DISABLE_UNUSED_FUNCTION_WARNING
# define ANGLE_REENABLE_UNUSED_FUNCTION_WARNING
#endif
#endif // COMMON_DEBUG_H_ #endif // COMMON_DEBUG_H_
...@@ -3964,6 +3964,58 @@ void FrameCapture::maybeOverrideEntryPoint(const gl::Context *context, CallCaptu ...@@ -3964,6 +3964,58 @@ void FrameCapture::maybeOverrideEntryPoint(const gl::Context *context, CallCaptu
} }
} }
void FrameCapture::maybeCaptureDrawArraysClientData(const gl::Context *context,
CallCapture &call,
size_t instanceCount)
{
if (!context->getStateCache().hasAnyActiveClientAttrib())
{
return;
}
// Get counts from paramBuffer.
GLint firstVertex =
call.params.getParamFlexName("first", "start", ParamType::TGLint, 1).value.GLintVal;
GLsizei drawCount = call.params.getParam("count", ParamType::TGLsizei, 2).value.GLsizeiVal;
captureClientArraySnapshot(context, firstVertex + drawCount, instanceCount);
}
void FrameCapture::maybeCaptureDrawElementsClientData(const gl::Context *context,
CallCapture &call,
size_t instanceCount)
{
if (!context->getStateCache().hasAnyActiveClientAttrib())
{
return;
}
GLsizei count = call.params.getParam("count", ParamType::TGLsizei, 1).value.GLsizeiVal;
gl::DrawElementsType drawElementsType =
call.params.getParam("typePacked", ParamType::TDrawElementsType, 2)
.value.DrawElementsTypeVal;
const void *indices =
call.params.getParam("indices", ParamType::TvoidConstPointer, 3).value.voidConstPointerVal;
gl::IndexRange indexRange;
bool restart = context->getState().isPrimitiveRestartEnabled();
gl::Buffer *elementArrayBuffer = context->getState().getVertexArray()->getElementArrayBuffer();
if (elementArrayBuffer)
{
size_t offset = reinterpret_cast<size_t>(indices);
(void)elementArrayBuffer->getIndexRange(context, drawElementsType, offset, count, restart,
&indexRange);
}
else
{
indexRange = gl::ComputeIndexRange(drawElementsType, indices, count, restart);
}
// index starts from 0
captureClientArraySnapshot(context, indexRange.end + 1, instanceCount);
}
void FrameCapture::maybeCapturePreCallUpdates(const gl::Context *context, CallCapture &call) void FrameCapture::maybeCapturePreCallUpdates(const gl::Context *context, CallCapture &call)
{ {
switch (call.entryPoint) switch (call.entryPoint)
...@@ -4026,51 +4078,35 @@ void FrameCapture::maybeCapturePreCallUpdates(const gl::Context *context, CallCa ...@@ -4026,51 +4078,35 @@ void FrameCapture::maybeCapturePreCallUpdates(const gl::Context *context, CallCa
case EntryPoint::GLDrawArrays: case EntryPoint::GLDrawArrays:
{ {
if (context->getStateCache().hasAnyActiveClientAttrib()) maybeCaptureDrawArraysClientData(context, call, 1);
{ break;
// Get counts from paramBuffer. }
GLint firstVertex =
call.params.getParam("first", ParamType::TGLint, 1).value.GLintVal; case EntryPoint::GLDrawArraysInstanced:
GLsizei drawCount = case EntryPoint::GLDrawArraysInstancedANGLE:
call.params.getParam("count", ParamType::TGLsizei, 2).value.GLsizeiVal; case EntryPoint::GLDrawArraysInstancedEXT:
captureClientArraySnapshot(context, firstVertex + drawCount, 1); {
} GLsizei instancecount =
call.params.getParamFlexName("instancecount", "primcount", ParamType::TGLsizei, 3)
.value.GLsizeiVal;
maybeCaptureDrawArraysClientData(context, call, instancecount);
break; break;
} }
case EntryPoint::GLDrawElements: case EntryPoint::GLDrawElements:
{ {
if (context->getStateCache().hasAnyActiveClientAttrib()) maybeCaptureDrawElementsClientData(context, call, 1);
{ break;
GLsizei count = }
call.params.getParam("count", ParamType::TGLsizei, 1).value.GLsizeiVal;
gl::DrawElementsType drawElementsType =
call.params.getParam("typePacked", ParamType::TDrawElementsType, 2)
.value.DrawElementsTypeVal;
const void *indices =
call.params.getParam("indices", ParamType::TvoidConstPointer, 3)
.value.voidConstPointerVal;
gl::IndexRange indexRange;
bool restart = context->getState().isPrimitiveRestartEnabled();
gl::Buffer *elementArrayBuffer =
context->getState().getVertexArray()->getElementArrayBuffer();
if (elementArrayBuffer)
{
size_t offset = reinterpret_cast<size_t>(indices);
(void)elementArrayBuffer->getIndexRange(context, drawElementsType, offset,
count, restart, &indexRange);
}
else
{
indexRange = gl::ComputeIndexRange(drawElementsType, indices, count, restart);
}
// index starts from 0 case EntryPoint::GLDrawElementsInstanced:
captureClientArraySnapshot(context, indexRange.end + 1, 1); case EntryPoint::GLDrawElementsInstancedANGLE:
} case EntryPoint::GLDrawElementsInstancedEXT:
{
GLsizei instancecount =
call.params.getParamFlexName("instancecount", "primcount", ParamType::TGLsizei, 4)
.value.GLsizeiVal;
maybeCaptureDrawElementsClientData(context, call, instancecount);
break; break;
} }
......
...@@ -349,6 +349,12 @@ class FrameCapture final : angle::NonCopyable ...@@ -349,6 +349,12 @@ class FrameCapture final : angle::NonCopyable
void maybeOverrideEntryPoint(const gl::Context *context, CallCapture &call); void maybeOverrideEntryPoint(const gl::Context *context, CallCapture &call);
void maybeCapturePreCallUpdates(const gl::Context *context, CallCapture &call); void maybeCapturePreCallUpdates(const gl::Context *context, CallCapture &call);
void maybeCapturePostCallUpdates(const gl::Context *context); void maybeCapturePostCallUpdates(const gl::Context *context);
void maybeCaptureDrawArraysClientData(const gl::Context *context,
CallCapture &call,
size_t instanceCount);
void maybeCaptureDrawElementsClientData(const gl::Context *context,
CallCapture &call,
size_t instanceCount);
static void ReplayCall(gl::Context *context, static void ReplayCall(gl::Context *context,
ReplayContext *replayContext, ReplayContext *replayContext,
......
...@@ -174,7 +174,8 @@ void CaptureDrawElementsInstancedANGLE_indices(const State &glState, ...@@ -174,7 +174,8 @@ void CaptureDrawElementsInstancedANGLE_indices(const State &glState,
GLsizei primcount, GLsizei primcount,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); CaptureDrawElements_indices(glState, isCallValid, modePacked, count, typePacked, indices,
paramCapture);
} }
void CaptureDrawElementsBaseVertexEXT_indices(const State &glState, void CaptureDrawElementsBaseVertexEXT_indices(const State &glState,
...@@ -2396,7 +2397,8 @@ void CaptureDrawElementsInstancedEXT_indices(const State &glState, ...@@ -2396,7 +2397,8 @@ void CaptureDrawElementsInstancedEXT_indices(const State &glState,
GLsizei primcount, GLsizei primcount,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); CaptureDrawElements_indices(glState, isCallValid, modePacked, count, typePacked, indices,
paramCapture);
} }
void CaptureCreateMemoryObjectsEXT_memoryObjectsPacked(const State &glState, void CaptureCreateMemoryObjectsEXT_memoryObjectsPacked(const State &glState,
......
...@@ -30,6 +30,11 @@ ...@@ -30,6 +30,11 @@
#include "libANGLE/renderer/FramebufferImpl.h" #include "libANGLE/renderer/FramebufferImpl.h"
#include "libANGLE/renderer/RenderbufferImpl.h" #include "libANGLE/renderer/RenderbufferImpl.h"
// Note: when diagnosing serialization comparison failures, you can disable the unused function
// compiler warning to allow bisecting the comparison function. One first check is to disable
// Framebuffer Attachment pixel comparison which includes the pixel contents of the default FBO.
// ANGLE_DISABLE_UNUSED_FUNCTION_WARNING
namespace angle namespace angle
{ {
......
...@@ -135,12 +135,13 @@ class CaptureReplayTests ...@@ -135,12 +135,13 @@ class CaptureReplayTests
return -1; return -1;
} }
bool isEqual = compareSerializedContexts(testIndex, frame, bos.getData()); bool isEqual = compareSerializedContexts(testIndex, frame, bos.getData());
// Swap always to allow RenderDoc/other tools to capture frames.
swap();
if (!isEqual) if (!isEqual)
{ {
cleanupTest(); cleanupTest();
return -1; return -1;
} }
swap();
} }
cleanupTest(); cleanupTest();
return 0; return 0;
......
...@@ -104,128 +104,6 @@ GetImageTest.* ...@@ -104,128 +104,6 @@ GetImageTest.*
GetTexLevelParameterTest.Queries/* GetTexLevelParameterTest.Queries/*
GLSLTest.InvariantGLPosition/* GLSLTest.InvariantGLPosition/*
GLSLTest.MissingReturnVec4/* GLSLTest.MissingReturnVec4/*
InstancingTest.IndexedAttrib0PointBufferAngle/*
InstancingTest.IndexedAttrib0PointBufferExt/*
InstancingTest.IndexedAttrib0PointMemoryAngle/*
InstancingTest.IndexedAttrib0PointMemoryExt/*
InstancingTest.IndexedAttrib0QuadBufferAngle/*
InstancingTest.IndexedAttrib0QuadBufferExt/*
InstancingTest.IndexedAttrib0QuadMemoryAngle/*
InstancingTest.IndexedAttrib0QuadMemoryExt/*
InstancingTest.IndexedAttrib0TriFanBufferAngle/*
InstancingTest.IndexedAttrib0TriFanBufferExt/*
InstancingTest.IndexedAttrib0TriFanMemoryAngle/*
InstancingTest.IndexedAttrib0TriFanMemoryExt/*
InstancingTest.IndexedAttrib1PointBufferAngle/*
InstancingTest.IndexedAttrib1PointBufferExt/*
InstancingTest.IndexedAttrib1PointMemoryAngle/*
InstancingTest.IndexedAttrib1PointMemoryExt/*
InstancingTest.IndexedAttrib1QuadBufferAngle/*
InstancingTest.IndexedAttrib1QuadBufferExt/*
InstancingTest.IndexedAttrib1QuadMemoryAngle/*
InstancingTest.IndexedAttrib1QuadMemoryExt/*
InstancingTest.IndexedAttrib1TriFanBufferAngle/*
InstancingTest.IndexedAttrib1TriFanBufferExt/*
InstancingTest.IndexedAttrib1TriFanMemoryAngle/*
InstancingTest.IndexedAttrib1TriFanMemoryExt/*
InstancingTest.Instances10Divisor1/*
InstancingTest.Instances11Divisor1/*
InstancingTest.Instances11Divisor2/*
InstancingTest.Instances12Divisor1/*
InstancingTest.Instances12Divisor11/*
InstancingTest.Instances13Divisor1/*
InstancingTest.Instances13Divisor2/*
InstancingTest.Instances14Divisor1/*
InstancingTest.Instances15Divisor1/*
InstancingTest.Instances15Divisor2/*
InstancingTest.Instances16Divisor1/*
InstancingTest.Instances16Divisor3/*
InstancingTest.Instances16Divisor7/*
InstancingTest.Instances17Divisor2/*
InstancingTest.Instances1Divisor1/*
InstancingTest.Instances1Divisor2/*
InstancingTest.Instances20Divisor2/*
InstancingTest.Instances21Divisor2/*
InstancingTest.Instances23Divisor2/*
InstancingTest.Instances25Divisor33/*
InstancingTest.Instances25Divisor5/*
InstancingTest.Instances26Divisor2/*
InstancingTest.Instances26Divisor3/*
InstancingTest.Instances27Divisor2/*
InstancingTest.Instances27Divisor4/*
InstancingTest.Instances28Divisor3/*
InstancingTest.Instances29Divisor11/*
InstancingTest.Instances29Divisor2/*
InstancingTest.Instances2Divisor1/*
InstancingTest.Instances30Divisor4/*
InstancingTest.Instances31Divisor6/*
InstancingTest.Instances32Divisor2/*
InstancingTest.Instances32Divisor3/*
InstancingTest.Instances32Divisor8/*
InstancingTest.Instances34Divisor3/*
InstancingTest.Instances34Divisor30/*
InstancingTest.Instances3Divisor1/*
InstancingTest.Instances3Divisor2/*
InstancingTest.Instances4Divisor1/*
InstancingTest.Instances5Divisor1/*
InstancingTest.Instances5Divisor2/*
InstancingTest.Instances6Divisor1/*
InstancingTest.Instances6Divisor2/*
InstancingTest.Instances7Divisor1/*
InstancingTest.Instances7Divisor2/*
InstancingTest.Instances8Divisor1/*
InstancingTest.Instances8Divisor2/*
InstancingTest.Instances8Divisor4/*
InstancingTest.Instances9Divisor1/*
InstancingTest.Instances9Divisor2/*
InstancingTest.NonIndexedAttrib0PointBufferAngleOffset0/*
InstancingTest.NonIndexedAttrib0PointBufferAngleOffset2/*
InstancingTest.NonIndexedAttrib0PointBufferExtOffset0/*
InstancingTest.NonIndexedAttrib0PointBufferExtOffset2/*
InstancingTest.NonIndexedAttrib0PointMemoryAngleOffset0/*
InstancingTest.NonIndexedAttrib0PointMemoryAngleOffset2/*
InstancingTest.NonIndexedAttrib0PointMemoryExtOffset0/*
InstancingTest.NonIndexedAttrib0PointMemoryExtOffset2/*
InstancingTest.NonIndexedAttrib0QuadBufferAngleOffset0/*
InstancingTest.NonIndexedAttrib0QuadBufferAngleOffset4/*
InstancingTest.NonIndexedAttrib0QuadBufferExtOffset0/*
InstancingTest.NonIndexedAttrib0QuadBufferExtOffset4/*
InstancingTest.NonIndexedAttrib0QuadMemoryAngleOffset0/*
InstancingTest.NonIndexedAttrib0QuadMemoryAngleOffset4/*
InstancingTest.NonIndexedAttrib0QuadMemoryExtOffset0/*
InstancingTest.NonIndexedAttrib0QuadMemoryExtOffset4/*
InstancingTest.NonIndexedAttrib0TriFanBufferAngleOffset0/*
InstancingTest.NonIndexedAttrib0TriFanBufferAngleOffset8/*
InstancingTest.NonIndexedAttrib0TriFanBufferExtOffset0/*
InstancingTest.NonIndexedAttrib0TriFanBufferExtOffset8/*
InstancingTest.NonIndexedAttrib0TriFanMemoryAngleOffset0/*
InstancingTest.NonIndexedAttrib0TriFanMemoryAngleOffset8/*
InstancingTest.NonIndexedAttrib0TriFanMemoryExtOffset0/*
InstancingTest.NonIndexedAttrib0TriFanMemoryExtOffset8/*
InstancingTest.NonIndexedAttrib1PointBufferAngleOffset0/*
InstancingTest.NonIndexedAttrib1PointBufferAngleOffset2/*
InstancingTest.NonIndexedAttrib1PointBufferExtOffset0/*
InstancingTest.NonIndexedAttrib1PointBufferExtOffset2/*
InstancingTest.NonIndexedAttrib1PointMemoryAngleOffset0/*
InstancingTest.NonIndexedAttrib1PointMemoryAngleOffset2/*
InstancingTest.NonIndexedAttrib1PointMemoryExtOffset0/*
InstancingTest.NonIndexedAttrib1PointMemoryExtOffset2/*
InstancingTest.NonIndexedAttrib1QuadBufferAngleOffset0/*
InstancingTest.NonIndexedAttrib1QuadBufferAngleOffset4/*
InstancingTest.NonIndexedAttrib1QuadBufferExtOffset0/*
InstancingTest.NonIndexedAttrib1QuadBufferExtOffset4/*
InstancingTest.NonIndexedAttrib1QuadMemoryAngleOffset0/*
InstancingTest.NonIndexedAttrib1QuadMemoryAngleOffset4/*
InstancingTest.NonIndexedAttrib1QuadMemoryExtOffset0/*
InstancingTest.NonIndexedAttrib1QuadMemoryExtOffset4/*
InstancingTest.NonIndexedAttrib1TriFanBufferAngleOffset0/*
InstancingTest.NonIndexedAttrib1TriFanBufferAngleOffset8/*
InstancingTest.NonIndexedAttrib1TriFanBufferExtOffset0/*
InstancingTest.NonIndexedAttrib1TriFanBufferExtOffset8/*
InstancingTest.NonIndexedAttrib1TriFanMemoryAngleOffset0/*
InstancingTest.NonIndexedAttrib1TriFanMemoryAngleOffset8/*
InstancingTest.NonIndexedAttrib1TriFanMemoryExtOffset0/*
InstancingTest.NonIndexedAttrib1TriFanMemoryExtOffset8/*
MemoryObjectTest.MemoryObjectQueries/* MemoryObjectTest.MemoryObjectQueries/*
MemoryObjectTest.MemoryObjectShouldBeMemoryObject/* MemoryObjectTest.MemoryObjectShouldBeMemoryObject/*
MemoryObjectTest.ShouldFailValidationOnImportFdUnsupportedHandleType/* MemoryObjectTest.ShouldFailValidationOnImportFdUnsupportedHandleType/*
......
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