Commit f6f8bf9e by Alexis Hetu Committed by Alexis Hétu

Adding task data for transform feedback

Transform feedback requires a bit of extra data to write properly into the transform feedback buffers. First it needs to know where in the buffer to read, which can be derived from the vertex number provided in vertexStart. Also, since SwiftShader always processes 3 vertices per primitive, regardless of the primitive type, transform feedback needs to know which vertices to use, and that information can be derived from verticesPerPrimitive. Change-Id: I820d99949d7b2955794cc143ffb178e76dd418d7 Reviewed-on: https://swiftshader-review.googlesource.com/5062Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent dbd1a8e6
...@@ -51,6 +51,8 @@ namespace sw ...@@ -51,6 +51,8 @@ namespace sw
enum DrawType : unsigned int enum DrawType : unsigned int
{ {
// These types must stay ordered by vertices per primitive. Also, if these basic types
// are modified, verify the value assigned to task->verticesPerPrimitive in Renderer.cpp
DRAW_POINTLIST = 0x00, DRAW_POINTLIST = 0x00,
DRAW_LINELIST = 0x01, DRAW_LINELIST = 0x01,
DRAW_LINESTRIP = 0x02, DRAW_LINESTRIP = 0x02,
......
...@@ -1457,7 +1457,12 @@ namespace sw ...@@ -1457,7 +1457,12 @@ namespace sw
return; return;
} }
task->vertexCount = triangleCount * 3; task->vertexStart = start * 3;
task->vertexCount = triangleCount * 3;
// Note: Quads aren't handled for verticesPerPrimitive, but verticesPerPrimitive is used for transform feedback,
// which is an OpenGL ES 3.0 feature, and OpenGL ES 3.0 doesn't support quads as a primitive type.
DrawType type = static_cast<DrawType>(static_cast<unsigned int>(draw->drawType) & 0xF);
task->verticesPerPrimitive = 1 + (type >= DRAW_LINELIST) + (type >= DRAW_TRIANGLELIST);
vertexRoutine(&triangle->v0, (unsigned int*)&batch, task, data); vertexRoutine(&triangle->v0, (unsigned int*)&batch, task, data);
} }
......
...@@ -32,7 +32,9 @@ namespace sw ...@@ -32,7 +32,9 @@ namespace sw
struct VertexTask struct VertexTask
{ {
unsigned int vertexStart;
unsigned int vertexCount; unsigned int vertexCount;
unsigned int verticesPerPrimitive;
VertexCache vertexCache; VertexCache vertexCache;
}; };
......
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