Lines Matching defs:const
105 static string arrayStr (const std::vector<T> (&arr))
115 static int arrayIndexOf (const std::vector<T> (&arr), const T& e)
120 static const char* getTextureTypeName (TextureType type)
168 static inline bool isFormatSupportedForTextureBuffer (const TextureFormat& format)
196 static inline string getShaderImageFormatQualifier (const TextureFormat& format)
198 const char* orderPart;
199 const char* typePart;
239 const char* const formatPart = isFormatTypeUnsignedInteger(formatType) ? "u"
243 const char* const imageTypePart = textureType == TEXTURETYPE_BUFFER ? "Buffer"
321 static inline tcu::Texture1D* newOneLevelTexture1D (const tcu::TextureFormat& format, int w)
323 tcu::Texture1D* const res = new tcu::Texture1D(format, w);
328 static inline tcu::Texture2D* newOneLevelTexture2D (const tcu::TextureFormat& format, int w, int h)
330 tcu::Texture2D* const res = new tcu::Texture2D(format, w, h);
335 static inline tcu::TextureCube* newOneLevelTextureCube (const tcu::TextureFormat& format, int size)
337 tcu::TextureCube* const res = new tcu::TextureCube(format, size);
343 static inline tcu::Texture3D* newOneLevelTexture3D (const tcu::TextureFormat& format, int w, int h, int d)
345 tcu::Texture3D* const res = new tcu::Texture3D(format, w, h, d);
350 static inline tcu::Texture2DArray* newOneLevelTexture2DArray (const tcu::TextureFormat& format, int w, int h, int d)
352 tcu::Texture2DArray* const res = new tcu::Texture2DArray(format, w, h, d);
379 static const char* const s_texBufExtString = "GL_EXT_texture_buffer";
381 static bool supportsES32orGL45(const RenderContext& renderContext)
388 static inline void checkTextureTypeExtensions (const glu::ContextInfo& contextInfo, TextureType type, const RenderContext& renderContext)
394 static inline string textureTypeExtensionShaderRequires (TextureType type, const RenderContext& renderContext)
402 static const char* const s_imageAtomicExtString = "GL_OES_shader_image_atomic";
404 static inline string imageAtomicExtensionShaderRequires (const RenderContext& renderContext)
470 static const char* getAtomicOperationCaseName (AtomicOperation op)
488 static const char* getAtomicOperationShaderFuncName (AtomicOperation op)
510 static const tcu::CubeFace faces[6] =
527 BufferMemMap (const glw::Functions& gl, deUint32 target, int offset, int size, deUint32 access)
542 void* getPtr (void) const { return m_ptr; }
543 void* operator* (void) const { return m_ptr; }
546 BufferMemMap (const BufferMemMap& other);
547 BufferMemMap& operator= (const BufferMemMap& other);
549 const glw::Functions& m_gl;
550 const deUint32 m_target;
559 UniformAccessLogger (const glw::Functions& gl, TestLog& log, deUint32 programGL)
566 void assign1i (const string& name, int x);
567 void assign3f (const string& name, float x, float y, float z);
570 int getLocation (const string& name);
572 const glw::Functions& m_gl;
574 const deUint32 m_programGL;
579 int UniformAccessLogger::getLocation (const string& name)
583 const int loc = m_gl.getUniformLocation(m_programGL, name.c_str());
590 void UniformAccessLogger::assign1i (const string& name, int x)
592 const int loc = getLocation(name);
597 void UniformAccessLogger::assign3f (const string& name, float x, float y, float z)
599 const int loc = getLocation(name);
608 LayeredImage (TextureType type, const TextureFormat& format, int w, int h, int d);
610 TextureType getImageType (void) const { return m_type; }
611 const IVec3& getSize (void) const { return m_size; }
612 const TextureFormat& getFormat (void) const { return m_format; }
617 void setPixel (int x, int y, int z, const ColorT& color) const;
619 Vec4 getPixel (int x, int y, int z) const;
620 IVec4 getPixelInt (int x, int y, int z) const;
621 UVec4 getPixelUint (int x, int y, int z) const { return getPixelInt(x, y, z).asUint(); }
627 ConstPixelBufferAccess getAccess (void) const { return getAccessInternal(); }
628 ConstPixelBufferAccess getSliceAccess (int slice) const { return getSliceAccessInternal(slice); }
629 ConstPixelBufferAccess getCubeFaceAccess (tcu::CubeFace face) const { return getCubeFaceAccessInternal(face); }
632 LayeredImage (const LayeredImage&);
633 LayeredImage& operator= (const LayeredImage&);
635 // Some helpers to reduce code duplication between const/non-const versions of getAccess and others.
636 PixelBufferAccess getAccessInternal (void) const;
637 PixelBufferAccess getSliceAccessInternal (int slice) const;
638 PixelBufferAccess getCubeFaceAccessInternal (tcu::CubeFace face) const;
640 const TextureType m_type;
641 const IVec3 m_size;
642 const TextureFormat m_format;
645 const SharedPtr<tcu::Texture1D> m_texBuffer;
646 const SharedPtr<tcu::Texture2D> m_tex2D;
647 const SharedPtr<tcu::TextureCube> m_texCube;
648 const SharedPtr<tcu::Texture3D> m_tex3D;
649 const SharedPtr<tcu::Texture2DArray> m_tex2DArray;
652 LayeredImage::LayeredImage (TextureType type, const TextureFormat& format, int w, int h, int d)
682 void LayeredImage::setPixel (int x, int y, int z, const ColorT& color) const
684 const PixelBufferAccess access = m_type == TEXTURETYPE_BUFFER ? m_texBuffer->getLevel(0)
694 Vec4 LayeredImage::getPixel (int x, int y, int z) const
696 const ConstPixelBufferAccess access = m_type == TEXTURETYPE_CUBE ? getCubeFaceAccess(glslImageFuncZToCubeFace(z)) : getAccess();
700 IVec4 LayeredImage::getPixelInt (int x, int y, int z) const
702 const ConstPixelBufferAccess access = m_type == TEXTURETYPE_CUBE ? getCubeFaceAccess(glslImageFuncZToCubeFace(z)) : getAccess();
706 PixelBufferAccess LayeredImage::getAccessInternal (void) const
717 PixelBufferAccess LayeredImage::getSliceAccessInternal (int slice) const
719 const PixelBufferAccess srcAccess = getAccessInternal();
723 PixelBufferAccess LayeredImage::getCubeFaceAccessInternal (tcu::CubeFace face) const
730 static void setTextureStorage (glu::CallLogWrapper& glLog, TextureType imageType, deUint32 internalFormat, const IVec3& imageSize, deUint32 textureBufGL)
732 const deUint32 textureTarget = getGLTextureTarget(imageType);
738 const TextureFormat format = glu::mapGLInternalFormat(internalFormat);
739 const int numBytes = format.getPixelSize() * imageSize.x();
766 static void uploadTexture (glu::CallLogWrapper& glLog, const LayeredImage& src, deUint32 textureBufGL)
768 const deUint32 internalFormat = glu::getInternalFormat(src.getFormat());
769 const glu::TransferFormat transferFormat = glu::getTransferFormat(src.getFormat());
770 const IVec3& imageSize = src.getSize();
775 const int pixelSize = src.getFormat().getPixelSize();
797 const tcu::CubeFace face = (tcu::CubeFace)faceI;
804 const deUint32 textureTarget = getGLTextureTarget(src.getImageType());
809 static void readPixelsRGBAInteger32 (const PixelBufferAccess& dst, int originX, int originY, glu::CallLogWrapper& glLog)
841 virtual bool operator() (TestLog&, const ConstPixelBufferAccess&, int sliceOrFaceNdx) const = 0;
856 static bool readIntegerTextureViaFBOAndVerify (const RenderContext& renderCtx,
860 const TextureFormat& textureFormat,
861 const IVec3& textureSize,
862 const ImageLayerVerifier& verifyLayer)
869 const tcu::ScopedLogSection section(log, "Verification", "Result verification (bind texture layer-by-layer to FBO, read with glReadPixels())");
871 const int numSlicesOrFaces = textureType == TEXTURETYPE_CUBE ? 6 : textureSize.z();
872 const deUint32 textureTargetGL = getGLTextureTarget(textureType);
913 static bool readFloatOrNormTextureWithLookupsAndVerify (const RenderContext& renderCtx,
917 const TextureFormat& textureFormat,
918 const IVec3& textureSize,
919 const ImageLayerVerifier& verifyLayer)
926 const tcu::ScopedLogSection section(log, "Verification", "Result verification (read texture layer-by-layer in compute shader with texture() into SSBO)");
927 const std::string glslVersionDeclaration = getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
929 const glu::ShaderProgram program(renderCtx,
970 const deUint32 textureTargetGL = getGLTextureTarget(textureType);
971 const glu::Buffer outputBuffer (renderCtx);
984 const deUint32 blockIndex = glLog.glGetProgramResourceIndex(program.getProgram(), GL_SHADER_STORAGE_BLOCK, "Output");
985 const int blockSize = glu::getProgramResourceInt(renderCtx.getFunctions(), program.getProgram(), GL_SHADER_STORAGE_BLOCK, blockIndex, GL_BUFFER_DATA_SIZE);
998 const int numSlicesOrFaces = textureType == TEXTURETYPE_CUBE ? 6 : textureSize.z();
1000 const PixelBufferAccess resultSliceAccess = resultSlice.getAccess();
1001 const deUint32 blockIndex = glLog.glGetProgramResourceIndex(program.getProgram(), GL_SHADER_STORAGE_BLOCK, "Output");
1002 const int blockSize = glu::getProgramResourceInt(renderCtx.getFunctions(), program.getProgram(), GL_SHADER_STORAGE_BLOCK, blockIndex, GL_BUFFER_DATA_SIZE);
1003 const deUint32 valueIndex = glLog.glGetProgramResourceIndex(program.getProgram(), GL_BUFFER_VARIABLE, "Output.color");
1004 const glu::InterfaceVariableInfo valueInfo = glu::getProgramInterfaceVariableInfo(renderCtx.getFunctions(), program.getProgram(), GL_BUFFER_VARIABLE, valueIndex);
1023 const float z = textureType == TEXTURETYPE_3D ?
1037 const BufferMemMap bufMap(renderCtx.getFunctions(), GL_SHADER_STORAGE_BUFFER, 0, blockSize, GL_MAP_READ_BIT);
1042 const int ndx = y*textureSize.x() + x;
1043 const float* const clrData = (const float*)((const deUint8*)bufMap.getPtr() + valueInfo.offset + valueInfo.arrayStride*ndx);
1065 static bool readBufferTextureWithMappingAndVerify (const RenderContext& renderCtx,
1068 const TextureFormat& textureFormat,
1070 const ImageLayerVerifier& verifyLayer)
1073 const PixelBufferAccess resultAccess = result.getAccess();
1074 const int dataSize = imageSize * textureFormat.getPixelSize();
1076 const tcu::ScopedLogSection section(glLog.getLog(), "Verification", "Result verification (read texture's buffer with a mapping)");
1080 const BufferMemMap bufMap(renderCtx.getFunctions(), GL_TEXTURE_BUFFER, 0, dataSize, GL_MAP_READ_BIT);
1088 static bool readTextureAndVerify (const RenderContext& renderCtx,
1093 const TextureFormat& textureFormat,
1094 const IVec3& imageSize,
1095 const ImageLayerVerifier& verifyLayer)
1109 ImageLayerComparer (const LayeredImage& reference,
1110 const IVec2& relevantRegion = IVec2(0) /* If given, only check this region of each slice. */)
1116 bool operator() (TestLog& log, const tcu::ConstPixelBufferAccess& resultSlice, int sliceOrFaceNdx) const
1118 const bool isCube = m_reference.getImageType() == TEXTURETYPE_CUBE;
1119 const ConstPixelBufferAccess referenceSlice = tcu::getSubregion(isCube ? m_reference.getCubeFaceAccess(glslImageFuncZToCubeFace(sliceOrFaceNdx))
1123 const string comparisonName = "Comparison" + toString(sliceOrFaceNdx);
1124 const string comparisonDesc = "Image Comparison, "
1135 const LayeredImage& m_reference;
1136 const IVec2 m_relevantRegion;
1148 ImageStoreCase (Context& context, const char* name, const char* description, const TextureFormat& format, TextureType textureType, deUint32 caseFlags = 0)
1160 const TextureFormat m_format;
1161 const TextureType m_textureType;
1162 const bool m_singleLayerBind;
1167 const RenderContext& renderCtx = m_context.getRenderContext();
1170 const deUint32 internalFormatGL = glu::getInternalFormat(m_format);
1171 const deUint32 textureTargetGL = getGLTextureTarget(m_textureType);
1172 const IVec3& imageSize = defaultImageSize(m_textureType);
1173 const int numSlicesOrFaces = m_textureType == TEXTURETYPE_CUBE ? 6 : imageSize.z();
1174 const int maxImageDimension = de::max(imageSize.x(), de::max(imageSize.y(), imageSize.z()));
1175 const float storeColorScale = isFormatTypeUnorm(m_format.type) ? 1.0f / (float)(maxImageDimension - 1)
1178 const float storeColorBias = isFormatTypeSnorm(m_format.type) ? -1.0f : 0.0f;
1179 const glu::Buffer textureBuf (renderCtx); // \note Only really used if using buffer texture.
1180 const glu::Texture texture (renderCtx);
1200 const string shaderImageFormatStr = getShaderImageFormatQualifier(m_format);
1201 const TextureType shaderImageType = m_singleLayerBind ? textureLayerType(m_textureType) : m_textureType;
1202 const string shaderImageTypeStr = getShaderImageType(m_format.type, shaderImageType);
1203 const bool isUintFormat = isFormatTypeUnsignedInteger(m_format.type);
1204 const bool isIntFormat = isFormatTypeSignedInteger(m_format.type);
1205 const string colorBaseExpr = string(isUintFormat ? "u" : isIntFormat ? "i" : "") + "vec4(gx^gy^gz, "
1209 const string colorExpr = colorBaseExpr + (storeColorScale == 1.0f ? "" : "*" + toString(storeColorScale))
1211 const std::string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
1213 const glu::ShaderProgram program(renderCtx,
1279 const int isIntegerFormat = isFormatTypeInteger(m_format.type);
1288 const IVec4 color(x^y^z, (imageSize.x()-1-x)^y^z, x^(imageSize.y()-1-y)^z, (imageSize.x()-1-x)^(imageSize.y()-1-y)^z);
1296 const bool compareOk = readTextureAndVerify(renderCtx, glLog, *texture, *textureBuf, m_textureType, m_format, imageSize, ImageLayerComparer(reference));
1313 ImageLoadAndStoreCase (Context& context, const char* name, const char* description, const TextureFormat& format, TextureType textureType, deUint32 caseFlags = 0)
1323 ImageLoadAndStoreCase (Context& context, const char* name, const char* description, const TextureFormat& textureFormat, const TextureFormat& imageFormat, TextureType textureType, deUint32 caseFlags = 0)
1339 static void replaceBadFloatReinterpretValues (LayeredImage& image, const TextureFormat& imageFormat);
1341 const TextureFormat m_textureFormat;
1342 const TextureFormat m_imageFormat;
1343 const TextureType m_textureType;
1344 const bool m_restrictImages;
1345 const bool m_singleLayerBind;
1349 void ImageLoadAndStoreCase::replaceBadFloatReinterpretValues (LayeredImage& image, const TextureFormat& imageFormat)
1352 const int pixelSize = imageFormat.getPixelSize();
1353 const int imageNumChannels = imageFormat.order == tcu::TextureFormat::R ? 1
1356 const IVec3 imageSize = image.getSize();
1357 const int numSlicesOrFaces = image.getImageType() == TEXTURETYPE_CUBE ? 6 : imageSize.z();
1363 const PixelBufferAccess sliceAccess = image.getImageType() == TEXTURETYPE_CUBE ? image.getCubeFaceAccess((tcu::CubeFace)z) : image.getSliceAccess(z);
1364 const int rowPitch = sliceAccess.getRowPitch();
1365 void *const data = sliceAccess.getDataPtr();
1370 void *const pixelData = (deUint8*)data + y*rowPitch + x*pixelSize;
1374 void *const channelData = (deUint8*)pixelData + c*pixelSize/imageNumChannels;
1375 const TcuFloatType f (*(TcuFloatTypeStorageType*)channelData);
1386 const RenderContext& renderCtx = m_context.getRenderContext();
1389 const deUint32 textureInternalFormatGL = glu::getInternalFormat(m_textureFormat);
1390 const deUint32 imageInternalFormatGL = glu::getInternalFormat(m_imageFormat);
1391 const deUint32 textureTargetGL = getGLTextureTarget(m_textureType);
1392 const IVec3& imageSize = defaultImageSize(m_textureType);
1393 const int maxImageDimension = de::max(imageSize.x(), de::max(imageSize.y(), imageSize.z()));
1394 const float storeColorScale = isFormatTypeUnorm(m_textureFormat.type) ? 1.0f / (float)(maxImageDimension - 1)
1397 const float storeColorBias = isFormatTypeSnorm(m_textureFormat.type) ? -1.0f : 0.0f;
1398 const int numSlicesOrFaces = m_textureType == TEXTURETYPE_CUBE ? 6 : imageSize.z();
1399 const bool isIntegerTextureFormat = isFormatTypeInteger(m_textureFormat.type);
1400 const glu::Buffer texture0Buf (renderCtx);
1401 const glu::Buffer texture1Buf (renderCtx);
1402 const glu::Texture texture0 (renderCtx);
1403 const glu::Texture texture1 (renderCtx);
1422 const IVec4 color(x^y^z, (imageSize.x()-1-x)^y^z, x^(imageSize.y()-1-y)^z, (imageSize.x()-1-x)^(imageSize.y()-1-y)^z);
1458 const char* const maybeRestrict = m_restrictImages ? "restrict" : "";
1459 const string shaderImageFormatStr = getShaderImageFormatQualifier(m_imageFormat);
1460 const TextureType shaderImageType = m_singleLayerBind ? textureLayerType(m_textureType) : m_textureType;
1461 const string shaderImageTypeStr = getShaderImageType(m_imageFormat.type, shaderImageType);
1462 const std::string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
1464 const glu::ShaderProgram program(renderCtx,
1538 const int pixelSize = m_imageFormat.getPixelSize();
1540 const PixelBufferAccess scratchAccess = scratch.getAccess();
1544 const PixelBufferAccess sliceAccess = m_textureType == TEXTURETYPE_CUBE ? reference.getCubeFaceAccess((tcu::CubeFace)z) : reference.getSliceAccess(z);
1545 const int rowPitch = sliceAccess.getRowPitch();
1546 void *const data = sliceAccess.getDataPtr();
1551 void *const pixelData = (deUint8*)data + y*rowPitch + x*pixelSize;
1571 const UVec4 temp = reference.getPixelUint(imageSize.x()-1-x, y, z);
1577 const Vec4 temp = reference.getPixel(imageSize.x()-1-x, y, z);
1586 const bool compareOk = readTextureAndVerify(renderCtx, glLog, *texture1, *texture1Buf, m_textureType, m_textureFormat, imageSize, ImageLayerComparer(reference));
1628 BinaryAtomicOperationCase (Context& context, const char* name, const char* description, const TextureFormat& format, TextureType imageType, AtomicOperation operation, AtomicOperationCaseType caseType)
1651 static int getAtomicFuncArgument (AtomicOperation op, const IVec3& invocationID, const IVec2& dispatchSizeXY);
1653 static string getAtomicFuncArgumentShaderStr (AtomicOperation op, const string& x, const string& y, const string& z, const IVec2& dispatchSizeXY);
1655 const int m_numInvocationsPerPixel = 5;
1656 const TextureFormat m_format;
1657 const TextureType m_imageType;
1658 const AtomicOperation m_operation;
1659 const AtomicOperationCaseType m_caseType;
1680 int BinaryAtomicOperationCase::getAtomicFuncArgument (AtomicOperation op, const IVec3& invocationID, const IVec2& dispatchSizeXY)
1682 const int x = invocationID.x();
1683 const int y = invocationID.y();
1684 const int z = invocationID.z();
1685 const int wid = dispatchSizeXY.x();
1686 const int hei = dispatchSizeXY.y();
1708 string BinaryAtomicOperationCase::getAtomicFuncArgumentShaderStr (AtomicOperation op, const string& x, const string& y, const string& z, const IVec2& dispatchSizeXY)
1735 bool operator() (TestLog& log, const ConstPixelBufferAccess& resultSlice, int sliceOrFaceNdx) const
1737 const bool isIntegerFormat = isFormatTypeInteger(resultSlice.getFormat().type);
1738 const IVec2 dispatchSizeXY (m_numInvocationsPerPixel*resultSlice.getWidth(), resultSlice.getHeight());
1766 const IVec3 gid(x + i*resultSlice.getWidth(), y, sliceOrFaceNdx);
1818 const AtomicOperation m_operation;
1819 const TextureType m_imageType;
1820 const int m_numInvocationsPerPixel;
1825 T getPixelValueX(const ConstPixelBufferAccess& resultSlice, int x, int y)
1831 float getPixelValueX<float>(const ConstPixelBufferAccess& resultSlice, int x, int y)
1840 ReturnValueVerifier (AtomicOperation operation, TextureType imageType, const IVec2& endResultImageLayerSize, int numInvocationsPerPixel) : m_operation(operation), m_imageType(imageType), m_endResultImageLayerSize(endResultImageLayerSize), m_numInvocationsPerPixel(numInvocationsPerPixel) {}
1842 bool operator() (TestLog& log, const ConstPixelBufferAccess& resultSlice, int sliceOrFaceNdx) const
1844 const bool isIntegerFormat (isFormatTypeInteger(resultSlice.getFormat().type));
1845 const IVec2 dispatchSizeXY (resultSlice.getWidth(), resultSlice.getHeight());
1876 const AtomicOperation m_operation;
1877 const TextureType m_imageType;
1878 const IVec2 m_endResultImageLayerSize;
1879 const int m_numInvocationsPerPixel;
1882 bool checkPixel(TestLog& log, const ConstPixelBufferAccess& resultSlice, int x, int y, int sliceOrFaceNdx, const IVec2 &dispatchSizeXY) const
1893 const IVec2 pixCoord (x + i*m_endResultImageLayerSize.x(), y);
1894 const IVec3 gid (pixCoord.x(), pixCoord.y(), sliceOrFaceNdx);
1905 const bool success = verifyOperationAccumulationIntermediateValues(m_operation,
1927 bool verifyOperationAccumulationIntermediateValues (AtomicOperation operation, T init, const std::vector<T> (&args), const std::vector<T> (&returnValues)) const
1939 bool verifyRecursive (AtomicOperation operation, int index, T valueSoFar, std::vector<bool> (&argsUsed), const std::vector<T> (&args), const std::vector<T> (&returnValues)) const
1963 const glu::RenderContext& renderContext = m_context.getRenderContext();
1972 const RenderContext& renderCtx = m_context.getRenderContext();
1975 const deUint32 internalFormatGL = glu::getInternalFormat(m_format);
1976 const deUint32 textureTargetGL = getGLTextureTarget(m_imageType);
1977 const IVec3& imageSize = defaultImageSize(m_imageType);
1978 const int numSlicesOrFaces = m_imageType == TEXTURETYPE_CUBE ? 6 : imageSize.z();
1979 const bool isUintFormat = isFormatTypeUnsignedInteger(m_format.type);
1980 const bool isIntFormat = isFormatTypeSignedInteger(m_format.type);
1981 const glu::Buffer endResultTextureBuf (renderCtx);
1982 const glu::Buffer returnValueTextureBuf (renderCtx);
1983 const glu::Texture endResultTexture (renderCtx); //!< Texture for the final result; i.e. the texture on which the atomic operations are done. Size imageSize.
1984 const glu::Texture returnValueTexture (renderCtx); //!< Texture into which the return values are stored if m_caseType == CASETYPE_RETURN_VALUES.
2017 const LayeredImage imageData(m_imageType, m_format, imageSize.x(), imageSize.y(), imageSize.z());
2020 const IVec4 initial(getOperationInitialValue(m_operation));
2064 const string colorVecTypeName = string(isUintFormat ? "u" : isIntFormat ? "i" : "") + "vec4";
2065 const string atomicCoord = m_imageType == TEXTURETYPE_BUFFER ? "gx % " + toString(imageSize.x())
2068 const string invocationCoord = m_imageType == TEXTURETYPE_BUFFER ? "gx"
2071 const string atomicArgExpr = (isUintFormat ? "uint"
2075 const string atomicInvocation = string() + getAtomicOperationShaderFuncName(m_operation) + "(u_results, " + atomicCoord + ", " + atomicArgExpr + ")";
2076 const string shaderImageFormatStr = getShaderImageFormatQualifier(m_format);
2077 const string shaderImageTypeStr = getShaderImageType(m_format.type, m_imageType);
2078 const std::string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
2080 const glu::ShaderProgram program(renderCtx,
2126 const deUint32 textureToCheckGL = m_caseType == ATOMIC_OPERATION_CASE_TYPE_END_RESULT ? *endResultTexture
2129 const deUint32 textureToCheckBufGL = m_caseType == ATOMIC_OPERATION_CASE_TYPE_END_RESULT ? *endResultTextureBuf
2133 const IVec3 textureToCheckSize = imageSize * IVec3(m_caseType == ATOMIC_OPERATION_CASE_TYPE_END_RESULT ? 1 : m_numInvocationsPerPixel, 1, 1);
2134 const UniquePtr<const ImageLayerVerifier> verifier (m_caseType == ATOMIC_OPERATION_CASE_TYPE_END_RESULT ? new EndResultVerifier(m_operation, m_imageType, m_numInvocationsPerPixel)
2158 AtomicCompSwapCase (Context& context, const char* name, const char* description, const TextureFormat& format, TextureType imageType, AtomicOperationCaseType caseType)
2175 static int getCompareArg (const IVec3& invocationID, int imageWidth);
2176 static int getAssignArg (const IVec3& invocationID, int imageWidth);
2177 static string getCompareArgShaderStr (const string& x, const string& y, const string& z, int imageWidth);
2178 static string getAssignArgShaderStr (const string& x, const string& y, const string& z, int imageWidth);
2180 const int m_numInvocationsPerPixel = 5;
2181 const TextureFormat m_format;
2182 const TextureType m_imageType;
2183 const AtomicOperationCaseType m_caseType;
2186 int AtomicCompSwapCase::getCompareArg (const IVec3& invocationID, int imageWidth)
2188 const int x = invocationID.x();
2189 const int y = invocationID.y();
2190 const int z = invocationID.z();
2191 const int wrapX = x % imageWidth;
2192 const int curPixelInvocationNdx = x / imageWidth;
2197 int AtomicCompSwapCase::getAssignArg (const IVec3& invocationID, int imageWidth)
2202 string AtomicCompSwapCase::getCompareArgShaderStr (const string& x, const string& y, const string& z, int imageWidth)
2204 const string wrapX = "(" + x + "%" + toString(imageWidth) + ")";
2205 const string curPixelInvocationNdx = "(" + x + "/" + toString(imageWidth) + ")";
2210 string AtomicCompSwapCase::getAssignArgShaderStr (const string& x, const string& y, const string& z, int imageWidth)
2212 const string wrapX = "(" + x + "%" + toString(imageWidth) + ")";
2213 const string curPixelInvocationNdx = "(" + x + "/" + toString(imageWidth) + " + 1)";
2220 const glu::RenderContext& renderContext = m_context.getRenderContext();
2232 bool operator() (TestLog& log, const ConstPixelBufferAccess& resultSlice, int sliceOrFaceNdx) const
2248 const int result = resultSlice.getPixelInt(x, y).x();
2254 const IVec3 gid(x + i*resultSlice.getWidth(), y, sliceOrFaceNdx);
2281 const TextureType m_imageType;
2282 const int m_imageWidth;
2283 const int m_numInvocationsPerPixel;
2292 bool operator() (TestLog& log, const ConstPixelBufferAccess& resultSlice, int sliceOrFaceNdx) const
2315 const IVec2 pixCoord (x + i*m_endResultImageWidth, y);
2316 const IVec3 gid (pixCoord.x(), pixCoord.y(), sliceOrFaceNdx);
2378 const TextureType m_imageType;
2379 const int m_endResultImageWidth;
2380 const int m_numInvocationsPerPixel;
2385 const RenderContext& renderCtx = m_context.getRenderContext();
2388 const deUint32 internalFormatGL = glu::getInternalFormat(m_format);
2389 const deUint32 textureTargetGL = getGLTextureTarget(m_imageType);
2390 const IVec3& imageSize = defaultImageSize(m_imageType);
2391 const int numSlicesOrFaces = m_imageType == TEXTURETYPE_CUBE ? 6 : imageSize.z();
2392 const bool isUintFormat = isFormatTypeUnsignedInteger(m_format.type);
2393 const bool isIntFormat = isFormatTypeSignedInteger(m_format.type);
2394 const glu::Buffer endResultTextureBuf (renderCtx);
2395 const glu::Buffer returnValueTextureBuf (renderCtx);
2396 const glu::Texture endResultTexture (renderCtx); //!< Texture for the final result; i.e. the texture on which the atomic operations are done. Size imageSize.
2397 const glu::Texture returnValueTexture (renderCtx); //!< Texture into which the return values are stored if m_caseType == CASETYPE_RETURN_VALUES.
2432 const LayeredImage imageData(m_imageType, m_format, imageSize.x(), imageSize.y(), imageSize.z());
2477 const string colorScalarTypeName = isUintFormat ? "uint" : isIntFormat ? "int" : DE_NULL;
2478 const string colorVecTypeName = string(isUintFormat ? "u" : isIntFormat ? "i" : DE_NULL) + "vec4";
2479 const string atomicCoord = m_imageType == TEXTURETYPE_BUFFER ? "gx % " + toString(imageSize.x())
2482 const string invocationCoord = m_imageType == TEXTURETYPE_BUFFER ? "gx"
2485 const string shaderImageFormatStr = getShaderImageFormatQualifier(m_format);
2486 const string shaderImageTypeStr = getShaderImageType(m_format.type, m_imageType);
2487 const string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
2489 const glu::ShaderProgram program(renderCtx,
2549 const deUint32 textureToCheckGL = m_caseType == ATOMIC_OPERATION_CASE_TYPE_END_RESULT ? *endResultTexture
2553 const deUint32 textureToCheckBufGL = m_caseType == ATOMIC_OPERATION_CASE_TYPE_END_RESULT ? *endResultTextureBuf
2560 const IVec3 relevantRegion = imageSize * (m_caseType == ATOMIC_OPERATION_CASE_TYPE_END_RESULT ? IVec3(1, 1, 1)
2563 const UniquePtr<const ImageLayerVerifier> verifier (m_caseType == ATOMIC_OPERATION_CASE_TYPE_END_RESULT ? new EndResultVerifier(m_imageType, imageSize.x(), m_numInvocationsPerPixel)
2588 CoherenceCase (Context& context, const char* name, const char* description, const TextureFormat& format, TextureType imageType, Qualifier qualifier)
2608 static const int SHADER_READ_OFFSETS_X[4];
2609 static const int SHADER_READ_OFFSETS_Y[4];
2610 static const int SHADER_READ_OFFSETS_Z[4];
2611 static const char* const SHADER_READ_OFFSETS_X_STR;
2612 static const char* const SHADER_READ_OFFSETS_Y_STR;
2613 static const char* const SHADER_READ_OFFSETS_Z_STR;
2615 const TextureFormat m_format;
2616 const TextureType m_imageType;
2617 const Qualifier m_qualifier;
2620 const int CoherenceCase::SHADER_READ_OFFSETS_X[4] = { 1, 4, 7, 10 };
2621 const int CoherenceCase::SHADER_READ_OFFSETS_Y[4] = { 2, 5, 8, 11 };
2622 const int CoherenceCase::SHADER_READ_OFFSETS_Z[4] = { 3, 6, 9, 12 };
2623 const char* const CoherenceCase::SHADER_READ_OFFSETS_X_STR = "int[]( 1, 4, 7, 10 )";
2624 const char* const CoherenceCase::SHADER_READ_OFFSETS_Y_STR = "int[]( 2, 5, 8, 11 )";
2625 const char* const CoherenceCase::SHADER_READ_OFFSETS_Z_STR = "int[]( 3, 6, 9, 12 )";
2629 const RenderContext& renderCtx = m_context.getRenderContext();
2632 const deUint32 internalFormatGL = glu::getInternalFormat(m_format);
2633 const deUint32 textureTargetGL = getGLTextureTarget(m_imageType);
2634 const IVec3& imageSize = defaultImageSize(m_imageType);
2635 const int numSlicesOrFaces = m_imageType == TEXTURETYPE_CUBE ? 6 : imageSize.z();
2636 const bool isUintFormat = isFormatTypeUnsignedInteger(m_format.type);
2637 const bool isIntFormat = isFormatTypeSignedInteger(m_format.type);
2638 const char* const qualifierName = m_qualifier == QUALIFIER_COHERENT ? "coherent"
2641 const glu::Buffer textureBuf (renderCtx);
2642 const glu::Texture texture (renderCtx);
2643 const IVec3 numGroups = IVec3(16, de::min(16, imageSize.y()), de::min(2, numSlicesOrFaces));
2644 const IVec3 workItemSize = IVec3(imageSize.x(), imageSize.y(), numSlicesOrFaces);
2645 const IVec3 localSize = workItemSize / numGroups;
2646 const IVec3 minReqMaxLocalSize = IVec3(128, 128, 64);
2647 const int minReqMaxLocalInvocations = 128;
2675 const string colorVecTypeName = string(isUintFormat ? "u" : isIntFormat ? "i" : "") + "vec4";
2676 const char* const colorScalarTypeName = isUintFormat ? "uint" : isIntFormat ? "int" : "float";
2677 const string invocationCoord = m_imageType == TEXTURETYPE_BUFFER ? "gx"
2680 const string shaderImageFormatStr = getShaderImageFormatQualifier(m_format);
2681 const string shaderImageTypeStr = getShaderImageType(m_format.type, m_imageType);
2682 const string localSizeX = de::toString(localSize.x());
2683 const string localSizeY = de::toString(localSize.y());
2684 const string localSizeZ = de::toString(localSize.z());
2685 const std::string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
2688 const glu::ShaderProgram program(renderCtx,
2766 const int groupBaseX = x / localSize.x() * localSize.x();
2767 const int groupBaseY = y / localSize.y() * localSize.y();
2768 const int groupBaseZ = z / localSize.z() * localSize.z();
2791 R32UIImageSingleValueVerifier (const deUint32 value) : m_min(value), m_max(value) {}
2792 R32UIImageSingleValueVerifier (const deUint32 min, const deUint32 max) : m_min(min), m_max(max) {}
2794 bool operator() (TestLog& log, const ConstPixelBufferAccess& resultSlice, int) const
2801 const deUint32 resultValue = resultSlice.getPixelUint(0, 0).x();
2815 const deUint32 m_min;
2816 const deUint32 m_max;
2833 ImageSizeCase (Context& context, const char* name, const char* description, const TextureFormat& format, TextureType imageType, const IVec3& size, ImageAccess imageAccess)
2846 const TextureFormat m_format;
2847 const TextureType m_imageType;
2848 const IVec3 m_imageSize;
2849 const ImageAccess m_imageAccess;
2854 const RenderContext& renderCtx = m_context.getRenderContext();
2857 const deUint32 internalFormatGL = glu::getInternalFormat(m_format);
2858 const deUint32 textureTargetGL = getGLTextureTarget(m_imageType);
2859 const glu::Buffer mainTextureBuf (renderCtx);
2860 const glu::Texture mainTexture (renderCtx);
2861 const glu::Texture shaderOutResultTexture (renderCtx);
2891 const char* const shaderImageAccessStr = m_imageAccess == IMAGEACCESS_READ_ONLY ? "readonly"
2895 const string shaderImageFormatStr = getShaderImageFormatQualifier(m_format);
2896 const string shaderImageTypeStr = getShaderImageType(m_format.type, m_imageType);
2897 const string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
2899 const glu::ShaderProgram program(renderCtx,
2944 const deUint32 referenceOutput = m_imageType == TEXTURETYPE_BUFFER ? (deUint32)( m_imageSize.x())
2981 EarlyFragmentTestsCase (Context& context, const char* name, const char* description, TestType type, bool useEarlyTests, RenderTargetType renderTarget)
3019 static const int RENDER_SIZE;
3021 const TestType m_type;
3022 const bool m_useEarlyTests;
3023 const RenderTargetType m_renderTarget;
3026 const int EarlyFragmentTestsCase::RENDER_SIZE = 32;
3030 const RenderContext& renderCtx = m_context.getRenderContext();
3034 const bool expectPartialResult = m_useEarlyTests && m_renderTarget != RENDERTARGET_FBO_WITHOUT_TEST_ATTACHMENT;
3035 const int viewportWidth = RENDER_SIZE;
3036 const int viewportHeight = RENDER_SIZE;
3037 const int viewportX = (m_renderTarget == RENDERTARGET_DEFAULT) ? (rnd.getInt(0, renderCtx.getRenderTarget().getWidth() - viewportWidth)) : (0);
3038 const int viewportY = (m_renderTarget == RENDERTARGET_DEFAULT) ? (rnd.getInt(0, renderCtx.getRenderTarget().getHeight() - viewportHeight)) : (0);
3039 const glu::Texture texture (renderCtx);
3131 const std::string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
3135 const glu::ShaderProgram program(renderCtx,
3176 static const float vertexPositions[4*3] =
3184 static const deUint16 indices[6] = { 0, 1, 2, 2, 1, 3 };
3186 const glu::VertexArrayBinding attrBindings[] =
3208 const int numSamples = de::max(1, renderCtx.getRenderTarget().getNumSamples());
3209 const int expectedCounter = expectPartialResult ? viewportWidth*viewportHeight/2 : viewportWidth*viewportHeight;
3210 const int tolerance = expectPartialResult ? de::max(viewportWidth, viewportHeight)*3 : 0;
3211 const int expectedMin = de::max(0, expectedCounter - tolerance);
3212 const int expectedMax = (expectedCounter + tolerance) * numSamples;
3240 static const TextureType imageTypes[] =
3249 static const TextureFormat formats[] =
3272 const TextureType imageType = imageTypes[imageTypeNdx];
3273 TestCaseGroup* const imageTypeGroup = new TestCaseGroup(m_context, getTextureTypeName(imageType), "");
3276 TestCaseGroup* const storeGroup = new TestCaseGroup(m_context, "store", "Plain imageStore() cases");
3277 TestCaseGroup* const loadStoreGroup = new TestCaseGroup(m_context, "load_store", "Cases with imageLoad() followed by imageStore()");
3278 TestCaseGroup* const atomicGroup = new TestCaseGroup(m_context, "atomic", "Atomic image operation cases");
3279 TestCaseGroup* const qualifierGroup = new TestCaseGroup(m_context, "qualifiers", "Coherent, volatile and restrict");
3280 TestCaseGroup* const reinterpretGroup = new TestCaseGroup(m_context, "format_reinterpret", "Cases with differing texture and image formats");
3281 TestCaseGroup* const imageSizeGroup = new TestCaseGroup(m_context, "image_size", "imageSize() cases");
3291 const TextureFormat& format = formats[formatNdx];
3292 const string formatName = getShaderImageFormatQualifier(formats[formatNdx]);
3317 const AtomicOperation operation = (AtomicOperation)operationI;
3322 const AtomicOperationCaseType caseType = (AtomicOperationCaseType)atomicCaseTypeI;
3323 const string caseTypeName = caseType == ATOMIC_OPERATION_CASE_TYPE_END_RESULT ? "result"
3326 const string caseName = string() + getAtomicOperationCaseName(operation) + "_" + formatName + "_" + caseTypeName;
3339 const CoherenceCase::Qualifier coherenceQualifier = (CoherenceCase::Qualifier)coherenceQualifierI;
3340 const char* const coherenceQualifierName = coherenceQualifier == CoherenceCase::QUALIFIER_COHERENT ? "coherent"
3343 const string caseName = string() + coherenceQualifierName + "_" + formatName;
3358 const TextureFormat& texFmt = formats[texFmtNdx];
3359 const TextureFormat& imgFmt = formats[imgFmtNdx];
3373 static const IVec3 baseImageSizes[] =
3383 const ImageSizeCase::ImageAccess imageAccess = (ImageSizeCase::ImageAccess)imageAccessI;
3384 const char* const imageAccessStr = imageAccess == ImageSizeCase::IMAGEACCESS_READ_ONLY ? "readonly"
3391 const IVec3& baseSize = baseImageSizes[imageSizeNdx];
3392 const IVec3 imageSize = imageType == TEXTURETYPE_BUFFER ? IVec3(baseSize.x(), 1, 1)
3399 const string sizeStr = imageType == TEXTURETYPE_BUFFER ? toString(imageSize.x())
3406 const string caseName = string() + imageAccessStr + "_" + sizeStr;
3418 TestCaseGroup* const earlyTestsGroup = new TestCaseGroup(m_context, "early_fragment_tests", "");
3425 const EarlyFragmentTestsCase::RenderTargetType targetType = (EarlyFragmentTestsCase::RenderTargetType)testRenderTargetI;
3426 const bool useEarlyTests = useEarlyTestsI != 0;
3427 const EarlyFragmentTestsCase::TestType testType = (EarlyFragmentTestsCase::TestType)testTypeI;
3429 const string testTypeName = testType == EarlyFragmentTestsCase::TESTTYPE_DEPTH ? "depth"
3433 const string targetName = targetType == EarlyFragmentTestsCase::RENDERTARGET_FBO ? (std::string("_fbo"))
3437 const string caseName = string(useEarlyTests ? "" : "no_") + "early_fragment_tests_" + testTypeName + targetName;
3439 const string caseDesc = string(useEarlyTests ? "Specify" : "Don't specify")