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 vk::VkFormat format, const std::string& operand)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 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	getSparseImageTypeName				(void) const = 0;
48 	virtual std::string	getUniformConstSparseImageTypeName	(void) const = 0;
49 
50 	virtual std::string	sparseImageOpString					(const std::string&		resultVariable,
51 															 const std::string&		resultType,
52 															 const std::string&		image,
53 															 const std::string&		coord,
54 															 const std::string&		mipLevel) const = 0;
55 };
56 
57 class SparseCaseOpImageSparseFetch : public SparseShaderIntrinsicsCaseStorage
58 {
59 public:
SparseCaseOpImageSparseFetch(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)60 	SparseCaseOpImageSparseFetch						(tcu::TestContext&		testCtx,
61 														 const std::string&		name,
62 														 const SpirVFunction	function,
63 														 const ImageType		imageType,
64 														 const tcu::UVec3&		imageSize,
65 														 const vk::VkFormat		format,
66 														 const std::string&		operand)
67 		: SparseShaderIntrinsicsCaseStorage (testCtx, name, function, imageType, imageSize, format, operand) {}
68 
69 	TestInstance*	createInstance						(Context&				context) const;
70 
71 	std::string		getSparseImageTypeName				(void) const;
72 	std::string		getUniformConstSparseImageTypeName	(void) const;
73 
74 	std::string		sparseImageOpString					(const std::string&		resultVariable,
75 														 const std::string&		resultType,
76 														 const std::string&		image,
77 														 const std::string&		coord,
78 														 const std::string&		mipLevel) const;
79 };
80 
81 class SparseCaseOpImageSparseRead : public SparseShaderIntrinsicsCaseStorage
82 {
83 public:
SparseCaseOpImageSparseRead(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)84 	SparseCaseOpImageSparseRead							(tcu::TestContext&		testCtx,
85 														 const std::string&		name,
86 														 const SpirVFunction	function,
87 														 const ImageType		imageType,
88 														 const tcu::UVec3&		imageSize,
89 														 const vk::VkFormat		format,
90 														 const std::string&		operand)
91 		: SparseShaderIntrinsicsCaseStorage (testCtx, name, function, imageType, imageSize, format, operand) {}
92 
93 	TestInstance*	createInstance						(Context&				context) const;
94 
95 	std::string		getSparseImageTypeName				(void) const;
96 	std::string		getUniformConstSparseImageTypeName	(void) const;
97 
98 	std::string		sparseImageOpString					(const std::string&		resultVariable,
99 														 const std::string&		resultType,
100 														 const std::string&		image,
101 														 const std::string&		coord,
102 														 const std::string&		mipLevel) const;
103 };
104 
105 } // sparse
106 } // vkt
107 
108 #endif // _VKTSPARSERESOURCESSHADERINTRINSICSSTORAGE_HPP
109