xref: /aosp_15_r20/external/deqp/external/vulkancts/modules/vulkan/image/vktImageAtomicSpirvShaders.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 #ifndef _VKTIMAGEATOMICSPIRVSHADERS_HPP
2 #define _VKTIMAGEATOMICSPIRVSHADERS_HPP
3 /*------------------------------------------------------------------------
4  * Vulkan Conformance Tests
5  * ------------------------
6  *
7  * Copyright (c) 2020 Valve Corporation.
8  * Copyright (c) 2020 The Khronos Group Inc.
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  *      http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  *//*!
23  * \file
24  * \brief Helper SPIR-V shaders for some image atomic operations.
25  *//*--------------------------------------------------------------------*/
26 #include "vktImageTestsUtil.hpp"
27 
28 #include <string>
29 
30 namespace vkt
31 {
32 namespace image
33 {
34 
35 // Test case variant, used when deciding which SPIR-V shader to get.
36 struct CaseVariant
37 {
38     enum CheckType
39     {
40         CHECK_TYPE_INTERMEDIATE_RESULTS = 0,
41         CHECK_TYPE_END_RESULTS,
42     };
43 
44     ImageType imageType;
45     tcu::TextureFormat textureFormat;
46     CheckType checkType;
47 
48     // Allows this struct to be used as key in maps.
49     bool operator<(const CaseVariant &other) const;
50 
51     // Constructor.
52     CaseVariant(ImageType imgtype, tcu::TextureFormat::ChannelOrder order, tcu::TextureFormat::ChannelType chtype,
53                 CheckType cktype);
54 };
55 
56 // Gets the shader template for the appropriate case variant.
57 std::string getSpirvAtomicOpShader(const CaseVariant &caseVariant);
58 
59 } // namespace image
60 } // namespace vkt
61 
62 #endif // _VKTIMAGEATOMICSPIRVSHADERS_HPP
63