// // Copyright 2015 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. //
// generatemip.inc: Defines the GenerateMip function, templated on the format // type of the image for which mip levels are being generated.
for (size_t y = 0; y < destHeight; y++)
{ const T *src0 = GetPixel<T>(sourceData, 0, y * 2, 0, sourceRowPitch, sourceDepthPitch); const T *src1 = GetPixel<T>(sourceData, 0, y * 2 + 1, 0, sourceRowPitch, sourceDepthPitch);
T *dst = GetPixel<T>(destData, 0, y, 0, destRowPitch, destDepthPitch);
for (size_t y = 0; y < destHeight; y++)
{ for (size_t x = 0; x < destWidth; x++)
{ const T *src0 = GetPixel<T>(sourceData, x * 2, y * 2, 0, sourceRowPitch, sourceDepthPitch); const T *src1 = GetPixel<T>(sourceData, x * 2, y * 2 + 1, 0, sourceRowPitch, sourceDepthPitch); const T *src2 = GetPixel<T>(sourceData, x * 2 + 1, y * 2, 0, sourceRowPitch, sourceDepthPitch); const T *src3 = GetPixel<T>(sourceData, x * 2 + 1, y * 2 + 1, 0, sourceRowPitch, sourceDepthPitch);
T *dst = GetPixel<T>(destData, x, y, 0, destRowPitch, destDepthPitch);
for (size_t z = 0; z < destDepth; z++)
{ for (size_t y = 0; y < destHeight; y++)
{ const T *src0 = GetPixel<T>(sourceData, 0, y * 2, z * 2, sourceRowPitch, sourceDepthPitch); const T *src1 = GetPixel<T>(sourceData, 0, y * 2, z * 2 + 1, sourceRowPitch, sourceDepthPitch); const T *src2 = GetPixel<T>(sourceData, 0, y * 2 + 1, z * 2, sourceRowPitch, sourceDepthPitch); const T *src3 = GetPixel<T>(sourceData, 0, y * 2 + 1, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
T *dst = GetPixel<T>(destData, 0, y, z, destRowPitch, destDepthPitch);
for (size_t z = 0; z < destDepth; z++)
{ for (size_t x = 0; x < destWidth; x++)
{ const T *src0 = GetPixel<T>(sourceData, x * 2, 0, z * 2, sourceRowPitch, sourceDepthPitch); const T *src1 = GetPixel<T>(sourceData, x * 2, 0, z * 2 + 1, sourceRowPitch, sourceDepthPitch); const T *src2 = GetPixel<T>(sourceData, x * 2 + 1, 0, z * 2, sourceRowPitch, sourceDepthPitch); const T *src3 = GetPixel<T>(sourceData, x * 2 + 1, 0, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
T *dst = GetPixel<T>(destData, x, 0, z, destRowPitch, destDepthPitch);
for (size_t z = 0; z < destDepth; z++)
{ for (size_t y = 0; y < destHeight; y++)
{ for (size_t x = 0; x < destWidth; x++)
{ const T *src0 = GetPixel<T>(sourceData, x * 2, y * 2, z * 2, sourceRowPitch, sourceDepthPitch); const T *src1 = GetPixel<T>(sourceData, x * 2, y * 2, z * 2 + 1, sourceRowPitch, sourceDepthPitch); const T *src2 = GetPixel<T>(sourceData, x * 2, y * 2 + 1, z * 2, sourceRowPitch, sourceDepthPitch); const T *src3 = GetPixel<T>(sourceData, x * 2, y * 2 + 1, z * 2 + 1, sourceRowPitch, sourceDepthPitch); const T *src4 = GetPixel<T>(sourceData, x * 2 + 1, y * 2, z * 2, sourceRowPitch, sourceDepthPitch); const T *src5 = GetPixel<T>(sourceData, x * 2 + 1, y * 2, z * 2 + 1, sourceRowPitch, sourceDepthPitch); const T *src6 = GetPixel<T>(sourceData, x * 2 + 1, y * 2 + 1, z * 2, sourceRowPitch, sourceDepthPitch); const T *src7 = GetPixel<T>(sourceData, x * 2 + 1, y * 2 + 1, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
T *dst = GetPixel<T>(destData, x, y, z, destRowPitch, destDepthPitch);
switch (index)
{ case 0: return nullptr; case 1: return GenerateMip_X<T>; // W x 1 x 1 case 2: return GenerateMip_Y<T>; // 1 x H x 1 case 3: return GenerateMip_XY<T>; // W x H x 1 case 4: return GenerateMip_Z<T>; // 1 x 1 x D case 5: return GenerateMip_XZ<T>; // W x 1 x D case 6: return GenerateMip_YZ<T>; // 1 x H x D case 7: return GenerateMip_XYZ<T>; // W x H x D
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.