1*35238bceSAndroid Build Coastguard Worker #ifndef _TCUTEXTURE_HPP
2*35238bceSAndroid Build Coastguard Worker #define _TCUTEXTURE_HPP
3*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program Tester Core
5*35238bceSAndroid Build Coastguard Worker * ----------------------------------------
6*35238bceSAndroid Build Coastguard Worker *
7*35238bceSAndroid Build Coastguard Worker * Copyright 2014 The Android Open Source Project
8*35238bceSAndroid Build Coastguard Worker *
9*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
10*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
11*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at
12*35238bceSAndroid Build Coastguard Worker *
13*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
14*35238bceSAndroid Build Coastguard Worker *
15*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
16*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
17*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
19*35238bceSAndroid Build Coastguard Worker * limitations under the License.
20*35238bceSAndroid Build Coastguard Worker *
21*35238bceSAndroid Build Coastguard Worker *//*!
22*35238bceSAndroid Build Coastguard Worker * \file
23*35238bceSAndroid Build Coastguard Worker * \brief Reference Texture Implementation.
24*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
25*35238bceSAndroid Build Coastguard Worker
26*35238bceSAndroid Build Coastguard Worker #include "tcuDefs.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "tcuVector.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "rrGenericVector.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "deArrayBuffer.hpp"
30*35238bceSAndroid Build Coastguard Worker
31*35238bceSAndroid Build Coastguard Worker #include <vector>
32*35238bceSAndroid Build Coastguard Worker #include <ostream>
33*35238bceSAndroid Build Coastguard Worker
34*35238bceSAndroid Build Coastguard Worker namespace tcu
35*35238bceSAndroid Build Coastguard Worker {
36*35238bceSAndroid Build Coastguard Worker
37*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
38*35238bceSAndroid Build Coastguard Worker * \brief Texture format
39*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
40*35238bceSAndroid Build Coastguard Worker class TextureFormat
41*35238bceSAndroid Build Coastguard Worker {
42*35238bceSAndroid Build Coastguard Worker public:
43*35238bceSAndroid Build Coastguard Worker enum ChannelOrder
44*35238bceSAndroid Build Coastguard Worker {
45*35238bceSAndroid Build Coastguard Worker R = 0,
46*35238bceSAndroid Build Coastguard Worker A,
47*35238bceSAndroid Build Coastguard Worker I,
48*35238bceSAndroid Build Coastguard Worker L,
49*35238bceSAndroid Build Coastguard Worker LA,
50*35238bceSAndroid Build Coastguard Worker RG,
51*35238bceSAndroid Build Coastguard Worker RA,
52*35238bceSAndroid Build Coastguard Worker RGB,
53*35238bceSAndroid Build Coastguard Worker RGBA,
54*35238bceSAndroid Build Coastguard Worker ARGB,
55*35238bceSAndroid Build Coastguard Worker ABGR,
56*35238bceSAndroid Build Coastguard Worker BGR,
57*35238bceSAndroid Build Coastguard Worker BGRA,
58*35238bceSAndroid Build Coastguard Worker
59*35238bceSAndroid Build Coastguard Worker sR,
60*35238bceSAndroid Build Coastguard Worker sRG,
61*35238bceSAndroid Build Coastguard Worker sRGB,
62*35238bceSAndroid Build Coastguard Worker sRGBA,
63*35238bceSAndroid Build Coastguard Worker sBGR,
64*35238bceSAndroid Build Coastguard Worker sBGRA,
65*35238bceSAndroid Build Coastguard Worker
66*35238bceSAndroid Build Coastguard Worker D,
67*35238bceSAndroid Build Coastguard Worker S,
68*35238bceSAndroid Build Coastguard Worker DS,
69*35238bceSAndroid Build Coastguard Worker
70*35238bceSAndroid Build Coastguard Worker CHANNELORDER_LAST
71*35238bceSAndroid Build Coastguard Worker };
72*35238bceSAndroid Build Coastguard Worker
73*35238bceSAndroid Build Coastguard Worker enum ChannelType
74*35238bceSAndroid Build Coastguard Worker {
75*35238bceSAndroid Build Coastguard Worker SNORM_INT8 = 0,
76*35238bceSAndroid Build Coastguard Worker SNORM_INT16,
77*35238bceSAndroid Build Coastguard Worker SNORM_INT32,
78*35238bceSAndroid Build Coastguard Worker UNORM_INT8,
79*35238bceSAndroid Build Coastguard Worker UNORM_INT16,
80*35238bceSAndroid Build Coastguard Worker UNORM_INT24,
81*35238bceSAndroid Build Coastguard Worker UNORM_INT32,
82*35238bceSAndroid Build Coastguard Worker UNORM_BYTE_44,
83*35238bceSAndroid Build Coastguard Worker UNORM_SHORT_565,
84*35238bceSAndroid Build Coastguard Worker UNORM_SHORT_555,
85*35238bceSAndroid Build Coastguard Worker UNORM_SHORT_4444,
86*35238bceSAndroid Build Coastguard Worker UNORM_SHORT_5551,
87*35238bceSAndroid Build Coastguard Worker UNORM_SHORT_1555,
88*35238bceSAndroid Build Coastguard Worker UNORM_INT_101010,
89*35238bceSAndroid Build Coastguard Worker SNORM_INT_1010102_REV,
90*35238bceSAndroid Build Coastguard Worker UNORM_INT_1010102_REV,
91*35238bceSAndroid Build Coastguard Worker UNSIGNED_BYTE_44,
92*35238bceSAndroid Build Coastguard Worker UNSIGNED_SHORT_565,
93*35238bceSAndroid Build Coastguard Worker UNSIGNED_SHORT_4444,
94*35238bceSAndroid Build Coastguard Worker UNSIGNED_SHORT_5551,
95*35238bceSAndroid Build Coastguard Worker SIGNED_INT_1010102_REV,
96*35238bceSAndroid Build Coastguard Worker UNSIGNED_INT_1010102_REV,
97*35238bceSAndroid Build Coastguard Worker UNSIGNED_INT_11F_11F_10F_REV,
98*35238bceSAndroid Build Coastguard Worker UNSIGNED_INT_999_E5_REV,
99*35238bceSAndroid Build Coastguard Worker UNSIGNED_INT_16_8_8,
100*35238bceSAndroid Build Coastguard Worker UNSIGNED_INT_24_8,
101*35238bceSAndroid Build Coastguard Worker UNSIGNED_INT_24_8_REV,
102*35238bceSAndroid Build Coastguard Worker SIGNED_INT8,
103*35238bceSAndroid Build Coastguard Worker SIGNED_INT16,
104*35238bceSAndroid Build Coastguard Worker SIGNED_INT32,
105*35238bceSAndroid Build Coastguard Worker SIGNED_INT64,
106*35238bceSAndroid Build Coastguard Worker UNSIGNED_INT8,
107*35238bceSAndroid Build Coastguard Worker UNSIGNED_INT16,
108*35238bceSAndroid Build Coastguard Worker UNSIGNED_INT24,
109*35238bceSAndroid Build Coastguard Worker UNSIGNED_INT32,
110*35238bceSAndroid Build Coastguard Worker UNSIGNED_INT64,
111*35238bceSAndroid Build Coastguard Worker HALF_FLOAT,
112*35238bceSAndroid Build Coastguard Worker FLOAT,
113*35238bceSAndroid Build Coastguard Worker FLOAT64,
114*35238bceSAndroid Build Coastguard Worker FLOAT_UNSIGNED_INT_24_8_REV,
115*35238bceSAndroid Build Coastguard Worker
116*35238bceSAndroid Build Coastguard Worker UNORM_SHORT_10,
117*35238bceSAndroid Build Coastguard Worker UNORM_SHORT_12,
118*35238bceSAndroid Build Coastguard Worker
119*35238bceSAndroid Build Coastguard Worker USCALED_INT8,
120*35238bceSAndroid Build Coastguard Worker USCALED_INT16,
121*35238bceSAndroid Build Coastguard Worker SSCALED_INT8,
122*35238bceSAndroid Build Coastguard Worker SSCALED_INT16,
123*35238bceSAndroid Build Coastguard Worker USCALED_INT_1010102_REV,
124*35238bceSAndroid Build Coastguard Worker SSCALED_INT_1010102_REV,
125*35238bceSAndroid Build Coastguard Worker
126*35238bceSAndroid Build Coastguard Worker CHANNELTYPE_LAST
127*35238bceSAndroid Build Coastguard Worker };
128*35238bceSAndroid Build Coastguard Worker
129*35238bceSAndroid Build Coastguard Worker ChannelOrder order;
130*35238bceSAndroid Build Coastguard Worker ChannelType type;
131*35238bceSAndroid Build Coastguard Worker
TextureFormat(ChannelOrder order_,ChannelType type_)132*35238bceSAndroid Build Coastguard Worker TextureFormat(ChannelOrder order_, ChannelType type_) : order(order_), type(type_)
133*35238bceSAndroid Build Coastguard Worker {
134*35238bceSAndroid Build Coastguard Worker }
135*35238bceSAndroid Build Coastguard Worker
TextureFormat(void)136*35238bceSAndroid Build Coastguard Worker TextureFormat(void) : order(CHANNELORDER_LAST), type(CHANNELTYPE_LAST)
137*35238bceSAndroid Build Coastguard Worker {
138*35238bceSAndroid Build Coastguard Worker }
139*35238bceSAndroid Build Coastguard Worker
140*35238bceSAndroid Build Coastguard Worker int getPixelSize(void) const; //!< Deprecated, use tcu::getPixelSize(fmt)
141*35238bceSAndroid Build Coastguard Worker
operator ==(const TextureFormat & other) const142*35238bceSAndroid Build Coastguard Worker bool operator==(const TextureFormat &other) const
143*35238bceSAndroid Build Coastguard Worker {
144*35238bceSAndroid Build Coastguard Worker return !(*this != other);
145*35238bceSAndroid Build Coastguard Worker }
operator !=(const TextureFormat & other) const146*35238bceSAndroid Build Coastguard Worker bool operator!=(const TextureFormat &other) const
147*35238bceSAndroid Build Coastguard Worker {
148*35238bceSAndroid Build Coastguard Worker return (order != other.order || type != other.type);
149*35238bceSAndroid Build Coastguard Worker }
150*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
151*35238bceSAndroid Build Coastguard Worker
152*35238bceSAndroid Build Coastguard Worker bool isValid(TextureFormat format);
153*35238bceSAndroid Build Coastguard Worker int getPixelSize(TextureFormat format);
154*35238bceSAndroid Build Coastguard Worker int getNumUsedChannels(TextureFormat::ChannelOrder order);
155*35238bceSAndroid Build Coastguard Worker bool hasAlphaChannel(TextureFormat::ChannelOrder order);
156*35238bceSAndroid Build Coastguard Worker int getChannelSize(TextureFormat::ChannelType type);
157*35238bceSAndroid Build Coastguard Worker
158*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
159*35238bceSAndroid Build Coastguard Worker * \brief Texture swizzle
160*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
161*35238bceSAndroid Build Coastguard Worker struct TextureSwizzle
162*35238bceSAndroid Build Coastguard Worker {
163*35238bceSAndroid Build Coastguard Worker enum Channel
164*35238bceSAndroid Build Coastguard Worker {
165*35238bceSAndroid Build Coastguard Worker // \note CHANNEL_N must equal int N
166*35238bceSAndroid Build Coastguard Worker CHANNEL_0 = 0,
167*35238bceSAndroid Build Coastguard Worker CHANNEL_1,
168*35238bceSAndroid Build Coastguard Worker CHANNEL_2,
169*35238bceSAndroid Build Coastguard Worker CHANNEL_3,
170*35238bceSAndroid Build Coastguard Worker
171*35238bceSAndroid Build Coastguard Worker CHANNEL_ZERO,
172*35238bceSAndroid Build Coastguard Worker CHANNEL_ONE,
173*35238bceSAndroid Build Coastguard Worker
174*35238bceSAndroid Build Coastguard Worker CHANNEL_LAST
175*35238bceSAndroid Build Coastguard Worker };
176*35238bceSAndroid Build Coastguard Worker
177*35238bceSAndroid Build Coastguard Worker Channel components[4];
178*35238bceSAndroid Build Coastguard Worker };
179*35238bceSAndroid Build Coastguard Worker
180*35238bceSAndroid Build Coastguard Worker //! get the swizzle used to expand texture data with a given channel order to RGBA form
181*35238bceSAndroid Build Coastguard Worker const TextureSwizzle &getChannelReadSwizzle(TextureFormat::ChannelOrder order);
182*35238bceSAndroid Build Coastguard Worker
183*35238bceSAndroid Build Coastguard Worker //! get the swizzle used to narrow RGBA form data to native texture data with a given channel order
184*35238bceSAndroid Build Coastguard Worker const TextureSwizzle &getChannelWriteSwizzle(TextureFormat::ChannelOrder order);
185*35238bceSAndroid Build Coastguard Worker
186*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
187*35238bceSAndroid Build Coastguard Worker * \brief Sampling parameters
188*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
189*35238bceSAndroid Build Coastguard Worker class Sampler
190*35238bceSAndroid Build Coastguard Worker {
191*35238bceSAndroid Build Coastguard Worker public:
192*35238bceSAndroid Build Coastguard Worker enum WrapMode
193*35238bceSAndroid Build Coastguard Worker {
194*35238bceSAndroid Build Coastguard Worker CLAMP_TO_EDGE = 0, //! Clamp to edge
195*35238bceSAndroid Build Coastguard Worker CLAMP_TO_BORDER, //! Use border color at edge
196*35238bceSAndroid Build Coastguard Worker REPEAT_GL, //! Repeat with OpenGL semantics
197*35238bceSAndroid Build Coastguard Worker REPEAT_CL, //! Repeat with OpenCL semantics
198*35238bceSAndroid Build Coastguard Worker MIRRORED_REPEAT_GL, //! Mirrored repeat with OpenGL semantics
199*35238bceSAndroid Build Coastguard Worker MIRRORED_REPEAT_CL, //! Mirrored repeat with OpenCL semantics
200*35238bceSAndroid Build Coastguard Worker MIRRORED_ONCE, //! Mirrored once in negative directions
201*35238bceSAndroid Build Coastguard Worker
202*35238bceSAndroid Build Coastguard Worker WRAPMODE_LAST
203*35238bceSAndroid Build Coastguard Worker };
204*35238bceSAndroid Build Coastguard Worker
205*35238bceSAndroid Build Coastguard Worker enum FilterMode
206*35238bceSAndroid Build Coastguard Worker {
207*35238bceSAndroid Build Coastguard Worker NEAREST = 0,
208*35238bceSAndroid Build Coastguard Worker LINEAR,
209*35238bceSAndroid Build Coastguard Worker CUBIC,
210*35238bceSAndroid Build Coastguard Worker
211*35238bceSAndroid Build Coastguard Worker NEAREST_MIPMAP_NEAREST,
212*35238bceSAndroid Build Coastguard Worker NEAREST_MIPMAP_LINEAR,
213*35238bceSAndroid Build Coastguard Worker LINEAR_MIPMAP_NEAREST,
214*35238bceSAndroid Build Coastguard Worker LINEAR_MIPMAP_LINEAR,
215*35238bceSAndroid Build Coastguard Worker CUBIC_MIPMAP_NEAREST,
216*35238bceSAndroid Build Coastguard Worker CUBIC_MIPMAP_LINEAR,
217*35238bceSAndroid Build Coastguard Worker
218*35238bceSAndroid Build Coastguard Worker FILTERMODE_LAST
219*35238bceSAndroid Build Coastguard Worker };
220*35238bceSAndroid Build Coastguard Worker
221*35238bceSAndroid Build Coastguard Worker enum ReductionMode
222*35238bceSAndroid Build Coastguard Worker {
223*35238bceSAndroid Build Coastguard Worker WEIGHTED_AVERAGE = 0,
224*35238bceSAndroid Build Coastguard Worker MIN,
225*35238bceSAndroid Build Coastguard Worker MAX,
226*35238bceSAndroid Build Coastguard Worker
227*35238bceSAndroid Build Coastguard Worker REDUCTIONMODE_LAST
228*35238bceSAndroid Build Coastguard Worker };
229*35238bceSAndroid Build Coastguard Worker
230*35238bceSAndroid Build Coastguard Worker enum CompareMode
231*35238bceSAndroid Build Coastguard Worker {
232*35238bceSAndroid Build Coastguard Worker COMPAREMODE_NONE = 0,
233*35238bceSAndroid Build Coastguard Worker COMPAREMODE_LESS,
234*35238bceSAndroid Build Coastguard Worker COMPAREMODE_LESS_OR_EQUAL,
235*35238bceSAndroid Build Coastguard Worker COMPAREMODE_GREATER,
236*35238bceSAndroid Build Coastguard Worker COMPAREMODE_GREATER_OR_EQUAL,
237*35238bceSAndroid Build Coastguard Worker COMPAREMODE_EQUAL,
238*35238bceSAndroid Build Coastguard Worker COMPAREMODE_NOT_EQUAL,
239*35238bceSAndroid Build Coastguard Worker COMPAREMODE_ALWAYS,
240*35238bceSAndroid Build Coastguard Worker COMPAREMODE_NEVER,
241*35238bceSAndroid Build Coastguard Worker
242*35238bceSAndroid Build Coastguard Worker COMPAREMODE_LAST
243*35238bceSAndroid Build Coastguard Worker };
244*35238bceSAndroid Build Coastguard Worker
245*35238bceSAndroid Build Coastguard Worker enum DepthStencilMode
246*35238bceSAndroid Build Coastguard Worker {
247*35238bceSAndroid Build Coastguard Worker MODE_DEPTH = 0,
248*35238bceSAndroid Build Coastguard Worker MODE_STENCIL,
249*35238bceSAndroid Build Coastguard Worker
250*35238bceSAndroid Build Coastguard Worker MODE_LAST
251*35238bceSAndroid Build Coastguard Worker };
252*35238bceSAndroid Build Coastguard Worker
253*35238bceSAndroid Build Coastguard Worker // Wrap control
254*35238bceSAndroid Build Coastguard Worker WrapMode wrapS;
255*35238bceSAndroid Build Coastguard Worker WrapMode wrapT;
256*35238bceSAndroid Build Coastguard Worker WrapMode wrapR;
257*35238bceSAndroid Build Coastguard Worker
258*35238bceSAndroid Build Coastguard Worker // Minifcation & magnification
259*35238bceSAndroid Build Coastguard Worker FilterMode minFilter;
260*35238bceSAndroid Build Coastguard Worker FilterMode magFilter;
261*35238bceSAndroid Build Coastguard Worker
262*35238bceSAndroid Build Coastguard Worker // min/max filtering reduction
263*35238bceSAndroid Build Coastguard Worker ReductionMode reductionMode;
264*35238bceSAndroid Build Coastguard Worker
265*35238bceSAndroid Build Coastguard Worker float lodThreshold; // lod <= lodThreshold ? magnified : minified
266*35238bceSAndroid Build Coastguard Worker
267*35238bceSAndroid Build Coastguard Worker // Coordinate normalization
268*35238bceSAndroid Build Coastguard Worker bool normalizedCoords;
269*35238bceSAndroid Build Coastguard Worker
270*35238bceSAndroid Build Coastguard Worker // Shadow comparison
271*35238bceSAndroid Build Coastguard Worker CompareMode compare;
272*35238bceSAndroid Build Coastguard Worker int compareChannel;
273*35238bceSAndroid Build Coastguard Worker
274*35238bceSAndroid Build Coastguard Worker // Border color.
275*35238bceSAndroid Build Coastguard Worker // \note It is setter's responsibility to guarantee that the values are representable
276*35238bceSAndroid Build Coastguard Worker // in sampled texture's internal format.
277*35238bceSAndroid Build Coastguard Worker // \note It is setter's responsibility to guarantee that the format is compatible with the
278*35238bceSAndroid Build Coastguard Worker // sampled texture's internal format. Otherwise results are undefined.
279*35238bceSAndroid Build Coastguard Worker rr::GenericVec4 borderColor;
280*35238bceSAndroid Build Coastguard Worker
281*35238bceSAndroid Build Coastguard Worker // Seamless cube map filtering
282*35238bceSAndroid Build Coastguard Worker bool seamlessCubeMap;
283*35238bceSAndroid Build Coastguard Worker
284*35238bceSAndroid Build Coastguard Worker // Depth stencil mode
285*35238bceSAndroid Build Coastguard Worker DepthStencilMode depthStencilMode;
286*35238bceSAndroid Build Coastguard Worker
Sampler(WrapMode wrapS_,WrapMode wrapT_,WrapMode wrapR_,FilterMode minFilter_,FilterMode magFilter_,float lodThreshold_=0.0f,bool normalizedCoords_=true,CompareMode compare_=COMPAREMODE_NONE,int compareChannel_=0,const Vec4 & borderColor_=Vec4 (0.0f,0.0f,0.0f,0.0f),bool seamlessCubeMap_=false,DepthStencilMode depthStencilMode_=MODE_DEPTH,ReductionMode reductionMode_=WEIGHTED_AVERAGE)287*35238bceSAndroid Build Coastguard Worker Sampler(WrapMode wrapS_, WrapMode wrapT_, WrapMode wrapR_, FilterMode minFilter_, FilterMode magFilter_,
288*35238bceSAndroid Build Coastguard Worker float lodThreshold_ = 0.0f, bool normalizedCoords_ = true, CompareMode compare_ = COMPAREMODE_NONE,
289*35238bceSAndroid Build Coastguard Worker int compareChannel_ = 0, const Vec4 &borderColor_ = Vec4(0.0f, 0.0f, 0.0f, 0.0f),
290*35238bceSAndroid Build Coastguard Worker bool seamlessCubeMap_ = false, DepthStencilMode depthStencilMode_ = MODE_DEPTH,
291*35238bceSAndroid Build Coastguard Worker ReductionMode reductionMode_ = WEIGHTED_AVERAGE)
292*35238bceSAndroid Build Coastguard Worker : wrapS(wrapS_)
293*35238bceSAndroid Build Coastguard Worker , wrapT(wrapT_)
294*35238bceSAndroid Build Coastguard Worker , wrapR(wrapR_)
295*35238bceSAndroid Build Coastguard Worker , minFilter(minFilter_)
296*35238bceSAndroid Build Coastguard Worker , magFilter(magFilter_)
297*35238bceSAndroid Build Coastguard Worker , reductionMode(reductionMode_)
298*35238bceSAndroid Build Coastguard Worker , lodThreshold(lodThreshold_)
299*35238bceSAndroid Build Coastguard Worker , normalizedCoords(normalizedCoords_)
300*35238bceSAndroid Build Coastguard Worker , compare(compare_)
301*35238bceSAndroid Build Coastguard Worker , compareChannel(compareChannel_)
302*35238bceSAndroid Build Coastguard Worker , borderColor(borderColor_)
303*35238bceSAndroid Build Coastguard Worker , seamlessCubeMap(seamlessCubeMap_)
304*35238bceSAndroid Build Coastguard Worker , depthStencilMode(depthStencilMode_)
305*35238bceSAndroid Build Coastguard Worker {
306*35238bceSAndroid Build Coastguard Worker }
307*35238bceSAndroid Build Coastguard Worker
Sampler(void)308*35238bceSAndroid Build Coastguard Worker Sampler(void)
309*35238bceSAndroid Build Coastguard Worker : wrapS(WRAPMODE_LAST)
310*35238bceSAndroid Build Coastguard Worker , wrapT(WRAPMODE_LAST)
311*35238bceSAndroid Build Coastguard Worker , wrapR(WRAPMODE_LAST)
312*35238bceSAndroid Build Coastguard Worker , minFilter(FILTERMODE_LAST)
313*35238bceSAndroid Build Coastguard Worker , magFilter(FILTERMODE_LAST)
314*35238bceSAndroid Build Coastguard Worker , reductionMode(REDUCTIONMODE_LAST)
315*35238bceSAndroid Build Coastguard Worker , lodThreshold(0.0f)
316*35238bceSAndroid Build Coastguard Worker , normalizedCoords(true)
317*35238bceSAndroid Build Coastguard Worker , compare(COMPAREMODE_NONE)
318*35238bceSAndroid Build Coastguard Worker , compareChannel(0)
319*35238bceSAndroid Build Coastguard Worker , borderColor(Vec4(0.0f, 0.0f, 0.0f, 0.0f))
320*35238bceSAndroid Build Coastguard Worker , seamlessCubeMap(false)
321*35238bceSAndroid Build Coastguard Worker , depthStencilMode(MODE_DEPTH)
322*35238bceSAndroid Build Coastguard Worker {
323*35238bceSAndroid Build Coastguard Worker }
324*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
325*35238bceSAndroid Build Coastguard Worker
326*35238bceSAndroid Build Coastguard Worker // Calculate pitches for pixel data with no padding.
327*35238bceSAndroid Build Coastguard Worker IVec3 calculatePackedPitch(const TextureFormat &format, const IVec3 &size);
328*35238bceSAndroid Build Coastguard Worker
329*35238bceSAndroid Build Coastguard Worker bool isSamplerMipmapModeLinear(tcu::Sampler::FilterMode filterMode);
330*35238bceSAndroid Build Coastguard Worker
331*35238bceSAndroid Build Coastguard Worker class TextureLevel;
332*35238bceSAndroid Build Coastguard Worker
333*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
334*35238bceSAndroid Build Coastguard Worker * \brief Read-only pixel data access
335*35238bceSAndroid Build Coastguard Worker *
336*35238bceSAndroid Build Coastguard Worker * ConstPixelBufferAccess encapsulates pixel data pointer along with
337*35238bceSAndroid Build Coastguard Worker * format and layout information. It can be used for read-only access
338*35238bceSAndroid Build Coastguard Worker * to arbitrary pixel buffers.
339*35238bceSAndroid Build Coastguard Worker *
340*35238bceSAndroid Build Coastguard Worker * Access objects are like iterators or pointers. They can be passed around
341*35238bceSAndroid Build Coastguard Worker * as values and are valid as long as the storage doesn't change.
342*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
343*35238bceSAndroid Build Coastguard Worker class ConstPixelBufferAccess
344*35238bceSAndroid Build Coastguard Worker {
345*35238bceSAndroid Build Coastguard Worker public:
346*35238bceSAndroid Build Coastguard Worker ConstPixelBufferAccess(void);
347*35238bceSAndroid Build Coastguard Worker ConstPixelBufferAccess(const TextureLevel &level);
348*35238bceSAndroid Build Coastguard Worker ConstPixelBufferAccess(const TextureFormat &format, int width, int height, int depth, const void *data);
349*35238bceSAndroid Build Coastguard Worker ConstPixelBufferAccess(const TextureFormat &format, const IVec3 &size, const void *data);
350*35238bceSAndroid Build Coastguard Worker ConstPixelBufferAccess(const TextureFormat &format, int width, int height, int depth, int rowPitch, int slicePitch,
351*35238bceSAndroid Build Coastguard Worker const void *data);
352*35238bceSAndroid Build Coastguard Worker ConstPixelBufferAccess(const TextureFormat &format, const IVec3 &size, const IVec3 &pitch, const void *data);
353*35238bceSAndroid Build Coastguard Worker ConstPixelBufferAccess(const TextureFormat &format, const IVec3 &size, const IVec3 &pitch, const IVec3 ÷r,
354*35238bceSAndroid Build Coastguard Worker const void *data);
355*35238bceSAndroid Build Coastguard Worker
getFormat(void) const356*35238bceSAndroid Build Coastguard Worker const TextureFormat &getFormat(void) const
357*35238bceSAndroid Build Coastguard Worker {
358*35238bceSAndroid Build Coastguard Worker return m_format;
359*35238bceSAndroid Build Coastguard Worker }
getSize(void) const360*35238bceSAndroid Build Coastguard Worker const IVec3 &getSize(void) const
361*35238bceSAndroid Build Coastguard Worker {
362*35238bceSAndroid Build Coastguard Worker return m_size;
363*35238bceSAndroid Build Coastguard Worker }
getWidth(void) const364*35238bceSAndroid Build Coastguard Worker int getWidth(void) const
365*35238bceSAndroid Build Coastguard Worker {
366*35238bceSAndroid Build Coastguard Worker return m_size.x();
367*35238bceSAndroid Build Coastguard Worker }
getHeight(void) const368*35238bceSAndroid Build Coastguard Worker int getHeight(void) const
369*35238bceSAndroid Build Coastguard Worker {
370*35238bceSAndroid Build Coastguard Worker return m_size.y();
371*35238bceSAndroid Build Coastguard Worker }
getDepth(void) const372*35238bceSAndroid Build Coastguard Worker int getDepth(void) const
373*35238bceSAndroid Build Coastguard Worker {
374*35238bceSAndroid Build Coastguard Worker return m_size.z();
375*35238bceSAndroid Build Coastguard Worker }
getPixelPitch(void) const376*35238bceSAndroid Build Coastguard Worker int getPixelPitch(void) const
377*35238bceSAndroid Build Coastguard Worker {
378*35238bceSAndroid Build Coastguard Worker return m_pitch.x();
379*35238bceSAndroid Build Coastguard Worker }
getRowPitch(void) const380*35238bceSAndroid Build Coastguard Worker int getRowPitch(void) const
381*35238bceSAndroid Build Coastguard Worker {
382*35238bceSAndroid Build Coastguard Worker return m_pitch.y();
383*35238bceSAndroid Build Coastguard Worker }
getSlicePitch(void) const384*35238bceSAndroid Build Coastguard Worker int getSlicePitch(void) const
385*35238bceSAndroid Build Coastguard Worker {
386*35238bceSAndroid Build Coastguard Worker return m_pitch.z();
387*35238bceSAndroid Build Coastguard Worker }
getPitch(void) const388*35238bceSAndroid Build Coastguard Worker const IVec3 &getPitch(void) const
389*35238bceSAndroid Build Coastguard Worker {
390*35238bceSAndroid Build Coastguard Worker return m_pitch;
391*35238bceSAndroid Build Coastguard Worker }
getDivider(void) const392*35238bceSAndroid Build Coastguard Worker const IVec3 &getDivider(void) const
393*35238bceSAndroid Build Coastguard Worker {
394*35238bceSAndroid Build Coastguard Worker return m_divider;
395*35238bceSAndroid Build Coastguard Worker }
396*35238bceSAndroid Build Coastguard Worker
getDataPtr(void) const397*35238bceSAndroid Build Coastguard Worker const void *getDataPtr(void) const
398*35238bceSAndroid Build Coastguard Worker {
399*35238bceSAndroid Build Coastguard Worker return m_data;
400*35238bceSAndroid Build Coastguard Worker }
getPixelPtr(int x,int y,int z=0) const401*35238bceSAndroid Build Coastguard Worker const void *getPixelPtr(int x, int y, int z = 0) const
402*35238bceSAndroid Build Coastguard Worker {
403*35238bceSAndroid Build Coastguard Worker return (const uint8_t *)m_data + (x / m_divider.x()) * m_pitch.x() + (y / m_divider.y()) * m_pitch.y() +
404*35238bceSAndroid Build Coastguard Worker (z / m_divider.z()) * m_pitch.z();
405*35238bceSAndroid Build Coastguard Worker }
406*35238bceSAndroid Build Coastguard Worker
407*35238bceSAndroid Build Coastguard Worker Vec4 getPixel(int x, int y, int z = 0) const;
408*35238bceSAndroid Build Coastguard Worker IVec4 getPixelInt(int x, int y, int z = 0) const;
getPixelUint(int x,int y,int z=0) const409*35238bceSAndroid Build Coastguard Worker UVec4 getPixelUint(int x, int y, int z = 0) const
410*35238bceSAndroid Build Coastguard Worker {
411*35238bceSAndroid Build Coastguard Worker return getPixelInt(x, y, z).cast<uint32_t>();
412*35238bceSAndroid Build Coastguard Worker }
413*35238bceSAndroid Build Coastguard Worker I64Vec4 getPixelInt64(int x, int y, int z = 0) const;
getPixelUint64(int x,int y,int z=0) const414*35238bceSAndroid Build Coastguard Worker U64Vec4 getPixelUint64(int x, int y, int z = 0) const
415*35238bceSAndroid Build Coastguard Worker {
416*35238bceSAndroid Build Coastguard Worker return getPixelInt64(x, y, z).cast<uint64_t>();
417*35238bceSAndroid Build Coastguard Worker }
418*35238bceSAndroid Build Coastguard Worker U64Vec4 getPixelBitsAsUint64(int x, int y, int z = 0) const;
419*35238bceSAndroid Build Coastguard Worker
420*35238bceSAndroid Build Coastguard Worker template <typename T>
421*35238bceSAndroid Build Coastguard Worker Vector<T, 4> getPixelT(int x, int y, int z = 0) const;
422*35238bceSAndroid Build Coastguard Worker
423*35238bceSAndroid Build Coastguard Worker float getPixDepth(int x, int y, int z = 0) const;
424*35238bceSAndroid Build Coastguard Worker int getPixStencil(int x, int y, int z = 0) const;
425*35238bceSAndroid Build Coastguard Worker
426*35238bceSAndroid Build Coastguard Worker Vec4 sample1D(const Sampler &sampler, Sampler::FilterMode filter, float s, int level) const;
427*35238bceSAndroid Build Coastguard Worker Vec4 sample2D(const Sampler &sampler, Sampler::FilterMode filter, float s, float t, int depth) const;
428*35238bceSAndroid Build Coastguard Worker Vec4 sample3D(const Sampler &sampler, Sampler::FilterMode filter, float s, float t, float r) const;
429*35238bceSAndroid Build Coastguard Worker
430*35238bceSAndroid Build Coastguard Worker Vec4 sample1DOffset(const Sampler &sampler, Sampler::FilterMode filter, float s, const IVec2 &offset) const;
431*35238bceSAndroid Build Coastguard Worker Vec4 sample2DOffset(const Sampler &sampler, Sampler::FilterMode filter, float s, float t,
432*35238bceSAndroid Build Coastguard Worker const IVec3 &offset) const;
433*35238bceSAndroid Build Coastguard Worker Vec4 sample3DOffset(const Sampler &sampler, Sampler::FilterMode filter, float s, float t, float r,
434*35238bceSAndroid Build Coastguard Worker const IVec3 &offset) const;
435*35238bceSAndroid Build Coastguard Worker
436*35238bceSAndroid Build Coastguard Worker float sample1DCompare(const Sampler &sampler, Sampler::FilterMode filter, float ref, float s,
437*35238bceSAndroid Build Coastguard Worker const IVec2 &offset) const;
438*35238bceSAndroid Build Coastguard Worker float sample2DCompare(const Sampler &sampler, Sampler::FilterMode filter, float ref, float s, float t,
439*35238bceSAndroid Build Coastguard Worker const IVec3 &offset) const;
440*35238bceSAndroid Build Coastguard Worker
441*35238bceSAndroid Build Coastguard Worker protected:
442*35238bceSAndroid Build Coastguard Worker TextureFormat m_format;
443*35238bceSAndroid Build Coastguard Worker IVec3 m_size;
444*35238bceSAndroid Build Coastguard Worker IVec3 m_pitch; //!< (pixelPitch, rowPitch, slicePitch)
445*35238bceSAndroid Build Coastguard Worker IVec3 m_divider;
446*35238bceSAndroid Build Coastguard Worker mutable void *m_data;
447*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
448*35238bceSAndroid Build Coastguard Worker
449*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
450*35238bceSAndroid Build Coastguard Worker * \brief Read-write pixel data access
451*35238bceSAndroid Build Coastguard Worker *
452*35238bceSAndroid Build Coastguard Worker * This class extends read-only access object by providing write functionality.
453*35238bceSAndroid Build Coastguard Worker *
454*35238bceSAndroid Build Coastguard Worker * \note PixelBufferAccess may not have any data members nor add any
455*35238bceSAndroid Build Coastguard Worker * virtual functions. It must be possible to reinterpret_cast<>
456*35238bceSAndroid Build Coastguard Worker * PixelBufferAccess to ConstPixelBufferAccess.
457*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
458*35238bceSAndroid Build Coastguard Worker class PixelBufferAccess : public ConstPixelBufferAccess
459*35238bceSAndroid Build Coastguard Worker {
460*35238bceSAndroid Build Coastguard Worker public:
PixelBufferAccess(void)461*35238bceSAndroid Build Coastguard Worker PixelBufferAccess(void)
462*35238bceSAndroid Build Coastguard Worker {
463*35238bceSAndroid Build Coastguard Worker }
464*35238bceSAndroid Build Coastguard Worker PixelBufferAccess(TextureLevel &level);
465*35238bceSAndroid Build Coastguard Worker PixelBufferAccess(const TextureFormat &format, int width, int height, int depth, void *data);
466*35238bceSAndroid Build Coastguard Worker PixelBufferAccess(const TextureFormat &format, const IVec3 &size, void *data);
467*35238bceSAndroid Build Coastguard Worker PixelBufferAccess(const TextureFormat &format, int width, int height, int depth, int rowPitch, int slicePitch,
468*35238bceSAndroid Build Coastguard Worker void *data);
469*35238bceSAndroid Build Coastguard Worker PixelBufferAccess(const TextureFormat &format, const IVec3 &size, const IVec3 &pitch, void *data);
470*35238bceSAndroid Build Coastguard Worker PixelBufferAccess(const TextureFormat &format, const IVec3 &size, const IVec3 &pitch, const IVec3 &block,
471*35238bceSAndroid Build Coastguard Worker void *data);
472*35238bceSAndroid Build Coastguard Worker
getDataPtr(void) const473*35238bceSAndroid Build Coastguard Worker void *getDataPtr(void) const
474*35238bceSAndroid Build Coastguard Worker {
475*35238bceSAndroid Build Coastguard Worker return m_data;
476*35238bceSAndroid Build Coastguard Worker }
getPixelPtr(int x,int y,int z=0) const477*35238bceSAndroid Build Coastguard Worker void *getPixelPtr(int x, int y, int z = 0) const
478*35238bceSAndroid Build Coastguard Worker {
479*35238bceSAndroid Build Coastguard Worker return (uint8_t *)m_data + (x / m_divider.x()) * m_pitch.x() + (y / m_divider.y()) * m_pitch.y() +
480*35238bceSAndroid Build Coastguard Worker (z / m_divider.z()) * m_pitch.z();
481*35238bceSAndroid Build Coastguard Worker }
482*35238bceSAndroid Build Coastguard Worker
483*35238bceSAndroid Build Coastguard Worker void setPixel(const tcu::Vec4 &color, int x, int y, int z = 0) const;
484*35238bceSAndroid Build Coastguard Worker void setPixel(const tcu::IVec4 &color, int x, int y, int z = 0) const;
setPixel(const tcu::UVec4 & color,int x,int y,int z=0) const485*35238bceSAndroid Build Coastguard Worker void setPixel(const tcu::UVec4 &color, int x, int y, int z = 0) const
486*35238bceSAndroid Build Coastguard Worker {
487*35238bceSAndroid Build Coastguard Worker setPixel(color.cast<int>(), x, y, z);
488*35238bceSAndroid Build Coastguard Worker }
489*35238bceSAndroid Build Coastguard Worker
490*35238bceSAndroid Build Coastguard Worker void setPixDepth(float depth, int x, int y, int z = 0) const;
491*35238bceSAndroid Build Coastguard Worker void setPixStencil(int stencil, int x, int y, int z = 0) const;
492*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
493*35238bceSAndroid Build Coastguard Worker
494*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
495*35238bceSAndroid Build Coastguard Worker * \brief Generic pixel data container
496*35238bceSAndroid Build Coastguard Worker *
497*35238bceSAndroid Build Coastguard Worker * This container supports all valid TextureFormat combinations and
498*35238bceSAndroid Build Coastguard Worker * both 2D and 3D textures. To read or manipulate data access object must
499*35238bceSAndroid Build Coastguard Worker * be queried using getAccess().
500*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
501*35238bceSAndroid Build Coastguard Worker class TextureLevel
502*35238bceSAndroid Build Coastguard Worker {
503*35238bceSAndroid Build Coastguard Worker public:
504*35238bceSAndroid Build Coastguard Worker TextureLevel(void);
505*35238bceSAndroid Build Coastguard Worker TextureLevel(const TextureFormat &format);
506*35238bceSAndroid Build Coastguard Worker TextureLevel(const TextureFormat &format, int width, int height, int depth = 1);
507*35238bceSAndroid Build Coastguard Worker ~TextureLevel(void);
508*35238bceSAndroid Build Coastguard Worker
getSize(void) const509*35238bceSAndroid Build Coastguard Worker const IVec3 &getSize(void) const
510*35238bceSAndroid Build Coastguard Worker {
511*35238bceSAndroid Build Coastguard Worker return m_size;
512*35238bceSAndroid Build Coastguard Worker }
getWidth(void) const513*35238bceSAndroid Build Coastguard Worker int getWidth(void) const
514*35238bceSAndroid Build Coastguard Worker {
515*35238bceSAndroid Build Coastguard Worker return m_size.x();
516*35238bceSAndroid Build Coastguard Worker }
getHeight(void) const517*35238bceSAndroid Build Coastguard Worker int getHeight(void) const
518*35238bceSAndroid Build Coastguard Worker {
519*35238bceSAndroid Build Coastguard Worker return m_size.y();
520*35238bceSAndroid Build Coastguard Worker }
getDepth(void) const521*35238bceSAndroid Build Coastguard Worker int getDepth(void) const
522*35238bceSAndroid Build Coastguard Worker {
523*35238bceSAndroid Build Coastguard Worker return m_size.z();
524*35238bceSAndroid Build Coastguard Worker }
isEmpty(void) const525*35238bceSAndroid Build Coastguard Worker bool isEmpty(void) const
526*35238bceSAndroid Build Coastguard Worker {
527*35238bceSAndroid Build Coastguard Worker return m_size.x() * m_size.y() * m_size.z() == 0;
528*35238bceSAndroid Build Coastguard Worker }
getFormat(void) const529*35238bceSAndroid Build Coastguard Worker const TextureFormat getFormat(void) const
530*35238bceSAndroid Build Coastguard Worker {
531*35238bceSAndroid Build Coastguard Worker return m_format;
532*35238bceSAndroid Build Coastguard Worker }
533*35238bceSAndroid Build Coastguard Worker
534*35238bceSAndroid Build Coastguard Worker void setStorage(const TextureFormat &format, int width, int heigth, int depth = 1);
535*35238bceSAndroid Build Coastguard Worker void setSize(int width, int height, int depth = 1);
536*35238bceSAndroid Build Coastguard Worker
getAccess(void)537*35238bceSAndroid Build Coastguard Worker PixelBufferAccess getAccess(void)
538*35238bceSAndroid Build Coastguard Worker {
539*35238bceSAndroid Build Coastguard Worker return isEmpty() ? PixelBufferAccess() :
540*35238bceSAndroid Build Coastguard Worker PixelBufferAccess(m_format, m_size, calculatePackedPitch(m_format, m_size), getPtr());
541*35238bceSAndroid Build Coastguard Worker }
getAccess(void) const542*35238bceSAndroid Build Coastguard Worker ConstPixelBufferAccess getAccess(void) const
543*35238bceSAndroid Build Coastguard Worker {
544*35238bceSAndroid Build Coastguard Worker return isEmpty() ? ConstPixelBufferAccess() :
545*35238bceSAndroid Build Coastguard Worker ConstPixelBufferAccess(m_format, m_size, calculatePackedPitch(m_format, m_size), getPtr());
546*35238bceSAndroid Build Coastguard Worker }
547*35238bceSAndroid Build Coastguard Worker
548*35238bceSAndroid Build Coastguard Worker private:
getPtr(void)549*35238bceSAndroid Build Coastguard Worker void *getPtr(void)
550*35238bceSAndroid Build Coastguard Worker {
551*35238bceSAndroid Build Coastguard Worker return m_data.getPtr();
552*35238bceSAndroid Build Coastguard Worker }
getPtr(void) const553*35238bceSAndroid Build Coastguard Worker const void *getPtr(void) const
554*35238bceSAndroid Build Coastguard Worker {
555*35238bceSAndroid Build Coastguard Worker return m_data.getPtr();
556*35238bceSAndroid Build Coastguard Worker }
557*35238bceSAndroid Build Coastguard Worker
558*35238bceSAndroid Build Coastguard Worker TextureFormat m_format;
559*35238bceSAndroid Build Coastguard Worker IVec3 m_size;
560*35238bceSAndroid Build Coastguard Worker de::ArrayBuffer<uint8_t> m_data;
561*35238bceSAndroid Build Coastguard Worker
562*35238bceSAndroid Build Coastguard Worker friend class ConstPixelBufferAccess;
563*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
564*35238bceSAndroid Build Coastguard Worker
565*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
566*35238bceSAndroid Build Coastguard Worker * \brief VK_EXT_image_view_min_lod
567*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
568*35238bceSAndroid Build Coastguard Worker enum ImageViewMinLodMode
569*35238bceSAndroid Build Coastguard Worker {
570*35238bceSAndroid Build Coastguard Worker IMAGEVIEWMINLODMODE_PREFERRED, //!< use image view min lod as-is
571*35238bceSAndroid Build Coastguard Worker IMAGEVIEWMINLODMODE_ALTERNATIVE, //!< use floor of image view min lod, as in 'Image Level(s) Selection' in VK spec (v 1.3.206)
572*35238bceSAndroid Build Coastguard Worker };
573*35238bceSAndroid Build Coastguard Worker
574*35238bceSAndroid Build Coastguard Worker struct ImageViewMinLod
575*35238bceSAndroid Build Coastguard Worker {
576*35238bceSAndroid Build Coastguard Worker float value;
577*35238bceSAndroid Build Coastguard Worker ImageViewMinLodMode mode;
578*35238bceSAndroid Build Coastguard Worker };
579*35238bceSAndroid Build Coastguard Worker
580*35238bceSAndroid Build Coastguard Worker struct ImageViewMinLodParams
581*35238bceSAndroid Build Coastguard Worker {
582*35238bceSAndroid Build Coastguard Worker int baseLevel;
583*35238bceSAndroid Build Coastguard Worker ImageViewMinLod minLod;
584*35238bceSAndroid Build Coastguard Worker bool intTexCoord;
585*35238bceSAndroid Build Coastguard Worker };
586*35238bceSAndroid Build Coastguard Worker
587*35238bceSAndroid Build Coastguard Worker Vec4 sampleLevelArray1D(const ConstPixelBufferAccess *levels, int numLevels, const Sampler &sampler, float s, int level,
588*35238bceSAndroid Build Coastguard Worker float lod);
589*35238bceSAndroid Build Coastguard Worker Vec4 sampleLevelArray2D(const ConstPixelBufferAccess *levels, int numLevels, const Sampler &sampler, float s, float t,
590*35238bceSAndroid Build Coastguard Worker int depth, float lod, bool es2 = false, ImageViewMinLodParams *minLodParams = DE_NULL);
591*35238bceSAndroid Build Coastguard Worker Vec4 sampleLevelArray3D(const ConstPixelBufferAccess *levels, int numLevels, const Sampler &sampler, float s, float t,
592*35238bceSAndroid Build Coastguard Worker float r, float lod, ImageViewMinLodParams *minLodParams = DE_NULL);
593*35238bceSAndroid Build Coastguard Worker
594*35238bceSAndroid Build Coastguard Worker Vec4 sampleLevelArray1DOffset(const ConstPixelBufferAccess *levels, int numLevels, const Sampler &sampler, float s,
595*35238bceSAndroid Build Coastguard Worker float lod, const IVec2 &offset);
596*35238bceSAndroid Build Coastguard Worker Vec4 sampleLevelArray2DOffset(const ConstPixelBufferAccess *levels, int numLevels, const Sampler &sampler, float s,
597*35238bceSAndroid Build Coastguard Worker float t, float lod, const IVec3 &offset, bool es2 = false,
598*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *minLodParams = DE_NULL);
599*35238bceSAndroid Build Coastguard Worker Vec4 sampleLevelArray3DOffset(const ConstPixelBufferAccess *levels, int numLevels, const Sampler &sampler, float s,
600*35238bceSAndroid Build Coastguard Worker float t, float r, float lod, const IVec3 &offset,
601*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *minLodParams = DE_NULL);
602*35238bceSAndroid Build Coastguard Worker
603*35238bceSAndroid Build Coastguard Worker float sampleLevelArray1DCompare(const ConstPixelBufferAccess *levels, int numLevels, const Sampler &sampler, float ref,
604*35238bceSAndroid Build Coastguard Worker float s, float lod, const IVec2 &offset);
605*35238bceSAndroid Build Coastguard Worker float sampleLevelArray2DCompare(const ConstPixelBufferAccess *levels, int numLevels, const Sampler &sampler, float ref,
606*35238bceSAndroid Build Coastguard Worker float s, float t, float lod, const IVec3 &offset);
607*35238bceSAndroid Build Coastguard Worker
608*35238bceSAndroid Build Coastguard Worker Vec4 gatherArray2DOffsets(const ConstPixelBufferAccess &src, const Sampler &sampler, float s, float t, int depth,
609*35238bceSAndroid Build Coastguard Worker int componentNdx, const IVec2 (&offsets)[4]);
610*35238bceSAndroid Build Coastguard Worker Vec4 gatherArray2DOffsetsCompare(const ConstPixelBufferAccess &src, const Sampler &sampler, float ref, float s, float t,
611*35238bceSAndroid Build Coastguard Worker int depth, const IVec2 (&offsets)[4]);
612*35238bceSAndroid Build Coastguard Worker
613*35238bceSAndroid Build Coastguard Worker enum CubeFace
614*35238bceSAndroid Build Coastguard Worker {
615*35238bceSAndroid Build Coastguard Worker CUBEFACE_NEGATIVE_X = 0,
616*35238bceSAndroid Build Coastguard Worker CUBEFACE_POSITIVE_X,
617*35238bceSAndroid Build Coastguard Worker CUBEFACE_NEGATIVE_Y,
618*35238bceSAndroid Build Coastguard Worker CUBEFACE_POSITIVE_Y,
619*35238bceSAndroid Build Coastguard Worker CUBEFACE_NEGATIVE_Z,
620*35238bceSAndroid Build Coastguard Worker CUBEFACE_POSITIVE_Z,
621*35238bceSAndroid Build Coastguard Worker
622*35238bceSAndroid Build Coastguard Worker CUBEFACE_LAST
623*35238bceSAndroid Build Coastguard Worker };
624*35238bceSAndroid Build Coastguard Worker
625*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
626*35238bceSAndroid Build Coastguard Worker * \brief Coordinates projected onto cube face.
627*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
628*35238bceSAndroid Build Coastguard Worker template <typename T>
629*35238bceSAndroid Build Coastguard Worker struct CubeFaceCoords
630*35238bceSAndroid Build Coastguard Worker {
631*35238bceSAndroid Build Coastguard Worker CubeFace face;
632*35238bceSAndroid Build Coastguard Worker T s;
633*35238bceSAndroid Build Coastguard Worker T t;
634*35238bceSAndroid Build Coastguard Worker
CubeFaceCoordstcu::CubeFaceCoords635*35238bceSAndroid Build Coastguard Worker CubeFaceCoords(CubeFace face_, T s_, T t_) : face(face_), s(s_), t(t_)
636*35238bceSAndroid Build Coastguard Worker {
637*35238bceSAndroid Build Coastguard Worker }
CubeFaceCoordstcu::CubeFaceCoords638*35238bceSAndroid Build Coastguard Worker CubeFaceCoords(CubeFace face_, const Vector<T, 2> &c) : face(face_), s(c.x()), t(c.y())
639*35238bceSAndroid Build Coastguard Worker {
640*35238bceSAndroid Build Coastguard Worker }
641*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
642*35238bceSAndroid Build Coastguard Worker
643*35238bceSAndroid Build Coastguard Worker typedef CubeFaceCoords<float> CubeFaceFloatCoords;
644*35238bceSAndroid Build Coastguard Worker typedef CubeFaceCoords<int> CubeFaceIntCoords;
645*35238bceSAndroid Build Coastguard Worker
646*35238bceSAndroid Build Coastguard Worker CubeFace selectCubeFace(const Vec3 &coords);
647*35238bceSAndroid Build Coastguard Worker Vec2 projectToFace(CubeFace face, const Vec3 &coords);
648*35238bceSAndroid Build Coastguard Worker CubeFaceFloatCoords getCubeFaceCoords(const Vec3 &coords);
649*35238bceSAndroid Build Coastguard Worker CubeFaceIntCoords remapCubeEdgeCoords(const CubeFaceIntCoords &coords, int size);
650*35238bceSAndroid Build Coastguard Worker
651*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
652*35238bceSAndroid Build Coastguard Worker * \brief 2D Texture View
653*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
654*35238bceSAndroid Build Coastguard Worker class Texture2DView
655*35238bceSAndroid Build Coastguard Worker {
656*35238bceSAndroid Build Coastguard Worker public:
657*35238bceSAndroid Build Coastguard Worker Texture2DView(int numLevels, const ConstPixelBufferAccess *levels, bool es2 = false,
658*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *minLodParams = DE_NULL);
659*35238bceSAndroid Build Coastguard Worker
getNumLevels(void) const660*35238bceSAndroid Build Coastguard Worker int getNumLevels(void) const
661*35238bceSAndroid Build Coastguard Worker {
662*35238bceSAndroid Build Coastguard Worker return m_numLevels;
663*35238bceSAndroid Build Coastguard Worker }
getWidth(void) const664*35238bceSAndroid Build Coastguard Worker int getWidth(void) const
665*35238bceSAndroid Build Coastguard Worker {
666*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0].getWidth() : 0;
667*35238bceSAndroid Build Coastguard Worker }
getHeight(void) const668*35238bceSAndroid Build Coastguard Worker int getHeight(void) const
669*35238bceSAndroid Build Coastguard Worker {
670*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0].getHeight() : 0;
671*35238bceSAndroid Build Coastguard Worker }
getLevel(int ndx) const672*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess &getLevel(int ndx) const
673*35238bceSAndroid Build Coastguard Worker {
674*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::inBounds(ndx, 0, m_numLevels));
675*35238bceSAndroid Build Coastguard Worker return m_levels[ndx];
676*35238bceSAndroid Build Coastguard Worker }
getLevels(void) const677*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *getLevels(void) const
678*35238bceSAndroid Build Coastguard Worker {
679*35238bceSAndroid Build Coastguard Worker return m_levels;
680*35238bceSAndroid Build Coastguard Worker }
isES2(void) const681*35238bceSAndroid Build Coastguard Worker bool isES2(void) const
682*35238bceSAndroid Build Coastguard Worker {
683*35238bceSAndroid Build Coastguard Worker return m_es2;
684*35238bceSAndroid Build Coastguard Worker }
685*35238bceSAndroid Build Coastguard Worker
686*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float t, float lod) const;
687*35238bceSAndroid Build Coastguard Worker Vec4 sampleOffset(const Sampler &sampler, float s, float t, float lod, const IVec2 &offset) const;
688*35238bceSAndroid Build Coastguard Worker float sampleCompare(const Sampler &sampler, float ref, float s, float t, float lod) const;
689*35238bceSAndroid Build Coastguard Worker float sampleCompareOffset(const Sampler &sampler, float ref, float s, float t, float lod,
690*35238bceSAndroid Build Coastguard Worker const IVec2 &offset) const;
691*35238bceSAndroid Build Coastguard Worker
692*35238bceSAndroid Build Coastguard Worker Vec4 gatherOffsets(const Sampler &sampler, float s, float t, int componentNdx, const IVec2 (&offsets)[4]) const;
693*35238bceSAndroid Build Coastguard Worker Vec4 gatherOffsetsCompare(const Sampler &sampler, float ref, float s, float t, const IVec2 (&offsets)[4]) const;
694*35238bceSAndroid Build Coastguard Worker
getImageViewMinLodParams(void) const695*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *getImageViewMinLodParams(void) const
696*35238bceSAndroid Build Coastguard Worker {
697*35238bceSAndroid Build Coastguard Worker return m_minLodParams;
698*35238bceSAndroid Build Coastguard Worker }
699*35238bceSAndroid Build Coastguard Worker
700*35238bceSAndroid Build Coastguard Worker protected:
701*35238bceSAndroid Build Coastguard Worker int m_numLevels;
702*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *m_levels;
703*35238bceSAndroid Build Coastguard Worker bool m_es2;
704*35238bceSAndroid Build Coastguard Worker struct ImageViewMinLodParams *m_minLodParams;
705*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
706*35238bceSAndroid Build Coastguard Worker
Texture2DView(int numLevels,const ConstPixelBufferAccess * levels,bool es2,ImageViewMinLodParams * minLodParams)707*35238bceSAndroid Build Coastguard Worker inline Texture2DView::Texture2DView(int numLevels, const ConstPixelBufferAccess *levels, bool es2,
708*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *minLodParams)
709*35238bceSAndroid Build Coastguard Worker : m_numLevels(numLevels)
710*35238bceSAndroid Build Coastguard Worker , m_levels(levels)
711*35238bceSAndroid Build Coastguard Worker , m_es2(es2)
712*35238bceSAndroid Build Coastguard Worker , m_minLodParams(minLodParams)
713*35238bceSAndroid Build Coastguard Worker {
714*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_numLevels >= 0 && ((m_numLevels == 0) == !m_levels));
715*35238bceSAndroid Build Coastguard Worker }
716*35238bceSAndroid Build Coastguard Worker
sample(const Sampler & sampler,float s,float t,float lod) const717*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture2DView::sample(const Sampler &sampler, float s, float t, float lod) const
718*35238bceSAndroid Build Coastguard Worker {
719*35238bceSAndroid Build Coastguard Worker return sampleLevelArray2D(m_levels, m_numLevels, sampler, s, t, 0 /* depth */, lod, m_es2, m_minLodParams);
720*35238bceSAndroid Build Coastguard Worker }
721*35238bceSAndroid Build Coastguard Worker
sampleOffset(const Sampler & sampler,float s,float t,float lod,const IVec2 & offset) const722*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture2DView::sampleOffset(const Sampler &sampler, float s, float t, float lod, const IVec2 &offset) const
723*35238bceSAndroid Build Coastguard Worker {
724*35238bceSAndroid Build Coastguard Worker return sampleLevelArray2DOffset(m_levels, m_numLevels, sampler, s, t, lod, IVec3(offset.x(), offset.y(), 0));
725*35238bceSAndroid Build Coastguard Worker }
726*35238bceSAndroid Build Coastguard Worker
sampleCompare(const Sampler & sampler,float ref,float s,float t,float lod) const727*35238bceSAndroid Build Coastguard Worker inline float Texture2DView::sampleCompare(const Sampler &sampler, float ref, float s, float t, float lod) const
728*35238bceSAndroid Build Coastguard Worker {
729*35238bceSAndroid Build Coastguard Worker return sampleLevelArray2DCompare(m_levels, m_numLevels, sampler, ref, s, t, lod, IVec3(0, 0, 0));
730*35238bceSAndroid Build Coastguard Worker }
731*35238bceSAndroid Build Coastguard Worker
sampleCompareOffset(const Sampler & sampler,float ref,float s,float t,float lod,const IVec2 & offset) const732*35238bceSAndroid Build Coastguard Worker inline float Texture2DView::sampleCompareOffset(const Sampler &sampler, float ref, float s, float t, float lod,
733*35238bceSAndroid Build Coastguard Worker const IVec2 &offset) const
734*35238bceSAndroid Build Coastguard Worker {
735*35238bceSAndroid Build Coastguard Worker return sampleLevelArray2DCompare(m_levels, m_numLevels, sampler, ref, s, t, lod, IVec3(offset.x(), offset.y(), 0));
736*35238bceSAndroid Build Coastguard Worker }
737*35238bceSAndroid Build Coastguard Worker
gatherOffsets(const Sampler & sampler,float s,float t,int componentNdx,const IVec2 (& offsets)[4]) const738*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture2DView::gatherOffsets(const Sampler &sampler, float s, float t, int componentNdx,
739*35238bceSAndroid Build Coastguard Worker const IVec2 (&offsets)[4]) const
740*35238bceSAndroid Build Coastguard Worker {
741*35238bceSAndroid Build Coastguard Worker return gatherArray2DOffsets(m_levels[0], sampler, s, t, 0, componentNdx, offsets);
742*35238bceSAndroid Build Coastguard Worker }
743*35238bceSAndroid Build Coastguard Worker
gatherOffsetsCompare(const Sampler & sampler,float ref,float s,float t,const IVec2 (& offsets)[4]) const744*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture2DView::gatherOffsetsCompare(const Sampler &sampler, float ref, float s, float t,
745*35238bceSAndroid Build Coastguard Worker const IVec2 (&offsets)[4]) const
746*35238bceSAndroid Build Coastguard Worker {
747*35238bceSAndroid Build Coastguard Worker return gatherArray2DOffsetsCompare(m_levels[0], sampler, ref, s, t, 0, offsets);
748*35238bceSAndroid Build Coastguard Worker }
749*35238bceSAndroid Build Coastguard Worker
750*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
751*35238bceSAndroid Build Coastguard Worker * \brief Base class for textures that have single mip-map pyramid
752*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
753*35238bceSAndroid Build Coastguard Worker class TextureLevelPyramid
754*35238bceSAndroid Build Coastguard Worker {
755*35238bceSAndroid Build Coastguard Worker public:
756*35238bceSAndroid Build Coastguard Worker TextureLevelPyramid(const TextureFormat &format, int numLevels);
757*35238bceSAndroid Build Coastguard Worker TextureLevelPyramid(const TextureLevelPyramid &other);
758*35238bceSAndroid Build Coastguard Worker ~TextureLevelPyramid(void);
759*35238bceSAndroid Build Coastguard Worker
getFormat(void) const760*35238bceSAndroid Build Coastguard Worker const TextureFormat &getFormat(void) const
761*35238bceSAndroid Build Coastguard Worker {
762*35238bceSAndroid Build Coastguard Worker return m_format;
763*35238bceSAndroid Build Coastguard Worker }
getNumLevels(void) const764*35238bceSAndroid Build Coastguard Worker int getNumLevels(void) const
765*35238bceSAndroid Build Coastguard Worker {
766*35238bceSAndroid Build Coastguard Worker return (int)m_access.size();
767*35238bceSAndroid Build Coastguard Worker }
768*35238bceSAndroid Build Coastguard Worker
isLevelEmpty(int levelNdx) const769*35238bceSAndroid Build Coastguard Worker bool isLevelEmpty(int levelNdx) const
770*35238bceSAndroid Build Coastguard Worker {
771*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::inBounds(levelNdx, 0, getNumLevels()));
772*35238bceSAndroid Build Coastguard Worker return m_data[(size_t)levelNdx].empty();
773*35238bceSAndroid Build Coastguard Worker }
getLevel(int levelNdx) const774*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess &getLevel(int levelNdx) const
775*35238bceSAndroid Build Coastguard Worker {
776*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::inBounds(levelNdx, 0, getNumLevels()));
777*35238bceSAndroid Build Coastguard Worker return m_access[(size_t)levelNdx];
778*35238bceSAndroid Build Coastguard Worker }
getLevel(int levelNdx)779*35238bceSAndroid Build Coastguard Worker const PixelBufferAccess &getLevel(int levelNdx)
780*35238bceSAndroid Build Coastguard Worker {
781*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::inBounds(levelNdx, 0, getNumLevels()));
782*35238bceSAndroid Build Coastguard Worker return m_access[(size_t)levelNdx];
783*35238bceSAndroid Build Coastguard Worker }
784*35238bceSAndroid Build Coastguard Worker
getLevels(void) const785*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *getLevels(void) const
786*35238bceSAndroid Build Coastguard Worker {
787*35238bceSAndroid Build Coastguard Worker return &m_access[0];
788*35238bceSAndroid Build Coastguard Worker }
getLevels(void)789*35238bceSAndroid Build Coastguard Worker const PixelBufferAccess *getLevels(void)
790*35238bceSAndroid Build Coastguard Worker {
791*35238bceSAndroid Build Coastguard Worker return &m_access[0];
792*35238bceSAndroid Build Coastguard Worker }
793*35238bceSAndroid Build Coastguard Worker
794*35238bceSAndroid Build Coastguard Worker void allocLevel(int levelNdx, int width, int height, int depth);
795*35238bceSAndroid Build Coastguard Worker void clearLevel(int levelNdx);
796*35238bceSAndroid Build Coastguard Worker
797*35238bceSAndroid Build Coastguard Worker TextureLevelPyramid &operator=(const TextureLevelPyramid &other);
798*35238bceSAndroid Build Coastguard Worker
799*35238bceSAndroid Build Coastguard Worker private:
800*35238bceSAndroid Build Coastguard Worker typedef de::ArrayBuffer<uint8_t> LevelData;
801*35238bceSAndroid Build Coastguard Worker
802*35238bceSAndroid Build Coastguard Worker TextureFormat m_format;
803*35238bceSAndroid Build Coastguard Worker std::vector<LevelData> m_data;
804*35238bceSAndroid Build Coastguard Worker std::vector<PixelBufferAccess> m_access;
805*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
806*35238bceSAndroid Build Coastguard Worker
807*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
808*35238bceSAndroid Build Coastguard Worker * \brief 2D Texture reference implementation
809*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
810*35238bceSAndroid Build Coastguard Worker class Texture2D : private TextureLevelPyramid
811*35238bceSAndroid Build Coastguard Worker {
812*35238bceSAndroid Build Coastguard Worker public:
813*35238bceSAndroid Build Coastguard Worker Texture2D(const TextureFormat &format, int width, int height, bool es2 = false);
814*35238bceSAndroid Build Coastguard Worker Texture2D(const TextureFormat &format, int width, int height, int mipmaps);
815*35238bceSAndroid Build Coastguard Worker Texture2D(const Texture2D &other);
816*35238bceSAndroid Build Coastguard Worker ~Texture2D(void);
817*35238bceSAndroid Build Coastguard Worker
getWidth(void) const818*35238bceSAndroid Build Coastguard Worker int getWidth(void) const
819*35238bceSAndroid Build Coastguard Worker {
820*35238bceSAndroid Build Coastguard Worker return m_width;
821*35238bceSAndroid Build Coastguard Worker }
getHeight(void) const822*35238bceSAndroid Build Coastguard Worker int getHeight(void) const
823*35238bceSAndroid Build Coastguard Worker {
824*35238bceSAndroid Build Coastguard Worker return m_height;
825*35238bceSAndroid Build Coastguard Worker }
getView(void) const826*35238bceSAndroid Build Coastguard Worker const Texture2DView &getView(void) const
827*35238bceSAndroid Build Coastguard Worker {
828*35238bceSAndroid Build Coastguard Worker return m_view;
829*35238bceSAndroid Build Coastguard Worker }
isYUVTextureUsed(void) const830*35238bceSAndroid Build Coastguard Worker bool isYUVTextureUsed(void) const
831*35238bceSAndroid Build Coastguard Worker {
832*35238bceSAndroid Build Coastguard Worker return m_yuvTextureUsed;
833*35238bceSAndroid Build Coastguard Worker }
834*35238bceSAndroid Build Coastguard Worker void allocLevel(int levelNdx);
835*35238bceSAndroid Build Coastguard Worker
836*35238bceSAndroid Build Coastguard Worker // Sampling
837*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float t, float lod) const;
838*35238bceSAndroid Build Coastguard Worker Vec4 sampleOffset(const Sampler &sampler, float s, float t, float lod, const IVec2 &offset) const;
839*35238bceSAndroid Build Coastguard Worker float sampleCompare(const Sampler &sampler, float ref, float s, float t, float lod) const;
840*35238bceSAndroid Build Coastguard Worker float sampleCompareOffset(const Sampler &sampler, float ref, float s, float t, float lod,
841*35238bceSAndroid Build Coastguard Worker const IVec2 &offset) const;
842*35238bceSAndroid Build Coastguard Worker
843*35238bceSAndroid Build Coastguard Worker Vec4 gatherOffsets(const Sampler &sampler, float s, float t, int componentNdx, const IVec2 (&offsets)[4]) const;
844*35238bceSAndroid Build Coastguard Worker Vec4 gatherOffsetsCompare(const Sampler &sampler, float ref, float s, float t, const IVec2 (&offsets)[4]) const;
845*35238bceSAndroid Build Coastguard Worker
846*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::clearLevel;
847*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getFormat;
848*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getLevel;
849*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getNumLevels;
850*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::isLevelEmpty;
851*35238bceSAndroid Build Coastguard Worker
852*35238bceSAndroid Build Coastguard Worker Texture2D &operator=(const Texture2D &other);
853*35238bceSAndroid Build Coastguard Worker //whether this is a yuv format texture tests
854*35238bceSAndroid Build Coastguard Worker bool m_yuvTextureUsed;
operator Texture2DView(void) const855*35238bceSAndroid Build Coastguard Worker operator Texture2DView(void) const
856*35238bceSAndroid Build Coastguard Worker {
857*35238bceSAndroid Build Coastguard Worker return m_view;
858*35238bceSAndroid Build Coastguard Worker }
859*35238bceSAndroid Build Coastguard Worker
860*35238bceSAndroid Build Coastguard Worker private:
861*35238bceSAndroid Build Coastguard Worker int m_width;
862*35238bceSAndroid Build Coastguard Worker int m_height;
863*35238bceSAndroid Build Coastguard Worker Texture2DView m_view;
864*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
865*35238bceSAndroid Build Coastguard Worker
sample(const Sampler & sampler,float s,float t,float lod) const866*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture2D::sample(const Sampler &sampler, float s, float t, float lod) const
867*35238bceSAndroid Build Coastguard Worker {
868*35238bceSAndroid Build Coastguard Worker return m_view.sample(sampler, s, t, lod);
869*35238bceSAndroid Build Coastguard Worker }
870*35238bceSAndroid Build Coastguard Worker
sampleOffset(const Sampler & sampler,float s,float t,float lod,const IVec2 & offset) const871*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture2D::sampleOffset(const Sampler &sampler, float s, float t, float lod, const IVec2 &offset) const
872*35238bceSAndroid Build Coastguard Worker {
873*35238bceSAndroid Build Coastguard Worker return m_view.sampleOffset(sampler, s, t, lod, offset);
874*35238bceSAndroid Build Coastguard Worker }
875*35238bceSAndroid Build Coastguard Worker
sampleCompare(const Sampler & sampler,float ref,float s,float t,float lod) const876*35238bceSAndroid Build Coastguard Worker inline float Texture2D::sampleCompare(const Sampler &sampler, float ref, float s, float t, float lod) const
877*35238bceSAndroid Build Coastguard Worker {
878*35238bceSAndroid Build Coastguard Worker return m_view.sampleCompare(sampler, ref, s, t, lod);
879*35238bceSAndroid Build Coastguard Worker }
880*35238bceSAndroid Build Coastguard Worker
sampleCompareOffset(const Sampler & sampler,float ref,float s,float t,float lod,const IVec2 & offset) const881*35238bceSAndroid Build Coastguard Worker inline float Texture2D::sampleCompareOffset(const Sampler &sampler, float ref, float s, float t, float lod,
882*35238bceSAndroid Build Coastguard Worker const IVec2 &offset) const
883*35238bceSAndroid Build Coastguard Worker {
884*35238bceSAndroid Build Coastguard Worker return m_view.sampleCompareOffset(sampler, ref, s, t, lod, offset);
885*35238bceSAndroid Build Coastguard Worker }
886*35238bceSAndroid Build Coastguard Worker
gatherOffsets(const Sampler & sampler,float s,float t,int componentNdx,const IVec2 (& offsets)[4]) const887*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture2D::gatherOffsets(const Sampler &sampler, float s, float t, int componentNdx,
888*35238bceSAndroid Build Coastguard Worker const IVec2 (&offsets)[4]) const
889*35238bceSAndroid Build Coastguard Worker {
890*35238bceSAndroid Build Coastguard Worker return m_view.gatherOffsets(sampler, s, t, componentNdx, offsets);
891*35238bceSAndroid Build Coastguard Worker }
892*35238bceSAndroid Build Coastguard Worker
gatherOffsetsCompare(const Sampler & sampler,float ref,float s,float t,const IVec2 (& offsets)[4]) const893*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture2D::gatherOffsetsCompare(const Sampler &sampler, float ref, float s, float t,
894*35238bceSAndroid Build Coastguard Worker const IVec2 (&offsets)[4]) const
895*35238bceSAndroid Build Coastguard Worker {
896*35238bceSAndroid Build Coastguard Worker return m_view.gatherOffsetsCompare(sampler, ref, s, t, offsets);
897*35238bceSAndroid Build Coastguard Worker }
898*35238bceSAndroid Build Coastguard Worker
899*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
900*35238bceSAndroid Build Coastguard Worker * \brief Cube Map Texture View
901*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
902*35238bceSAndroid Build Coastguard Worker class TextureCubeView
903*35238bceSAndroid Build Coastguard Worker {
904*35238bceSAndroid Build Coastguard Worker public:
905*35238bceSAndroid Build Coastguard Worker TextureCubeView(void);
906*35238bceSAndroid Build Coastguard Worker TextureCubeView(int numLevels, const ConstPixelBufferAccess *const (&levels)[CUBEFACE_LAST], bool es2 = false,
907*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *minLodParams = DE_NULL);
908*35238bceSAndroid Build Coastguard Worker
getNumLevels(void) const909*35238bceSAndroid Build Coastguard Worker int getNumLevels(void) const
910*35238bceSAndroid Build Coastguard Worker {
911*35238bceSAndroid Build Coastguard Worker return m_numLevels;
912*35238bceSAndroid Build Coastguard Worker }
isES2(void) const913*35238bceSAndroid Build Coastguard Worker bool isES2(void) const
914*35238bceSAndroid Build Coastguard Worker {
915*35238bceSAndroid Build Coastguard Worker return m_es2;
916*35238bceSAndroid Build Coastguard Worker }
getSize(void) const917*35238bceSAndroid Build Coastguard Worker int getSize(void) const
918*35238bceSAndroid Build Coastguard Worker {
919*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0][0].getWidth() : 0;
920*35238bceSAndroid Build Coastguard Worker }
getLevelFace(int ndx,CubeFace face) const921*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess &getLevelFace(int ndx, CubeFace face) const
922*35238bceSAndroid Build Coastguard Worker {
923*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::inBounds(ndx, 0, m_numLevels));
924*35238bceSAndroid Build Coastguard Worker return m_levels[face][ndx];
925*35238bceSAndroid Build Coastguard Worker }
getFaceLevels(CubeFace face) const926*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *getFaceLevels(CubeFace face) const
927*35238bceSAndroid Build Coastguard Worker {
928*35238bceSAndroid Build Coastguard Worker return m_levels[face];
929*35238bceSAndroid Build Coastguard Worker }
930*35238bceSAndroid Build Coastguard Worker
931*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float t, float p, float lod) const;
932*35238bceSAndroid Build Coastguard Worker float sampleCompare(const Sampler &sampler, float ref, float s, float t, float r, float lod) const;
933*35238bceSAndroid Build Coastguard Worker
934*35238bceSAndroid Build Coastguard Worker Vec4 gather(const Sampler &sampler, float s, float t, float r, int componentNdx) const;
935*35238bceSAndroid Build Coastguard Worker Vec4 gatherCompare(const Sampler &sampler, float ref, float s, float t, float r) const;
936*35238bceSAndroid Build Coastguard Worker
getImageViewMinLodParams(void) const937*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *getImageViewMinLodParams(void) const
938*35238bceSAndroid Build Coastguard Worker {
939*35238bceSAndroid Build Coastguard Worker return m_minLodParams;
940*35238bceSAndroid Build Coastguard Worker }
941*35238bceSAndroid Build Coastguard Worker
942*35238bceSAndroid Build Coastguard Worker protected:
943*35238bceSAndroid Build Coastguard Worker int m_numLevels;
944*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *m_levels[CUBEFACE_LAST];
945*35238bceSAndroid Build Coastguard Worker bool m_es2;
946*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *m_minLodParams;
947*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
948*35238bceSAndroid Build Coastguard Worker
949*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
950*35238bceSAndroid Build Coastguard Worker * \brief Cube Map Texture reference implementation
951*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
952*35238bceSAndroid Build Coastguard Worker class TextureCube
953*35238bceSAndroid Build Coastguard Worker {
954*35238bceSAndroid Build Coastguard Worker public:
955*35238bceSAndroid Build Coastguard Worker TextureCube(const TextureFormat &format, int size, bool es2 = false);
956*35238bceSAndroid Build Coastguard Worker TextureCube(const TextureCube &other);
957*35238bceSAndroid Build Coastguard Worker ~TextureCube(void);
958*35238bceSAndroid Build Coastguard Worker
getFormat(void) const959*35238bceSAndroid Build Coastguard Worker const TextureFormat &getFormat(void) const
960*35238bceSAndroid Build Coastguard Worker {
961*35238bceSAndroid Build Coastguard Worker return m_format;
962*35238bceSAndroid Build Coastguard Worker }
getSize(void) const963*35238bceSAndroid Build Coastguard Worker int getSize(void) const
964*35238bceSAndroid Build Coastguard Worker {
965*35238bceSAndroid Build Coastguard Worker return m_size;
966*35238bceSAndroid Build Coastguard Worker }
getView(void) const967*35238bceSAndroid Build Coastguard Worker const TextureCubeView &getView(void) const
968*35238bceSAndroid Build Coastguard Worker {
969*35238bceSAndroid Build Coastguard Worker return m_view;
970*35238bceSAndroid Build Coastguard Worker }
971*35238bceSAndroid Build Coastguard Worker
getNumLevels(void) const972*35238bceSAndroid Build Coastguard Worker int getNumLevels(void) const
973*35238bceSAndroid Build Coastguard Worker {
974*35238bceSAndroid Build Coastguard Worker return (int)m_access[0].size();
975*35238bceSAndroid Build Coastguard Worker }
getLevelFace(int ndx,CubeFace face) const976*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess &getLevelFace(int ndx, CubeFace face) const
977*35238bceSAndroid Build Coastguard Worker {
978*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::inBounds(ndx, 0, getNumLevels()));
979*35238bceSAndroid Build Coastguard Worker return m_access[face][(size_t)ndx];
980*35238bceSAndroid Build Coastguard Worker }
getLevelFace(int ndx,CubeFace face)981*35238bceSAndroid Build Coastguard Worker const PixelBufferAccess &getLevelFace(int ndx, CubeFace face)
982*35238bceSAndroid Build Coastguard Worker {
983*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::inBounds(ndx, 0, getNumLevels()));
984*35238bceSAndroid Build Coastguard Worker return m_access[face][(size_t)ndx];
985*35238bceSAndroid Build Coastguard Worker }
986*35238bceSAndroid Build Coastguard Worker
987*35238bceSAndroid Build Coastguard Worker void allocLevel(CubeFace face, int levelNdx);
988*35238bceSAndroid Build Coastguard Worker void clearLevel(CubeFace face, int levelNdx);
isLevelEmpty(CubeFace face,int levelNdx) const989*35238bceSAndroid Build Coastguard Worker bool isLevelEmpty(CubeFace face, int levelNdx) const
990*35238bceSAndroid Build Coastguard Worker {
991*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::inBounds(levelNdx, 0, getNumLevels()));
992*35238bceSAndroid Build Coastguard Worker return m_data[face][(size_t)levelNdx].empty();
993*35238bceSAndroid Build Coastguard Worker }
994*35238bceSAndroid Build Coastguard Worker
995*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float t, float p, float lod) const;
996*35238bceSAndroid Build Coastguard Worker float sampleCompare(const Sampler &sampler, float ref, float s, float t, float r, float lod) const;
997*35238bceSAndroid Build Coastguard Worker
998*35238bceSAndroid Build Coastguard Worker Vec4 gather(const Sampler &sampler, float s, float t, float r, int componentNdx) const;
999*35238bceSAndroid Build Coastguard Worker Vec4 gatherCompare(const Sampler &sampler, float ref, float s, float t, float r) const;
1000*35238bceSAndroid Build Coastguard Worker
1001*35238bceSAndroid Build Coastguard Worker TextureCube &operator=(const TextureCube &other);
1002*35238bceSAndroid Build Coastguard Worker
operator TextureCubeView(void) const1003*35238bceSAndroid Build Coastguard Worker operator TextureCubeView(void) const
1004*35238bceSAndroid Build Coastguard Worker {
1005*35238bceSAndroid Build Coastguard Worker return m_view;
1006*35238bceSAndroid Build Coastguard Worker }
1007*35238bceSAndroid Build Coastguard Worker
1008*35238bceSAndroid Build Coastguard Worker private:
1009*35238bceSAndroid Build Coastguard Worker typedef de::ArrayBuffer<uint8_t> LevelData;
1010*35238bceSAndroid Build Coastguard Worker
1011*35238bceSAndroid Build Coastguard Worker TextureFormat m_format;
1012*35238bceSAndroid Build Coastguard Worker int m_size;
1013*35238bceSAndroid Build Coastguard Worker std::vector<LevelData> m_data[CUBEFACE_LAST];
1014*35238bceSAndroid Build Coastguard Worker std::vector<PixelBufferAccess> m_access[CUBEFACE_LAST];
1015*35238bceSAndroid Build Coastguard Worker TextureCubeView m_view;
1016*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
1017*35238bceSAndroid Build Coastguard Worker
sample(const Sampler & sampler,float s,float t,float p,float lod) const1018*35238bceSAndroid Build Coastguard Worker inline Vec4 TextureCube::sample(const Sampler &sampler, float s, float t, float p, float lod) const
1019*35238bceSAndroid Build Coastguard Worker {
1020*35238bceSAndroid Build Coastguard Worker return m_view.sample(sampler, s, t, p, lod);
1021*35238bceSAndroid Build Coastguard Worker }
1022*35238bceSAndroid Build Coastguard Worker
sampleCompare(const Sampler & sampler,float ref,float s,float t,float r,float lod) const1023*35238bceSAndroid Build Coastguard Worker inline float TextureCube::sampleCompare(const Sampler &sampler, float ref, float s, float t, float r, float lod) const
1024*35238bceSAndroid Build Coastguard Worker {
1025*35238bceSAndroid Build Coastguard Worker return m_view.sampleCompare(sampler, ref, s, t, r, lod);
1026*35238bceSAndroid Build Coastguard Worker }
1027*35238bceSAndroid Build Coastguard Worker
gather(const Sampler & sampler,float s,float t,float r,int componentNdx) const1028*35238bceSAndroid Build Coastguard Worker inline Vec4 TextureCube::gather(const Sampler &sampler, float s, float t, float r, int componentNdx) const
1029*35238bceSAndroid Build Coastguard Worker {
1030*35238bceSAndroid Build Coastguard Worker return m_view.gather(sampler, s, t, r, componentNdx);
1031*35238bceSAndroid Build Coastguard Worker }
1032*35238bceSAndroid Build Coastguard Worker
gatherCompare(const Sampler & sampler,float ref,float s,float t,float r) const1033*35238bceSAndroid Build Coastguard Worker inline Vec4 TextureCube::gatherCompare(const Sampler &sampler, float ref, float s, float t, float r) const
1034*35238bceSAndroid Build Coastguard Worker {
1035*35238bceSAndroid Build Coastguard Worker return m_view.gatherCompare(sampler, ref, s, t, r);
1036*35238bceSAndroid Build Coastguard Worker }
1037*35238bceSAndroid Build Coastguard Worker
1038*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
1039*35238bceSAndroid Build Coastguard Worker * \brief 1D Texture View
1040*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
1041*35238bceSAndroid Build Coastguard Worker class Texture1DView
1042*35238bceSAndroid Build Coastguard Worker {
1043*35238bceSAndroid Build Coastguard Worker public:
1044*35238bceSAndroid Build Coastguard Worker Texture1DView(int numLevels, const ConstPixelBufferAccess *levels, bool es2, ImageViewMinLodParams *minLodParams);
1045*35238bceSAndroid Build Coastguard Worker
getNumLevels(void) const1046*35238bceSAndroid Build Coastguard Worker int getNumLevels(void) const
1047*35238bceSAndroid Build Coastguard Worker {
1048*35238bceSAndroid Build Coastguard Worker return m_numLevels;
1049*35238bceSAndroid Build Coastguard Worker }
getWidth(void) const1050*35238bceSAndroid Build Coastguard Worker int getWidth(void) const
1051*35238bceSAndroid Build Coastguard Worker {
1052*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0].getWidth() : 0;
1053*35238bceSAndroid Build Coastguard Worker }
getLevel(int ndx) const1054*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess &getLevel(int ndx) const
1055*35238bceSAndroid Build Coastguard Worker {
1056*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::inBounds(ndx, 0, m_numLevels));
1057*35238bceSAndroid Build Coastguard Worker return m_levels[ndx];
1058*35238bceSAndroid Build Coastguard Worker }
getLevels(void) const1059*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *getLevels(void) const
1060*35238bceSAndroid Build Coastguard Worker {
1061*35238bceSAndroid Build Coastguard Worker return m_levels;
1062*35238bceSAndroid Build Coastguard Worker }
isES2(void) const1063*35238bceSAndroid Build Coastguard Worker bool isES2(void) const
1064*35238bceSAndroid Build Coastguard Worker {
1065*35238bceSAndroid Build Coastguard Worker return false;
1066*35238bceSAndroid Build Coastguard Worker }
1067*35238bceSAndroid Build Coastguard Worker
1068*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float lod) const;
1069*35238bceSAndroid Build Coastguard Worker Vec4 sampleOffset(const Sampler &sampler, float s, float lod, int32_t offset) const;
1070*35238bceSAndroid Build Coastguard Worker float sampleCompare(const Sampler &sampler, float ref, float s, float lod) const;
1071*35238bceSAndroid Build Coastguard Worker float sampleCompareOffset(const Sampler &sampler, float ref, float s, float lod, int32_t offset) const;
1072*35238bceSAndroid Build Coastguard Worker
getImageViewMinLodParams(void) const1073*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *getImageViewMinLodParams(void) const
1074*35238bceSAndroid Build Coastguard Worker {
1075*35238bceSAndroid Build Coastguard Worker return DE_NULL;
1076*35238bceSAndroid Build Coastguard Worker }
1077*35238bceSAndroid Build Coastguard Worker
1078*35238bceSAndroid Build Coastguard Worker protected:
1079*35238bceSAndroid Build Coastguard Worker int m_numLevels;
1080*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *m_levels;
1081*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
1082*35238bceSAndroid Build Coastguard Worker
Texture1DView(int numLevels,const ConstPixelBufferAccess * levels,bool es2 DE_UNUSED_ATTR=false,ImageViewMinLodParams * minLodParams DE_UNUSED_ATTR=DE_NULL)1083*35238bceSAndroid Build Coastguard Worker inline Texture1DView::Texture1DView(int numLevels, const ConstPixelBufferAccess *levels,
1084*35238bceSAndroid Build Coastguard Worker bool es2 DE_UNUSED_ATTR = false,
1085*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *minLodParams DE_UNUSED_ATTR = DE_NULL)
1086*35238bceSAndroid Build Coastguard Worker : m_numLevels(numLevels)
1087*35238bceSAndroid Build Coastguard Worker , m_levels(levels)
1088*35238bceSAndroid Build Coastguard Worker {
1089*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_numLevels >= 0 && ((m_numLevels == 0) == !m_levels));
1090*35238bceSAndroid Build Coastguard Worker }
1091*35238bceSAndroid Build Coastguard Worker
sample(const Sampler & sampler,float s,float lod) const1092*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture1DView::sample(const Sampler &sampler, float s, float lod) const
1093*35238bceSAndroid Build Coastguard Worker {
1094*35238bceSAndroid Build Coastguard Worker return sampleLevelArray1D(m_levels, m_numLevels, sampler, s, 0 /* depth */, lod);
1095*35238bceSAndroid Build Coastguard Worker }
1096*35238bceSAndroid Build Coastguard Worker
sampleOffset(const Sampler & sampler,float s,float lod,int32_t offset) const1097*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture1DView::sampleOffset(const Sampler &sampler, float s, float lod, int32_t offset) const
1098*35238bceSAndroid Build Coastguard Worker {
1099*35238bceSAndroid Build Coastguard Worker return sampleLevelArray1DOffset(m_levels, m_numLevels, sampler, s, lod, IVec2(offset, 0));
1100*35238bceSAndroid Build Coastguard Worker }
1101*35238bceSAndroid Build Coastguard Worker
sampleCompare(const Sampler & sampler,float ref,float s,float lod) const1102*35238bceSAndroid Build Coastguard Worker inline float Texture1DView::sampleCompare(const Sampler &sampler, float ref, float s, float lod) const
1103*35238bceSAndroid Build Coastguard Worker {
1104*35238bceSAndroid Build Coastguard Worker return sampleLevelArray1DCompare(m_levels, m_numLevels, sampler, ref, s, lod, IVec2(0, 0));
1105*35238bceSAndroid Build Coastguard Worker }
1106*35238bceSAndroid Build Coastguard Worker
sampleCompareOffset(const Sampler & sampler,float ref,float s,float lod,int32_t offset) const1107*35238bceSAndroid Build Coastguard Worker inline float Texture1DView::sampleCompareOffset(const Sampler &sampler, float ref, float s, float lod,
1108*35238bceSAndroid Build Coastguard Worker int32_t offset) const
1109*35238bceSAndroid Build Coastguard Worker {
1110*35238bceSAndroid Build Coastguard Worker return sampleLevelArray1DCompare(m_levels, m_numLevels, sampler, ref, s, lod, IVec2(offset, 0));
1111*35238bceSAndroid Build Coastguard Worker }
1112*35238bceSAndroid Build Coastguard Worker
1113*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
1114*35238bceSAndroid Build Coastguard Worker * \brief 1D Texture reference implementation
1115*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
1116*35238bceSAndroid Build Coastguard Worker class Texture1D : private TextureLevelPyramid
1117*35238bceSAndroid Build Coastguard Worker {
1118*35238bceSAndroid Build Coastguard Worker public:
1119*35238bceSAndroid Build Coastguard Worker Texture1D(const TextureFormat &format, int width);
1120*35238bceSAndroid Build Coastguard Worker Texture1D(const Texture1D &other);
1121*35238bceSAndroid Build Coastguard Worker ~Texture1D(void);
1122*35238bceSAndroid Build Coastguard Worker
getWidth(void) const1123*35238bceSAndroid Build Coastguard Worker int getWidth(void) const
1124*35238bceSAndroid Build Coastguard Worker {
1125*35238bceSAndroid Build Coastguard Worker return m_width;
1126*35238bceSAndroid Build Coastguard Worker }
getView(void) const1127*35238bceSAndroid Build Coastguard Worker const Texture1DView &getView(void) const
1128*35238bceSAndroid Build Coastguard Worker {
1129*35238bceSAndroid Build Coastguard Worker return m_view;
1130*35238bceSAndroid Build Coastguard Worker }
1131*35238bceSAndroid Build Coastguard Worker
1132*35238bceSAndroid Build Coastguard Worker void allocLevel(int levelNdx);
1133*35238bceSAndroid Build Coastguard Worker
1134*35238bceSAndroid Build Coastguard Worker // Sampling
1135*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float lod) const;
1136*35238bceSAndroid Build Coastguard Worker Vec4 sampleOffset(const Sampler &sampler, float s, float lod, int32_t offset) const;
1137*35238bceSAndroid Build Coastguard Worker float sampleCompare(const Sampler &sampler, float ref, float s, float lod) const;
1138*35238bceSAndroid Build Coastguard Worker float sampleCompareOffset(const Sampler &sampler, float ref, float s, float lod, int32_t offset) const;
1139*35238bceSAndroid Build Coastguard Worker
1140*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::clearLevel;
1141*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getFormat;
1142*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getLevel;
1143*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getNumLevels;
1144*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::isLevelEmpty;
1145*35238bceSAndroid Build Coastguard Worker
1146*35238bceSAndroid Build Coastguard Worker Texture1D &operator=(const Texture1D &other);
1147*35238bceSAndroid Build Coastguard Worker
operator Texture1DView(void) const1148*35238bceSAndroid Build Coastguard Worker operator Texture1DView(void) const
1149*35238bceSAndroid Build Coastguard Worker {
1150*35238bceSAndroid Build Coastguard Worker return m_view;
1151*35238bceSAndroid Build Coastguard Worker }
1152*35238bceSAndroid Build Coastguard Worker
1153*35238bceSAndroid Build Coastguard Worker private:
1154*35238bceSAndroid Build Coastguard Worker int m_width;
1155*35238bceSAndroid Build Coastguard Worker Texture1DView m_view;
1156*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
1157*35238bceSAndroid Build Coastguard Worker
sample(const Sampler & sampler,float s,float lod) const1158*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture1D::sample(const Sampler &sampler, float s, float lod) const
1159*35238bceSAndroid Build Coastguard Worker {
1160*35238bceSAndroid Build Coastguard Worker return m_view.sample(sampler, s, lod);
1161*35238bceSAndroid Build Coastguard Worker }
1162*35238bceSAndroid Build Coastguard Worker
sampleOffset(const Sampler & sampler,float s,float lod,int32_t offset) const1163*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture1D::sampleOffset(const Sampler &sampler, float s, float lod, int32_t offset) const
1164*35238bceSAndroid Build Coastguard Worker {
1165*35238bceSAndroid Build Coastguard Worker return m_view.sampleOffset(sampler, s, lod, offset);
1166*35238bceSAndroid Build Coastguard Worker }
1167*35238bceSAndroid Build Coastguard Worker
sampleCompare(const Sampler & sampler,float ref,float s,float lod) const1168*35238bceSAndroid Build Coastguard Worker inline float Texture1D::sampleCompare(const Sampler &sampler, float ref, float s, float lod) const
1169*35238bceSAndroid Build Coastguard Worker {
1170*35238bceSAndroid Build Coastguard Worker return m_view.sampleCompare(sampler, ref, s, lod);
1171*35238bceSAndroid Build Coastguard Worker }
1172*35238bceSAndroid Build Coastguard Worker
sampleCompareOffset(const Sampler & sampler,float ref,float s,float lod,int32_t offset) const1173*35238bceSAndroid Build Coastguard Worker inline float Texture1D::sampleCompareOffset(const Sampler &sampler, float ref, float s, float lod, int32_t offset) const
1174*35238bceSAndroid Build Coastguard Worker {
1175*35238bceSAndroid Build Coastguard Worker return m_view.sampleCompareOffset(sampler, ref, s, lod, offset);
1176*35238bceSAndroid Build Coastguard Worker }
1177*35238bceSAndroid Build Coastguard Worker
1178*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
1179*35238bceSAndroid Build Coastguard Worker * \brief 1D Array Texture View
1180*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
1181*35238bceSAndroid Build Coastguard Worker class Texture1DArrayView
1182*35238bceSAndroid Build Coastguard Worker {
1183*35238bceSAndroid Build Coastguard Worker public:
1184*35238bceSAndroid Build Coastguard Worker Texture1DArrayView(int numLevels, const ConstPixelBufferAccess *levels, bool es2 = false,
1185*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *minLodParams = DE_NULL);
1186*35238bceSAndroid Build Coastguard Worker
getWidth(void) const1187*35238bceSAndroid Build Coastguard Worker int getWidth(void) const
1188*35238bceSAndroid Build Coastguard Worker {
1189*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0].getWidth() : 0;
1190*35238bceSAndroid Build Coastguard Worker }
getNumLayers(void) const1191*35238bceSAndroid Build Coastguard Worker int getNumLayers(void) const
1192*35238bceSAndroid Build Coastguard Worker {
1193*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0].getHeight() : 0;
1194*35238bceSAndroid Build Coastguard Worker }
getNumLevels(void) const1195*35238bceSAndroid Build Coastguard Worker int getNumLevels(void) const
1196*35238bceSAndroid Build Coastguard Worker {
1197*35238bceSAndroid Build Coastguard Worker return m_numLevels;
1198*35238bceSAndroid Build Coastguard Worker }
getLevel(int ndx) const1199*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess &getLevel(int ndx) const
1200*35238bceSAndroid Build Coastguard Worker {
1201*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::inBounds(ndx, 0, m_numLevels));
1202*35238bceSAndroid Build Coastguard Worker return m_levels[ndx];
1203*35238bceSAndroid Build Coastguard Worker }
getLevels(void) const1204*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *getLevels(void) const
1205*35238bceSAndroid Build Coastguard Worker {
1206*35238bceSAndroid Build Coastguard Worker return m_levels;
1207*35238bceSAndroid Build Coastguard Worker }
isES2(void) const1208*35238bceSAndroid Build Coastguard Worker bool isES2(void) const
1209*35238bceSAndroid Build Coastguard Worker {
1210*35238bceSAndroid Build Coastguard Worker return false;
1211*35238bceSAndroid Build Coastguard Worker }
1212*35238bceSAndroid Build Coastguard Worker
1213*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float t, float lod) const;
1214*35238bceSAndroid Build Coastguard Worker Vec4 sampleOffset(const Sampler &sampler, float s, float t, float lod, int32_t offset) const;
1215*35238bceSAndroid Build Coastguard Worker float sampleCompare(const Sampler &sampler, float ref, float s, float t, float lod) const;
1216*35238bceSAndroid Build Coastguard Worker float sampleCompareOffset(const Sampler &sampler, float ref, float s, float t, float lod, int32_t offset) const;
1217*35238bceSAndroid Build Coastguard Worker
getImageViewMinLodParams(void) const1218*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *getImageViewMinLodParams(void) const
1219*35238bceSAndroid Build Coastguard Worker {
1220*35238bceSAndroid Build Coastguard Worker return DE_NULL;
1221*35238bceSAndroid Build Coastguard Worker }
1222*35238bceSAndroid Build Coastguard Worker
1223*35238bceSAndroid Build Coastguard Worker protected:
1224*35238bceSAndroid Build Coastguard Worker int selectLayer(float r) const;
1225*35238bceSAndroid Build Coastguard Worker
1226*35238bceSAndroid Build Coastguard Worker int m_numLevels;
1227*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *m_levels;
1228*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
1229*35238bceSAndroid Build Coastguard Worker
1230*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
1231*35238bceSAndroid Build Coastguard Worker * \brief 1D Array Texture reference implementation
1232*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
1233*35238bceSAndroid Build Coastguard Worker class Texture1DArray : private TextureLevelPyramid
1234*35238bceSAndroid Build Coastguard Worker {
1235*35238bceSAndroid Build Coastguard Worker public:
1236*35238bceSAndroid Build Coastguard Worker Texture1DArray(const TextureFormat &format, int width, int numLayers);
1237*35238bceSAndroid Build Coastguard Worker Texture1DArray(const Texture1DArray &other);
1238*35238bceSAndroid Build Coastguard Worker ~Texture1DArray(void);
1239*35238bceSAndroid Build Coastguard Worker
getWidth(void) const1240*35238bceSAndroid Build Coastguard Worker int getWidth(void) const
1241*35238bceSAndroid Build Coastguard Worker {
1242*35238bceSAndroid Build Coastguard Worker return m_width;
1243*35238bceSAndroid Build Coastguard Worker }
getNumLayers(void) const1244*35238bceSAndroid Build Coastguard Worker int getNumLayers(void) const
1245*35238bceSAndroid Build Coastguard Worker {
1246*35238bceSAndroid Build Coastguard Worker return m_numLayers;
1247*35238bceSAndroid Build Coastguard Worker }
1248*35238bceSAndroid Build Coastguard Worker
1249*35238bceSAndroid Build Coastguard Worker void allocLevel(int levelNdx);
1250*35238bceSAndroid Build Coastguard Worker
1251*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::clearLevel;
1252*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getFormat;
1253*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getLevel;
1254*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getNumLevels;
1255*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::isLevelEmpty;
1256*35238bceSAndroid Build Coastguard Worker
1257*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float t, float lod) const;
1258*35238bceSAndroid Build Coastguard Worker Vec4 sampleOffset(const Sampler &sampler, float s, float t, float lod, int32_t offset) const;
1259*35238bceSAndroid Build Coastguard Worker float sampleCompare(const Sampler &sampler, float ref, float s, float t, float lod) const;
1260*35238bceSAndroid Build Coastguard Worker float sampleCompareOffset(const Sampler &sampler, float ref, float s, float t, float lod, int32_t offset) const;
1261*35238bceSAndroid Build Coastguard Worker
1262*35238bceSAndroid Build Coastguard Worker Texture1DArray &operator=(const Texture1DArray &other);
1263*35238bceSAndroid Build Coastguard Worker
operator Texture1DArrayView(void) const1264*35238bceSAndroid Build Coastguard Worker operator Texture1DArrayView(void) const
1265*35238bceSAndroid Build Coastguard Worker {
1266*35238bceSAndroid Build Coastguard Worker return m_view;
1267*35238bceSAndroid Build Coastguard Worker }
1268*35238bceSAndroid Build Coastguard Worker
1269*35238bceSAndroid Build Coastguard Worker private:
1270*35238bceSAndroid Build Coastguard Worker int m_width;
1271*35238bceSAndroid Build Coastguard Worker int m_numLayers;
1272*35238bceSAndroid Build Coastguard Worker Texture1DArrayView m_view;
1273*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
1274*35238bceSAndroid Build Coastguard Worker
sample(const Sampler & sampler,float s,float t,float lod) const1275*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture1DArray::sample(const Sampler &sampler, float s, float t, float lod) const
1276*35238bceSAndroid Build Coastguard Worker {
1277*35238bceSAndroid Build Coastguard Worker return m_view.sample(sampler, s, t, lod);
1278*35238bceSAndroid Build Coastguard Worker }
1279*35238bceSAndroid Build Coastguard Worker
sampleOffset(const Sampler & sampler,float s,float t,float lod,int32_t offset) const1280*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture1DArray::sampleOffset(const Sampler &sampler, float s, float t, float lod, int32_t offset) const
1281*35238bceSAndroid Build Coastguard Worker {
1282*35238bceSAndroid Build Coastguard Worker return m_view.sampleOffset(sampler, s, t, lod, offset);
1283*35238bceSAndroid Build Coastguard Worker }
1284*35238bceSAndroid Build Coastguard Worker
sampleCompare(const Sampler & sampler,float ref,float s,float t,float lod) const1285*35238bceSAndroid Build Coastguard Worker inline float Texture1DArray::sampleCompare(const Sampler &sampler, float ref, float s, float t, float lod) const
1286*35238bceSAndroid Build Coastguard Worker {
1287*35238bceSAndroid Build Coastguard Worker return m_view.sampleCompare(sampler, ref, s, t, lod);
1288*35238bceSAndroid Build Coastguard Worker }
1289*35238bceSAndroid Build Coastguard Worker
sampleCompareOffset(const Sampler & sampler,float ref,float s,float t,float lod,int32_t offset) const1290*35238bceSAndroid Build Coastguard Worker inline float Texture1DArray::sampleCompareOffset(const Sampler &sampler, float ref, float s, float t, float lod,
1291*35238bceSAndroid Build Coastguard Worker int32_t offset) const
1292*35238bceSAndroid Build Coastguard Worker {
1293*35238bceSAndroid Build Coastguard Worker return m_view.sampleCompareOffset(sampler, ref, s, t, lod, offset);
1294*35238bceSAndroid Build Coastguard Worker }
1295*35238bceSAndroid Build Coastguard Worker
1296*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
1297*35238bceSAndroid Build Coastguard Worker * \brief 2D Array Texture View
1298*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
1299*35238bceSAndroid Build Coastguard Worker class Texture2DArrayView
1300*35238bceSAndroid Build Coastguard Worker {
1301*35238bceSAndroid Build Coastguard Worker public:
1302*35238bceSAndroid Build Coastguard Worker Texture2DArrayView(int numLevels, const ConstPixelBufferAccess *levels, bool es2 = false,
1303*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *minLodParams = DE_NULL);
1304*35238bceSAndroid Build Coastguard Worker
getWidth(void) const1305*35238bceSAndroid Build Coastguard Worker int getWidth(void) const
1306*35238bceSAndroid Build Coastguard Worker {
1307*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0].getWidth() : 0;
1308*35238bceSAndroid Build Coastguard Worker }
getHeight(void) const1309*35238bceSAndroid Build Coastguard Worker int getHeight(void) const
1310*35238bceSAndroid Build Coastguard Worker {
1311*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0].getHeight() : 0;
1312*35238bceSAndroid Build Coastguard Worker }
getNumLayers(void) const1313*35238bceSAndroid Build Coastguard Worker int getNumLayers(void) const
1314*35238bceSAndroid Build Coastguard Worker {
1315*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0].getDepth() : 0;
1316*35238bceSAndroid Build Coastguard Worker }
getNumLevels(void) const1317*35238bceSAndroid Build Coastguard Worker int getNumLevels(void) const
1318*35238bceSAndroid Build Coastguard Worker {
1319*35238bceSAndroid Build Coastguard Worker return m_numLevels;
1320*35238bceSAndroid Build Coastguard Worker }
getLevel(int ndx) const1321*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess &getLevel(int ndx) const
1322*35238bceSAndroid Build Coastguard Worker {
1323*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::inBounds(ndx, 0, m_numLevels));
1324*35238bceSAndroid Build Coastguard Worker return m_levels[ndx];
1325*35238bceSAndroid Build Coastguard Worker }
getLevels(void) const1326*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *getLevels(void) const
1327*35238bceSAndroid Build Coastguard Worker {
1328*35238bceSAndroid Build Coastguard Worker return m_levels;
1329*35238bceSAndroid Build Coastguard Worker }
isES2(void) const1330*35238bceSAndroid Build Coastguard Worker bool isES2(void) const
1331*35238bceSAndroid Build Coastguard Worker {
1332*35238bceSAndroid Build Coastguard Worker return false;
1333*35238bceSAndroid Build Coastguard Worker }
1334*35238bceSAndroid Build Coastguard Worker
1335*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float t, float r, float lod) const;
1336*35238bceSAndroid Build Coastguard Worker Vec4 sampleOffset(const Sampler &sampler, float s, float t, float r, float lod, const IVec2 &offset) const;
1337*35238bceSAndroid Build Coastguard Worker float sampleCompare(const Sampler &sampler, float ref, float s, float t, float r, float lod) const;
1338*35238bceSAndroid Build Coastguard Worker float sampleCompareOffset(const Sampler &sampler, float ref, float s, float t, float r, float lod,
1339*35238bceSAndroid Build Coastguard Worker const IVec2 &offset) const;
1340*35238bceSAndroid Build Coastguard Worker
1341*35238bceSAndroid Build Coastguard Worker Vec4 gatherOffsets(const Sampler &sampler, float s, float t, float r, int componentNdx,
1342*35238bceSAndroid Build Coastguard Worker const IVec2 (&offsets)[4]) const;
1343*35238bceSAndroid Build Coastguard Worker Vec4 gatherOffsetsCompare(const Sampler &sampler, float ref, float s, float t, float r,
1344*35238bceSAndroid Build Coastguard Worker const IVec2 (&offsets)[4]) const;
1345*35238bceSAndroid Build Coastguard Worker
getImageViewMinLodParams(void) const1346*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *getImageViewMinLodParams(void) const
1347*35238bceSAndroid Build Coastguard Worker {
1348*35238bceSAndroid Build Coastguard Worker return DE_NULL;
1349*35238bceSAndroid Build Coastguard Worker }
1350*35238bceSAndroid Build Coastguard Worker
1351*35238bceSAndroid Build Coastguard Worker protected:
1352*35238bceSAndroid Build Coastguard Worker int selectLayer(float r) const;
1353*35238bceSAndroid Build Coastguard Worker
1354*35238bceSAndroid Build Coastguard Worker int m_numLevels;
1355*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *m_levels;
1356*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
1357*35238bceSAndroid Build Coastguard Worker
1358*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
1359*35238bceSAndroid Build Coastguard Worker * \brief 2D Array Texture reference implementation
1360*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
1361*35238bceSAndroid Build Coastguard Worker class Texture2DArray : private TextureLevelPyramid
1362*35238bceSAndroid Build Coastguard Worker {
1363*35238bceSAndroid Build Coastguard Worker public:
1364*35238bceSAndroid Build Coastguard Worker Texture2DArray(const TextureFormat &format, int width, int height, int numLayers);
1365*35238bceSAndroid Build Coastguard Worker Texture2DArray(const Texture2DArray &other);
1366*35238bceSAndroid Build Coastguard Worker ~Texture2DArray(void);
1367*35238bceSAndroid Build Coastguard Worker
getWidth(void) const1368*35238bceSAndroid Build Coastguard Worker int getWidth(void) const
1369*35238bceSAndroid Build Coastguard Worker {
1370*35238bceSAndroid Build Coastguard Worker return m_width;
1371*35238bceSAndroid Build Coastguard Worker }
getHeight(void) const1372*35238bceSAndroid Build Coastguard Worker int getHeight(void) const
1373*35238bceSAndroid Build Coastguard Worker {
1374*35238bceSAndroid Build Coastguard Worker return m_height;
1375*35238bceSAndroid Build Coastguard Worker }
getNumLayers(void) const1376*35238bceSAndroid Build Coastguard Worker int getNumLayers(void) const
1377*35238bceSAndroid Build Coastguard Worker {
1378*35238bceSAndroid Build Coastguard Worker return m_numLayers;
1379*35238bceSAndroid Build Coastguard Worker }
1380*35238bceSAndroid Build Coastguard Worker
1381*35238bceSAndroid Build Coastguard Worker void allocLevel(int levelNdx);
1382*35238bceSAndroid Build Coastguard Worker
1383*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::clearLevel;
1384*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getFormat;
1385*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getLevel;
1386*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getNumLevels;
1387*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::isLevelEmpty;
1388*35238bceSAndroid Build Coastguard Worker
1389*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float t, float r, float lod) const;
1390*35238bceSAndroid Build Coastguard Worker Vec4 sampleOffset(const Sampler &sampler, float s, float t, float r, float lod, const IVec2 &offset) const;
1391*35238bceSAndroid Build Coastguard Worker float sampleCompare(const Sampler &sampler, float ref, float s, float t, float r, float lod) const;
1392*35238bceSAndroid Build Coastguard Worker float sampleCompareOffset(const Sampler &sampler, float ref, float s, float t, float r, float lod,
1393*35238bceSAndroid Build Coastguard Worker const IVec2 &offset) const;
1394*35238bceSAndroid Build Coastguard Worker
1395*35238bceSAndroid Build Coastguard Worker Vec4 gatherOffsets(const Sampler &sampler, float s, float t, float r, int componentNdx,
1396*35238bceSAndroid Build Coastguard Worker const IVec2 (&offsets)[4]) const;
1397*35238bceSAndroid Build Coastguard Worker Vec4 gatherOffsetsCompare(const Sampler &sampler, float ref, float s, float t, float r,
1398*35238bceSAndroid Build Coastguard Worker const IVec2 (&offsets)[4]) const;
1399*35238bceSAndroid Build Coastguard Worker
1400*35238bceSAndroid Build Coastguard Worker Texture2DArray &operator=(const Texture2DArray &other);
1401*35238bceSAndroid Build Coastguard Worker
operator Texture2DArrayView(void) const1402*35238bceSAndroid Build Coastguard Worker operator Texture2DArrayView(void) const
1403*35238bceSAndroid Build Coastguard Worker {
1404*35238bceSAndroid Build Coastguard Worker return m_view;
1405*35238bceSAndroid Build Coastguard Worker }
1406*35238bceSAndroid Build Coastguard Worker
1407*35238bceSAndroid Build Coastguard Worker private:
1408*35238bceSAndroid Build Coastguard Worker int m_width;
1409*35238bceSAndroid Build Coastguard Worker int m_height;
1410*35238bceSAndroid Build Coastguard Worker int m_numLayers;
1411*35238bceSAndroid Build Coastguard Worker Texture2DArrayView m_view;
1412*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
1413*35238bceSAndroid Build Coastguard Worker
sample(const Sampler & sampler,float s,float t,float r,float lod) const1414*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture2DArray::sample(const Sampler &sampler, float s, float t, float r, float lod) const
1415*35238bceSAndroid Build Coastguard Worker {
1416*35238bceSAndroid Build Coastguard Worker return m_view.sample(sampler, s, t, r, lod);
1417*35238bceSAndroid Build Coastguard Worker }
1418*35238bceSAndroid Build Coastguard Worker
sampleOffset(const Sampler & sampler,float s,float t,float r,float lod,const IVec2 & offset) const1419*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture2DArray::sampleOffset(const Sampler &sampler, float s, float t, float r, float lod,
1420*35238bceSAndroid Build Coastguard Worker const IVec2 &offset) const
1421*35238bceSAndroid Build Coastguard Worker {
1422*35238bceSAndroid Build Coastguard Worker return m_view.sampleOffset(sampler, s, t, r, lod, offset);
1423*35238bceSAndroid Build Coastguard Worker }
1424*35238bceSAndroid Build Coastguard Worker
sampleCompare(const Sampler & sampler,float ref,float s,float t,float r,float lod) const1425*35238bceSAndroid Build Coastguard Worker inline float Texture2DArray::sampleCompare(const Sampler &sampler, float ref, float s, float t, float r,
1426*35238bceSAndroid Build Coastguard Worker float lod) const
1427*35238bceSAndroid Build Coastguard Worker {
1428*35238bceSAndroid Build Coastguard Worker return m_view.sampleCompare(sampler, ref, s, t, r, lod);
1429*35238bceSAndroid Build Coastguard Worker }
1430*35238bceSAndroid Build Coastguard Worker
sampleCompareOffset(const Sampler & sampler,float ref,float s,float t,float r,float lod,const IVec2 & offset) const1431*35238bceSAndroid Build Coastguard Worker inline float Texture2DArray::sampleCompareOffset(const Sampler &sampler, float ref, float s, float t, float r,
1432*35238bceSAndroid Build Coastguard Worker float lod, const IVec2 &offset) const
1433*35238bceSAndroid Build Coastguard Worker {
1434*35238bceSAndroid Build Coastguard Worker return m_view.sampleCompareOffset(sampler, ref, s, t, r, lod, offset);
1435*35238bceSAndroid Build Coastguard Worker }
1436*35238bceSAndroid Build Coastguard Worker
gatherOffsets(const Sampler & sampler,float s,float t,float r,int componentNdx,const IVec2 (& offsets)[4]) const1437*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture2DArray::gatherOffsets(const Sampler &sampler, float s, float t, float r, int componentNdx,
1438*35238bceSAndroid Build Coastguard Worker const IVec2 (&offsets)[4]) const
1439*35238bceSAndroid Build Coastguard Worker {
1440*35238bceSAndroid Build Coastguard Worker return m_view.gatherOffsets(sampler, s, t, r, componentNdx, offsets);
1441*35238bceSAndroid Build Coastguard Worker }
1442*35238bceSAndroid Build Coastguard Worker
gatherOffsetsCompare(const Sampler & sampler,float ref,float s,float t,float r,const IVec2 (& offsets)[4]) const1443*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture2DArray::gatherOffsetsCompare(const Sampler &sampler, float ref, float s, float t, float r,
1444*35238bceSAndroid Build Coastguard Worker const IVec2 (&offsets)[4]) const
1445*35238bceSAndroid Build Coastguard Worker {
1446*35238bceSAndroid Build Coastguard Worker return m_view.gatherOffsetsCompare(sampler, ref, s, t, r, offsets);
1447*35238bceSAndroid Build Coastguard Worker }
1448*35238bceSAndroid Build Coastguard Worker
1449*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
1450*35238bceSAndroid Build Coastguard Worker * \brief 3D Texture View
1451*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
1452*35238bceSAndroid Build Coastguard Worker class Texture3DView
1453*35238bceSAndroid Build Coastguard Worker {
1454*35238bceSAndroid Build Coastguard Worker public:
1455*35238bceSAndroid Build Coastguard Worker Texture3DView(int numLevels, const ConstPixelBufferAccess *levels, bool es2 = false,
1456*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *minLodParams = DE_NULL);
1457*35238bceSAndroid Build Coastguard Worker
getWidth(void) const1458*35238bceSAndroid Build Coastguard Worker int getWidth(void) const
1459*35238bceSAndroid Build Coastguard Worker {
1460*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0].getWidth() : 0;
1461*35238bceSAndroid Build Coastguard Worker }
getHeight(void) const1462*35238bceSAndroid Build Coastguard Worker int getHeight(void) const
1463*35238bceSAndroid Build Coastguard Worker {
1464*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0].getHeight() : 0;
1465*35238bceSAndroid Build Coastguard Worker }
getDepth(void) const1466*35238bceSAndroid Build Coastguard Worker int getDepth(void) const
1467*35238bceSAndroid Build Coastguard Worker {
1468*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0].getDepth() : 0;
1469*35238bceSAndroid Build Coastguard Worker }
getNumLevels(void) const1470*35238bceSAndroid Build Coastguard Worker int getNumLevels(void) const
1471*35238bceSAndroid Build Coastguard Worker {
1472*35238bceSAndroid Build Coastguard Worker return m_numLevels;
1473*35238bceSAndroid Build Coastguard Worker }
getLevel(int ndx) const1474*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess &getLevel(int ndx) const
1475*35238bceSAndroid Build Coastguard Worker {
1476*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::inBounds(ndx, 0, m_numLevels));
1477*35238bceSAndroid Build Coastguard Worker return m_levels[ndx];
1478*35238bceSAndroid Build Coastguard Worker }
getLevels(void) const1479*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *getLevels(void) const
1480*35238bceSAndroid Build Coastguard Worker {
1481*35238bceSAndroid Build Coastguard Worker return m_levels;
1482*35238bceSAndroid Build Coastguard Worker }
isES2(void) const1483*35238bceSAndroid Build Coastguard Worker bool isES2(void) const
1484*35238bceSAndroid Build Coastguard Worker {
1485*35238bceSAndroid Build Coastguard Worker return m_es2;
1486*35238bceSAndroid Build Coastguard Worker }
1487*35238bceSAndroid Build Coastguard Worker
1488*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float t, float r, float lod) const;
1489*35238bceSAndroid Build Coastguard Worker Vec4 sampleOffset(const Sampler &sampler, float s, float t, float r, float lod, const IVec3 &offset) const;
1490*35238bceSAndroid Build Coastguard Worker
getImageViewMinLodParams(void) const1491*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *getImageViewMinLodParams(void) const
1492*35238bceSAndroid Build Coastguard Worker {
1493*35238bceSAndroid Build Coastguard Worker return m_minLodParams;
1494*35238bceSAndroid Build Coastguard Worker }
1495*35238bceSAndroid Build Coastguard Worker
1496*35238bceSAndroid Build Coastguard Worker protected:
1497*35238bceSAndroid Build Coastguard Worker int m_numLevels;
1498*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *m_levels;
1499*35238bceSAndroid Build Coastguard Worker bool m_es2;
1500*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *m_minLodParams;
1501*35238bceSAndroid Build Coastguard Worker
1502*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
1503*35238bceSAndroid Build Coastguard Worker
sample(const Sampler & sampler,float s,float t,float r,float lod) const1504*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture3DView::sample(const Sampler &sampler, float s, float t, float r, float lod) const
1505*35238bceSAndroid Build Coastguard Worker {
1506*35238bceSAndroid Build Coastguard Worker return sampleLevelArray3D(m_levels, m_numLevels, sampler, s, t, r, lod, m_minLodParams);
1507*35238bceSAndroid Build Coastguard Worker }
1508*35238bceSAndroid Build Coastguard Worker
sampleOffset(const Sampler & sampler,float s,float t,float r,float lod,const IVec3 & offset) const1509*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture3DView::sampleOffset(const Sampler &sampler, float s, float t, float r, float lod,
1510*35238bceSAndroid Build Coastguard Worker const IVec3 &offset) const
1511*35238bceSAndroid Build Coastguard Worker {
1512*35238bceSAndroid Build Coastguard Worker return sampleLevelArray3DOffset(m_levels, m_numLevels, sampler, s, t, r, lod, offset, m_minLodParams);
1513*35238bceSAndroid Build Coastguard Worker }
1514*35238bceSAndroid Build Coastguard Worker
1515*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
1516*35238bceSAndroid Build Coastguard Worker * \brief 3D Texture reference implementation
1517*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
1518*35238bceSAndroid Build Coastguard Worker class Texture3D : private TextureLevelPyramid
1519*35238bceSAndroid Build Coastguard Worker {
1520*35238bceSAndroid Build Coastguard Worker public:
1521*35238bceSAndroid Build Coastguard Worker Texture3D(const TextureFormat &format, int width, int height, int depth);
1522*35238bceSAndroid Build Coastguard Worker Texture3D(const Texture3D &other);
1523*35238bceSAndroid Build Coastguard Worker ~Texture3D(void);
1524*35238bceSAndroid Build Coastguard Worker
getWidth(void) const1525*35238bceSAndroid Build Coastguard Worker int getWidth(void) const
1526*35238bceSAndroid Build Coastguard Worker {
1527*35238bceSAndroid Build Coastguard Worker return m_width;
1528*35238bceSAndroid Build Coastguard Worker }
getHeight(void) const1529*35238bceSAndroid Build Coastguard Worker int getHeight(void) const
1530*35238bceSAndroid Build Coastguard Worker {
1531*35238bceSAndroid Build Coastguard Worker return m_height;
1532*35238bceSAndroid Build Coastguard Worker }
getDepth(void) const1533*35238bceSAndroid Build Coastguard Worker int getDepth(void) const
1534*35238bceSAndroid Build Coastguard Worker {
1535*35238bceSAndroid Build Coastguard Worker return m_depth;
1536*35238bceSAndroid Build Coastguard Worker }
1537*35238bceSAndroid Build Coastguard Worker
1538*35238bceSAndroid Build Coastguard Worker void allocLevel(int levelNdx);
1539*35238bceSAndroid Build Coastguard Worker
1540*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::clearLevel;
1541*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getFormat;
1542*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getLevel;
1543*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getNumLevels;
1544*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::isLevelEmpty;
1545*35238bceSAndroid Build Coastguard Worker
1546*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float t, float r, float lod) const;
1547*35238bceSAndroid Build Coastguard Worker Vec4 sampleOffset(const Sampler &sampler, float s, float t, float r, float lod, const IVec3 &offset) const;
1548*35238bceSAndroid Build Coastguard Worker
1549*35238bceSAndroid Build Coastguard Worker Texture3D &operator=(const Texture3D &other);
1550*35238bceSAndroid Build Coastguard Worker
operator Texture3DView(void) const1551*35238bceSAndroid Build Coastguard Worker operator Texture3DView(void) const
1552*35238bceSAndroid Build Coastguard Worker {
1553*35238bceSAndroid Build Coastguard Worker return m_view;
1554*35238bceSAndroid Build Coastguard Worker }
1555*35238bceSAndroid Build Coastguard Worker
1556*35238bceSAndroid Build Coastguard Worker private:
1557*35238bceSAndroid Build Coastguard Worker int m_width;
1558*35238bceSAndroid Build Coastguard Worker int m_height;
1559*35238bceSAndroid Build Coastguard Worker int m_depth;
1560*35238bceSAndroid Build Coastguard Worker Texture3DView m_view;
1561*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
1562*35238bceSAndroid Build Coastguard Worker
sample(const Sampler & sampler,float s,float t,float r,float lod) const1563*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture3D::sample(const Sampler &sampler, float s, float t, float r, float lod) const
1564*35238bceSAndroid Build Coastguard Worker {
1565*35238bceSAndroid Build Coastguard Worker return m_view.sample(sampler, s, t, r, lod);
1566*35238bceSAndroid Build Coastguard Worker }
1567*35238bceSAndroid Build Coastguard Worker
sampleOffset(const Sampler & sampler,float s,float t,float r,float lod,const IVec3 & offset) const1568*35238bceSAndroid Build Coastguard Worker inline Vec4 Texture3D::sampleOffset(const Sampler &sampler, float s, float t, float r, float lod,
1569*35238bceSAndroid Build Coastguard Worker const IVec3 &offset) const
1570*35238bceSAndroid Build Coastguard Worker {
1571*35238bceSAndroid Build Coastguard Worker return m_view.sampleOffset(sampler, s, t, r, lod, offset);
1572*35238bceSAndroid Build Coastguard Worker }
1573*35238bceSAndroid Build Coastguard Worker
1574*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
1575*35238bceSAndroid Build Coastguard Worker * \brief Cube Map Array Texture View
1576*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
1577*35238bceSAndroid Build Coastguard Worker class TextureCubeArrayView
1578*35238bceSAndroid Build Coastguard Worker {
1579*35238bceSAndroid Build Coastguard Worker public:
1580*35238bceSAndroid Build Coastguard Worker TextureCubeArrayView(int numLevels, const ConstPixelBufferAccess *levels, bool es2 = false,
1581*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *minLodParams = DE_NULL);
1582*35238bceSAndroid Build Coastguard Worker
getSize(void) const1583*35238bceSAndroid Build Coastguard Worker int getSize(void) const
1584*35238bceSAndroid Build Coastguard Worker {
1585*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0].getWidth() : 0;
1586*35238bceSAndroid Build Coastguard Worker }
getDepth(void) const1587*35238bceSAndroid Build Coastguard Worker int getDepth(void) const
1588*35238bceSAndroid Build Coastguard Worker {
1589*35238bceSAndroid Build Coastguard Worker return m_numLevels > 0 ? m_levels[0].getDepth() : 0;
1590*35238bceSAndroid Build Coastguard Worker }
getNumLayers(void) const1591*35238bceSAndroid Build Coastguard Worker int getNumLayers(void) const
1592*35238bceSAndroid Build Coastguard Worker {
1593*35238bceSAndroid Build Coastguard Worker return getDepth() / 6;
1594*35238bceSAndroid Build Coastguard Worker }
getNumLevels(void) const1595*35238bceSAndroid Build Coastguard Worker int getNumLevels(void) const
1596*35238bceSAndroid Build Coastguard Worker {
1597*35238bceSAndroid Build Coastguard Worker return m_numLevels;
1598*35238bceSAndroid Build Coastguard Worker }
getLevel(int ndx) const1599*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess &getLevel(int ndx) const
1600*35238bceSAndroid Build Coastguard Worker {
1601*35238bceSAndroid Build Coastguard Worker DE_ASSERT(de::inBounds(ndx, 0, m_numLevels));
1602*35238bceSAndroid Build Coastguard Worker return m_levels[ndx];
1603*35238bceSAndroid Build Coastguard Worker }
getLevels(void) const1604*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *getLevels(void) const
1605*35238bceSAndroid Build Coastguard Worker {
1606*35238bceSAndroid Build Coastguard Worker return m_levels;
1607*35238bceSAndroid Build Coastguard Worker }
isES2(void) const1608*35238bceSAndroid Build Coastguard Worker bool isES2(void) const
1609*35238bceSAndroid Build Coastguard Worker {
1610*35238bceSAndroid Build Coastguard Worker return false;
1611*35238bceSAndroid Build Coastguard Worker }
1612*35238bceSAndroid Build Coastguard Worker
1613*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float t, float r, float q, float lod) const;
1614*35238bceSAndroid Build Coastguard Worker Vec4 sampleOffset(const Sampler &sampler, float s, float t, float r, float q, float lod, const IVec2 &offset) const;
1615*35238bceSAndroid Build Coastguard Worker float sampleCompare(const Sampler &sampler, float ref, float s, float t, float r, float q, float lod) const;
1616*35238bceSAndroid Build Coastguard Worker float sampleCompareOffset(const Sampler &sampler, float ref, float s, float t, float r, float q, float lod,
1617*35238bceSAndroid Build Coastguard Worker const IVec2 &offset) const;
1618*35238bceSAndroid Build Coastguard Worker
getImageViewMinLodParams(void) const1619*35238bceSAndroid Build Coastguard Worker ImageViewMinLodParams *getImageViewMinLodParams(void) const
1620*35238bceSAndroid Build Coastguard Worker {
1621*35238bceSAndroid Build Coastguard Worker return DE_NULL;
1622*35238bceSAndroid Build Coastguard Worker }
1623*35238bceSAndroid Build Coastguard Worker
1624*35238bceSAndroid Build Coastguard Worker protected:
1625*35238bceSAndroid Build Coastguard Worker int selectLayer(float q) const;
1626*35238bceSAndroid Build Coastguard Worker
1627*35238bceSAndroid Build Coastguard Worker int m_numLevels;
1628*35238bceSAndroid Build Coastguard Worker const ConstPixelBufferAccess *m_levels;
1629*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
1630*35238bceSAndroid Build Coastguard Worker
1631*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*!
1632*35238bceSAndroid Build Coastguard Worker * \brief Cube Map Array Texture reference implementation
1633*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
1634*35238bceSAndroid Build Coastguard Worker class TextureCubeArray : private TextureLevelPyramid
1635*35238bceSAndroid Build Coastguard Worker {
1636*35238bceSAndroid Build Coastguard Worker public:
1637*35238bceSAndroid Build Coastguard Worker TextureCubeArray(const TextureFormat &format, int size, int depth);
1638*35238bceSAndroid Build Coastguard Worker TextureCubeArray(const TextureCubeArray &other);
1639*35238bceSAndroid Build Coastguard Worker ~TextureCubeArray(void);
1640*35238bceSAndroid Build Coastguard Worker
getSize(void) const1641*35238bceSAndroid Build Coastguard Worker int getSize(void) const
1642*35238bceSAndroid Build Coastguard Worker {
1643*35238bceSAndroid Build Coastguard Worker return m_size;
1644*35238bceSAndroid Build Coastguard Worker }
getDepth(void) const1645*35238bceSAndroid Build Coastguard Worker int getDepth(void) const
1646*35238bceSAndroid Build Coastguard Worker {
1647*35238bceSAndroid Build Coastguard Worker return m_depth;
1648*35238bceSAndroid Build Coastguard Worker }
1649*35238bceSAndroid Build Coastguard Worker
1650*35238bceSAndroid Build Coastguard Worker void allocLevel(int levelNdx);
1651*35238bceSAndroid Build Coastguard Worker
1652*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::clearLevel;
1653*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getFormat;
1654*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getLevel;
1655*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::getNumLevels;
1656*35238bceSAndroid Build Coastguard Worker using TextureLevelPyramid::isLevelEmpty;
1657*35238bceSAndroid Build Coastguard Worker
1658*35238bceSAndroid Build Coastguard Worker Vec4 sample(const Sampler &sampler, float s, float t, float r, float q, float lod) const;
1659*35238bceSAndroid Build Coastguard Worker Vec4 sampleOffset(const Sampler &sampler, float s, float t, float r, float q, float lod, const IVec2 &offset) const;
1660*35238bceSAndroid Build Coastguard Worker float sampleCompare(const Sampler &sampler, float ref, float s, float t, float r, float q, float lod) const;
1661*35238bceSAndroid Build Coastguard Worker float sampleCompareOffset(const Sampler &sampler, float ref, float s, float t, float r, float q, float lod,
1662*35238bceSAndroid Build Coastguard Worker const IVec2 &offset) const;
1663*35238bceSAndroid Build Coastguard Worker
1664*35238bceSAndroid Build Coastguard Worker TextureCubeArray &operator=(const TextureCubeArray &other);
1665*35238bceSAndroid Build Coastguard Worker
operator TextureCubeArrayView(void) const1666*35238bceSAndroid Build Coastguard Worker operator TextureCubeArrayView(void) const
1667*35238bceSAndroid Build Coastguard Worker {
1668*35238bceSAndroid Build Coastguard Worker return m_view;
1669*35238bceSAndroid Build Coastguard Worker }
1670*35238bceSAndroid Build Coastguard Worker
1671*35238bceSAndroid Build Coastguard Worker private:
1672*35238bceSAndroid Build Coastguard Worker int m_size;
1673*35238bceSAndroid Build Coastguard Worker int m_depth;
1674*35238bceSAndroid Build Coastguard Worker TextureCubeArrayView m_view;
1675*35238bceSAndroid Build Coastguard Worker } DE_WARN_UNUSED_TYPE;
1676*35238bceSAndroid Build Coastguard Worker
sample(const Sampler & sampler,float s,float t,float r,float q,float lod) const1677*35238bceSAndroid Build Coastguard Worker inline Vec4 TextureCubeArray::sample(const Sampler &sampler, float s, float t, float r, float q, float lod) const
1678*35238bceSAndroid Build Coastguard Worker {
1679*35238bceSAndroid Build Coastguard Worker return m_view.sample(sampler, s, t, r, q, lod);
1680*35238bceSAndroid Build Coastguard Worker }
1681*35238bceSAndroid Build Coastguard Worker
sampleOffset(const Sampler & sampler,float s,float t,float r,float q,float lod,const IVec2 & offset) const1682*35238bceSAndroid Build Coastguard Worker inline Vec4 TextureCubeArray::sampleOffset(const Sampler &sampler, float s, float t, float r, float q, float lod,
1683*35238bceSAndroid Build Coastguard Worker const IVec2 &offset) const
1684*35238bceSAndroid Build Coastguard Worker {
1685*35238bceSAndroid Build Coastguard Worker return m_view.sampleOffset(sampler, s, t, r, q, lod, offset);
1686*35238bceSAndroid Build Coastguard Worker }
1687*35238bceSAndroid Build Coastguard Worker
sampleCompare(const Sampler & sampler,float ref,float s,float t,float r,float q,float lod) const1688*35238bceSAndroid Build Coastguard Worker inline float TextureCubeArray::sampleCompare(const Sampler &sampler, float ref, float s, float t, float r, float q,
1689*35238bceSAndroid Build Coastguard Worker float lod) const
1690*35238bceSAndroid Build Coastguard Worker {
1691*35238bceSAndroid Build Coastguard Worker return m_view.sampleCompare(sampler, ref, s, t, r, q, lod);
1692*35238bceSAndroid Build Coastguard Worker }
1693*35238bceSAndroid Build Coastguard Worker
sampleCompareOffset(const Sampler & sampler,float ref,float s,float t,float r,float q,float lod,const IVec2 & offset) const1694*35238bceSAndroid Build Coastguard Worker inline float TextureCubeArray::sampleCompareOffset(const Sampler &sampler, float ref, float s, float t, float r,
1695*35238bceSAndroid Build Coastguard Worker float q, float lod, const IVec2 &offset) const
1696*35238bceSAndroid Build Coastguard Worker {
1697*35238bceSAndroid Build Coastguard Worker return m_view.sampleCompareOffset(sampler, ref, s, t, r, q, lod, offset);
1698*35238bceSAndroid Build Coastguard Worker }
1699*35238bceSAndroid Build Coastguard Worker
1700*35238bceSAndroid Build Coastguard Worker // Stream operators.
1701*35238bceSAndroid Build Coastguard Worker std::ostream &operator<<(std::ostream &str, TextureFormat::ChannelOrder order);
1702*35238bceSAndroid Build Coastguard Worker std::ostream &operator<<(std::ostream &str, TextureFormat::ChannelType type);
1703*35238bceSAndroid Build Coastguard Worker std::ostream &operator<<(std::ostream &str, TextureFormat format);
1704*35238bceSAndroid Build Coastguard Worker std::ostream &operator<<(std::ostream &str, CubeFace face);
1705*35238bceSAndroid Build Coastguard Worker std::ostream &operator<<(std::ostream &str, const ConstPixelBufferAccess &access);
1706*35238bceSAndroid Build Coastguard Worker
1707*35238bceSAndroid Build Coastguard Worker } // namespace tcu
1708*35238bceSAndroid Build Coastguard Worker
1709*35238bceSAndroid Build Coastguard Worker #endif // _TCUTEXTURE_HPP
1710