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