1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program Reference Renderer
3 * -----------------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Primitive packet
22 *//*--------------------------------------------------------------------*/
24 #include "rrPrimitivePacket.hpp"
26 #include "rrVertexPacket.hpp"
31 GeometryEmitter::GeometryEmitter (VertexPacketAllocator& vpalloc, size_t numVertices)
34 , m_maxVertices (numVertices)
38 void GeometryEmitter::EmitVertex (const tcu::Vec4& position, float pointSize, const GenericVec4* varyings, int primitiveID)
42 if (++m_numEmitted > m_maxVertices)
44 DE_FATAL("Undefined results, too many vertices emitted.");
48 packet = m_vpalloc.alloc();
50 packet->position = position;
51 packet->pointSize = pointSize;
52 packet->primitiveID = primitiveID;
54 for (size_t ndx = 0; ndx < m_vpalloc.getNumVertexOutputs(); ++ndx)
55 packet->outputs[ndx] = varyings[ndx];
57 m_emitted.push_back(packet);
60 void GeometryEmitter::EndPrimitive (void)
63 m_emitted.push_back(DE_NULL);
66 void GeometryEmitter::moveEmittedTo (std::vector<VertexPacket*>& output)
68 m_emitted.swap(output);