1 // GENERATED FILE - DO NOT EDIT. 2 // Generated by gen_load_texture_border_functions_table.py using data from 3 // load_texture_border_functions_data.json 4 // 5 // Copyright 2021 The ANGLE Project Authors. All rights reserved. 6 // Use of this source code is governed by a BSD-style license that can be 7 // found in the LICENSE file. 8 // 9 // load_texture_border_functions_table": 10 // Contains the LoadTextureBorderFunctionMap for texture_format_util.h 11 // 12 13 #include "image_util/loadtextureborder.h" 14 #include "libANGLE/renderer/load_texture_border_functions_table.h" 15 16 using namespace rx; 17 18 namespace angle 19 { 20 21 namespace 22 { 23 24 // ES3 texture border color loading functions vary based on: 25 // - the GL internal format (supplied to glTex*Image*D) 26 // - the target DXGI_FORMAT that the image will be loaded into (which is chosen based on the D3D 27 // device's capabilities) 28 // This map type determines which loading function to use, based on these two parameters. 29 // This map only contains formats which need to reorder border color channel explictly. 30 DefaultLoadFunction()31LoadTextureBorderFunctionInfo DefaultLoadFunction() 32 { 33 return LoadTextureBorderFunctionInfo(LoadToNative); 34 } 35 ALPHA8_EXT_to_R8_UNORM()36LoadTextureBorderFunctionInfo ALPHA8_EXT_to_R8_UNORM() 37 { 38 return LoadTextureBorderFunctionInfo(LoadA8ToR8); 39 } 40 LUMINANCE8_ALPHA8_EXT_to_R8G8_UNORM()41LoadTextureBorderFunctionInfo LUMINANCE8_ALPHA8_EXT_to_R8G8_UNORM() 42 { 43 return LoadTextureBorderFunctionInfo(LoadLA8ToR8G8); 44 } 45 46 } // namespace 47 GetLoadTextureBorderFunctionsMap(GLenum internalFormat,FormatID angleFormat)48LoadTextureBorderFunctionMap GetLoadTextureBorderFunctionsMap(GLenum internalFormat, 49 FormatID angleFormat) 50 { 51 switch (internalFormat) 52 { 53 case GL_ALPHA8_EXT: 54 { 55 switch (angleFormat) 56 { 57 case FormatID::R8_UNORM: 58 return ALPHA8_EXT_to_R8_UNORM; 59 default: 60 return DefaultLoadFunction; 61 } 62 } 63 case GL_LUMINANCE8_ALPHA8_EXT: 64 { 65 switch (angleFormat) 66 { 67 case FormatID::R8G8_UNORM: 68 return LUMINANCE8_ALPHA8_EXT_to_R8G8_UNORM; 69 default: 70 return DefaultLoadFunction; 71 } 72 } 73 74 default: 75 // Use LoadToNative for any format that doesn't reorder channels. 76 return DefaultLoadFunction; 77 } 78 79 } // GetLoadTextureBorderFunctionsMap 80 81 } // namespace angle 82