Home | History | Annotate | Download | only in simplereference
      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:
     57 	virtual			~NamedObject		(void) {}
     58 
     59 	deUint32		getName				(void) const	{ return m_name;								}
     60 
     61 	int				getRefCount			(void) const	{ return m_refCount;							}
     62 	void			incRefCount			(void)			{ m_refCount += 1;								}
     63 	void			decRefCount			(void)			{ DE_ASSERT(m_refCount > 0); m_refCount -= 1;	}
     64 
     65 protected:
     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);
     89 	virtual						~Texture		(void) {}
     90 
     91 	Type						getType			(void) const	{ return m_type;			}
     92 
     93 	int							getBaseLevel	(void) const	{ return m_baseLevel;		}
     94 	int							getMaxLevel		(void) const	{ return m_maxLevel;		}
     95 	bool						isImmutable		(void) const	{ return m_immutable;		}
     96 
     97 	void						setBaseLevel	(int baseLevel)	{ m_baseLevel = baseLevel;	}
     98 	void						setMaxLevel		(int maxLevel)	{ m_maxLevel = maxLevel;	}
     99 	void						setImmutable	(void)			{ m_immutable = true;		}
    100 
    101 	const tcu::Sampler&			getSampler		(void) const	{ return m_sampler;			}
    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 
    121 	bool								hasLevel			(int level) const	{ return deInBounds32(level, 0, DE_LENGTH_OF_ARRAY(m_data)) && !m_data[level].empty();	}
    122 	const tcu::PixelBufferAccess&		getLevel			(int level)			{ DE_ASSERT(hasLevel(level)); return m_access[level];									}
    123 	const tcu::ConstPixelBufferAccess&	getLevel			(int level) const	{ DE_ASSERT(hasLevel(level)); return m_access[level];									}
    124 
    125 	const tcu::ConstPixelBufferAccess*	getLevels			(void) const		{ return &m_access[0];																	}
    126 	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 
    147 	void								clearLevels		(void) { m_levels.clear(); }
    148 
    149 	bool								hasLevel		(int level) const	{ return m_levels.hasLevel(level);	}
    150 	const tcu::ConstPixelBufferAccess&	getLevel		(int level) const	{ return m_levels.getLevel(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);
    171 	virtual								~Texture2D		(void);
    172 
    173 	void								clearLevels		(void) { m_levels.clear(); }
    174 
    175 	bool								hasLevel		(int level) const	{ return m_levels.hasLevel(level);	}
    176 	const tcu::ConstPixelBufferAccess&	getLevel		(int level) const	{ return m_levels.getLevel(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);
    197 	virtual								~TextureCube	(void);
    198 
    199 	void								clearLevels		(void);
    200 
    201 	bool								hasFace			(int level, tcu::CubeFace face) const	{ return m_levels[face].hasLevel(level);	}
    202 	const tcu::PixelBufferAccess&		getFace			(int level, tcu::CubeFace face)			{ return m_levels[face].getLevel(level);	}
    203 	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 
    224 	void								clearLevels		(void) { m_levels.clear(); }
    225 
    226 	bool								hasLevel		(int level) const	{ return m_levels.hasLevel(level);	}
    227 	const tcu::ConstPixelBufferAccess&	getLevel		(int level) const	{ return m_levels.getLevel(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 
    250 	void								clearLevels		(void) { m_levels.clear(); }
    251 
    252 	bool								hasLevel		(int level) const	{ return m_levels.hasLevel(level);	}
    253 	const tcu::ConstPixelBufferAccess&	getLevel		(int level) const	{ return m_levels.getLevel(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 
    276 	void								clearLevels			(void) { m_levels.clear(); }
    277 
    278 	bool								hasLevel			(int level) const	{ return m_levels.hasLevel(level);	}
    279 	const tcu::ConstPixelBufferAccess&	getLevel			(int level) const	{ return m_levels.getLevel(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 
    315 	int							getWidth			(void) const	{ return m_data.getWidth();		}
    316 	int							getHeight			(void) const	{ return m_data.getHeight();	}
    317 	tcu::TextureFormat			getFormat			(void) const	{ return m_data.getFormat();	}
    318 
    319 	tcu::PixelBufferAccess		getAccess			(void)			{ return m_data.getAccess();	}
    320 	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 
    370 		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 
    383 	Attachment&				getAttachment	(AttachmentPoint point)			{ return m_attachments[point]; }
    384 	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:
    394 							DataBuffer			(deUint32 name) : NamedObject(name) {}
    395 							~DataBuffer			(void) {}
    396 
    397 	void					setStorage			(int size) { m_data.resize(size); }
    398 
    399 	int						getSize				(void) const	{ return (int)m_data.size();					}
    400 	const deUint8*			getData				(void) const	{ return m_data.empty() ? DE_NULL : &m_data[0];	}
    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);
    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 
    468 	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>
    480 ObjectManager<T>::ObjectManager (void)
    481 	: m_lastName(0)
    482 {
    483 }
    484 
    485 template <typename T>
    486 ObjectManager<T>::~ObjectManager (void)
    487 {
    488 	DE_ASSERT(m_objects.size() == 0);
    489 }
    490 
    491 template <typename T>
    492 deUint32 ObjectManager<T>::allocateName (void)
    493 {
    494 	TCU_CHECK(m_lastName != 0xffffffff);
    495 	return ++m_lastName;
    496 }
    497 
    498 template <typename T>
    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>
    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>
    521 void ObjectManager<T>::acquireReference (T* object)
    522 {
    523 	DE_ASSERT(find(object->getName()) == object);
    524 	object->incRefCount();
    525 }
    526 
    527 template <typename T>
    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>
    541 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 {
    557 	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 	{
    567 	}
    568 
    569 								ReferenceContextLimits	(const glu::RenderContext& renderCtx);
    570 
    571 	void						addExtension			(const char* extension);
    572 
    573 	glu::ContextType			contextType;
    574 
    575 	int							maxTextureImageUnits;
    576 	int							maxTexture2DSize;
    577 	int							maxTextureCubeSize;
    578 	int							maxTexture2DArrayLayers;
    579 	int							maxTexture3DSize;
    580 	int							maxRenderbufferSize;
    581 	int							maxVertexAttribs;
    582 
    583 	// Both variants are needed since there are glGetString() and glGetStringi()
    584 	std::vector<std::string>	extensionList;
    585 	std::string					extensionStr;
    586 };
    587 
    588 class ReferenceContextBuffers
    589 {
    590 public:
    591 	ReferenceContextBuffers (const tcu::PixelFormat& colorBits, int depthBits, int stencilBits, int width, int height, int samples = 1);
    592 
    593 	rr::MultisamplePixelBufferAccess	getColorbuffer		(void) { return rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_colorbuffer.getAccess());	}
    594 	rr::MultisamplePixelBufferAccess	getDepthbuffer		(void) { return rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_depthbuffer.getAccess());	}
    595 	rr::MultisamplePixelBufferAccess	getStencilbuffer	(void) { return rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_stencilbuffer.getAccess());	}
    596 
    597 private:
    598 	tcu::TextureLevel	m_colorbuffer;
    599 	tcu::TextureLevel	m_depthbuffer;
    600 	tcu::TextureLevel	m_stencilbuffer;
    601 };
    602 
    603 class ReferenceContext : public Context
    604 {
    605 public:
    606 							ReferenceContext		(const ReferenceContextLimits& limits, const rr::MultisamplePixelBufferAccess& colorbuffer, const rr::MultisamplePixelBufferAccess& depthbuffer, const rr::MultisamplePixelBufferAccess& stencilbuffer);
    607 	virtual					~ReferenceContext		(void);
    608 
    609 	virtual int				getWidth				(void) const	{ return m_defaultColorbuffer.raw().getHeight();	}
    610 	virtual int				getHeight				(void) const	{ return m_defaultColorbuffer.raw().getDepth();		}
    611 
    612 	virtual void			viewport				(int x, int y, int width, int height) { m_viewport = tcu::IVec4(x, y, width, height); }
    613 	virtual void			activeTexture			(deUint32 texture);
    614 
    615 	virtual void			bindTexture				(deUint32 target, deUint32 texture);
    616 	virtual void			genTextures				(int numTextures, deUint32* textures);
    617 	virtual void			deleteTextures			(int numTextures, const deUint32* textures);
    618 
    619 	virtual void			bindFramebuffer			(deUint32 target, deUint32 framebuffer);
    620 	virtual void			genFramebuffers			(int numFramebuffers, deUint32* framebuffers);
    621 	virtual void			deleteFramebuffers		(int numFramebuffers, const deUint32* framebuffers);
    622 
    623 	virtual void			bindRenderbuffer		(deUint32 target, deUint32 renderbuffer);
    624 	virtual void			genRenderbuffers		(int numRenderbuffers, deUint32* renderbuffers);
    625 	virtual void			deleteRenderbuffers		(int numRenderbuffers, const deUint32* renderbuffers);
    626 
    627 	virtual void			pixelStorei				(deUint32 pname, int param);
    628 	virtual void			texImage1D				(deUint32 target, int level, deUint32 internalFormat, int width, int border, deUint32 format, deUint32 type, const void* data);
    629 	virtual void			texImage2D				(deUint32 target, int level, deUint32 internalFormat, int width, int height, int border, deUint32 format, deUint32 type, const void* data);
    630 	virtual void			texImage3D				(deUint32 target, int level, deUint32 internalFormat, int width, int height, int depth, int border, deUint32 format, deUint32 type, const void* data);
    631 	virtual void			texSubImage1D			(deUint32 target, int level, int xoffset, int width, deUint32 format, deUint32 type, const void* data);
    632 	virtual void			texSubImage2D			(deUint32 target, int level, int xoffset, int yoffset, int width, int height, deUint32 format, deUint32 type, const void* data);
    633 	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);
    634 	virtual void			copyTexImage1D			(deUint32 target, int level, deUint32 internalFormat, int x, int y, int width, int border);
    635 	virtual void			copyTexImage2D			(deUint32 target, int level, deUint32 internalFormat, int x, int y, int width, int height, int border);
    636 	virtual void			copyTexSubImage1D		(deUint32 target, int level, int xoffset, int x, int y, int width);
    637 	virtual void			copyTexSubImage2D		(deUint32 target, int level, int xoffset, int yoffset, int x, int y, int width, int height);
    638 	virtual void			copyTexSubImage3D		(deUint32 target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height);
    639 
    640 	virtual void			texStorage2D			(deUint32 target, int levels, deUint32 internalFormat, int width, int height);
    641 	virtual void			texStorage3D			(deUint32 target, int levels, deUint32 internalFormat, int width, int height, int depth);
    642 
    643 	virtual void			texParameteri			(deUint32 target, deUint32 pname, int value);
    644 
    645 	virtual void			framebufferTexture2D	(deUint32 target, deUint32 attachment, deUint32 textarget, deUint32 texture, int level);
    646 	virtual void			framebufferTextureLayer	(deUint32 target, deUint32 attachment, deUint32 texture, int level, int layer);
    647 	virtual void			framebufferRenderbuffer	(deUint32 target, deUint32 attachment, deUint32 renderbuffertarget, deUint32 renderbuffer);
    648 	virtual deUint32		checkFramebufferStatus	(deUint32 target);
    649 
    650 	virtual void			getFramebufferAttachmentParameteriv	(deUint32 target, deUint32 attachment, deUint32 pname, int* params);
    651 
    652 	virtual void			renderbufferStorage				(deUint32 target, deUint32 internalformat, int width, int height);
    653 	virtual void			renderbufferStorageMultisample	(deUint32 target, int samples, deUint32 internalFormat, int width, int height);
    654 
    655 	virtual void			bindBuffer				(deUint32 target, deUint32 buffer);
    656 	virtual void			genBuffers				(int numBuffers, deUint32* buffers);
    657 	virtual void			deleteBuffers			(int numBuffers, const deUint32* buffers);
    658 
    659 	virtual void			bufferData				(deUint32 target, deIntptr size, const void* data, deUint32 usage);
    660 	virtual void			bufferSubData			(deUint32 target, deIntptr offset, deIntptr size, const void* data);
    661 
    662 	virtual void			clearColor				(float red, float green, float blue, float alpha);
    663 	virtual void			clearDepthf				(float depth);
    664 	virtual void			clearStencil			(int stencil);
    665 
    666 	virtual void			clear					(deUint32 buffers);
    667 	virtual void			clearBufferiv			(deUint32 buffer, int drawbuffer, const int* value);
    668 	virtual void			clearBufferfv			(deUint32 buffer, int drawbuffer, const float* value);
    669 	virtual void			clearBufferuiv			(deUint32 buffer, int drawbuffer, const deUint32* value);
    670 	virtual void			clearBufferfi			(deUint32 buffer, int drawbuffer, float depth, int stencil);
    671 	virtual void			scissor					(int x, int y, int width, int height);
    672 
    673 	virtual void			enable					(deUint32 cap);
    674 	virtual void			disable					(deUint32 cap);
    675 
    676 	virtual void			stencilFunc				(deUint32 func, int ref, deUint32 mask);
    677 	virtual void			stencilOp				(deUint32 sfail, deUint32 dpfail, deUint32 dppass);
    678 	virtual void			stencilFuncSeparate		(deUint32 face, deUint32 func, int ref, deUint32 mask);
    679 	virtual void			stencilOpSeparate		(deUint32 face, deUint32 sfail, deUint32 dpfail, deUint32 dppass);
    680 
    681 	virtual void			depthFunc				(deUint32 func);
    682 	virtual void			depthRangef				(float n, float f);
    683 	virtual void			depthRange				(double n, double f);
    684 
    685 	virtual void			polygonOffset			(float factor, float units);
    686 	virtual void			provokingVertex			(deUint32 convention);
    687 	virtual void			primitiveRestartIndex	(deUint32 index);
    688 
    689 	virtual void			blendEquation			(deUint32 mode);
    690 	virtual void			blendEquationSeparate	(deUint32 modeRGB, deUint32 modeAlpha);
    691 	virtual void			blendFunc				(deUint32 src, deUint32 dst);
    692 	virtual void			blendFuncSeparate		(deUint32 srcRGB, deUint32 dstRGB, deUint32 srcAlpha, deUint32 dstAlpha);
    693 	virtual void			blendColor				(float red, float green, float blue, float alpha);
    694 
    695 	virtual void			colorMask				(deBool r, deBool g, deBool b, deBool a);
    696 	virtual void			depthMask				(deBool mask);
    697 	virtual void			stencilMask				(deUint32 mask);
    698 	virtual void			stencilMaskSeparate		(deUint32 face, deUint32 mask);
    699 
    700 	virtual void			blitFramebuffer			(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, deUint32 mask, deUint32 filter);
    701 
    702 	virtual void			invalidateSubFramebuffer(deUint32 target, int numAttachments, const deUint32* attachments, int x, int y, int width, int height);
    703 	virtual void			invalidateFramebuffer	(deUint32 target, int numAttachments, const deUint32* attachments);
    704 
    705 	virtual void			bindVertexArray			(deUint32 array);
    706 	virtual void			genVertexArrays			(int numArrays, deUint32* vertexArrays);
    707 	virtual void			deleteVertexArrays		(int numArrays, const deUint32* vertexArrays);
    708 
    709 	virtual void			vertexAttribPointer		(deUint32 index, int size, deUint32 type, deBool normalized, int stride, const void *pointer);
    710 	virtual void			vertexAttribIPointer	(deUint32 index, int size, deUint32 type, int stride, const void *pointer);
    711 	virtual void			enableVertexAttribArray	(deUint32 index);
    712 	virtual void			disableVertexAttribArray(deUint32 index);
    713 	virtual void			vertexAttribDivisor		(deUint32 index, deUint32 divisor);
    714 
    715 	virtual void			vertexAttrib1f			(deUint32 index, float);
    716 	virtual void			vertexAttrib2f			(deUint32 index, float, float);
    717 	virtual void			vertexAttrib3f			(deUint32 index, float, float, float);
    718 	virtual void			vertexAttrib4f			(deUint32 index, float, float, float, float);
    719 	virtual void			vertexAttribI4i			(deUint32 index, deInt32, deInt32, deInt32, deInt32);
    720 	virtual void			vertexAttribI4ui		(deUint32 index, deUint32, deUint32, deUint32, deUint32);
    721 
    722 	virtual deInt32			getAttribLocation		(deUint32 program, const char *name);
    723 
    724 	virtual void			uniform1f				(deInt32 location, float);
    725 	virtual void			uniform1i				(deInt32 location, deInt32);
    726 	virtual void			uniform1fv				(deInt32 index, deInt32 count, const float*);
    727 	virtual void			uniform2fv				(deInt32 index, deInt32 count, const float*);
    728 	virtual void			uniform3fv				(deInt32 index, deInt32 count, const float*);
    729 	virtual void			uniform4fv				(deInt32 index, deInt32 count, const float*);
    730 	virtual void			uniform1iv				(deInt32 index, deInt32 count, const deInt32*);
    731 	virtual void			uniform2iv				(deInt32 index, deInt32 count, const deInt32*);
    732 	virtual void			uniform3iv				(deInt32 index, deInt32 count, const deInt32*);
    733 	virtual void			uniform4iv				(deInt32 index, deInt32 count, const deInt32*);
    734 	virtual void			uniformMatrix3fv		(deInt32 location, deInt32 count, deBool transpose, const float *value);
    735 	virtual void			uniformMatrix4fv		(deInt32 location, deInt32 count, deBool transpose, const float *value);
    736 	virtual deInt32			getUniformLocation		(deUint32 program, const char *name);
    737 
    738 	virtual void			lineWidth				(float);
    739 
    740 	virtual void			drawArrays				(deUint32 mode, int first, int count);
    741 	virtual void			drawArraysInstanced		(deUint32 mode, int first, int count, int instanceCount);
    742 	virtual void			drawElements			(deUint32 mode, int count, deUint32 type, const void *indices);
    743 	virtual void			drawElementsBaseVertex	(deUint32 mode, int count, deUint32 type, const void *indices, int baseVertex);
    744 	virtual void			drawElementsInstanced	(deUint32 mode, int count, deUint32 type, const void *indices, int instanceCount);
    745 	virtual void			drawElementsInstancedBaseVertex	(deUint32 mode, int count, deUint32 type, const void *indices, int instanceCount, int baseVertex);
    746 	virtual void			drawRangeElements		(deUint32 mode, deUint32 start, deUint32 end, int count, deUint32 type, const void *indices);
    747 	virtual void			drawRangeElementsBaseVertex (deUint32 mode, deUint32 start, deUint32 end, int count, deUint32 type, const void *indices, int baseVertex);
    748 	virtual void			drawArraysIndirect		(deUint32 mode, const void *indirect);
    749 	virtual void			drawElementsIndirect	(deUint32 mode, deUint32 type, const void *indirect);
    750 
    751 	virtual void			multiDrawArrays			(deUint32 mode, const int* first, const int* count, int primCount);
    752 	virtual void			multiDrawElements		(deUint32 mode, const int* count, deUint32 type, const void** indices, int primCount);
    753 	virtual void			multiDrawElementsBaseVertex (deUint32 mode, const int* count, deUint32 type, const void** indices, int primCount, const int* baseVertex);
    754 
    755 	virtual deUint32		createProgram			(ShaderProgram* program);
    756 	virtual void			useProgram				(deUint32 program);
    757 	virtual void			deleteProgram			(deUint32 program);
    758 
    759 	virtual void			readPixels				(int x, int y, int width, int height, deUint32 format, deUint32 type, void* data);
    760 	virtual deUint32		getError				(void);
    761 	virtual void			finish					(void);
    762 
    763 	virtual void			getIntegerv				(deUint32 pname, int* params);
    764 	virtual const char*		getString				(deUint32 pname);
    765 
    766 	// Expose helpers from Context.
    767 	using Context::readPixels;
    768 	using Context::texImage2D;
    769 	using Context::texSubImage2D;
    770 
    771 private:
    772 							ReferenceContext		(const ReferenceContext& other); // Not allowed!
    773 	ReferenceContext&		operator=				(const ReferenceContext& other); // Not allowed!
    774 
    775 	void					deleteTexture			(rc::Texture* texture);
    776 	void					deleteFramebuffer		(rc::Framebuffer* framebuffer);
    777 	void					deleteRenderbuffer		(rc::Renderbuffer* renderbuffer);
    778 	void					deleteBuffer			(rc::DataBuffer* buffer);
    779 	void					deleteVertexArray		(rc::VertexArray* vertexArray);
    780 	void					deleteProgramObject		(rc::ShaderProgramObjectContainer* sp);
    781 
    782 	void					acquireFboAttachmentReference	(const rc::Framebuffer::Attachment& attachment);
    783 	void					releaseFboAttachmentReference	(const rc::Framebuffer::Attachment& attachment);
    784 	tcu::PixelBufferAccess	getFboAttachment		(const rc::Framebuffer& framebuffer, rc::Framebuffer::AttachmentPoint point);
    785 
    786 	deUint32				blitResolveMultisampleFramebuffer (deUint32 mask, const tcu::IVec4& srcRect, const tcu::IVec4& dstRect, bool flipX, bool flipY);
    787 
    788 	rr::MultisamplePixelBufferAccess	getDrawColorbuffer		(void)	{ return (m_drawFramebufferBinding) ? (rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(getFboAttachment(*m_drawFramebufferBinding, rc::Framebuffer::ATTACHMENTPOINT_COLOR0)))	:	(m_defaultColorbuffer);		}
    789 	rr::MultisamplePixelBufferAccess	getDrawDepthbuffer		(void)	{ return (m_drawFramebufferBinding) ? (rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(getFboAttachment(*m_drawFramebufferBinding, rc::Framebuffer::ATTACHMENTPOINT_DEPTH)))	:	(m_defaultDepthbuffer);		}
    790 	rr::MultisamplePixelBufferAccess	getDrawStencilbuffer	(void)	{ return (m_drawFramebufferBinding) ? (rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(getFboAttachment(*m_drawFramebufferBinding, rc::Framebuffer::ATTACHMENTPOINT_STENCIL)))	:	(m_defaultStencilbuffer);	}
    791 	rr::MultisamplePixelBufferAccess	getReadColorbuffer		(void)	{ return (m_readFramebufferBinding) ? (rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(getFboAttachment(*m_readFramebufferBinding, rc::Framebuffer::ATTACHMENTPOINT_COLOR0)))	:	(m_defaultColorbuffer);		}
    792 	rr::MultisamplePixelBufferAccess	getReadDepthbuffer		(void)	{ return (m_readFramebufferBinding) ? (rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(getFboAttachment(*m_readFramebufferBinding, rc::Framebuffer::ATTACHMENTPOINT_DEPTH)))	:	(m_defaultDepthbuffer);		}
    793 	rr::MultisamplePixelBufferAccess	getReadStencilbuffer	(void)	{ return (m_readFramebufferBinding) ? (rr::MultisamplePixelBufferAccess::fromSinglesampleAccess(getFboAttachment(*m_readFramebufferBinding, rc::Framebuffer::ATTACHMENTPOINT_STENCIL)))	:	(m_defaultStencilbuffer);	}
    794 
    795 	const rc::Texture2D&	getTexture2D			(int unitNdx) const;
    796 	const rc::TextureCube&	getTextureCube			(int unitNdx) const;
    797 	const tcu::IVec4&		getViewport				(void) const { return m_viewport; }
    798 
    799 	void					setError				(deUint32 error);
    800 
    801 	void					setTex1DBinding			(int unit, rc::Texture1D*			tex1D);
    802 	void					setTex2DBinding			(int unit, rc::Texture2D*			tex2D);
    803 	void					setTexCubeBinding		(int unit, rc::TextureCube*			texCube);
    804 	void					setTex2DArrayBinding	(int unit, rc::Texture2DArray*		tex2DArray);
    805 	void					setTex3DBinding			(int unit, rc::Texture3D*			tex3D);
    806 	void					setTexCubeArrayBinding	(int unit, rc::TextureCubeArray*	texCubeArray);
    807 
    808 	void					setBufferBinding		(deUint32 target, rc::DataBuffer* buffer);
    809 	rc::DataBuffer*			getBufferBinding		(deUint32 target) const;
    810 
    811 	void*					getPixelPackPtr			(void* ptrOffset) const			{ return m_pixelPackBufferBinding ? (void*)((deUintptr)m_pixelPackBufferBinding->getData()+(deUintptr)ptrOffset) : ptrOffset;	}
    812 	const void*				getPixelUnpackPtr		(const void* ptrOffset) const	{ return m_pixelUnpackBufferBinding ? (const void*)((deUintptr)m_pixelUnpackBufferBinding->getData()+(deUintptr)ptrOffset) : ptrOffset; }
    813 
    814 	bool					predrawErrorChecks		(deUint32 mode);
    815 	void					drawWithReference		(const rr::PrimitiveList& primitives, int instanceCount);
    816 
    817 	// Helpers for getting valid access object based on current unpack state.
    818 	tcu::ConstPixelBufferAccess		getUnpack2DAccess		(const tcu::TextureFormat& format, int width, int height, const void* data);
    819 	tcu::ConstPixelBufferAccess		getUnpack3DAccess		(const tcu::TextureFormat& format, int width, int height, int depth, const void* data);
    820 
    821 	void					uniformv				(deInt32 index, glu::DataType type, deInt32 count, const void*);
    822 
    823 	struct TextureUnit
    824 	{
    825 
    826 		rc::Texture1D*			tex1DBinding;
    827 		rc::Texture2D*			tex2DBinding;
    828 		rc::TextureCube*		texCubeBinding;
    829 		rc::Texture2DArray*		tex2DArrayBinding;
    830 		rc::Texture3D*			tex3DBinding;
    831 		rc::TextureCubeArray*	texCubeArrayBinding;
    832 
    833 		rc::Texture1D			default1DTex;
    834 		rc::Texture2D			default2DTex;
    835 		rc::TextureCube			defaultCubeTex;
    836 		rc::Texture2DArray		default2DArrayTex;
    837 		rc::Texture3D			default3DTex;
    838 		rc::TextureCubeArray	defaultCubeArrayTex;
    839 
    840 		TextureUnit (void)
    841 			: tex1DBinding			(DE_NULL)
    842 			, tex2DBinding			(DE_NULL)
    843 			, texCubeBinding		(DE_NULL)
    844 			, tex2DArrayBinding		(DE_NULL)
    845 			, tex3DBinding			(DE_NULL)
    846 			, texCubeArrayBinding	(DE_NULL)
    847 			, default1DTex			(0)
    848 			, default2DTex			(0)
    849 			, defaultCubeTex		(0)
    850 			, default2DArrayTex		(0)
    851 			, default3DTex			(0)
    852 			, defaultCubeArrayTex	(0)
    853 		{
    854 		}
    855 	};
    856 
    857 	struct StencilState
    858 	{
    859 		deUint32		func;
    860 		int				ref;
    861 		deUint32		opMask;
    862 		deUint32		opStencilFail;
    863 		deUint32		opDepthFail;
    864 		deUint32		opDepthPass;
    865 		deUint32		writeMask;
    866 
    867 		StencilState (void);
    868 	};
    869 
    870 	ReferenceContextLimits						m_limits;
    871 
    872 	rr::MultisamplePixelBufferAccess			m_defaultColorbuffer;
    873 	rr::MultisamplePixelBufferAccess			m_defaultDepthbuffer;
    874 	rr::MultisamplePixelBufferAccess			m_defaultStencilbuffer;
    875 	rc::VertexArray								m_clientVertexArray;
    876 
    877 	tcu::IVec4									m_viewport;
    878 
    879 	rc::ObjectManager<rc::Texture>				m_textures;
    880 	rc::ObjectManager<rc::Framebuffer>			m_framebuffers;
    881 	rc::ObjectManager<rc::Renderbuffer>			m_renderbuffers;
    882 	rc::ObjectManager<rc::DataBuffer>			m_buffers;
    883 	rc::ObjectManager<rc::VertexArray>			m_vertexArrays;
    884 	rc::ObjectManager<rc::ShaderProgramObjectContainer>		m_programs;
    885 
    886 	int											m_activeTexture;
    887 	std::vector<TextureUnit>					m_textureUnits;
    888 	rc::Texture1D								m_emptyTex1D;
    889 	rc::Texture2D								m_emptyTex2D;
    890 	rc::TextureCube								m_emptyTexCube;
    891 	rc::Texture2DArray							m_emptyTex2DArray;
    892 	rc::Texture3D								m_emptyTex3D;
    893 	rc::TextureCubeArray						m_emptyTexCubeArray;
    894 
    895 	int											m_pixelUnpackRowLength;
    896 	int											m_pixelUnpackSkipRows;
    897 	int											m_pixelUnpackSkipPixels;
    898 	int											m_pixelUnpackImageHeight;
    899 	int											m_pixelUnpackSkipImages;
    900 	int											m_pixelUnpackAlignment;
    901 	int											m_pixelPackAlignment;
    902 
    903 	rc::Framebuffer*							m_readFramebufferBinding;
    904 	rc::Framebuffer*							m_drawFramebufferBinding;
    905 	rc::Renderbuffer*							m_renderbufferBinding;
    906 	rc::VertexArray*							m_vertexArrayBinding;
    907 	rc::ShaderProgramObjectContainer*			m_currentProgram;
    908 
    909 	rc::DataBuffer*								m_arrayBufferBinding;
    910 	rc::DataBuffer*								m_pixelPackBufferBinding;
    911 	rc::DataBuffer*								m_pixelUnpackBufferBinding;
    912 	rc::DataBuffer*								m_transformFeedbackBufferBinding;
    913 	rc::DataBuffer*								m_uniformBufferBinding;
    914 	rc::DataBuffer*								m_copyReadBufferBinding;
    915 	rc::DataBuffer*								m_copyWriteBufferBinding;
    916 	rc::DataBuffer*								m_drawIndirectBufferBinding;
    917 
    918 	tcu::Vec4									m_clearColor;
    919 	float										m_clearDepth;
    920 	int											m_clearStencil;
    921 
    922 	bool										m_scissorEnabled;
    923 	tcu::IVec4									m_scissorBox;
    924 
    925 	bool										m_stencilTestEnabled;
    926 	StencilState								m_stencil[rr::FACETYPE_LAST];
    927 
    928 	bool										m_depthTestEnabled;
    929 	deUint32									m_depthFunc;
    930 	float										m_depthRangeNear;
    931 	float										m_depthRangeFar;
    932 
    933 	float										m_polygonOffsetFactor;
    934 	float										m_polygonOffsetUnits;
    935 	bool										m_polygonOffsetFillEnabled;
    936 
    937 	bool										m_provokingFirstVertexConvention;
    938 
    939 	bool										m_blendEnabled;
    940 	deUint32									m_blendModeRGB;
    941 	deUint32									m_blendModeAlpha;
    942 	deUint32									m_blendFactorSrcRGB;
    943 	deUint32									m_blendFactorDstRGB;
    944 	deUint32									m_blendFactorSrcAlpha;
    945 	deUint32									m_blendFactorDstAlpha;
    946 	tcu::Vec4									m_blendColor;
    947 
    948 	bool										m_sRGBUpdateEnabled;
    949 
    950 	bool										m_depthClampEnabled;
    951 
    952 	tcu::BVec4									m_colorMask;
    953 	bool										m_depthMask;
    954 
    955 	std::vector<rr::GenericVec4>				m_currentAttribs;
    956 	float										m_lineWidth;
    957 
    958 	bool										m_primitiveRestartFixedIndex;
    959 	bool										m_primitiveRestartSettableIndex;
    960 	deUint32									m_primitiveRestartIndex;
    961 
    962 	deUint32									m_lastError;
    963 
    964 	rr::FragmentProcessor						m_fragmentProcessor;
    965 	std::vector<rr::Fragment>					m_fragmentBuffer;
    966 	std::vector<float>							m_fragmentDepths;
    967 } DE_WARN_UNUSED_TYPE;
    968 
    969 } // sglr
    970 
    971 #endif // _SGLRREFERENCECONTEXT_HPP
    972