1 #ifndef _RRRENDERER_HPP
2 #define _RRRENDERER_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Reference Renderer
5 * -----------------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief Reference renderer interface.
24 *//*--------------------------------------------------------------------*/
27 #include "rrShaders.hpp"
28 #include "rrRenderState.hpp"
29 #include "rrPrimitiveTypes.hpp"
30 #include "rrMultisamplePixelBufferAccess.hpp"
31 #include "tcuTexture.hpp"
44 RenderTarget (const MultisamplePixelBufferAccess& colorMultisampleBuffer,
45 const MultisamplePixelBufferAccess& depthMultisampleBuffer = MultisamplePixelBufferAccess(),
46 const MultisamplePixelBufferAccess& stencilMultisampleBuffer = MultisamplePixelBufferAccess());
48 int getNumSamples (void) const;
50 const MultisamplePixelBufferAccess& getColorBuffer (int ndx) const { DE_ASSERT(de::inRange(ndx, 0, m_numColorBuffers)); return m_colorBuffers[ndx]; }
51 int getNumColorBuffers (void) const { return m_numColorBuffers; }
52 const MultisamplePixelBufferAccess& getStencilBuffer (void) const { return m_stencilBuffer; }
53 const MultisamplePixelBufferAccess& getDepthBuffer (void) const { return m_depthBuffer; }
56 MultisamplePixelBufferAccess m_colorBuffers[MAX_COLOR_BUFFERS];
57 const int m_numColorBuffers;
58 const MultisamplePixelBufferAccess m_depthBuffer;
59 const MultisamplePixelBufferAccess m_stencilBuffer;
60 } DE_WARN_UNUSED_TYPE;
64 Program (const VertexShader* vertexShader_, const FragmentShader* fragmentShader_, const GeometryShader* geometryShader_ = DE_NULL)
65 : vertexShader (vertexShader_)
66 , fragmentShader (fragmentShader_)
67 , geometryShader (geometryShader_)
71 const VertexShader* vertexShader;
72 const FragmentShader* fragmentShader;
73 const GeometryShader* geometryShader;
74 } DE_WARN_UNUSED_TYPE;
78 DrawIndices (const deUint32*, int baseVertex = 0);
79 DrawIndices (const deUint16*, int baseVertex = 0);
80 DrawIndices (const deUint8*, int baseVertex = 0);
81 DrawIndices (const void* ptr, IndexType type, int baseVertex = 0);
83 const void* const indices;
84 const IndexType indexType;
86 } DE_WARN_UNUSED_TYPE;
91 PrimitiveList (PrimitiveType primitiveType, int numElements, const int firstElement); // !< primitive list for drawArrays-like call
92 PrimitiveList (PrimitiveType primitiveType, int numElements, const DrawIndices& indices); // !< primitive list for drawElements-like call
94 size_t getIndex (size_t elementNdx) const;
95 bool isRestartIndex (size_t elementNdx, deUint32 restartIndex) const;
97 inline size_t getNumElements (void) const { return m_numElements; }
98 inline PrimitiveType getPrimitiveType (void) const { return m_primitiveType; }
99 inline IndexType getIndexType (void) const { return m_indexType; }
102 const PrimitiveType m_primitiveType;
103 const size_t m_numElements;
104 const void* const m_indices; // !< if indices is NULL, indices is interpreted as [first (== baseVertex) + 0, first + 1, first + 2, ...]
105 const IndexType m_indexType;
106 const int m_baseVertex;
112 DrawCommand (const RenderState& state_, const RenderTarget& renderTarget_, const Program& program_, int numVertexAttribs_, const VertexAttrib* vertexAttribs_, const PrimitiveList& primitives_)
114 , renderTarget (renderTarget_)
116 , numVertexAttribs (numVertexAttribs_)
117 , vertexAttribs (vertexAttribs_)
118 , primitives (primitives_)
122 const RenderState& state;
123 const RenderTarget& renderTarget;
124 const Program& program;
126 const int numVertexAttribs;
127 const VertexAttrib* const vertexAttribs;
129 const PrimitiveList& primitives;
130 } DE_WARN_UNUSED_TYPE;
138 void draw (const DrawCommand& command) const;
139 void drawInstanced (const DrawCommand& command, int numInstances) const;
140 } DE_WARN_UNUSED_TYPE;
144 #endif // _RRRENDERER_HPP