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 vk::VkFormat format, const std::string& operand)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 vk::VkFormat		format,
42 											 const std::string&		operand)
43 		: SparseShaderIntrinsicsCaseBase (testCtx, name, function, imageType, imageSize, format, operand) {}
44 
45 	void				initPrograms		(vk::SourceCollections&	programCollection) const;
46 
47 	virtual std::string	sparseImageOpString	(const std::string&		resultVariable,
48 											 const std::string&		resultType,
49 											 const std::string&		image,
50 											 const std::string&		coord,
51 											 const std::string&		miplevel) const = 0;
52 };
53 
54 class SparseShaderIntrinsicsCaseSampledExplicit : public SparseShaderIntrinsicsCaseSampledBase
55 {
56 public:
SparseShaderIntrinsicsCaseSampledExplicit(tcu::TestContext& testCtx, const std::string& name, const SpirVFunction function, const ImageType imageType, const tcu::UVec3& imageSize, const vk::VkFormat format, const std::string& operand)57 	SparseShaderIntrinsicsCaseSampledExplicit	(tcu::TestContext&		testCtx,
58 												 const std::string&		name,
59 												 const SpirVFunction	function,
60 												 const ImageType		imageType,
61 												 const tcu::UVec3&		imageSize,
62 												 const vk::VkFormat		format,
63 												 const std::string&		operand)
64 		: SparseShaderIntrinsicsCaseSampledBase (testCtx, name, function, imageType, imageSize, format, operand) {}
65 
66 	TestInstance*	createInstance				(Context&				context) const;
67 };
68 
69 class SparseCaseOpImageSparseSampleExplicitLod : public SparseShaderIntrinsicsCaseSampledExplicit
70 {
71 public:
SparseCaseOpImageSparseSampleExplicitLod(tcu::TestContext& testCtx, const std::string& name, const SpirVFunction function, const ImageType imageType, const tcu::UVec3& imageSize, const vk::VkFormat format, const std::string& operand)72 	SparseCaseOpImageSparseSampleExplicitLod	(tcu::TestContext&		testCtx,
73 												 const std::string&		name,
74 												 const SpirVFunction	function,
75 												 const ImageType		imageType,
76 												 const tcu::UVec3&		imageSize,
77 												 const vk::VkFormat		format,
78 												 const std::string&		operand)
79 		: SparseShaderIntrinsicsCaseSampledExplicit (testCtx, name, function, imageType, imageSize, format, operand) {}
80 
81 	std::string	sparseImageOpString				(const std::string&		resultVariable,
82 												 const std::string&		resultType,
83 												 const std::string&		image,
84 												 const std::string&		coord,
85 												 const std::string&		miplevel) const;
86 };
87 
88 class SparseShaderIntrinsicsCaseSampledImplicit : public SparseShaderIntrinsicsCaseSampledBase
89 {
90 public:
SparseShaderIntrinsicsCaseSampledImplicit(tcu::TestContext& testCtx, const std::string& name, const SpirVFunction function, const ImageType imageType, const tcu::UVec3& imageSize, const vk::VkFormat format, const std::string& operand)91 	SparseShaderIntrinsicsCaseSampledImplicit	(tcu::TestContext&		testCtx,
92 												 const std::string&		name,
93 												 const SpirVFunction	function,
94 												 const ImageType		imageType,
95 												 const tcu::UVec3&		imageSize,
96 												 const vk::VkFormat		format,
97 												 const std::string&		operand)
98 		: SparseShaderIntrinsicsCaseSampledBase (testCtx, name, function, imageType, imageSize, format, operand) {}
99 
100 	TestInstance*	createInstance				(Context&				context) const;
101 };
102 
103 class SparseCaseOpImageSparseSampleImplicitLod : public SparseShaderIntrinsicsCaseSampledImplicit
104 {
105 public:
SparseCaseOpImageSparseSampleImplicitLod(tcu::TestContext& testCtx, const std::string& name, const SpirVFunction function, const ImageType imageType, const tcu::UVec3& imageSize, const vk::VkFormat format, const std::string& operand)106 	SparseCaseOpImageSparseSampleImplicitLod	(tcu::TestContext&		testCtx,
107 												 const std::string&		name,
108 												 const SpirVFunction	function,
109 												 const ImageType		imageType,
110 												 const tcu::UVec3&		imageSize,
111 												 const vk::VkFormat		format,
112 												 const std::string&		operand)
113 		: SparseShaderIntrinsicsCaseSampledImplicit (testCtx, name, function, imageType, imageSize, format, operand) {}
114 
115 	std::string	sparseImageOpString				(const std::string&		resultVariable,
116 												 const std::string&		resultType,
117 												 const std::string&		image,
118 												 const std::string&		coord,
119 												 const std::string&		miplevel) const;
120 };
121 
122 class SparseCaseOpImageSparseGather : public SparseShaderIntrinsicsCaseSampledImplicit
123 {
124 public:
SparseCaseOpImageSparseGather(tcu::TestContext& testCtx, const std::string& name, const SpirVFunction function, const ImageType imageType, const tcu::UVec3& imageSize, const vk::VkFormat format, const std::string& operand)125 	SparseCaseOpImageSparseGather		(tcu::TestContext&		testCtx,
126 										 const std::string&		name,
127 										 const SpirVFunction	function,
128 										 const ImageType		imageType,
129 										 const tcu::UVec3&		imageSize,
130 										 const vk::VkFormat		format,
131 										 const std::string&		operand)
132 		: SparseShaderIntrinsicsCaseSampledImplicit (testCtx, name, function, imageType, imageSize, format, operand) {}
133 
134 	std::string	sparseImageOpString		(const std::string&		resultVariable,
135 										 const std::string&		resultType,
136 										 const std::string&		image,
137 										 const std::string&		coord,
138 										 const std::string&		miplevel) const;
139 };
140 
141 } // sparse
142 } // vkt
143 
144 #endif // _VKTSPARSERESOURCESSHADERINTRINSICSSAMPLED_HPP
145