Commit 541d6a03 by Alexis Hetu Committed by Alexis Hétu

Primitive restart fixed

SwiftShader wasn't correctly handling having no restart indices in the index buffer while having primitive restart enabled. In the WebGL 2 conformance tests, the reference image is also computed while primitive restart is on, which means that Context::drawElements() may modify the internal primitive type, so indices must be adjusted to reflect that change, even if no restart indices are present in the index buffer. Fixes all WebGL 2 tests in: all/deqp/functional/gles3/primitiverestart Change-Id: I24f129e0f7bd42b5037b74617b48a32621440ddb Reviewed-on: https://swiftshader-review.googlesource.com/16548Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 61fe99f5
......@@ -65,7 +65,8 @@ void copyIndices(GLenum type, const void *input, GLsizei count, void *output)
inline GLsizei getNumIndices(const std::vector<GLsizei>& restartIndices, size_t i, GLsizei count)
{
return (i == 0) ? restartIndices[0] : ((i == restartIndices.size()) ? (count - restartIndices[i - 1] - 1) : (restartIndices[i] - restartIndices[i - 1] - 1));
return restartIndices.empty() ? count :
((i == 0) ? restartIndices[0] : ((i == restartIndices.size()) ? (count - restartIndices[i - 1] - 1) : (restartIndices[i] - restartIndices[i - 1] - 1)));
}
void copyIndices(GLenum mode, GLenum type, const std::vector<GLsizei>& restartIndices, const void *input, GLsizei count, void* output)
......@@ -290,11 +291,6 @@ GLenum IndexDataManager::prepareIndexData(GLenum mode, GLenum type, GLuint start
std::vector<GLsizei>* restartIndices = primitiveRestart ? new std::vector<GLsizei>() : nullptr;
computeRange(type, indices, count, &translated->minIndex, &translated->maxIndex, restartIndices);
if(restartIndices && restartIndices->empty())
{
delete restartIndices;
restartIndices = nullptr;
}
StreamingIndexBuffer *streamingBuffer = mStreamingBuffer;
......
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