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"
40 namespace texture_filtering
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 std::vector<tcu::ConstPixelBufferAccess>& pba);
132 bool verifySample (const SampleArguments& args,
133 const tcu::Vec4& result) const;
135 bool verifySampleReport (const SampleArguments& args,
136 const tcu::Vec4& result,
137 std::string& report) const;
141 bool verifySampleFiltered (const tcu::Vec4& result,
142 const tcu::IVec3& baseTexelHi,
143 const tcu::IVec3& baseTexelLo,
144 const tcu::IVec3& texelGridOffsetHi,
145 const tcu::IVec3& texelGridOffsetLo,
148 const tcu::Vec2& lodFracBounds,
150 vk::VkSamplerMipmapMode mipmapFilter,
151 std::ostream& report) const;
153 bool verifySampleTexelGridCoords (const SampleArguments& args,
154 const tcu::Vec4& result,
155 const tcu::IVec3& gridCoordHi,
156 const tcu::IVec3& gridCoordLo,
157 const tcu::Vec2& lodBounds,
159 vk::VkSamplerMipmapMode mipmapFilter,
160 std::ostream& report) const;
162 bool verifySampleMipmapLevel (const SampleArguments& args,
163 const tcu::Vec4& result,
164 const tcu::Vec4& coord,
165 const tcu::Vec2& lodFracBounds,
167 std::ostream& report) const;
169 bool verifySampleCubemapFace (const SampleArguments& args,
170 const tcu::Vec4& result,
171 const tcu::Vec4& coord,
172 const tcu::Vec4& dPdx,
173 const tcu::Vec4& dPdy,
175 std::ostream& report) const;
177 bool verifySampleImpl (const SampleArguments& args,
178 const tcu::Vec4& result,
179 std::ostream& report) const;
181 bool coordOutOfRange (const tcu::IVec3& coord,
185 void fetchTexel (const tcu::IVec3& coordIn,
189 tcu::Vec4& resultMin,
190 tcu::Vec4& resultMax) const;
192 void fetchTexelWrapped (const tcu::IVec3& coord,
195 tcu::Vec4& resultMin,
196 tcu::Vec4& resultMax) const;
198 void getFilteredSample1D (const tcu::IVec3& texelBase,
202 tcu::Vec4& resultMin,
203 tcu::Vec4& resultMax) const;
205 void getFilteredSample2D (const tcu::IVec3& texelBase,
206 const tcu::Vec2& weights,
209 tcu::Vec4& resultMin,
210 tcu::Vec4& resultMax) const;
212 void getFilteredSample3D (const tcu::IVec3& texelBase,
213 const tcu::Vec3& weights,
216 tcu::Vec4& resultMin,
217 tcu::Vec4& resultMax) const;
219 void getFilteredSample (const tcu::IVec3& texelBase,
220 const tcu::Vec3& weights,
223 tcu::Vec4& resultMin,
224 tcu::Vec4& resultMax) const;
226 void getMipmapStepBounds (const tcu::Vec2& lodFracBounds,
228 deInt32& stepMax) const;
230 const tcu::FloatFormat m_internalFormat;
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;
239 const int m_unnormalizedDim;
241 const std::vector<tcu::ConstPixelBufferAccess>& m_pba;
244 } // texture_filtering
247 #endif // _VKTSAMPLEVERIFIER_HPP