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 "tcuTexture.hpp"
31 #include "tcuVector.hpp"
39 namespace texture_filtering
42 struct SampleArguments
55 LOOKUP_LOD_MODE_DERIVATIVES = 0,
61 struct SampleLookupSettings
63 LookupLodMode lookupLodMode;
70 WRAPPING_MODE_REPEAT = 0,
71 WRAPPING_MODE_MIRRORED_REPEAT,
72 WRAPPING_MODE_CLAMP_TO_EDGE,
73 WRAPPING_MODE_CLAMP_TO_BORDER,
74 WRAPPING_MODE_MIRROR_CLAMP_TO_EDGE,
79 struct SamplerParameters
81 vk::VkFilter magFilter;
82 vk::VkFilter minFilter;
83 vk::VkSamplerMipmapMode mipmapFilter;
85 vk::VkSamplerAddressMode wrappingModeU;
86 vk::VkSamplerAddressMode wrappingModeV;
87 vk::VkSamplerAddressMode wrappingModeW;
89 vk::VkBorderColor borderColor;
110 struct ImageViewParameters
118 deUint32 arrayLayers;
124 SampleVerifier (const ImageViewParameters& imParams,
125 const SamplerParameters& samplerParams,
126 const SampleLookupSettings& sampleLookupSettings,
129 const std::vector<tcu::ConstPixelBufferAccess>& pba);
131 bool verifySample (const SampleArguments& args,
132 const tcu::Vec4& result) const;
134 bool verifySampleReport (const SampleArguments& args,
135 const tcu::Vec4& result,
136 std::string& report) const;
139 bool verifySampleMipmapLinear (tcu::Vec4 result,
145 deUint8 levelHi) const;
147 bool verifySampleFiltered (const tcu::Vec4& result,
148 const tcu::Vec3& unnormalizedCoordHi,
149 const tcu::Vec3& unnormalizedCoordLo,
152 const tcu::Vec2& lodFracBounds,
154 vk::VkSamplerMipmapMode mipmapFilter,
155 std::ostream& report) const;
157 bool verifySampleUnnormalizedCoords (const SampleArguments& args,
158 const tcu::Vec4& result,
159 const tcu::Vec3& unnormalizedCoord,
160 const tcu::Vec3& unnormalizedCoordLo,
161 const tcu::Vec2& lodBounds,
163 vk::VkSamplerMipmapMode mipmapFilter,
164 std::ostream& report) const;
166 bool verifySampleMipmapLevel (const SampleArguments& args,
167 const tcu::Vec4& result,
168 const tcu::Vec4& coord,
169 const tcu::Vec2& lodFracBounds,
171 std::ostream& report) const;
173 bool verifySampleCubemapFace (const SampleArguments& args,
174 const tcu::Vec4& result,
175 const tcu::Vec4& coord,
176 const tcu::Vec4& dPdx,
177 const tcu::Vec4& dPdy,
179 std::ostream& report) const;
181 bool verifySampleImpl (const SampleArguments& args,
182 const tcu::Vec4& result,
183 std::ostream& report) const;
185 bool coordOutOfRange (const tcu::IVec3& coord,
189 tcu::Vec4 fetchTexel (const tcu::IVec3& coordIn,
192 vk::VkFilter filter) const;
194 tcu::Vec4 getFilteredSample1D (const tcu::IVec3& texelBase,
197 deUint8 level) const;
199 tcu::Vec4 getFilteredSample2D (const tcu::IVec3& texelBase,
200 const tcu::Vec2& weights,
202 deUint8 level) const;
204 tcu::Vec4 getFilteredSample3D (const tcu::IVec3& texelBase,
205 const tcu::Vec3& weights,
207 deUint8 level) const;
209 tcu::Vec4 getFilteredSample (const tcu::IVec3& texelBase,
210 const tcu::Vec3& weights,
212 deUint8 level) const;
214 void getWeightStepBounds (const tcu::Vec3& unnormalizedCoord,
215 tcu::IVec3& weightStepMin,
216 tcu::IVec3& weightStepMax,
217 tcu::IVec3& texelBase) const;
219 void getMipmapStepBounds (const tcu::Vec2& lodFracBounds,
221 deInt32& stepMax) const;
223 const ImageViewParameters& m_imParams;
224 const SamplerParameters& m_samplerParams;
225 const SampleLookupSettings& m_sampleLookupSettings;
230 int m_unnormalizedDim;
232 const std::vector<tcu::ConstPixelBufferAccess>& m_pba;
235 } // texture_filtering
238 #endif // _VKTSAMPLEVERIFIER_HPP