1 #ifndef _VKTSPARSERESOURCESSHADERINTRINSICSSAMPLED_HPP
2 #define _VKTSPARSERESOURCESSHADERINTRINSICSSAMPLED_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  vktSparseResourcesShaderIntrinsicsSampled.hpp
23  * \brief Sparse Resources Shader Intrinsics for sampled images
24  *//*--------------------------------------------------------------------*/
25 
26 #include "vktSparseResourcesShaderIntrinsicsBase.hpp"
27 
28 namespace vkt
29 {
30 namespace sparse
31 {
32 
33 class SparseShaderIntrinsicsCaseSampledBase : public SparseShaderIntrinsicsCaseBase
34 {
35 public:
SparseShaderIntrinsicsCaseSampledBase(tcu::TestContext & testCtx,const std::string & name,const SpirVFunction function,const ImageType imageType,const tcu::UVec3 & imageSize,const tcu::TextureFormat & format)36 	SparseShaderIntrinsicsCaseSampledBase		(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	sparseImageOpString		(const std::string&			resultVariable,
47 												 const std::string&			resultType,
48 												 const std::string&			image,
49 												 const std::string&			coord,
50 												 const std::string&			miplevel) const = 0;
51 };
52 
53 class SparseShaderIntrinsicsCaseSampledExplicit : public SparseShaderIntrinsicsCaseSampledBase
54 {
55 public:
SparseShaderIntrinsicsCaseSampledExplicit(tcu::TestContext & testCtx,const std::string & name,const SpirVFunction function,const ImageType imageType,const tcu::UVec3 & imageSize,const tcu::TextureFormat & format)56 	SparseShaderIntrinsicsCaseSampledExplicit	(tcu::TestContext&			testCtx,
57 												 const std::string&			name,
58 												 const SpirVFunction		function,
59 												 const ImageType			imageType,
60 												 const tcu::UVec3&			imageSize,
61 												 const tcu::TextureFormat&	format)
62 												 : SparseShaderIntrinsicsCaseSampledBase (testCtx, name, function, imageType, imageSize, format) {}
63 
64 	TestInstance*	createInstance				(Context&					context) const;
65 };
66 
67 class SparseCaseOpImageSparseSampleExplicitLod : public SparseShaderIntrinsicsCaseSampledExplicit
68 {
69 public:
SparseCaseOpImageSparseSampleExplicitLod(tcu::TestContext & testCtx,const std::string & name,const SpirVFunction function,const ImageType imageType,const tcu::UVec3 & imageSize,const tcu::TextureFormat & format)70 	SparseCaseOpImageSparseSampleExplicitLod	(tcu::TestContext&			testCtx,
71 												 const std::string&			name,
72 												 const SpirVFunction		function,
73 												 const ImageType			imageType,
74 												 const tcu::UVec3&			imageSize,
75 												 const tcu::TextureFormat&	format)
76 												 : SparseShaderIntrinsicsCaseSampledExplicit (testCtx, name, function, imageType, imageSize, format) {}
77 
78 	std::string	sparseImageOpString				(const std::string&			resultVariable,
79 												 const std::string&			resultType,
80 												 const std::string&			image,
81 												 const std::string&			coord,
82 												 const std::string&			miplevel) const;
83 };
84 
85 class SparseShaderIntrinsicsCaseSampledImplicit : public SparseShaderIntrinsicsCaseSampledBase
86 {
87 public:
SparseShaderIntrinsicsCaseSampledImplicit(tcu::TestContext & testCtx,const std::string & name,const SpirVFunction function,const ImageType imageType,const tcu::UVec3 & imageSize,const tcu::TextureFormat & format)88 	SparseShaderIntrinsicsCaseSampledImplicit	(tcu::TestContext&			testCtx,
89 												 const std::string&			name,
90 												 const SpirVFunction		function,
91 												 const ImageType			imageType,
92 												 const tcu::UVec3&			imageSize,
93 												 const tcu::TextureFormat&	format)
94 												 : SparseShaderIntrinsicsCaseSampledBase (testCtx, name, function, imageType, imageSize, format) {}
95 
96 	TestInstance*	createInstance				(Context&					context) const;
97 };
98 
99 class SparseCaseOpImageSparseSampleImplicitLod : public SparseShaderIntrinsicsCaseSampledImplicit
100 {
101 public:
SparseCaseOpImageSparseSampleImplicitLod(tcu::TestContext & testCtx,const std::string & name,const SpirVFunction function,const ImageType imageType,const tcu::UVec3 & imageSize,const tcu::TextureFormat & format)102 	SparseCaseOpImageSparseSampleImplicitLod	(tcu::TestContext&			testCtx,
103 												 const std::string&			name,
104 												 const SpirVFunction		function,
105 												 const ImageType			imageType,
106 												 const tcu::UVec3&			imageSize,
107 												 const tcu::TextureFormat&	format)
108 												 : SparseShaderIntrinsicsCaseSampledImplicit (testCtx, name, function, imageType, imageSize, format) {}
109 
110 	std::string	sparseImageOpString				(const std::string&			resultVariable,
111 												 const std::string&			resultType,
112 												 const std::string&			image,
113 												 const std::string&			coord,
114 												 const std::string&			miplevel) const;
115 };
116 
117 class SparseCaseOpImageSparseGather : public SparseShaderIntrinsicsCaseSampledImplicit
118 {
119 public:
SparseCaseOpImageSparseGather(tcu::TestContext & testCtx,const std::string & name,const SpirVFunction function,const ImageType imageType,const tcu::UVec3 & imageSize,const tcu::TextureFormat & format)120 	SparseCaseOpImageSparseGather				(tcu::TestContext&			testCtx,
121 												 const std::string&			name,
122 												 const SpirVFunction		function,
123 												 const ImageType			imageType,
124 												 const tcu::UVec3&			imageSize,
125 												 const tcu::TextureFormat&	format)
126 												 : SparseShaderIntrinsicsCaseSampledImplicit (testCtx, name, function, imageType, imageSize, format) {}
127 
128 	std::string	sparseImageOpString				(const std::string&			resultVariable,
129 												 const std::string&			resultType,
130 												 const std::string&			image,
131 												 const std::string&			coord,
132 												 const std::string&			miplevel) const;
133 };
134 
135 } // sparse
136 } // vkt
137 
138 #endif // _VKTSPARSERESOURCESSHADERINTRINSICSSAMPLED_HPP
139