• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _SGLRREFERENCECONTEXT_HPP
2 #define _SGLRREFERENCECONTEXT_HPP
3 /*-------------------------------------------------------------------------
4  * drawElements Quality Program OpenGL ES Utilities
5  * ------------------------------------------------
6  *
7  * Copyright 2014 The Android Open Source Project
8  *
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
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
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.
20  *
21  *//*!
22  * \file
23  * \brief Reference Rendering Context.
24  *//*--------------------------------------------------------------------*/
25 
26 #include "tcuDefs.hpp"
27 #include "sglrContext.hpp"
28 #include "tcuPixelFormat.hpp"
29 #include "tcuSurface.hpp"
30 #include "tcuTexture.hpp"
31 #include "tcuVector.hpp"
32 #include "rrFragmentOperations.hpp"
33 #include "rrRenderState.hpp"
34 #include "rrRenderer.hpp"
35 #include "rrMultisamplePixelBufferAccess.hpp"
36 #include "gluRenderContext.hpp"
37 #include "gluShaderUtil.hpp"
38 #include "deArrayBuffer.hpp"
39 
40 #include <map>
41 #include <vector>
42 
43 namespace sglr
44 {
45 namespace rc
46 {
47 
48 enum
49 {
50 	MAX_TEXTURE_SIZE_LOG2		= 14,
51 	MAX_TEXTURE_SIZE			= 1<<MAX_TEXTURE_SIZE_LOG2
52 };
53 
54 class NamedObject
55 {
56 public:
~NamedObject(void)57 	virtual			~NamedObject		(void) {}
58 
getName(void) const59 	deUint32		getName				(void) const	{ return m_name;								}
60 
getRefCount(void) const61 	int				getRefCount			(void) const	{ return m_refCount;							}
incRefCount(void)62 	void			incRefCount			(void)			{ m_refCount += 1;								}
decRefCount(void)63 	void			decRefCount			(void)			{ DE_ASSERT(m_refCount > 0); m_refCount -= 1;	}
64 
65 protected:
NamedObject(deUint32 name)66 					NamedObject			(deUint32 name) : m_name(name), m_refCount(1) {}
67 
68 private:
69 	deUint32		m_name;
70 	int				m_refCount;
71 };
72 
73 class Texture : public NamedObject
74 {
75 public:
76 	enum Type
77 	{
78 		TYPE_1D,
79 		TYPE_2D,
80 		TYPE_CUBE_MAP,
81 		TYPE_2D_ARRAY,
82 		TYPE_3D,
83 		TYPE_CUBE_MAP_ARRAY,
84 
85 		TYPE_LAST
86 	};
87 
88 								Texture			(deUint32 name, Type type, deBool seamless = true);
~Texture(void)89 	virtual						~Texture		(void) {}
90 
getType(void) const91 	Type						getType			(void) const	{ return m_type;			}
92 
getBaseLevel(void) const93 	int							getBaseLevel	(void) const	{ return m_baseLevel;		}
getMaxLevel(void) const94 	int							getMaxLevel		(void) const	{ return m_maxLevel;		}
isImmutable(void) const95 	bool						isImmutable		(void) const	{ return m_immutable;		}
96 
setBaseLevel(int baseLevel)97 	void						setBaseLevel	(int baseLevel)	{ m_baseLevel = baseLevel;	}
setMaxLevel(int maxLevel)98 	void						setMaxLevel		(int maxLevel)	{ m_maxLevel = maxLevel;	}
setImmutable(void)99 	void						setImmutable	(void)			{ m_immutable = true;		}
100 
getSampler(void) const101 	const tcu::Sampler&			getSampler		(void) const	{ return m_sampler;			}
getSampler(void)102 	tcu::Sampler&				getSampler		(void)			{ return m_sampler;			}
103 
104 private:
105 	Type						m_type;
106 
107 	bool						m_immutable;
108 
109 	tcu::Sampler				m_sampler;
110 	int							m_baseLevel;
111 	int							m_maxLevel;
112 };
113 
114 //! Class for managing list of texture levels.
115 class TextureLevelArray
116 {
117 public:
118 										TextureLevelArray	(void);
119 										~TextureLevelArray	(void);
120 
hasLevel(int level) const121 	bool								hasLevel			(int level) const	{ return deInBounds32(level, 0, DE_LENGTH_OF_ARRAY(m_data)) && !m_data[level].empty();	}
getLevel(int level)122 	const tcu::PixelBufferAccess&		getLevel			(int level)			{ DE_ASSERT(hasLevel(level)); return m_access[level];									}
getLevel(int level) const123 	const tcu::ConstPixelBufferAccess&	getLevel			(int level) const	{ DE_ASSERT(hasLevel(level)); return m_access[level];									}
124 
getLevels(void) const125 	const tcu::ConstPixelBufferAccess*	getLevels			(void) const		{ return &m_access[0];																	}
getEffectiveLevels(void) const126 	const tcu::ConstPixelBufferAccess*	getEffectiveLevels	(void) const		{ return &m_effectiveAccess[0];															}
127 
128 	void								allocLevel			(int level, const tcu::TextureFormat& format, int width, int height, int depth);
129 	void								clearLevel			(int level);
130 
131 	void								clear				(void);
132 
133 	void								updateSamplerMode	(tcu::Sampler::DepthStencilMode);
134 
135 private:
136 	de::ArrayBuffer<deUint8>			m_data[MAX_TEXTURE_SIZE_LOG2];
137 	tcu::PixelBufferAccess				m_access[MAX_TEXTURE_SIZE_LOG2];
138 	tcu::ConstPixelBufferAccess			m_effectiveAccess[MAX_TEXTURE_SIZE_LOG2];	//!< the currently effective sampling mode. For Depth-stencil texture always either Depth or stencil.
139 };
140 
141 class Texture1D : public Texture
142 {
143 public:
144 										Texture1D		(deUint32 name = 0);
145 	virtual								~Texture1D		(void);
146 
clearLevels(void)147 	void								clearLevels		(void) { m_levels.clear(); }
148 
hasLevel(int level) const149 	bool								hasLevel		(int level) const	{ return m_levels.hasLevel(level);	}
getLevel(int level) const150 	const tcu::ConstPixelBufferAccess&	getLevel		(int level) const	{ return m_levels.getLevel(level);	}
getLevel(int level)151 	const tcu::PixelBufferAccess&		getLevel		(int level)			{ return m_levels.getLevel(level);	}
152 
153 	void								allocLevel		(int level, const tcu::TextureFormat& format, int width);
154 
155 	bool								isComplete		(void) const;
156 
157 	void								updateView		(tcu::Sampler::DepthStencilMode mode); // \note View must be refreshed after texture parameter/size changes, before calling sample*()
158 
159 	tcu::Vec4							sample			(float s, float lod) const;
160 	void								sample4			(tcu::Vec4 output[4], const float packetTexcoords[4], float lodBias = 0.0f) const;
161 
162 private:
163 	TextureLevelArray					m_levels;
164 	tcu::Texture2DView					m_view;
165 };
166 
167 class Texture2D : public Texture
168 {
169 public:
170 										Texture2D		(deUint32 name = 0, bool es2 = false);
171 	virtual								~Texture2D		(void);
172 
clearLevels(void)173 	void								clearLevels		(void) { m_levels.clear(); }
174 
hasLevel(int level) const175 	bool								hasLevel		(int level) const	{ return m_levels.hasLevel(level);	}
getLevel(int level) const176 	const tcu::ConstPixelBufferAccess&	getLevel		(int level) const	{ return m_levels.getLevel(level);	}
getLevel(int level)177 	const tcu::PixelBufferAccess&		getLevel		(int level)			{ return m_levels.getLevel(level);	}
178 
179 	void								allocLevel		(int level, const tcu::TextureFormat& format, int width, int height);
180 
181 	bool								isComplete		(void) const;
182 
183 	void								updateView		(tcu::Sampler::DepthStencilMode mode); // \note View must be refreshed after texture parameter/size changes, before calling sample*()
184 
185 	tcu::Vec4							sample			(float s, float t, float lod) const;
186 	void								sample4			(tcu::Vec4 output[4], const tcu::Vec2 packetTexcoords[4], float lodBias = 0.0f) const;
187 
188 private:
189 	TextureLevelArray					m_levels;
190 	tcu::Texture2DView					m_view;
191 };
192 
193 class TextureCube : public Texture
194 {
195 public:
196 										TextureCube		(deUint32 name = 0, deBool seamless = true);
197 	virtual								~TextureCube	(void);
198 
199 	void								clearLevels		(void);
200 
hasFace(int level,tcu::CubeFace face) const201 	bool								hasFace			(int level, tcu::CubeFace face) const	{ return m_levels[face].hasLevel(level);	}
getFace(int level,tcu::CubeFace face)202 	const tcu::PixelBufferAccess&		getFace			(int level, tcu::CubeFace face)			{ return m_levels[face].getLevel(level);	}
getFace(int level,tcu::CubeFace face) const203 	const tcu::ConstPixelBufferAccess&	getFace			(int level, tcu::CubeFace face) const	{ return m_levels[face].getLevel(level);	}
204 
205 	void								allocFace		(int level, tcu::CubeFace face, const tcu::TextureFormat& format, int width, int height);
206 
207 	bool								isComplete		(void) const;
208 	void								updateView		(tcu::Sampler::DepthStencilMode mode); // \note View must be refreshed after texture parameter/size changes, before calling sample*()
209 
210 	tcu::Vec4							sample			(float s, float t, float p, float lod) const;
211 	void								sample4			(tcu::Vec4 output[4], const tcu::Vec3 packetTexcoords[4], float lodBias = 0.0f) const;
212 
213 private:
214 	TextureLevelArray					m_levels[tcu::CUBEFACE_LAST];
215 	tcu::TextureCubeView				m_view;
216 };
217 
218 class Texture2DArray : public Texture
219 {
220 public:
221 										Texture2DArray	(deUint32 name = 0);
222 	virtual								~Texture2DArray	(void);
223 
clearLevels(void)224 	void								clearLevels		(void) { m_levels.clear(); }
225 
hasLevel(int level) const226 	bool								hasLevel		(int level) const	{ return m_levels.hasLevel(level);	}
getLevel(int level) const227 	const tcu::ConstPixelBufferAccess&	getLevel		(int level) const	{ return m_levels.getLevel(level);	}
getLevel(int level)228 	const tcu::PixelBufferAccess&		getLevel		(int level)			{ return m_levels.getLevel(level);	}
229 
230 	void								allocLevel		(int level, const tcu::TextureFormat& format, int width, int height, int numLayers);
231 
232 	bool								isComplete		(void) const;
233 
234 	void								updateView		(tcu::Sampler::DepthStencilMode mode); // \note View must be refreshed after texture parameter/size changes, before calling sample*()
235 
236 	tcu::Vec4							sample			(float s, float t, float r, float lod) const;
237 	void								sample4			(tcu::Vec4 output[4], const tcu::Vec3 packetTexcoords[4], float lodBias = 0.0f) const;
238 
239 private:
240 	TextureLevelArray					m_levels;
241 	tcu::Texture2DArrayView				m_view;
242 };
243 
244 class Texture3D : public Texture
245 {
246 public:
247 										Texture3D		(deUint32 name = 0);
248 	virtual								~Texture3D		(void);
249 
clearLevels(void)250 	void								clearLevels		(void) { m_levels.clear(); }
251 
hasLevel(int level) const252 	bool								hasLevel		(int level) const	{ return m_levels.hasLevel(level);	}
getLevel(int level) const253 	const tcu::ConstPixelBufferAccess&	getLevel		(int level) const	{ return m_levels.getLevel(level);	}
getLevel(int level)254 	const tcu::PixelBufferAccess&		getLevel		(int level)			{ return m_levels.getLevel(level);	}
255 
256 	void								allocLevel		(int level, const tcu::TextureFormat& format, int width, int height, int numLayers);
257 
258 	bool								isComplete		(void) const;
259 
260 	void								updateView		(tcu::Sampler::DepthStencilMode mode); // \note View must be refreshed after texture parameter/size changes, before calling sample*()
261 
262 	tcu::Vec4							sample			(float s, float t, float r, float lod) const;
263 	void								sample4			(tcu::Vec4 output[4], const tcu::Vec3 packetTexcoords[4], float lodBias = 0.0f) const;
264 
265 private:
266 	TextureLevelArray					m_levels;
267 	tcu::Texture3DView					m_view;
268 };
269 
270 class TextureCubeArray : public Texture
271 {
272 public:
273 										TextureCubeArray	(deUint32 name = 0);
274 	virtual								~TextureCubeArray	(void);
275 
clearLevels(void)276 	void								clearLevels			(void) { m_levels.clear(); }
277 
hasLevel(int level) const278 	bool								hasLevel			(int level) const	{ return m_levels.hasLevel(level);	}
getLevel(int level) const279 	const tcu::ConstPixelBufferAccess&	getLevel			(int level) const	{ return m_levels.getLevel(level);	}
getLevel(int level)280 	const tcu::PixelBufferAccess&		getLevel			(int level)			{ return m_levels.getLevel(level);	}
281 
282 	void								allocLevel			(int level, const tcu::TextureFormat& format, int width, int height, int numLayers);
283 
284 	bool								isComplete			(void) const;
285 
286 	void								updateView			(tcu::Sampler::DepthStencilMode mode); // \note View must be refreshed after texture parameter/size changes, before calling sample*()
287 
288 	tcu::Vec4							sample				(float s, float t, float r, float q, float lod) const;
289 	void								sample4				(tcu::Vec4 output[4], const tcu::Vec4 packetTexcoords[4], float lodBias = 0.0f) const;
290 
291 private:
292 	TextureLevelArray					m_levels;
293 	tcu::TextureCubeArrayView			m_view;
294 };
295 
296 class Renderbuffer : public NamedObject
297 {
298 public:
299 	enum Format
300 	{
301 		FORMAT_DEPTH_COMPONENT16,
302 		FORMAT_RGBA4,
303 		FORMAT_RGB5_A1,
304 		FORMAT_RGB565,
305 		FORMAT_STENCIL_INDEX8,
306 
307 		FORMAT_LAST
308 	};
309 
310 								Renderbuffer		(deUint32 name);
311 	virtual						~Renderbuffer		(void);
312 
313 	void						setStorage			(const tcu::TextureFormat& format, int width, int height);
314 
getWidth(void) const315 	int							getWidth			(void) const	{ return m_data.getWidth();		}
getHeight(void) const316 	int							getHeight			(void) const	{ return m_data.getHeight();	}
getFormat(void) const317 	tcu::TextureFormat			getFormat			(void) const	{ return m_data.getFormat();	}
318 
getAccess(void)319 	tcu::PixelBufferAccess		getAccess			(void)			{ return m_data.getAccess();	}
getAccess(void) const320 	tcu::ConstPixelBufferAccess	getAccess			(void) const	{ return m_data.getAccess();	}
321 
322 private:
323 	tcu::TextureLevel			m_data;
324 };
325 
326 class Framebuffer : public NamedObject
327 {
328 public:
329 	enum AttachmentPoint
330 	{
331 		ATTACHMENTPOINT_COLOR0,
332 		ATTACHMENTPOINT_DEPTH,
333 		ATTACHMENTPOINT_STENCIL,
334 
335 		ATTACHMENTPOINT_LAST
336 	};
337 
338 	enum AttachmentType
339 	{
340 		ATTACHMENTTYPE_RENDERBUFFER,
341 		ATTACHMENTTYPE_TEXTURE,
342 
343 		ATTACHMENTTYPE_LAST
344 	};
345 
346 	enum TexTarget
347 	{
348 		TEXTARGET_2D,
349 		TEXTARGET_CUBE_MAP_POSITIVE_X,
350 		TEXTARGET_CUBE_MAP_POSITIVE_Y,
351 		TEXTARGET_CUBE_MAP_POSITIVE_Z,
352 		TEXTARGET_CUBE_MAP_NEGATIVE_X,
353 		TEXTARGET_CUBE_MAP_NEGATIVE_Y,
354 		TEXTARGET_CUBE_MAP_NEGATIVE_Z,
355 		TEXTARGET_2D_ARRAY,
356 		TEXTARGET_3D,
357 		TEXTARGET_CUBE_MAP_ARRAY,
358 
359 		TEXTARGET_LAST
360 	};
361 
362 	struct Attachment
363 	{
364 		AttachmentType	type;
365 		deUint32		name;
366 		TexTarget		texTarget;
367 		int				level;
368 		int				layer;
369 
Attachmentsglr::rc::Framebuffer::Attachment370 		Attachment (void)
371 			: type		(ATTACHMENTTYPE_LAST)
372 			, name		(0)
373 			, texTarget	(TEXTARGET_LAST)
374 			, level		(0)
375 			, layer		(0)
376 		{
377 		}
378 	};
379 
380 							Framebuffer		(deUint32 name);
381 	virtual					~Framebuffer	(void);
382 
getAttachment(AttachmentPoint point)383 	Attachment&				getAttachment	(AttachmentPoint point)			{ return m_attachments[point]; }
getAttachment(AttachmentPoint point) const384 	const Attachment&		getAttachment	(AttachmentPoint point) const	{ return m_attachments[point]; }
385 
386 private:
387 
388 	Attachment			m_attachments[ATTACHMENTPOINT_LAST];
389 };
390 
391 class DataBuffer : public NamedObject
392 {
393 public:
DataBuffer(deUint32 name)394 							DataBuffer			(deUint32 name) : NamedObject(name) {}
~DataBuffer(void)395 							~DataBuffer			(void) {}
396 
setStorage(int size)397 	void					setStorage			(int size) { m_data.resize(size); }
398 
getSize(void) const399 	int						getSize				(void) const	{ return (int)m_data.size();					}
getData(void) const400 	const deUint8*			getData				(void) const	{ return m_data.empty() ? DE_NULL : &m_data[0];	}
getData(void)401 	deUint8*				getData				(void)			{ return m_data.empty() ? DE_NULL : &m_data[0];	}
402 
403 private:
404 	std::vector<deUint8>	m_data;
405 };
406 
407 class VertexArray : public NamedObject
408 {
409 public:
410 	struct VertexAttribArray
411 	{
412 		bool			enabled;
413 		int				size;
414 		int				stride;
415 		deUint32		type;
416 
417 		bool			normalized;
418 		bool			integer;
419 		int				divisor;
420 
421 		/**
422 		  ! These three variables define the state. bufferDeleted is needed to distinguish
423 		  ! drawing from user pointer and offset to a deleted buffer from each other.
424 		  !
425 		  ! Only these three combinations are possible:
426 		  ! 1) bufferDeleted = false, bufferBinding = NULL, pointer = user_ptr.   < render from a user ptr
427 		  ! 2) bufferDeleted = false, bufferBinding = ptr,  pointer = offset.     < render from a buffer with offset
428 		  ! 3) bufferDeleted = true,  bufferBinding = NULL, pointer = offset      < render from a deleted buffer. Don't do anything
429 		  !
430 		  ! (bufferFreed = true) implies (bufferBinding = NULL)
431 		 */
432 		bool			bufferDeleted;
433 		rc::DataBuffer*	bufferBinding;
434 		const void*		pointer;
435 	};
436 
437 									VertexArray		(deUint32 name, int maxVertexAttribs);
~VertexArray(void)438 									~VertexArray	(void) {}
439 
440 	rc::DataBuffer*					m_elementArrayBufferBinding;
441 	std::vector<VertexAttribArray>	m_arrays;
442 };
443 
444 class ShaderProgramObjectContainer : public NamedObject
445 {
446 public:
447 									ShaderProgramObjectContainer	(deUint32 name, ShaderProgram* program);
448 									~ShaderProgramObjectContainer	(void);
449 
450 	ShaderProgram*					m_program;
451 	bool							m_deleteFlag;
452 };
453 
454 template <typename T>
455 class ObjectManager
456 {
457 public:
458 							ObjectManager			(void);
459 							~ObjectManager			(void);
460 
461 	deUint32				allocateName			(void);
462 	void					insert					(T* object);
463 	T*						find					(deUint32 name);
464 
465 	void					acquireReference		(T* object);
466 	void					releaseReference		(T* object);
467 
getCount(void) const468 	int						getCount				(void) const { return (int)m_objects.size(); }
469 	void					getAll					(typename std::vector<T*>& objects) const;
470 
471 private:
472 							ObjectManager			(const ObjectManager<T>& other);
473 	ObjectManager&			operator=				(const ObjectManager<T>& other);
474 
475 	deUint32				m_lastName;
476 	std::map<deUint32, T*>	m_objects;
477 };
478 
479 template <typename T>
ObjectManager(void)480 ObjectManager<T>::ObjectManager (void)
481 	: m_lastName(0)
482 {
483 }
484 
485 template <typename T>
~ObjectManager(void)486 ObjectManager<T>::~ObjectManager (void)
487 {
488 	DE_ASSERT(m_objects.size() == 0);
489 }
490 
491 template <typename T>
allocateName(void)492 deUint32 ObjectManager<T>::allocateName (void)
493 {
494 	TCU_CHECK(m_lastName != 0xffffffff);
495 	return ++m_lastName;
496 }
497 
498 template <typename T>
insert(T * object)499 void ObjectManager<T>::insert (T* object)
500 {
501 	deUint32 name = object->getName();
502 	DE_ASSERT(object->getName() != 0);
503 
504 	if (name > m_lastName)
505 		m_lastName = name;
506 
507 	m_objects.insert(std::pair<deUint32, T*>(name, object));
508 }
509 
510 template <typename T>
find(deUint32 name)511 T* ObjectManager<T>::find (deUint32 name)
512 {
513 	typename std::map<deUint32, T*>::iterator it = m_objects.find(name);
514 	if (it != m_objects.end())
515 		return it->second;
516 	else
517 		return DE_NULL;
518 }
519 
520 template <typename T>
acquireReference(T * object)521 void ObjectManager<T>::acquireReference (T* object)
522 {
523 	DE_ASSERT(find(object->getName()) == object);
524 	object->incRefCount();
525 }
526 
527 template <typename T>
releaseReference(T * object)528 void ObjectManager<T>::releaseReference (T* object)
529 {
530 	DE_ASSERT(find(object->getName()) == object);
531 	object->decRefCount();
532 
533 	if (object->getRefCount() == 0)
534 	{
535 		m_objects.erase(object->getName());
536 		delete object;
537 	}
538 }
539 
540 template <typename T>
getAll(typename std::vector<T * > & objects) const541 void ObjectManager<T>::getAll (typename std::vector<T*>& objects) const
542 {
543 	objects.resize(m_objects.size());
544 	typename std::vector<T*>::iterator dst = objects.begin();
545 
546 	for (typename std::map<deUint32, T*>::const_iterator i = m_objects.begin();
547 		 i != m_objects.end(); i++)
548 	{
549 		*dst++ = i->second;
550 	}
551 }
552 
553 } // rc
554 
555 struct ReferenceContextLimits
556 {
ReferenceContextLimitssglr::ReferenceContextLimits557 	ReferenceContextLimits (void)
558 		: contextType				(glu::ApiType::es(3,0))
559 		, maxTextureImageUnits		(16)
560 		, maxTexture2DSize			(2048)
561 		, maxTextureCubeSize		(2048)
562 		, maxTexture2DArrayLayers	(256)
563 		, maxTexture3DSize			(256)
564 		, maxRenderbufferSize		(2048)
565 		, maxVertexAttribs			(16)
566 		, subpixelBits				(rr::RenderState::DEFAULT_SUBPIXEL_BITS)
567 	{
568 	}
569 
570 								ReferenceContextLimits	(const glu::RenderContext& renderCtx);
571 
572 	void						addExtension			(const char* extension);
573 
574 	glu::ContextType			contextType;
575 
576 	int							maxTextureImageUnits;
577 	int							maxTexture2DSize;
578 	int							maxTextureCubeSize;
579 	int							maxTexture2DArrayLayers;
580 	int							maxTexture3DSize;
581 	int							maxRenderbufferSize;
582 	int							maxVertexAttribs;
583 	int							subpixelBits;
584 
585 	// Both variants are needed since there are glGetString() and glGetStringi()
586 	std::vector<std::string>	extensionList;
587 	std::string					extensionStr;
588 };
589 
590 class ReferenceContextBuffers
591 {
592 public:
593 	ReferenceContextBuffers (const tcu::PixelFormat& colorBits, int depthBits, int stencilBits, int width, int height, int samples = 1);
594 
getColorbuffer(void)595 	rr::MultisamplePixelBufferAccess	getColorbuffer		(void) { return rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_colorbuffer.getAccess());	}
getDepthbuffer(void)596 	rr::MultisamplePixelBufferAccess	getDepthbuffer		(void) { return rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_depthbuffer.getAccess());	}
getStencilbuffer(void)597 	rr::MultisamplePixelBufferAccess	getStencilbuffer	(void) { return rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_stencilbuffer.getAccess());	}
598 
599 private:
600 	tcu::TextureLevel	m_colorbuffer;
601 	tcu::TextureLevel	m_depthbuffer;
602 	tcu::TextureLevel	m_stencilbuffer;
603 };
604 
605 class ReferenceContext : public Context
606 {
607 public:
608 							ReferenceContext		(const ReferenceContextLimits& limits, const rr::MultisamplePixelBufferAccess& colorbuffer, const rr::MultisamplePixelBufferAccess& depthbuffer, const rr::MultisamplePixelBufferAccess& stencilbuffer);
609 	virtual					~ReferenceContext		(void);
610 
getWidth(void) const611 	virtual int				getWidth				(void) const	{ return m_defaultColorbuffer.raw().getHeight();	}
getHeight(void) const612 	virtual int				getHeight				(void) const	{ return m_defaultColorbuffer.raw().getDepth();		}
613 
viewport(int x,int y,int width,int height)614 	virtual void			viewport				(int x, int y, int width, int height) { m_viewport = tcu::IVec4(x, y, width, height); }
615 	virtual void			activeTexture			(deUint32 texture);
616 
617 	virtual void			bindTexture				(deUint32 target, deUint32 texture);
618 	virtual void			genTextures				(int numTextures, deUint32* textures);
619 	virtual void			deleteTextures			(int numTextures, const deUint32* textures);
620 
621 	virtual void			bindFramebuffer			(deUint32 target, deUint32 framebuffer);
622 	virtual void			genFramebuffers			(int numFramebuffers, deUint32* framebuffers);
623 	virtual void			deleteFramebuffers		(int numFramebuffers, const deUint32* framebuffers);
624 
625 	virtual void			bindRenderbuffer		(deUint32 target, deUint32 renderbuffer);
626 	virtual void			genRenderbuffers		(int numRenderbuffers, deUint32* renderbuffers);
627 	virtual void			deleteRenderbuffers		(int numRenderbuffers, const deUint32* renderbuffers);
628 
629 	virtual void			pixelStorei				(deUint32 pname, int param);
630 	virtual void			texImage1D				(deUint32 target, int level, deUint32 internalFormat, int width, int border, deUint32 format, deUint32 type, const void* data);
631 	virtual void			texImage2D				(deUint32 target, int level, deUint32 internalFormat, int width, int height, int border, deUint32 format, deUint32 type, const void* data);
632 	virtual void			texImage3D				(deUint32 target, int level, deUint32 internalFormat, int width, int height, int depth, int border, deUint32 format, deUint32 type, const void* data);
633 	virtual void			texSubImage1D			(deUint32 target, int level, int xoffset, int width, deUint32 format, deUint32 type, const void* data);
634 	virtual void			texSubImage2D			(deUint32 target, int level, int xoffset, int yoffset, int width, int height, deUint32 format, deUint32 type, const void* data);
635 	virtual void			texSubImage3D			(deUint32 target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, deUint32 format, deUint32 type, const void* data);
636 	virtual void			copyTexImage1D			(deUint32 target, int level, deUint32 internalFormat, int x, int y, int width, int border);
637 	virtual void			copyTexImage2D			(deUint32 target, int level, deUint32 internalFormat, int x, int y, int width, int height, int border);
638 	virtual void			copyTexSubImage1D		(deUint32 target, int level, int xoffset, int x, int y, int width);
639 	virtual void			copyTexSubImage2D		(deUint32 target, int level, int xoffset, int yoffset, int x, int y, int width, int height);
640 	virtual void			copyTexSubImage3D		(deUint32 target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height);
641 
642 	virtual void			texStorage2D			(deUint32 target, int levels, deUint32 internalFormat, int width, int height);
643 	virtual void			texStorage3D			(deUint32 target, int levels, deUint32 internalFormat, int width, int height, int depth);
644 
645 	virtual void			texParameteri			(deUint32 target, deUint32 pname, int value);
646 
647 	virtual void			framebufferTexture2D	(deUint32 target, deUint32 attachment, deUint32 textarget, deUint32 texture, int level);
648 	virtual void			framebufferTextureLayer	(deUint32 target, deUint32 attachment, deUint32 texture, int level, int layer);
649 	virtual void			framebufferRenderbuffer	(deUint32 target, deUint32 attachment, deUint32 renderbuffertarget, deUint32 renderbuffer);
650 	virtual deUint32		checkFramebufferStatus	(deUint32 target);
651 
652 	virtual void			getFramebufferAttachmentParameteriv	(deUint32 target, deUint32 attachment, deUint32 pname, int* params);
653 
654 	virtual void			renderbufferStorage				(deUint32 target, deUint32 internalformat, int width, int height);
655 	virtual void			renderbufferStorageMultisample	(deUint32 target, int samples, deUint32 internalFormat, int width, int height);
656 
657 	virtual void			bindBuffer				(deUint32 target, deUint32 buffer);
658 	virtual void			genBuffers				(int numBuffers, deUint32* buffers);
659 	virtual void			deleteBuffers			(int numBuffers, const deUint32* buffers);
660 
661 	virtual void			bufferData				(deUint32 target, deIntptr size, const void* data, deUint32 usage);
662 	virtual void			bufferSubData			(deUint32 target, deIntptr offset, deIntptr size, const void* data);
663 
664 	virtual void			clearColor				(float red, float green, float blue, float alpha);
665 	virtual void			clearDepthf				(float depth);
666 	virtual void			clearStencil			(int stencil);
667 
668 	virtual void			clear					(deUint32 buffers);
669 	virtual void			clearBufferiv			(deUint32 buffer, int drawbuffer, const int* value);
670 	virtual void			clearBufferfv			(deUint32 buffer, int drawbuffer, const float* value);
671 	virtual void			clearBufferuiv			(deUint32 buffer, int drawbuffer, const deUint32* value);
672 	virtual void			clearBufferfi			(deUint32 buffer, int drawbuffer, float depth, int stencil);
673 	virtual void			scissor					(int x, int y, int width, int height);
674 
675 	virtual void			enable					(deUint32 cap);
676 	virtual void			disable					(deUint32 cap);
677 
678 	virtual void			stencilFunc				(deUint32 func, int ref, deUint32 mask);
679 	virtual void			stencilOp				(deUint32 sfail, deUint32 dpfail, deUint32 dppass);
680 	virtual void			stencilFuncSeparate		(deUint32 face, deUint32 func, int ref, deUint32 mask);
681 	virtual void			stencilOpSeparate		(deUint32 face, deUint32 sfail, deUint32 dpfail, deUint32 dppass);
682 
683 	virtual void			depthFunc				(deUint32 func);
684 	virtual void			depthRangef				(float n, float f);
685 	virtual void			depthRange				(double n, double f);
686 
687 	virtual void			polygonOffset			(float factor, float units);
688 	virtual void			provokingVertex			(deUint32 convention);
689 	virtual void			primitiveRestartIndex	(deUint32 index);
690 
691 	virtual void			blendEquation			(deUint32 mode);
692 	virtual void			blendEquationSeparate	(deUint32 modeRGB, deUint32 modeAlpha);
693 	virtual void			blendFunc				(deUint32 src, deUint32 dst);
694 	virtual void			blendFuncSeparate		(deUint32 srcRGB, deUint32 dstRGB, deUint32 srcAlpha, deUint32 dstAlpha);
695 	virtual void			blendColor				(float red, float green, float blue, float alpha);
696 
697 	virtual void			colorMask				(deBool r, deBool g, deBool b, deBool a);
698 	virtual void			depthMask				(deBool mask);
699 	virtual void			stencilMask				(deUint32 mask);
700 	virtual void			stencilMaskSeparate		(deUint32 face, deUint32 mask);
701 
702 	virtual void			blitFramebuffer			(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, deUint32 mask, deUint32 filter);
703 
704 	virtual void			invalidateSubFramebuffer(deUint32 target, int numAttachments, const deUint32* attachments, int x, int y, int width, int height);
705 	virtual void			invalidateFramebuffer	(deUint32 target, int numAttachments, const deUint32* attachments);
706 
707 	virtual void			bindVertexArray			(deUint32 array);
708 	virtual void			genVertexArrays			(int numArrays, deUint32* vertexArrays);
709 	virtual void			deleteVertexArrays		(int numArrays, const deUint32* vertexArrays);
710 
711 	virtual void			vertexAttribPointer		(deUint32 index, int size, deUint32 type, deBool normalized, int stride, const void *pointer);
712 	virtual void			vertexAttribIPointer	(deUint32 index, int size, deUint32 type, int stride, const void *pointer);
713 	virtual void			enableVertexAttribArray	(deUint32 index);
714 	virtual void			disableVertexAttribArray(deUint32 index);
715 	virtual void			vertexAttribDivisor		(deUint32 index, deUint32 divisor);
716 
717 	virtual void			vertexAttrib1f			(deUint32 index, float);
718 	virtual void			vertexAttrib2f			(deUint32 index, float, float);
719 	virtual void			vertexAttrib3f			(deUint32 index, float, float, float);
720 	virtual void			vertexAttrib4f			(deUint32 index, float, float, float, float);
721 	virtual void			vertexAttribI4i			(deUint32 index, deInt32, deInt32, deInt32, deInt32);
722 	virtual void			vertexAttribI4ui		(deUint32 index, deUint32, deUint32, deUint32, deUint32);
723 
724 	virtual deInt32			getAttribLocation		(deUint32 program, const char *name);
725 
726 	virtual void			uniform1f				(deInt32 location, float);
727 	virtual void			uniform1i				(deInt32 location, deInt32);
728 	virtual void			uniform1fv				(deInt32 index, deInt32 count, const float*);
729 	virtual void			uniform2fv				(deInt32 index, deInt32 count, const float*);
730 	virtual void			uniform3fv				(deInt32 index, deInt32 count, const float*);
731 	virtual void			uniform4fv				(deInt32 index, deInt32 count, const float*);
732 	virtual void			uniform1iv				(deInt32 index, deInt32 count, const deInt32*);
733 	virtual void			uniform2iv				(deInt32 index, deInt32 count, const deInt32*);
734 	virtual void			uniform3iv				(deInt32 index, deInt32 count, const deInt32*);
735 	virtual void			uniform4iv				(deInt32 index, deInt32 count, const deInt32*);
736 	virtual void			uniformMatrix3fv		(deInt32 location, deInt32 count, deBool transpose, const float *value);
737 	virtual void			uniformMatrix4fv		(deInt32 location, deInt32 count, deBool transpose, const float *value);
738 	virtual deInt32			getUniformLocation		(deUint32 program, const char *name);
739 
740 	virtual void			lineWidth				(float);
741 
742 	virtual void			drawArrays				(deUint32 mode, int first, int count);
743 	virtual void			drawArraysInstanced		(deUint32 mode, int first, int count, int instanceCount);
744 	virtual void			drawElements			(deUint32 mode, int count, deUint32 type, const void *indices);
745 	virtual void			drawElementsBaseVertex	(deUint32 mode, int count, deUint32 type, const void *indices, int baseVertex);
746 	virtual void			drawElementsInstanced	(deUint32 mode, int count, deUint32 type, const void *indices, int instanceCount);
747 	virtual void			drawElementsInstancedBaseVertex	(deUint32 mode, int count, deUint32 type, const void *indices, int instanceCount, int baseVertex);
748 	virtual void			drawRangeElements		(deUint32 mode, deUint32 start, deUint32 end, int count, deUint32 type, const void *indices);
749 	virtual void			drawRangeElementsBaseVertex (deUint32 mode, deUint32 start, deUint32 end, int count, deUint32 type, const void *indices, int baseVertex);
750 	virtual void			drawArraysIndirect		(deUint32 mode, const void *indirect);
751 	virtual void			drawElementsIndirect	(deUint32 mode, deUint32 type, const void *indirect);
752 
753 	virtual void			multiDrawArrays			(deUint32 mode, const int* first, const int* count, int primCount);
754 	virtual void			multiDrawElements		(deUint32 mode, const int* count, deUint32 type, const void** indices, int primCount);
755 	virtual void			multiDrawElementsBaseVertex (deUint32 mode, const int* count, deUint32 type, const void** indices, int primCount, const int* baseVertex);
756 
757 	virtual deUint32		createProgram			(ShaderProgram* program);
758 	virtual void			useProgram				(deUint32 program);
759 	virtual void			deleteProgram			(deUint32 program);
760 
761 	virtual void			readPixels				(int x, int y, int width, int height, deUint32 format, deUint32 type, void* data);
762 	virtual deUint32		getError				(void);
763 	virtual void			finish					(void);
764 
765 	virtual void			getIntegerv				(deUint32 pname, int* params);
766 	virtual const char*		getString				(deUint32 pname);
767 
768 	// Expose helpers from Context.
769 	using Context::readPixels;
770 	using Context::texImage2D;
771 	using Context::texSubImage2D;
772 
773 private:
774 							ReferenceContext		(const ReferenceContext& other); // Not allowed!
775 	ReferenceContext&		operator=				(const ReferenceContext& other); // Not allowed!
776 
777 	void					deleteTexture			(rc::Texture* texture);
778 	void					deleteFramebuffer		(rc::Framebuffer* framebuffer);
779 	void					deleteRenderbuffer		(rc::Renderbuffer* renderbuffer);
780 	void					deleteBuffer			(rc::DataBuffer* buffer);
781 	void					deleteVertexArray		(rc::VertexArray* vertexArray);
782 	void					deleteProgramObject		(rc::ShaderProgramObjectContainer* sp);
783 
784 	void					acquireFboAttachmentReference	(const rc::Framebuffer::Attachment& attachment);
785 	void					releaseFboAttachmentReference	(const rc::Framebuffer::Attachment& attachment);
786 	tcu::PixelBufferAccess	getFboAttachment		(const rc::Framebuffer& framebuffer, rc::Framebuffer::AttachmentPoint point);
787 
788 	deUint32				blitResolveMultisampleFramebuffer (deUint32 mask, const tcu::IVec4& srcRect, const tcu::IVec4& dstRect, bool flipX, bool flipY);
789 
getDrawColorbuffer(void)790 	rr::MultisamplePixelBufferAccess	getDrawColorbuffer		(void)	{ return (m_drawFramebufferBinding) ? (rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(getFboAttachment(*m_drawFramebufferBinding, rc::Framebuffer::ATTACHMENTPOINT_COLOR0)))	:	(m_defaultColorbuffer);		}
getDrawDepthbuffer(void)791 	rr::MultisamplePixelBufferAccess	getDrawDepthbuffer		(void)	{ return (m_drawFramebufferBinding) ? (rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(getFboAttachment(*m_drawFramebufferBinding, rc::Framebuffer::ATTACHMENTPOINT_DEPTH)))	:	(m_defaultDepthbuffer);		}
getDrawStencilbuffer(void)792 	rr::MultisamplePixelBufferAccess	getDrawStencilbuffer	(void)	{ return (m_drawFramebufferBinding) ? (rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(getFboAttachment(*m_drawFramebufferBinding, rc::Framebuffer::ATTACHMENTPOINT_STENCIL)))	:	(m_defaultStencilbuffer);	}
getReadColorbuffer(void)793 	rr::MultisamplePixelBufferAccess	getReadColorbuffer		(void)	{ return (m_readFramebufferBinding) ? (rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(getFboAttachment(*m_readFramebufferBinding, rc::Framebuffer::ATTACHMENTPOINT_COLOR0)))	:	(m_defaultColorbuffer);		}
getReadDepthbuffer(void)794 	rr::MultisamplePixelBufferAccess	getReadDepthbuffer		(void)	{ return (m_readFramebufferBinding) ? (rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(getFboAttachment(*m_readFramebufferBinding, rc::Framebuffer::ATTACHMENTPOINT_DEPTH)))	:	(m_defaultDepthbuffer);		}
getReadStencilbuffer(void)795 	rr::MultisamplePixelBufferAccess	getReadStencilbuffer	(void)	{ return (m_readFramebufferBinding) ? (rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(getFboAttachment(*m_readFramebufferBinding, rc::Framebuffer::ATTACHMENTPOINT_STENCIL)))	:	(m_defaultStencilbuffer);	}
796 
797 	const rc::Texture2D&	getTexture2D			(int unitNdx) const;
798 	const rc::TextureCube&	getTextureCube			(int unitNdx) const;
getViewport(void) const799 	const tcu::IVec4&		getViewport				(void) const { return m_viewport; }
800 
801 	void					setError				(deUint32 error);
802 
803 	void					setTex1DBinding			(int unit, rc::Texture1D*			tex1D);
804 	void					setTex2DBinding			(int unit, rc::Texture2D*			tex2D);
805 	void					setTexCubeBinding		(int unit, rc::TextureCube*			texCube);
806 	void					setTex2DArrayBinding	(int unit, rc::Texture2DArray*		tex2DArray);
807 	void					setTex3DBinding			(int unit, rc::Texture3D*			tex3D);
808 	void					setTexCubeArrayBinding	(int unit, rc::TextureCubeArray*	texCubeArray);
809 
810 	void					setBufferBinding		(deUint32 target, rc::DataBuffer* buffer);
811 	rc::DataBuffer*			getBufferBinding		(deUint32 target) const;
812 
getPixelPackPtr(void * ptrOffset) const813 	void*					getPixelPackPtr			(void* ptrOffset) const			{ return m_pixelPackBufferBinding ? (void*)((deUintptr)m_pixelPackBufferBinding->getData()+(deUintptr)ptrOffset) : ptrOffset;	}
getPixelUnpackPtr(const void * ptrOffset) const814 	const void*				getPixelUnpackPtr		(const void* ptrOffset) const	{ return m_pixelUnpackBufferBinding ? (const void*)((deUintptr)m_pixelUnpackBufferBinding->getData()+(deUintptr)ptrOffset) : ptrOffset; }
815 
816 	bool					predrawErrorChecks		(deUint32 mode);
817 	void					drawWithReference		(const rr::PrimitiveList& primitives, int instanceCount);
818 
819 	// Helpers for getting valid access object based on current unpack state.
820 	tcu::ConstPixelBufferAccess		getUnpack2DAccess		(const tcu::TextureFormat& format, int width, int height, const void* data);
821 	tcu::ConstPixelBufferAccess		getUnpack3DAccess		(const tcu::TextureFormat& format, int width, int height, int depth, const void* data);
822 
823 	void					uniformv				(deInt32 index, glu::DataType type, deInt32 count, const void*);
824 
825 	struct TextureUnit
826 	{
827 
828 		rc::Texture1D*			tex1DBinding;
829 		rc::Texture2D*			tex2DBinding;
830 		rc::TextureCube*		texCubeBinding;
831 		rc::Texture2DArray*		tex2DArrayBinding;
832 		rc::Texture3D*			tex3DBinding;
833 		rc::TextureCubeArray*	texCubeArrayBinding;
834 
835 		rc::Texture1D			default1DTex;
836 		rc::Texture2D			default2DTex;
837 		rc::TextureCube			defaultCubeTex;
838 		rc::Texture2DArray		default2DArrayTex;
839 		rc::Texture3D			default3DTex;
840 		rc::TextureCubeArray	defaultCubeArrayTex;
841 
TextureUnitsglr::ReferenceContext::TextureUnit842 		TextureUnit (void)
843 			: tex1DBinding			(DE_NULL)
844 			, tex2DBinding			(DE_NULL)
845 			, texCubeBinding		(DE_NULL)
846 			, tex2DArrayBinding		(DE_NULL)
847 			, tex3DBinding			(DE_NULL)
848 			, texCubeArrayBinding	(DE_NULL)
849 			, default1DTex			(0)
850 			, default2DTex			(0)
851 			, defaultCubeTex		(0)
852 			, default2DArrayTex		(0)
853 			, default3DTex			(0)
854 			, defaultCubeArrayTex	(0)
855 		{
856 		}
857 	};
858 
859 	struct StencilState
860 	{
861 		deUint32		func;
862 		int				ref;
863 		deUint32		opMask;
864 		deUint32		opStencilFail;
865 		deUint32		opDepthFail;
866 		deUint32		opDepthPass;
867 		deUint32		writeMask;
868 
869 		StencilState (void);
870 	};
871 
872 	ReferenceContextLimits						m_limits;
873 
874 	rr::MultisamplePixelBufferAccess			m_defaultColorbuffer;
875 	rr::MultisamplePixelBufferAccess			m_defaultDepthbuffer;
876 	rr::MultisamplePixelBufferAccess			m_defaultStencilbuffer;
877 	rc::VertexArray								m_clientVertexArray;
878 
879 	tcu::IVec4									m_viewport;
880 
881 	rc::ObjectManager<rc::Texture>				m_textures;
882 	rc::ObjectManager<rc::Framebuffer>			m_framebuffers;
883 	rc::ObjectManager<rc::Renderbuffer>			m_renderbuffers;
884 	rc::ObjectManager<rc::DataBuffer>			m_buffers;
885 	rc::ObjectManager<rc::VertexArray>			m_vertexArrays;
886 	rc::ObjectManager<rc::ShaderProgramObjectContainer>		m_programs;
887 
888 	int											m_activeTexture;
889 	std::vector<TextureUnit>					m_textureUnits;
890 	rc::Texture1D								m_emptyTex1D;
891 	rc::Texture2D								m_emptyTex2D;
892 	rc::TextureCube								m_emptyTexCube;
893 	rc::Texture2DArray							m_emptyTex2DArray;
894 	rc::Texture3D								m_emptyTex3D;
895 	rc::TextureCubeArray						m_emptyTexCubeArray;
896 
897 	int											m_pixelUnpackRowLength;
898 	int											m_pixelUnpackSkipRows;
899 	int											m_pixelUnpackSkipPixels;
900 	int											m_pixelUnpackImageHeight;
901 	int											m_pixelUnpackSkipImages;
902 	int											m_pixelUnpackAlignment;
903 	int											m_pixelPackAlignment;
904 
905 	rc::Framebuffer*							m_readFramebufferBinding;
906 	rc::Framebuffer*							m_drawFramebufferBinding;
907 	rc::Renderbuffer*							m_renderbufferBinding;
908 	rc::VertexArray*							m_vertexArrayBinding;
909 	rc::ShaderProgramObjectContainer*			m_currentProgram;
910 
911 	rc::DataBuffer*								m_arrayBufferBinding;
912 	rc::DataBuffer*								m_pixelPackBufferBinding;
913 	rc::DataBuffer*								m_pixelUnpackBufferBinding;
914 	rc::DataBuffer*								m_transformFeedbackBufferBinding;
915 	rc::DataBuffer*								m_uniformBufferBinding;
916 	rc::DataBuffer*								m_copyReadBufferBinding;
917 	rc::DataBuffer*								m_copyWriteBufferBinding;
918 	rc::DataBuffer*								m_drawIndirectBufferBinding;
919 
920 	tcu::Vec4									m_clearColor;
921 	float										m_clearDepth;
922 	int											m_clearStencil;
923 
924 	bool										m_scissorEnabled;
925 	tcu::IVec4									m_scissorBox;
926 
927 	bool										m_stencilTestEnabled;
928 	StencilState								m_stencil[rr::FACETYPE_LAST];
929 
930 	bool										m_depthTestEnabled;
931 	deUint32									m_depthFunc;
932 	float										m_depthRangeNear;
933 	float										m_depthRangeFar;
934 
935 	float										m_polygonOffsetFactor;
936 	float										m_polygonOffsetUnits;
937 	bool										m_polygonOffsetFillEnabled;
938 
939 	bool										m_provokingFirstVertexConvention;
940 
941 	bool										m_blendEnabled;
942 	deUint32									m_blendModeRGB;
943 	deUint32									m_blendModeAlpha;
944 	deUint32									m_blendFactorSrcRGB;
945 	deUint32									m_blendFactorDstRGB;
946 	deUint32									m_blendFactorSrcAlpha;
947 	deUint32									m_blendFactorDstAlpha;
948 	tcu::Vec4									m_blendColor;
949 
950 	bool										m_sRGBUpdateEnabled;
951 
952 	bool										m_depthClampEnabled;
953 
954 	tcu::BVec4									m_colorMask;
955 	bool										m_depthMask;
956 
957 	std::vector<rr::GenericVec4>				m_currentAttribs;
958 	float										m_lineWidth;
959 
960 	bool										m_primitiveRestartFixedIndex;
961 	bool										m_primitiveRestartSettableIndex;
962 	deUint32									m_primitiveRestartIndex;
963 
964 	deUint32									m_lastError;
965 
966 	rr::FragmentProcessor						m_fragmentProcessor;
967 	std::vector<rr::Fragment>					m_fragmentBuffer;
968 	std::vector<float>							m_fragmentDepths;
969 } DE_WARN_UNUSED_TYPE;
970 
971 } // sglr
972 
973 #endif // _SGLRREFERENCECONTEXT_HPP
974