зеркало из https://github.com/AvaloniaUI/angle.git
Metal: autogen for PBO related shaders.
Bug: angleproject:2634 Change-Id: I36e5a6a4cb11d82f666c410b33fdb39ad35a5e80 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2336557 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
e82f282289
Коммит
63c91a3bb9
|
@ -1,44 +1,50 @@
|
|||
{
|
||||
"src/libANGLE/renderer/angle_format_map.json":
|
||||
"aa4a0d3463b76858a75787b9cdec8e98",
|
||||
"src/libANGLE/renderer/metal/shaders/blit.metal":
|
||||
"f02720a0f3d9624b67bdb808cbc94c7f",
|
||||
"src/libANGLE/renderer/metal/shaders/clear.metal":
|
||||
"67da9886363c530132e5bc2199bab2db",
|
||||
"src/libANGLE/renderer/metal/shaders/common.h":
|
||||
"4260719e5f35107db1029d2fe6e1a732",
|
||||
"0cadef47fb785aa3102acb2a6eae94bb",
|
||||
"src/libANGLE/renderer/metal/shaders/compiled/compiled_default_metallib_2_1_debug_ios_autogen.inc":
|
||||
"f4338f3b943f760d0ba0684415d5ad9d",
|
||||
"242c1dcfed23f2ce130a5813b0845885",
|
||||
"src/libANGLE/renderer/metal/shaders/compiled/compiled_default_metallib_2_1_debug_ios_sim_autogen.inc":
|
||||
"72f85d542aaecf87adfe7cda971af2c4",
|
||||
"472d8b494249c8dd51900fbedf2bfc1e",
|
||||
"src/libANGLE/renderer/metal/shaders/compiled/compiled_default_metallib_2_1_debug_mac_autogen.inc":
|
||||
"41e6633271eca9848076394f9090c155",
|
||||
"71503cf6b999d7d34592851b623bd2ec",
|
||||
"src/libANGLE/renderer/metal/shaders/compiled/compiled_default_metallib_2_1_ios_autogen.inc":
|
||||
"73e40c41a6cdecdd46fb98383c1a03f1",
|
||||
"7bd32594077ff118df55d19607cb03cc",
|
||||
"src/libANGLE/renderer/metal/shaders/compiled/compiled_default_metallib_2_1_ios_sim_autogen.inc":
|
||||
"1b32e75f82db3b3e10d32cca04add8b5",
|
||||
"144649774236fb4c89ea333c6b7c7432",
|
||||
"src/libANGLE/renderer/metal/shaders/compiled/compiled_default_metallib_2_1_mac_autogen.inc":
|
||||
"d4b8c7ddabab1f4099fea4291e5093ef",
|
||||
"5a88edbf58f094953b65ba76f7dbdbec",
|
||||
"src/libANGLE/renderer/metal/shaders/compiled/compiled_default_metallib_debug_ios_autogen.inc":
|
||||
"962ff1364859ad38a097a3b6d837a1eb",
|
||||
"d1c9a9922b3dc5761f88e63f3f7715b6",
|
||||
"src/libANGLE/renderer/metal/shaders/compiled/compiled_default_metallib_debug_ios_sim_autogen.inc":
|
||||
"e34a72c1a16ecb43357da1b192328859",
|
||||
"821c685f4ba29301b27eb4cff53fd6d9",
|
||||
"src/libANGLE/renderer/metal/shaders/compiled/compiled_default_metallib_debug_mac_autogen.inc":
|
||||
"652937413a0ff7885683dcfaf8c16941",
|
||||
"4e7dd43bf0f6403a551052c6d83b4abe",
|
||||
"src/libANGLE/renderer/metal/shaders/compiled/compiled_default_metallib_ios_autogen.inc":
|
||||
"7d7d55cacb18961cc04839cf5aa95c7a",
|
||||
"e7421348d7b6168f78645f904b438129",
|
||||
"src/libANGLE/renderer/metal/shaders/compiled/compiled_default_metallib_ios_sim_autogen.inc":
|
||||
"31372593af055f15070ebe6f50b19237",
|
||||
"eb0cb7ef0f1fcd26d2747cee596c4d1f",
|
||||
"src/libANGLE/renderer/metal/shaders/compiled/compiled_default_metallib_mac_autogen.inc":
|
||||
"a0032256c254737bbdfb58395a7c3f6a",
|
||||
"bce93a1c3e8283b96a41a0088f4d83ad",
|
||||
"src/libANGLE/renderer/metal/shaders/compiled/mtl_default_shaders_autogen.inc":
|
||||
"634a127f4e94f6bc3123e89850d010ee",
|
||||
"src/libANGLE/renderer/metal/shaders/constants.h":
|
||||
"dad1a869a1095be669b7da5651901d38",
|
||||
"src/libANGLE/renderer/metal/shaders/copy_buffer.metal":
|
||||
"97b258edbade1ed088e4c03a1102f974",
|
||||
"src/libANGLE/renderer/metal/shaders/format_autogen.h":
|
||||
"2d9f0752644dffd14423fa0c03ca8e65",
|
||||
"src/libANGLE/renderer/metal/shaders/gen_indices.metal":
|
||||
"87a76d5e12825111c0595f69e79f5d20",
|
||||
"src/libANGLE/renderer/metal/shaders/gen_mipmap.metal":
|
||||
"54dca94c48bead446624079070b9b309",
|
||||
"src/libANGLE/renderer/metal/shaders/gen_mtl_internal_shaders.py":
|
||||
"baaa20430675d8909fa4c61f8a926eb8",
|
||||
"691460118fccd9c7fd0c451adaa2b330",
|
||||
"src/libANGLE/renderer/metal/shaders/visibility.metal":
|
||||
"998d705656c63849edd0187cd8062fc7"
|
||||
}
|
|
@ -72,6 +72,7 @@ _metal_backend_sources = [
|
|||
"shaders/compiled/compiled_default_metallib_mac_autogen.inc",
|
||||
"shaders/compiled/mtl_default_shaders_autogen.inc",
|
||||
"shaders/constants.h",
|
||||
"shaders/format_autogen.h",
|
||||
]
|
||||
|
||||
config("angle_metal_backend_config") {
|
||||
|
|
|
@ -134,6 +134,128 @@ static inline float4 linearToSRGB(float4 color)
|
|||
return float4(linearToSRGB(color.r), linearToSRGB(color.g), linearToSRGB(color.b), color.a);
|
||||
}
|
||||
|
||||
template <typename Short>
|
||||
static inline Short bytesToShort(constant uchar *input, uint offset)
|
||||
{
|
||||
Short inputLo = input[offset];
|
||||
Short inputHi = input[offset + 1];
|
||||
// Little endian conversion:
|
||||
return inputLo | (inputHi << 8);
|
||||
}
|
||||
|
||||
template <typename Int>
|
||||
static inline Int bytesToInt(constant uchar *input, uint offset)
|
||||
{
|
||||
Int input0 = input[offset];
|
||||
Int input1 = input[offset + 1];
|
||||
Int input2 = input[offset + 2];
|
||||
Int input3 = input[offset + 3];
|
||||
// Little endian conversion:
|
||||
return input0 | (input1 << 8) | (input2 << 16) | (input3 << 24);
|
||||
}
|
||||
|
||||
template <typename Short>
|
||||
static inline void shortToBytes(Short val, uint offset, device uchar *output)
|
||||
{
|
||||
ushort valUnsigned = as_type<ushort>(val);
|
||||
output[offset] = valUnsigned & 0xff;
|
||||
output[offset + 1] = (valUnsigned >> 8) & 0xff;
|
||||
}
|
||||
|
||||
template <typename Int>
|
||||
static inline void intToBytes(Int val, uint offset, device uchar *output)
|
||||
{
|
||||
uint valUnsigned = as_type<uint>(val);
|
||||
output[offset] = valUnsigned & 0xff;
|
||||
output[offset + 1] = (valUnsigned >> 8) & 0xff;
|
||||
output[offset + 2] = (valUnsigned >> 16) & 0xff;
|
||||
output[offset + 3] = (valUnsigned >> 24) & 0xff;
|
||||
}
|
||||
|
||||
static inline void floatToBytes(float val, uint offset, device uchar *output)
|
||||
{
|
||||
intToBytes(as_type<uint>(val), offset, output);
|
||||
}
|
||||
|
||||
static inline void int24bitToBytes(uint val, uint offset, device uchar *output)
|
||||
{
|
||||
output[offset] = val & 0xff;
|
||||
output[offset + 1] = (val >> 8) & 0xff;
|
||||
output[offset + 2] = (val >> 16) & 0xff;
|
||||
}
|
||||
|
||||
template <unsigned int inputBitCount, unsigned int inputBitStart, typename T>
|
||||
static inline T getShiftedData(T input)
|
||||
{
|
||||
static_assert(inputBitCount + inputBitStart <= (sizeof(T) * 8),
|
||||
"T must have at least as many bits as inputBitCount + inputBitStart.");
|
||||
const T mask = (1 << inputBitCount) - 1;
|
||||
return (input >> inputBitStart) & mask;
|
||||
}
|
||||
|
||||
template <unsigned int inputBitCount, unsigned int inputBitStart, typename T>
|
||||
static inline T shiftData(T input)
|
||||
{
|
||||
static_assert(inputBitCount + inputBitStart <= (sizeof(T) * 8),
|
||||
"T must have at least as many bits as inputBitCount + inputBitStart.");
|
||||
const T mask = (1 << inputBitCount) - 1;
|
||||
return (input & mask) << inputBitStart;
|
||||
}
|
||||
|
||||
template <unsigned int inputBitCount, typename T>
|
||||
static inline float normalizedToFloat(T input)
|
||||
{
|
||||
static_assert(inputBitCount <= (sizeof(T) * 8),
|
||||
"T must have more bits than or same bits as inputBitCount.");
|
||||
static_assert(inputBitCount <= 23, "Only single precision is supported");
|
||||
|
||||
constexpr float inverseMax = 1.0f / ((1 << inputBitCount) - 1);
|
||||
return input * inverseMax;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline float normalizedToFloat(T input)
|
||||
{
|
||||
return normalizedToFloat<sizeof(T) * 8, T>(input);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline float normalizedToFloat(short input)
|
||||
{
|
||||
constexpr float inverseMax = 1.0f / 0x7fff;
|
||||
return static_cast<float>(input) * inverseMax;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline float normalizedToFloat(int input)
|
||||
{
|
||||
constexpr float inverseMax = 1.0f / 0x7fffffff;
|
||||
return static_cast<float>(input) * inverseMax;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline float normalizedToFloat(uint input)
|
||||
{
|
||||
constexpr float inverseMax = 1.0f / 0xffffffff;
|
||||
return static_cast<float>(input) * inverseMax;
|
||||
}
|
||||
|
||||
template <unsigned int outputBitCount, typename T>
|
||||
static inline T floatToNormalized(float input)
|
||||
{
|
||||
static_assert(outputBitCount <= (sizeof(T) * 8),
|
||||
"T must have more bits than or same bits as inputBitCount.");
|
||||
static_assert(outputBitCount <= 23, "Only single precision is supported");
|
||||
|
||||
return static_cast<T>(((1 << outputBitCount) - 1) * input + 0.5f);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline T floatToNormalized(float input)
|
||||
{
|
||||
return floatToNormalized<sizeof(T) * 8, T>(input);
|
||||
}
|
||||
|
||||
} // namespace mtl_shader
|
||||
} // namespace rx
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,246 @@
|
|||
// GENERATED FILE - DO NOT EDIT.
|
||||
// Generated by gen_mtl_internal_shaders.py
|
||||
//
|
||||
// Copyright 2020 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.
|
||||
//
|
||||
namespace rx
|
||||
{
|
||||
namespace mtl_shader
|
||||
{
|
||||
|
||||
namespace FormatID
|
||||
{
|
||||
enum
|
||||
{
|
||||
NONE,
|
||||
A16_FLOAT,
|
||||
A1R5G5B5_UNORM,
|
||||
A2R10G10B10_SINT_VERTEX,
|
||||
A2R10G10B10_SNORM_VERTEX,
|
||||
A2R10G10B10_SSCALED_VERTEX,
|
||||
A2R10G10B10_UINT_VERTEX,
|
||||
A2R10G10B10_UNORM_VERTEX,
|
||||
A2R10G10B10_USCALED_VERTEX,
|
||||
A32_FLOAT,
|
||||
A8_UNORM,
|
||||
ASTC_10x10_SRGB_BLOCK,
|
||||
ASTC_10x10_UNORM_BLOCK,
|
||||
ASTC_10x5_SRGB_BLOCK,
|
||||
ASTC_10x5_UNORM_BLOCK,
|
||||
ASTC_10x6_SRGB_BLOCK,
|
||||
ASTC_10x6_UNORM_BLOCK,
|
||||
ASTC_10x8_SRGB_BLOCK,
|
||||
ASTC_10x8_UNORM_BLOCK,
|
||||
ASTC_12x10_SRGB_BLOCK,
|
||||
ASTC_12x10_UNORM_BLOCK,
|
||||
ASTC_12x12_SRGB_BLOCK,
|
||||
ASTC_12x12_UNORM_BLOCK,
|
||||
ASTC_3x3x3_UNORM_BLOCK,
|
||||
ASTC_3x3x3_UNORM_SRGB_BLOCK,
|
||||
ASTC_4x3x3_UNORM_BLOCK,
|
||||
ASTC_4x3x3_UNORM_SRGB_BLOCK,
|
||||
ASTC_4x4_SRGB_BLOCK,
|
||||
ASTC_4x4_UNORM_BLOCK,
|
||||
ASTC_4x4x3_UNORM_BLOCK,
|
||||
ASTC_4x4x3_UNORM_SRGB_BLOCK,
|
||||
ASTC_4x4x4_UNORM_BLOCK,
|
||||
ASTC_4x4x4_UNORM_SRGB_BLOCK,
|
||||
ASTC_5x4_SRGB_BLOCK,
|
||||
ASTC_5x4_UNORM_BLOCK,
|
||||
ASTC_5x4x4_UNORM_BLOCK,
|
||||
ASTC_5x4x4_UNORM_SRGB_BLOCK,
|
||||
ASTC_5x5_SRGB_BLOCK,
|
||||
ASTC_5x5_UNORM_BLOCK,
|
||||
ASTC_5x5x4_UNORM_BLOCK,
|
||||
ASTC_5x5x4_UNORM_SRGB_BLOCK,
|
||||
ASTC_5x5x5_UNORM_BLOCK,
|
||||
ASTC_5x5x5_UNORM_SRGB_BLOCK,
|
||||
ASTC_6x5_SRGB_BLOCK,
|
||||
ASTC_6x5_UNORM_BLOCK,
|
||||
ASTC_6x5x5_UNORM_BLOCK,
|
||||
ASTC_6x5x5_UNORM_SRGB_BLOCK,
|
||||
ASTC_6x6_SRGB_BLOCK,
|
||||
ASTC_6x6_UNORM_BLOCK,
|
||||
ASTC_6x6x5_UNORM_BLOCK,
|
||||
ASTC_6x6x5_UNORM_SRGB_BLOCK,
|
||||
ASTC_6x6x6_UNORM_BLOCK,
|
||||
ASTC_6x6x6_UNORM_SRGB_BLOCK,
|
||||
ASTC_8x5_SRGB_BLOCK,
|
||||
ASTC_8x5_UNORM_BLOCK,
|
||||
ASTC_8x6_SRGB_BLOCK,
|
||||
ASTC_8x6_UNORM_BLOCK,
|
||||
ASTC_8x8_SRGB_BLOCK,
|
||||
ASTC_8x8_UNORM_BLOCK,
|
||||
B10G10R10A2_UNORM,
|
||||
B4G4R4A4_UNORM,
|
||||
B5G5R5A1_UNORM,
|
||||
B5G6R5_UNORM,
|
||||
B8G8R8A8_TYPELESS,
|
||||
B8G8R8A8_TYPELESS_SRGB,
|
||||
B8G8R8A8_UNORM,
|
||||
B8G8R8A8_UNORM_SRGB,
|
||||
B8G8R8X8_UNORM,
|
||||
BC1_RGBA_UNORM_BLOCK,
|
||||
BC1_RGBA_UNORM_SRGB_BLOCK,
|
||||
BC1_RGB_UNORM_BLOCK,
|
||||
BC1_RGB_UNORM_SRGB_BLOCK,
|
||||
BC2_RGBA_UNORM_BLOCK,
|
||||
BC2_RGBA_UNORM_SRGB_BLOCK,
|
||||
BC3_RGBA_UNORM_BLOCK,
|
||||
BC3_RGBA_UNORM_SRGB_BLOCK,
|
||||
BC4_RED_SNORM_BLOCK,
|
||||
BC4_RED_UNORM_BLOCK,
|
||||
BC5_RG_SNORM_BLOCK,
|
||||
BC5_RG_UNORM_BLOCK,
|
||||
BPTC_RGBA_UNORM_BLOCK,
|
||||
BPTC_RGB_SIGNED_FLOAT_BLOCK,
|
||||
BPTC_RGB_UNSIGNED_FLOAT_BLOCK,
|
||||
BPTC_SRGB_ALPHA_UNORM_BLOCK,
|
||||
D16_UNORM,
|
||||
D24_UNORM_S8_UINT,
|
||||
D24_UNORM_X8_UINT,
|
||||
D32_FLOAT,
|
||||
D32_FLOAT_S8X24_UINT,
|
||||
D32_UNORM,
|
||||
EAC_R11G11_SNORM_BLOCK,
|
||||
EAC_R11G11_UNORM_BLOCK,
|
||||
EAC_R11_SNORM_BLOCK,
|
||||
EAC_R11_UNORM_BLOCK,
|
||||
ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK,
|
||||
ETC1_R8G8B8_UNORM_BLOCK,
|
||||
ETC2_R8G8B8A1_SRGB_BLOCK,
|
||||
ETC2_R8G8B8A1_UNORM_BLOCK,
|
||||
ETC2_R8G8B8A8_SRGB_BLOCK,
|
||||
ETC2_R8G8B8A8_UNORM_BLOCK,
|
||||
ETC2_R8G8B8_SRGB_BLOCK,
|
||||
ETC2_R8G8B8_UNORM_BLOCK,
|
||||
L16A16_FLOAT,
|
||||
L16_FLOAT,
|
||||
L32A32_FLOAT,
|
||||
L32_FLOAT,
|
||||
L8A8_UNORM,
|
||||
L8_UNORM,
|
||||
PVRTC1_RGBA_2BPP_UNORM_BLOCK,
|
||||
PVRTC1_RGBA_2BPP_UNORM_SRGB_BLOCK,
|
||||
PVRTC1_RGBA_4BPP_UNORM_BLOCK,
|
||||
PVRTC1_RGBA_4BPP_UNORM_SRGB_BLOCK,
|
||||
PVRTC1_RGB_2BPP_UNORM_BLOCK,
|
||||
PVRTC1_RGB_2BPP_UNORM_SRGB_BLOCK,
|
||||
PVRTC1_RGB_4BPP_UNORM_BLOCK,
|
||||
PVRTC1_RGB_4BPP_UNORM_SRGB_BLOCK,
|
||||
R10G10B10A2_SINT,
|
||||
R10G10B10A2_SNORM,
|
||||
R10G10B10A2_SSCALED,
|
||||
R10G10B10A2_UINT,
|
||||
R10G10B10A2_UNORM,
|
||||
R10G10B10A2_USCALED,
|
||||
R10G10B10X2_UNORM,
|
||||
R11G11B10_FLOAT,
|
||||
R16G16B16A16_FLOAT,
|
||||
R16G16B16A16_SINT,
|
||||
R16G16B16A16_SNORM,
|
||||
R16G16B16A16_SSCALED,
|
||||
R16G16B16A16_UINT,
|
||||
R16G16B16A16_UNORM,
|
||||
R16G16B16A16_USCALED,
|
||||
R16G16B16_FLOAT,
|
||||
R16G16B16_SINT,
|
||||
R16G16B16_SNORM,
|
||||
R16G16B16_SSCALED,
|
||||
R16G16B16_UINT,
|
||||
R16G16B16_UNORM,
|
||||
R16G16B16_USCALED,
|
||||
R16G16_FLOAT,
|
||||
R16G16_SINT,
|
||||
R16G16_SNORM,
|
||||
R16G16_SSCALED,
|
||||
R16G16_UINT,
|
||||
R16G16_UNORM,
|
||||
R16G16_USCALED,
|
||||
R16_FLOAT,
|
||||
R16_SINT,
|
||||
R16_SNORM,
|
||||
R16_SSCALED,
|
||||
R16_UINT,
|
||||
R16_UNORM,
|
||||
R16_USCALED,
|
||||
R32G32B32A32_FIXED,
|
||||
R32G32B32A32_FLOAT,
|
||||
R32G32B32A32_SINT,
|
||||
R32G32B32A32_SNORM,
|
||||
R32G32B32A32_SSCALED,
|
||||
R32G32B32A32_UINT,
|
||||
R32G32B32A32_UNORM,
|
||||
R32G32B32A32_USCALED,
|
||||
R32G32B32_FIXED,
|
||||
R32G32B32_FLOAT,
|
||||
R32G32B32_SINT,
|
||||
R32G32B32_SNORM,
|
||||
R32G32B32_SSCALED,
|
||||
R32G32B32_UINT,
|
||||
R32G32B32_UNORM,
|
||||
R32G32B32_USCALED,
|
||||
R32G32_FIXED,
|
||||
R32G32_FLOAT,
|
||||
R32G32_SINT,
|
||||
R32G32_SNORM,
|
||||
R32G32_SSCALED,
|
||||
R32G32_UINT,
|
||||
R32G32_UNORM,
|
||||
R32G32_USCALED,
|
||||
R32_FIXED,
|
||||
R32_FLOAT,
|
||||
R32_SINT,
|
||||
R32_SNORM,
|
||||
R32_SSCALED,
|
||||
R32_UINT,
|
||||
R32_UNORM,
|
||||
R32_USCALED,
|
||||
R4G4B4A4_UNORM,
|
||||
R5G5B5A1_UNORM,
|
||||
R5G6B5_UNORM,
|
||||
R8G8B8A8_SINT,
|
||||
R8G8B8A8_SNORM,
|
||||
R8G8B8A8_SSCALED,
|
||||
R8G8B8A8_TYPELESS,
|
||||
R8G8B8A8_TYPELESS_SRGB,
|
||||
R8G8B8A8_UINT,
|
||||
R8G8B8A8_UNORM,
|
||||
R8G8B8A8_UNORM_SRGB,
|
||||
R8G8B8A8_USCALED,
|
||||
R8G8B8_SINT,
|
||||
R8G8B8_SNORM,
|
||||
R8G8B8_SSCALED,
|
||||
R8G8B8_UINT,
|
||||
R8G8B8_UNORM,
|
||||
R8G8B8_UNORM_SRGB,
|
||||
R8G8B8_USCALED,
|
||||
R8G8_SINT,
|
||||
R8G8_SNORM,
|
||||
R8G8_SSCALED,
|
||||
R8G8_UINT,
|
||||
R8G8_UNORM,
|
||||
R8G8_USCALED,
|
||||
R8_SINT,
|
||||
R8_SNORM,
|
||||
R8_SSCALED,
|
||||
R8_UINT,
|
||||
R8_UNORM,
|
||||
R8_UNORM_SRGB,
|
||||
R8_USCALED,
|
||||
R9G9B9E5_SHAREDEXP,
|
||||
S8_UINT,
|
||||
X2R10G10B10_SINT_VERTEX,
|
||||
X2R10G10B10_SNORM_VERTEX,
|
||||
X2R10G10B10_SSCALED_VERTEX,
|
||||
X2R10G10B10_UINT_VERTEX,
|
||||
X2R10G10B10_UNORM_VERTEX,
|
||||
X2R10G10B10_USCALED_VERTEX,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
} // namespace mtl_shader
|
||||
} // namespace rx
|
|
@ -12,6 +12,9 @@ import sys
|
|||
import json
|
||||
from datetime import datetime
|
||||
|
||||
sys.path.append('../..')
|
||||
import angle_format
|
||||
|
||||
template_header_boilerplate = """// GENERATED FILE - DO NOT EDIT.
|
||||
// Generated by {script_name}
|
||||
//
|
||||
|
@ -161,9 +164,35 @@ def gen_precompiled_shaders(mac_version, ios_version, variable_name, additional_
|
|||
os.system('rm -rfv compiled/*.metallib')
|
||||
|
||||
|
||||
def gen_shader_enums_code(angle_formats):
|
||||
|
||||
code = "namespace rx\n"
|
||||
code += "{\n"
|
||||
code += "namespace mtl_shader\n"
|
||||
code += "{\n"
|
||||
code += "\n"
|
||||
code += "namespace FormatID\n"
|
||||
code += "{\n"
|
||||
code += "enum\n"
|
||||
code += "{\n"
|
||||
code += " NONE,\n"
|
||||
for angle_format in sorted(angle_formats):
|
||||
if angle_format == 'NONE': # NONE already moved to the beginning of enum declaration
|
||||
continue
|
||||
code += " " + angle_format + ",\n"
|
||||
code += "};\n\n"
|
||||
code += "}\n"
|
||||
code += "\n"
|
||||
code += "}\n"
|
||||
code += "}\n"
|
||||
|
||||
return code
|
||||
|
||||
|
||||
def main():
|
||||
src_files = [
|
||||
'blit.metal', 'clear.metal', 'gen_indices.metal', 'gen_mipmap.metal', 'visibility.metal'
|
||||
'blit.metal', 'clear.metal', 'gen_indices.metal', 'gen_mipmap.metal', 'copy_buffer.metal',
|
||||
'visibility.metal'
|
||||
]
|
||||
|
||||
# yapf: disable
|
||||
|
@ -185,8 +214,9 @@ def main():
|
|||
|
||||
# auto_script parameters.
|
||||
if len(sys.argv) > 1:
|
||||
inputs = src_files + ['common.h', 'constants.h']
|
||||
outputs = ['compiled/mtl_default_shaders_autogen.inc'] + os_specific_autogen_files
|
||||
inputs = ['../../angle_format_map.json'] + src_files + ['common.h', 'constants.h']
|
||||
outputs = ['format_autogen.h', 'compiled/mtl_default_shaders_autogen.inc'
|
||||
] + os_specific_autogen_files
|
||||
|
||||
if sys.argv[1] == 'inputs':
|
||||
print ','.join(inputs)
|
||||
|
@ -202,6 +232,15 @@ def main():
|
|||
boilerplate_code = template_header_boilerplate.format(
|
||||
script_name=sys.argv[0], copyright_year=datetime.today().year)
|
||||
|
||||
# -------- Generate shader constants -----------
|
||||
angle_to_gl = angle_format.load_inverse_table('../../angle_format_map.json')
|
||||
shader_formats_autogen = gen_shader_enums_code(angle_to_gl.keys())
|
||||
shader_autogen_header = boilerplate_code + shader_formats_autogen
|
||||
|
||||
with open('format_autogen.h', 'wt') as out_file:
|
||||
out_file.write(shader_autogen_header)
|
||||
out_file.close()
|
||||
|
||||
# -------- Compile shaders -----------
|
||||
# boilerplate code
|
||||
os.system("echo \"{0}\" > compiled/mtl_default_shaders_autogen.inc".format(boilerplate_code))
|
||||
|
|
Загрузка…
Ссылка в новой задаче