1 #ifndef _VKTSAMPLEVERIFIER_HPP
2 #define _VKTSAMPLEVERIFIER_HPP
3 /*-------------------------------------------------------------------------
4 * Vulkan Conformance Tests
5 * ------------------------
7 * Copyright (c) 2016 Google Inc.
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 * \brief GPU image sample verification
24 *//*--------------------------------------------------------------------*/
28 #include "deUniquePtr.hpp"
30 #include "tcuFloatFormat.hpp"
31 #include "tcuTexture.hpp"
32 #include "tcuVector.hpp"
43 struct SampleArguments
56 LOOKUP_LOD_MODE_DERIVATIVES = 0,
62 struct SampleLookupSettings
64 LookupLodMode lookupLodMode;
71 WRAPPING_MODE_REPEAT = 0,
72 WRAPPING_MODE_MIRRORED_REPEAT,
73 WRAPPING_MODE_CLAMP_TO_EDGE,
74 WRAPPING_MODE_CLAMP_TO_BORDER,
75 WRAPPING_MODE_MIRROR_CLAMP_TO_EDGE,
80 struct SamplerParameters
82 vk::VkFilter magFilter;
83 vk::VkFilter minFilter;
84 vk::VkSamplerMipmapMode mipmapFilter;
86 vk::VkSamplerAddressMode wrappingModeU;
87 vk::VkSamplerAddressMode wrappingModeV;
88 vk::VkSamplerAddressMode wrappingModeW;
90 vk::VkBorderColor borderColor;
111 struct ImageViewParameters
125 SampleVerifier (const ImageViewParameters& imParams,
126 const SamplerParameters& samplerParams,
127 const SampleLookupSettings& sampleLookupSettings,
130 const tcu::FloatFormat& conversionPrecision,
131 const tcu::FloatFormat& filteringPrecision,
132 const std::vector<tcu::ConstPixelBufferAccess>& levels);
134 bool verifySample (const SampleArguments& args,
135 const tcu::Vec4& result) const;
137 bool verifySampleReport (const SampleArguments& args,
138 const tcu::Vec4& result,
139 std::string& report) const;
143 bool verifySampleFiltered (const tcu::Vec4& result,
144 const tcu::IVec3& baseTexelHi,
145 const tcu::IVec3& baseTexelLo,
146 const tcu::IVec3& texelGridOffsetHi,
147 const tcu::IVec3& texelGridOffsetLo,
150 const tcu::Vec2& lodFracBounds,
152 vk::VkSamplerMipmapMode mipmapFilter,
153 std::ostream& report) const;
155 bool verifySampleTexelGridCoords (const SampleArguments& args,
156 const tcu::Vec4& result,
157 const tcu::IVec3& gridCoordHi,
158 const tcu::IVec3& gridCoordLo,
159 const tcu::Vec2& lodBounds,
161 vk::VkSamplerMipmapMode mipmapFilter,
162 std::ostream& report) const;
164 bool verifySampleMipmapLevel (const SampleArguments& args,
165 const tcu::Vec4& result,
166 const tcu::Vec4& coord,
167 const tcu::Vec2& lodFracBounds,
169 std::ostream& report) const;
171 bool verifySampleCubemapFace (const SampleArguments& args,
172 const tcu::Vec4& result,
173 const tcu::Vec4& coord,
174 const tcu::Vec4& dPdx,
175 const tcu::Vec4& dPdy,
177 std::ostream& report) const;
179 bool verifySampleImpl (const SampleArguments& args,
180 const tcu::Vec4& result,
181 std::ostream& report) const;
183 bool coordOutOfRange (const tcu::IVec3& coord,
187 void fetchTexel (const tcu::IVec3& coordIn,
191 tcu::Vec4& resultMin,
192 tcu::Vec4& resultMax) const;
194 void fetchTexelWrapped (const tcu::IVec3& coord,
197 tcu::Vec4& resultMin,
198 tcu::Vec4& resultMax) const;
200 void getFilteredSample1D (const tcu::IVec3& texelBase,
204 tcu::Vec4& resultMin,
205 tcu::Vec4& resultMax) const;
207 void getFilteredSample2D (const tcu::IVec3& texelBase,
208 const tcu::Vec2& weights,
211 tcu::Vec4& resultMin,
212 tcu::Vec4& resultMax) const;
214 void getFilteredSample3D (const tcu::IVec3& texelBase,
215 const tcu::Vec3& weights,
218 tcu::Vec4& resultMin,
219 tcu::Vec4& resultMax) const;
221 void getFilteredSample (const tcu::IVec3& texelBase,
222 const tcu::Vec3& weights,
225 tcu::Vec4& resultMin,
226 tcu::Vec4& resultMax) const;
228 void getMipmapStepBounds (const tcu::Vec2& lodFracBounds,
230 deInt32& stepMax) const;
232 const ImageViewParameters& m_imParams;
233 const SamplerParameters& m_samplerParams;
234 const SampleLookupSettings& m_sampleLookupSettings;
236 const int m_coordBits;
237 const int m_mipmapBits;
238 const tcu::FloatFormat m_conversionPrecision;
239 const tcu::FloatFormat m_filteringPrecision;
241 const int m_unnormalizedDim;
243 const std::vector<tcu::ConstPixelBufferAccess>& m_levels;
249 #endif // _VKTSAMPLEVERIFIER_HPP