1 #ifndef _VKTSPARSERESOURCESSHADERINTRINSICSSTORAGE_HPP
2 #define _VKTSPARSERESOURCESSHADERINTRINSICSSTORAGE_HPP
3 /*------------------------------------------------------------------------
4  * Vulkan Conformance Tests
5  * ------------------------
6  *
7  * Copyright (c) 2016 The Khronos Group Inc.
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  vktSparseResourcesShaderIntrinsicsStorage.hpp
23  * \brief Sparse Resources Shader Intrinsics for storage images
24  *//*--------------------------------------------------------------------*/
25 
26 #include "vktSparseResourcesShaderIntrinsicsBase.hpp"
27 
28 namespace vkt
29 {
30 namespace sparse
31 {
32 
33 class SparseShaderIntrinsicsCaseStorage : public SparseShaderIntrinsicsCaseBase
34 {
35 public:
SparseShaderIntrinsicsCaseStorage(tcu::TestContext & testCtx,const std::string & name,const SpirVFunction function,const ImageType imageType,const tcu::UVec3 & imageSize,const tcu::TextureFormat & format)36 	SparseShaderIntrinsicsCaseStorage		(tcu::TestContext&			testCtx,
37 											 const std::string&			name,
38 											 const SpirVFunction		function,
39 											 const ImageType			imageType,
40 											 const tcu::UVec3&			imageSize,
41 											 const tcu::TextureFormat&	format)
42 											 : SparseShaderIntrinsicsCaseBase (testCtx, name, function, imageType, imageSize, format) {}
43 
44 	void				initPrograms		(vk::SourceCollections&		programCollection) const;
45 
46 	virtual std::string	getSparseImageTypeName				(void) const = 0;
47 	virtual std::string	getUniformConstSparseImageTypeName	(void) const = 0;
48 
49 	virtual std::string	sparseImageOpString	(const std::string&			resultVariable,
50 											 const std::string&			resultType,
51 											 const std::string&			image,
52 											 const std::string&			coord,
53 											 const std::string&			mipLevel) const = 0;
54 };
55 
56 class SparseCaseOpImageSparseFetch : public SparseShaderIntrinsicsCaseStorage
57 {
58 public:
SparseCaseOpImageSparseFetch(tcu::TestContext & testCtx,const std::string & name,const SpirVFunction function,const ImageType imageType,const tcu::UVec3 & imageSize,const tcu::TextureFormat & format)59 	SparseCaseOpImageSparseFetch			(tcu::TestContext&			testCtx,
60 											 const std::string&			name,
61 											 const SpirVFunction		function,
62 											 const ImageType			imageType,
63 											 const tcu::UVec3&			imageSize,
64 											 const tcu::TextureFormat&	format)
65 											 : SparseShaderIntrinsicsCaseStorage (testCtx, name, function, imageType, imageSize, format) {}
66 
67 	TestInstance* createInstance			(Context& context) const;
68 
69 	std::string	getSparseImageTypeName				(void) const;
70 	std::string	getUniformConstSparseImageTypeName	(void) const;
71 
72 	std::string	sparseImageOpString			(const std::string&			resultVariable,
73 											 const std::string&			resultType,
74 											 const std::string&			image,
75 											 const std::string&			coord,
76 											 const std::string&			mipLevel) const;
77 };
78 
79 class SparseCaseOpImageSparseRead : public SparseShaderIntrinsicsCaseStorage
80 {
81 public:
SparseCaseOpImageSparseRead(tcu::TestContext & testCtx,const std::string & name,const SpirVFunction function,const ImageType imageType,const tcu::UVec3 & imageSize,const tcu::TextureFormat & format)82 	SparseCaseOpImageSparseRead				(tcu::TestContext&			testCtx,
83 											 const std::string&			name,
84 											 const SpirVFunction		function,
85 											 const ImageType			imageType,
86 											 const tcu::UVec3&			imageSize,
87 											 const tcu::TextureFormat&	format)
88 											 : SparseShaderIntrinsicsCaseStorage (testCtx, name, function, imageType, imageSize, format) {}
89 
90 	TestInstance* createInstance			(Context& context) const;
91 
92 	std::string	getSparseImageTypeName				(void) const;
93 	std::string	getUniformConstSparseImageTypeName	(void) const;
94 
95 	std::string	sparseImageOpString			(const std::string& resultVariable,
96 											 const std::string& resultType,
97 											 const std::string& image,
98 											 const std::string& coord,
99 											 const std::string& mipLevel) const;
100 };
101 
102 } // sparse
103 } // vkt
104 
105 #endif // _VKTSPARSERESOURCESSHADERINTRINSICSSTORAGE_HPP
106