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, const std::string &name, const SpirVFunction function,
37                                       const ImageType imageType, const tcu::UVec3 &imageSize, const vk::VkFormat format,
38                                       const std::string &operand)
39         : SparseShaderIntrinsicsCaseBase(testCtx, name, function, imageType, imageSize, format, operand)
40     {
41     }
42 
43     void initPrograms(vk::SourceCollections &programCollection) const;
44 
45     virtual std::string getSparseImageTypeName(void) const             = 0;
46     virtual std::string getUniformConstSparseImageTypeName(void) const = 0;
47 
48     virtual std::string sparseImageOpString(const std::string &resultVariable, const std::string &resultType,
49                                             const std::string &image, const std::string &coord,
50                                             const std::string &mipLevel) const = 0;
51 };
52 
53 class SparseCaseOpImageSparseFetch : public SparseShaderIntrinsicsCaseStorage
54 {
55 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)56     SparseCaseOpImageSparseFetch(tcu::TestContext &testCtx, const std::string &name, const SpirVFunction function,
57                                  const ImageType imageType, const tcu::UVec3 &imageSize, const vk::VkFormat format,
58                                  const std::string &operand)
59         : SparseShaderIntrinsicsCaseStorage(testCtx, name, function, imageType, imageSize, format, operand)
60     {
61     }
62 
63     TestInstance *createInstance(Context &context) const;
64 
65     std::string getSparseImageTypeName(void) const;
66     std::string getUniformConstSparseImageTypeName(void) const;
67 
68     std::string sparseImageOpString(const std::string &resultVariable, const std::string &resultType,
69                                     const std::string &image, const std::string &coord,
70                                     const std::string &mipLevel) const;
71 };
72 
73 class SparseCaseOpImageSparseRead : public SparseShaderIntrinsicsCaseStorage
74 {
75 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)76     SparseCaseOpImageSparseRead(tcu::TestContext &testCtx, const std::string &name, const SpirVFunction function,
77                                 const ImageType imageType, const tcu::UVec3 &imageSize, const vk::VkFormat format,
78                                 const std::string &operand)
79         : SparseShaderIntrinsicsCaseStorage(testCtx, name, function, imageType, imageSize, format, operand)
80     {
81     }
82 
83     TestInstance *createInstance(Context &context) const;
84 
85     std::string getSparseImageTypeName(void) const;
86     std::string getUniformConstSparseImageTypeName(void) const;
87 
88     std::string sparseImageOpString(const std::string &resultVariable, const std::string &resultType,
89                                     const std::string &image, const std::string &coord,
90                                     const std::string &mipLevel) const;
91 };
92 
93 } // namespace sparse
94 } // namespace vkt
95 
96 #endif // _VKTSPARSERESOURCESSHADERINTRINSICSSTORAGE_HPP
97