Commit e40edf92 by Lubosz Sarnecki Committed by Commit Bot

FrameCapture: Add GLES1 support to CaptureVertexArrayData.

Implement CaptureVertexPointerES1 that captures specific GLES1 vertex pointer functions depending on the attribute index. Use GLES1 capture functions in CaptureVertexArrayData by detecting the current context version. Implement VertexArrayType function in GLES1Renderer to get a ClientVertexArrayType enum from a vertex attrib index. Bug: angleproject:5893 Change-Id: I442b2e29475ca817860388cafc120db90a0fb9c4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2846838Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
parent eb91ebc9
...@@ -455,6 +455,29 @@ int GLES1Renderer::VertexArrayIndex(ClientVertexArrayType type, const GLES1State ...@@ -455,6 +455,29 @@ int GLES1Renderer::VertexArrayIndex(ClientVertexArrayType type, const GLES1State
} }
// static // static
ClientVertexArrayType GLES1Renderer::VertexArrayType(int attribIndex)
{
switch (attribIndex)
{
case kVertexAttribIndex:
return ClientVertexArrayType::Vertex;
case kNormalAttribIndex:
return ClientVertexArrayType::Normal;
case kColorAttribIndex:
return ClientVertexArrayType::Color;
case kPointSizeAttribIndex:
return ClientVertexArrayType::PointSize;
default:
if (attribIndex < kTextureCoordAttribIndexBase + kTexUnitCount)
{
return ClientVertexArrayType::TextureCoord;
}
UNREACHABLE();
return ClientVertexArrayType::InvalidEnum;
}
}
// static
int GLES1Renderer::TexCoordArrayIndex(unsigned int unit) int GLES1Renderer::TexCoordArrayIndex(unsigned int unit)
{ {
return kTextureCoordAttribIndexBase + unit; return kTextureCoordAttribIndexBase + unit;
......
...@@ -38,6 +38,7 @@ class GLES1Renderer final : angle::NonCopyable ...@@ -38,6 +38,7 @@ class GLES1Renderer final : angle::NonCopyable
angle::Result prepareForDraw(PrimitiveMode mode, Context *context, State *glState); angle::Result prepareForDraw(PrimitiveMode mode, Context *context, State *glState);
static int VertexArrayIndex(ClientVertexArrayType type, const GLES1State &gles1); static int VertexArrayIndex(ClientVertexArrayType type, const GLES1State &gles1);
static ClientVertexArrayType VertexArrayType(int attribIndex);
static int TexCoordArrayIndex(unsigned int unit); static int TexCoordArrayIndex(unsigned int unit);
void drawTexture(Context *context, void drawTexture(Context *context,
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "libANGLE/Shader.h" #include "libANGLE/Shader.h"
#include "libANGLE/Surface.h" #include "libANGLE/Surface.h"
#include "libANGLE/VertexArray.h" #include "libANGLE/VertexArray.h"
#include "libANGLE/capture/capture_gles_1_0_autogen.h"
#include "libANGLE/capture/capture_gles_2_0_autogen.h" #include "libANGLE/capture/capture_gles_2_0_autogen.h"
#include "libANGLE/capture/capture_gles_3_0_autogen.h" #include "libANGLE/capture/capture_gles_3_0_autogen.h"
#include "libANGLE/capture/capture_gles_3_1_autogen.h" #include "libANGLE/capture/capture_gles_3_1_autogen.h"
...@@ -1870,6 +1871,46 @@ void CaptureUpdateUniformValues(const gl::State &replayState, ...@@ -1870,6 +1871,46 @@ void CaptureUpdateUniformValues(const gl::State &replayState,
} }
} }
void CaptureVertexPointerES1(std::vector<CallCapture> *setupCalls,
gl::State *replayState,
GLuint attribIndex,
const gl::VertexAttribute &attrib,
const gl::VertexBinding &binding)
{
switch (gl::GLES1Renderer::VertexArrayType(attribIndex))
{
case gl::ClientVertexArrayType::Vertex:
Capture(setupCalls,
CaptureVertexPointer(*replayState, true, attrib.format->channelCount,
attrib.format->vertexAttribType, binding.getStride(),
attrib.pointer));
break;
case gl::ClientVertexArrayType::Normal:
Capture(setupCalls,
CaptureNormalPointer(*replayState, true, attrib.format->vertexAttribType,
binding.getStride(), attrib.pointer));
break;
case gl::ClientVertexArrayType::Color:
Capture(setupCalls, CaptureColorPointer(*replayState, true, attrib.format->channelCount,
attrib.format->vertexAttribType,
binding.getStride(), attrib.pointer));
break;
case gl::ClientVertexArrayType::PointSize:
Capture(setupCalls,
CapturePointSizePointerOES(*replayState, true, attrib.format->vertexAttribType,
binding.getStride(), attrib.pointer));
break;
case gl::ClientVertexArrayType::TextureCoord:
Capture(setupCalls,
CaptureTexCoordPointer(*replayState, true, attrib.format->channelCount,
attrib.format->vertexAttribType, binding.getStride(),
attrib.pointer));
break;
default:
UNREACHABLE();
}
}
void CaptureVertexArrayData(std::vector<CallCapture> *setupCalls, void CaptureVertexArrayData(std::vector<CallCapture> *setupCalls,
const gl::Context *context, const gl::Context *context,
const gl::VertexArray *vertexArray, const gl::VertexArray *vertexArray,
...@@ -1888,7 +1929,17 @@ void CaptureVertexArrayData(std::vector<CallCapture> *setupCalls, ...@@ -1888,7 +1929,17 @@ void CaptureVertexArrayData(std::vector<CallCapture> *setupCalls,
if (attrib.enabled != defaultAttrib.enabled) if (attrib.enabled != defaultAttrib.enabled)
{ {
Capture(setupCalls, CaptureEnableVertexAttribArray(*replayState, false, attribIndex)); if (context->isGLES1())
{
Capture(setupCalls,
CaptureEnableClientState(*replayState, false,
gl::GLES1Renderer::VertexArrayType(attribIndex)));
}
else
{
Capture(setupCalls,
CaptureEnableVertexAttribArray(*replayState, false, attribIndex));
}
} }
if (attrib.format != defaultAttrib.format || attrib.pointer != defaultAttrib.pointer || if (attrib.format != defaultAttrib.format || attrib.pointer != defaultAttrib.pointer ||
...@@ -1906,11 +1957,19 @@ void CaptureVertexArrayData(std::vector<CallCapture> *setupCalls, ...@@ -1906,11 +1957,19 @@ void CaptureVertexArrayData(std::vector<CallCapture> *setupCalls,
} }
// Establish the relationship between currently bound buffer and the VAO // Establish the relationship between currently bound buffer and the VAO
Capture(setupCalls, CaptureVertexAttribPointer( if (context->isGLES1())
{
CaptureVertexPointerES1(setupCalls, replayState, attribIndex, attrib, binding);
}
else
{
Capture(setupCalls,
CaptureVertexAttribPointer(
*replayState, true, attribIndex, attrib.format->channelCount, *replayState, true, attribIndex, attrib.format->channelCount,
attrib.format->vertexAttribType, attrib.format->isNorm(), attrib.format->vertexAttribType, attrib.format->isNorm(),
binding.getStride(), attrib.pointer)); binding.getStride(), attrib.pointer));
} }
}
if (binding.getDivisor() != 0) if (binding.getDivisor() != 0)
{ {
......
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