Commit d9618bf4 by Frank Henigman Committed by Commit Bot

Vulkan: prepare for buffer format fallbacks.

Generate code for buffer fallbacks as well as texture fallbacks. No functional change. BUG=angleproject:2405 Change-Id: I9f30a2cbb3cd9ba1d18474f99cba434b030b0232 Reviewed-on: https://chromium-review.googlesource.com/1113026 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent ecbaf666
......@@ -66,9 +66,9 @@
"Vulkan format:src/libANGLE/renderer/angle_format_map.json":
"82d80c3be2cdfcc17aec07cf2223907f",
"Vulkan format:src/libANGLE/renderer/vulkan/gen_vk_format_table.py":
"85a1e412d2dc8d3c06a8f3249e0aae48",
"86aa4d78d3f1c82f938f1175237c86ce",
"Vulkan format:src/libANGLE/renderer/vulkan/vk_format_map.json":
"0ea1d6c72f5ffabecbf8d5d68a527dc7",
"ad20bf1583747eb8e70b991135803c3c",
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/gen_vk_internal_shaders.py":
"c1cc895645db3fe1cd284352890c219e",
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/shaders/src/FullScreenQuad.vert":
......
......@@ -135,7 +135,7 @@ angle::Result PixelBuffer::stageSubresourceUpdate(ContextVk *contextVk,
const uint8_t *source = pixels + inputSkipBytes;
LoadImageFunctionInfo loadFunction = vkFormat.loadFunctions(type);
LoadImageFunctionInfo loadFunction = vkFormat.textureLoadFunctions(type);
loadFunction.loadFunction(extents.width, extents.height, extents.depth, source, inputRowPitch,
inputDepthPitch, stagingPointer, outputRowPitch, outputDepthPitch);
......@@ -190,7 +190,7 @@ angle::Result PixelBuffer::stageSubresourceUpdateFromFramebuffer(
const vk::Format &vkFormat = renderer->getFormat(formatInfo.sizedInternalFormat);
const angle::Format &storageFormat = vkFormat.textureFormat();
LoadImageFunctionInfo loadFunction = vkFormat.loadFunctions(formatInfo.type);
LoadImageFunctionInfo loadFunction = vkFormat.textureLoadFunctions(formatInfo.type);
size_t outputRowPitch = storageFormat.pixelBytes * clippedRectangle.width;
size_t outputDepthPitch = outputRowPitch * clippedRectangle.height;
......
......@@ -57,92 +57,85 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
}} // namespace rx
"""
empty_format_entry_template = """{space}case angle::Format::ID::{format_id}:
{space} // This format is not implemented in Vulkan.
{space} break;
empty_format_entry_template = """case angle::Format::ID::{format_id}:
// This format is not implemented in Vulkan.
break;
"""
format_entry_template = """{space}case angle::Format::ID::{format_id}:
{space}{{
{space} internalFormat = {internal_format};
{space} textureFormatID = angle::Format::ID::{texture};
{space} vkTextureFormat = {vk_texture_format};
{space} bufferFormatID = angle::Format::ID::{buffer};
{space} vkBufferFormat = {vk_buffer_format};
{space} dataInitializerFunction = {initializer};
{space} break;
{space}}}
format_entry_template = """case angle::Format::ID::{format_id}:
internalFormat = {internal_format};
{texture_template}
{buffer_template}
break;
"""
# This currently only handles texture fallback formats.
fallback_format_entry_template = """{space}case angle::Format::ID::{format_id}:
{space}{{
{space} internalFormat = {internal_format};
{space} if (!HasFullFormatSupport(physicalDevice, {vk_texture_format}))
{space} {{
{space} textureFormatID = angle::Format::ID::{fallback_texture};
{space} vkTextureFormat = {fallback_vk_texture_format};
{space} dataInitializerFunction = {fallback_initializer};
{space} ASSERT(HasFullFormatSupport(physicalDevice, {fallback_vk_texture_format}));
{space} }}
{space} else
{space} {{
{space} textureFormatID = angle::Format::ID::{texture};
{space} vkTextureFormat = {vk_texture_format};
{space} dataInitializerFunction = {initializer};
{space} }}
{space} bufferFormatID = angle::Format::ID::{buffer};
{space} vkBufferFormat = {vk_buffer_format};
{space} break;
{space}}}
"""
texture_basic_template = """textureFormatID = angle::Format::ID::{texture};
vkTextureFormat = {vk_texture_format};
textureInitializerFunction = {texture_initializer};"""
def gen_format_case(angle, internal_format, vk_json_data):
texture_fallback_template = """initTextureFallback(physicalDevice,
angle::Format::ID::{texture},
{vk_texture_format},
{texture_initializer},
angle::Format::ID::{texture_fallback},
{vk_texture_format_fallback},
{texture_initializer_fallback});"""
buffer_basic_template = """bufferFormatID = angle::Format::ID::{buffer};
vkBufferFormat = {vk_buffer_format};"""
buffer_fallback_template = """initBufferFallback(physicalDevice,
angle::Format::ID::{buffer},
{vk_buffer_format},
angle::Format::ID::{buffer_fallback},
{vk_buffer_format_fallback});"""
def gen_format_case(angle, internal_format, vk_json_data):
vk_map = vk_json_data["map"]
vk_overrides = vk_json_data["overrides"]
vk_fallbacks = vk_json_data["fallbacks"]
args = {
"space": " ",
"format_id": angle,
"internal_format": internal_format
}
args = { "format_id" : angle }
if ((angle not in vk_map) and (angle not in vk_overrides) and
(angle not in vk_fallbacks)) or angle == 'NONE':
return empty_format_entry_template.format(**args)
template = format_entry_template
if angle in vk_map:
args["buffer"] = angle
args["texture"] = angle
if angle in vk_overrides:
args.update(vk_overrides[angle])
if angle in vk_fallbacks:
template = fallback_format_entry_template
fallback = vk_fallbacks[angle]
assert not "buffer" in fallback, "Buffer fallbacks not yet supported"
assert "texture" in fallback, "Fallback must have a texture fallback"
args["fallback_texture"] = fallback["texture"]
args["fallback_vk_texture_format"] = vk_map[fallback["texture"]]
args["fallback_initializer"] = angle_format.get_internal_format_initializer(
internal_format, fallback["texture"])
assert "buffer" in args, "Missing buffer format for " + angle
assert "texture" in args, "Missing texture format for " + angle
args["vk_buffer_format"] = vk_map[args["buffer"]]
args["vk_texture_format"] = vk_map[args["texture"]]
args["initializer"] = angle_format.get_internal_format_initializer(
internal_format, args["texture"])
return template.format(**args)
def get_formats_and_template(format, type, basic_template, fallback_template):
format = vk_overrides.get(format, {}).get(type, format)
fallback = vk_fallbacks.get(format, {}).get(type, "NONE")
if format not in vk_map:
format = "NONE"
template = ""
elif fallback == "NONE":
template = basic_template
else:
template = fallback_template
return format, fallback, template
texture_format, texture_fallback, texture_template = get_formats_and_template(
angle, "texture", texture_basic_template, texture_fallback_template)
buffer_format, buffer_fallback, buffer_template = get_formats_and_template(
angle, "buffer", buffer_basic_template, buffer_fallback_template)
args.update(
internal_format=internal_format,
texture_template=texture_template,
texture=texture_format,
vk_texture_format=vk_map[texture_format],
texture_initializer=angle_format.get_internal_format_initializer(internal_format,
texture_format),
texture_fallback=texture_fallback,
vk_texture_format_fallback=vk_map[texture_fallback],
texture_initializer_fallback=angle_format.get_internal_format_initializer(internal_format,
texture_fallback),
buffer_template=buffer_template,
buffer=buffer_format,
vk_buffer_format=vk_map[buffer_format],
buffer_fallback=buffer_fallback,
vk_buffer_format_fallback=vk_map[buffer_fallback],
)
return format_entry_template.format(**args).format(**args)
input_file_name = 'vk_format_map.json'
out_file_name = 'vk_format_table'
......
......@@ -203,23 +203,18 @@
},
"overrides": {
"A8_UNORM": {
"buffer": "NONE",
"texture": "R8_UNORM"
},
"L8_UNORM": {
"buffer": "NONE",
"texture": "R8_UNORM"
},
"L8A8_UNORM": {
"buffer": "NONE",
"texture": "R8G8_UNORM"
},
"R4G4B4A4_UNORM": {
"buffer": "NONE",
"texture": "R8G8B8A8_UNORM"
},
"R5G5B5A1_UNORM": {
"buffer": "NONE",
"texture": "A1R5G5B5_UNORM"
},
"R8G8B8_UNORM": {
......
......@@ -31,364 +31,299 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::A1R5G5B5_UNORM:
{
internalFormat = GL_A1RGB5_ANGLEX;
textureFormatID = angle::Format::ID::A1R5G5B5_UNORM;
vkTextureFormat = VK_FORMAT_A1R5G5B5_UNORM_PACK16;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::A1R5G5B5_UNORM;
vkBufferFormat = VK_FORMAT_A1R5G5B5_UNORM_PACK16;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::A32_FLOAT:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::A8_UNORM:
{
internalFormat = GL_ALPHA8_EXT;
textureFormatID = angle::Format::ID::R8_UNORM;
vkTextureFormat = VK_FORMAT_R8_UNORM;
bufferFormatID = angle::Format::ID::NONE;
vkBufferFormat = VK_FORMAT_UNDEFINED;
dataInitializerFunction = nullptr;
textureInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_10x10_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;
textureFormatID = angle::Format::ID::ASTC_10x10_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_10x10_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_10x10_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_10x10_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_10x10_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_10x10_KHR;
textureFormatID = angle::Format::ID::ASTC_10x10_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_10x10_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_10x10_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_10x10_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_10x5_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;
textureFormatID = angle::Format::ID::ASTC_10x5_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_10x5_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_10x5_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_10x5_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_10x5_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_10x5_KHR;
textureFormatID = angle::Format::ID::ASTC_10x5_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_10x5_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_10x5_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_10x5_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_10x6_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;
textureFormatID = angle::Format::ID::ASTC_10x6_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_10x6_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_10x6_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_10x6_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_10x6_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_10x6_KHR;
textureFormatID = angle::Format::ID::ASTC_10x6_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_10x6_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_10x6_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_10x6_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_10x8_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;
textureFormatID = angle::Format::ID::ASTC_10x8_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_10x8_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_10x8_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_10x8_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_10x8_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_10x8_KHR;
textureFormatID = angle::Format::ID::ASTC_10x8_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_10x8_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_10x8_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_10x8_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_12x10_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;
textureFormatID = angle::Format::ID::ASTC_12x10_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_12x10_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_12x10_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_12x10_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_12x10_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_12x10_KHR;
textureFormatID = angle::Format::ID::ASTC_12x10_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_12x10_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_12x10_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_12x10_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_12x12_SRGB_BLOCK:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::ASTC_12x12_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_12x12_KHR;
textureFormatID = angle::Format::ID::ASTC_12x12_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_12x12_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_12x12_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_12x12_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_4x4_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
textureFormatID = angle::Format::ID::ASTC_4x4_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_4x4_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_4x4_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_4x4_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_4x4_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
textureFormatID = angle::Format::ID::ASTC_4x4_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_4x4_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_4x4_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_4x4_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_5x4_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;
textureFormatID = angle::Format::ID::ASTC_5x4_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_5x4_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_5x4_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_5x4_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_5x4_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_5x4_KHR;
textureFormatID = angle::Format::ID::ASTC_5x4_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_5x4_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_5x4_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_5x4_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_5x5_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;
textureFormatID = angle::Format::ID::ASTC_5x5_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_5x5_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_5x5_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_5x5_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_5x5_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_5x5_KHR;
textureFormatID = angle::Format::ID::ASTC_5x5_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_5x5_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_5x5_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_5x5_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_6x5_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;
textureFormatID = angle::Format::ID::ASTC_6x5_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_6x5_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_6x5_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_6x5_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_6x5_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_6x5_KHR;
textureFormatID = angle::Format::ID::ASTC_6x5_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_6x5_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_6x5_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_6x5_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_6x6_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;
textureFormatID = angle::Format::ID::ASTC_6x6_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_6x6_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_6x6_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_6x6_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_6x6_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_6x6_KHR;
textureFormatID = angle::Format::ID::ASTC_6x6_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_6x6_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_6x6_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_6x6_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_8x5_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;
textureFormatID = angle::Format::ID::ASTC_8x5_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_8x5_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_8x5_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_8x5_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_8x5_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_8x5_KHR;
textureFormatID = angle::Format::ID::ASTC_8x5_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_8x5_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_8x5_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_8x5_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_8x6_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;
textureFormatID = angle::Format::ID::ASTC_8x6_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_8x6_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_8x6_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_8x6_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_8x6_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_8x6_KHR;
textureFormatID = angle::Format::ID::ASTC_8x6_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_8x6_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_8x6_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_8x6_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_8x8_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;
textureFormatID = angle::Format::ID::ASTC_8x8_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_8x8_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_8x8_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_8x8_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ASTC_8x8_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_ASTC_8x8_KHR;
textureFormatID = angle::Format::ID::ASTC_8x8_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ASTC_8x8_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ASTC_8x8_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ASTC_8x8_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::B4G4R4A4_UNORM:
{
internalFormat = GL_BGRA4_ANGLEX;
textureFormatID = angle::Format::ID::B4G4R4A4_UNORM;
vkTextureFormat = VK_FORMAT_B4G4R4A4_UNORM_PACK16;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::B4G4R4A4_UNORM;
vkBufferFormat = VK_FORMAT_B4G4R4A4_UNORM_PACK16;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::B5G5R5A1_UNORM:
{
internalFormat = GL_BGR5_A1_ANGLEX;
textureFormatID = angle::Format::ID::B5G5R5A1_UNORM;
vkTextureFormat = VK_FORMAT_B5G5R5A1_UNORM_PACK16;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::B5G5R5A1_UNORM;
vkBufferFormat = VK_FORMAT_B5G5R5A1_UNORM_PACK16;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::B5G6R5_UNORM:
{
internalFormat = GL_BGR565_ANGLEX;
textureFormatID = angle::Format::ID::B5G6R5_UNORM;
vkTextureFormat = VK_FORMAT_B5G6R5_UNORM_PACK16;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::B5G6R5_UNORM;
vkBufferFormat = VK_FORMAT_B5G6R5_UNORM_PACK16;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::B8G8R8A8_TYPELESS:
// This format is not implemented in Vulkan.
......@@ -399,56 +334,48 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::B8G8R8A8_UNORM:
{
internalFormat = GL_BGRA8_EXT;
textureFormatID = angle::Format::ID::B8G8R8A8_UNORM;
vkTextureFormat = VK_FORMAT_B8G8R8A8_UNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::B8G8R8A8_UNORM;
vkBufferFormat = VK_FORMAT_B8G8R8A8_UNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::B8G8R8A8_UNORM_SRGB:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::B8G8R8X8_UNORM:
{
internalFormat = GL_BGRX8_ANGLEX;
textureFormatID = angle::Format::ID::B8G8R8A8_UNORM;
vkTextureFormat = VK_FORMAT_B8G8R8A8_UNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::NONE;
vkBufferFormat = VK_FORMAT_UNDEFINED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::BC1_RGBA_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
textureFormatID = angle::Format::ID::BC1_RGBA_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_BC1_RGBA_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::BC1_RGBA_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_BC1_RGBA_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::BC1_RGBA_UNORM_SRGB_BLOCK:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::BC1_RGB_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
textureFormatID = angle::Format::ID::BC1_RGB_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_BC1_RGB_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::BC1_RGB_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_BC1_RGB_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::BC1_RGB_UNORM_SRGB_BLOCK:
// This format is not implemented in Vulkan.
......@@ -471,120 +398,86 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::D16_UNORM:
{
internalFormat = GL_DEPTH_COMPONENT16;
textureFormatID = angle::Format::ID::D16_UNORM;
vkTextureFormat = VK_FORMAT_D16_UNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::D16_UNORM;
vkBufferFormat = VK_FORMAT_D16_UNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::D24_UNORM:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::D24_UNORM_S8_UINT:
{
internalFormat = GL_DEPTH24_STENCIL8;
if (!HasFullFormatSupport(physicalDevice, VK_FORMAT_D24_UNORM_S8_UINT))
{
textureFormatID = angle::Format::ID::D32_FLOAT_S8X24_UINT;
vkTextureFormat = VK_FORMAT_D32_SFLOAT_S8_UINT;
dataInitializerFunction = nullptr;
ASSERT(HasFullFormatSupport(physicalDevice, VK_FORMAT_D32_SFLOAT_S8_UINT));
}
else
{
textureFormatID = angle::Format::ID::D24_UNORM_S8_UINT;
vkTextureFormat = VK_FORMAT_D24_UNORM_S8_UINT;
dataInitializerFunction = nullptr;
}
initTextureFallback(physicalDevice, angle::Format::ID::D24_UNORM_S8_UINT,
VK_FORMAT_D24_UNORM_S8_UINT, nullptr,
angle::Format::ID::D32_FLOAT_S8X24_UINT,
VK_FORMAT_D32_SFLOAT_S8_UINT, nullptr);
bufferFormatID = angle::Format::ID::D24_UNORM_S8_UINT;
vkBufferFormat = VK_FORMAT_D24_UNORM_S8_UINT;
break;
}
case angle::Format::ID::D32_FLOAT:
{
internalFormat = GL_DEPTH_COMPONENT32F;
textureFormatID = angle::Format::ID::D32_FLOAT;
vkTextureFormat = VK_FORMAT_D32_SFLOAT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::D32_FLOAT;
vkBufferFormat = VK_FORMAT_D32_SFLOAT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::D32_FLOAT_S8X24_UINT:
{
internalFormat = GL_DEPTH32F_STENCIL8;
if (!HasFullFormatSupport(physicalDevice, VK_FORMAT_D32_SFLOAT_S8_UINT))
{
textureFormatID = angle::Format::ID::D24_UNORM_S8_UINT;
vkTextureFormat = VK_FORMAT_D24_UNORM_S8_UINT;
dataInitializerFunction = nullptr;
ASSERT(HasFullFormatSupport(physicalDevice, VK_FORMAT_D24_UNORM_S8_UINT));
}
else
{
textureFormatID = angle::Format::ID::D32_FLOAT_S8X24_UINT;
vkTextureFormat = VK_FORMAT_D32_SFLOAT_S8_UINT;
dataInitializerFunction = nullptr;
}
initTextureFallback(physicalDevice, angle::Format::ID::D32_FLOAT_S8X24_UINT,
VK_FORMAT_D32_SFLOAT_S8_UINT, nullptr,
angle::Format::ID::D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT,
nullptr);
bufferFormatID = angle::Format::ID::D32_FLOAT_S8X24_UINT;
vkBufferFormat = VK_FORMAT_D32_SFLOAT_S8_UINT;
break;
}
case angle::Format::ID::D32_UNORM:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::EAC_R11G11_SNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_SIGNED_RG11_EAC;
textureFormatID = angle::Format::ID::EAC_R11G11_SNORM_BLOCK;
vkTextureFormat = VK_FORMAT_EAC_R11G11_SNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::EAC_R11G11_SNORM_BLOCK;
vkBufferFormat = VK_FORMAT_EAC_R11G11_SNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::EAC_R11G11_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RG11_EAC;
textureFormatID = angle::Format::ID::EAC_R11G11_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_EAC_R11G11_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::EAC_R11G11_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_EAC_R11G11_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::EAC_R11_SNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_SIGNED_R11_EAC;
textureFormatID = angle::Format::ID::EAC_R11_SNORM_BLOCK;
vkTextureFormat = VK_FORMAT_EAC_R11_SNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::EAC_R11_SNORM_BLOCK;
vkBufferFormat = VK_FORMAT_EAC_R11_SNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::EAC_R11_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_R11_EAC;
textureFormatID = angle::Format::ID::EAC_R11_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_EAC_R11_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::EAC_R11_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_EAC_R11_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK:
// This format is not implemented in Vulkan.
......@@ -595,70 +488,58 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::ETC2_R8G8B8A1_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;
textureFormatID = angle::Format::ID::ETC2_R8G8B8A1_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ETC2_R8G8B8A1_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ETC2_R8G8B8A1_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
textureFormatID = angle::Format::ID::ETC2_R8G8B8A1_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK;
textureInitializerFunction = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
bufferFormatID = angle::Format::ID::ETC2_R8G8B8A1_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK;
dataInitializerFunction = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
break;
}
case angle::Format::ID::ETC2_R8G8B8A8_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;
textureFormatID = angle::Format::ID::ETC2_R8G8B8A8_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ETC2_R8G8B8A8_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ETC2_R8G8B8A8_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC;
textureFormatID = angle::Format::ID::ETC2_R8G8B8A8_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ETC2_R8G8B8A8_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ETC2_R8G8B8_SRGB_BLOCK:
{
internalFormat = GL_COMPRESSED_SRGB8_ETC2;
textureFormatID = angle::Format::ID::ETC2_R8G8B8_SRGB_BLOCK;
vkTextureFormat = VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ETC2_R8G8B8_SRGB_BLOCK;
vkBufferFormat = VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::ETC2_R8G8B8_UNORM_BLOCK:
{
internalFormat = GL_COMPRESSED_RGB8_ETC2;
textureFormatID = angle::Format::ID::ETC2_R8G8B8_UNORM_BLOCK;
vkTextureFormat = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::ETC2_R8G8B8_UNORM_BLOCK;
vkBufferFormat = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::L16A16_FLOAT:
// This format is not implemented in Vulkan.
......@@ -677,26 +558,20 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::L8A8_UNORM:
{
internalFormat = GL_LUMINANCE8_ALPHA8_EXT;
textureFormatID = angle::Format::ID::R8G8_UNORM;
vkTextureFormat = VK_FORMAT_R8G8_UNORM;
bufferFormatID = angle::Format::ID::NONE;
vkBufferFormat = VK_FORMAT_UNDEFINED;
dataInitializerFunction = nullptr;
textureInitializerFunction = nullptr;
break;
}
case angle::Format::ID::L8_UNORM:
{
internalFormat = GL_LUMINANCE8_EXT;
textureFormatID = angle::Format::ID::R8_UNORM;
vkTextureFormat = VK_FORMAT_R8_UNORM;
bufferFormatID = angle::Format::ID::NONE;
vkBufferFormat = VK_FORMAT_UNDEFINED;
dataInitializerFunction = nullptr;
textureInitializerFunction = nullptr;
break;
}
case angle::Format::ID::NONE:
// This format is not implemented in Vulkan.
......@@ -731,338 +606,278 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::R16G16B16A16_FLOAT:
{
internalFormat = GL_RGBA16F;
textureFormatID = angle::Format::ID::R16G16B16A16_FLOAT;
vkTextureFormat = VK_FORMAT_R16G16B16A16_SFLOAT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16A16_FLOAT;
vkBufferFormat = VK_FORMAT_R16G16B16A16_SFLOAT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16B16A16_SINT:
{
internalFormat = GL_RGBA16I;
textureFormatID = angle::Format::ID::R16G16B16A16_SINT;
vkTextureFormat = VK_FORMAT_R16G16B16A16_SINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16A16_SINT;
vkBufferFormat = VK_FORMAT_R16G16B16A16_SINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16B16A16_SNORM:
{
internalFormat = GL_RGBA16_SNORM_EXT;
textureFormatID = angle::Format::ID::R16G16B16A16_SNORM;
vkTextureFormat = VK_FORMAT_R16G16B16A16_SNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16A16_SNORM;
vkBufferFormat = VK_FORMAT_R16G16B16A16_SNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16B16A16_SSCALED:
{
internalFormat = GL_RGBA16_SSCALED_ANGLEX;
textureFormatID = angle::Format::ID::R16G16B16A16_SSCALED;
vkTextureFormat = VK_FORMAT_R16G16B16A16_SSCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16A16_SSCALED;
vkBufferFormat = VK_FORMAT_R16G16B16A16_SSCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16B16A16_UINT:
{
internalFormat = GL_RGBA16UI;
textureFormatID = angle::Format::ID::R16G16B16A16_UINT;
vkTextureFormat = VK_FORMAT_R16G16B16A16_UINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16A16_UINT;
vkBufferFormat = VK_FORMAT_R16G16B16A16_UINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16B16A16_UNORM:
{
internalFormat = GL_RGBA16_EXT;
textureFormatID = angle::Format::ID::R16G16B16A16_UNORM;
vkTextureFormat = VK_FORMAT_R16G16B16A16_UNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16A16_UNORM;
vkBufferFormat = VK_FORMAT_R16G16B16A16_UNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16B16A16_USCALED:
{
internalFormat = GL_RGBA16_USCALED_ANGLEX;
textureFormatID = angle::Format::ID::R16G16B16A16_USCALED;
vkTextureFormat = VK_FORMAT_R16G16B16A16_USCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16A16_USCALED;
vkBufferFormat = VK_FORMAT_R16G16B16A16_USCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16B16_FLOAT:
{
internalFormat = GL_RGB16F;
textureFormatID = angle::Format::ID::R16G16B16_FLOAT;
vkTextureFormat = VK_FORMAT_R16G16B16_SFLOAT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16_FLOAT;
vkBufferFormat = VK_FORMAT_R16G16B16_SFLOAT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16B16_SINT:
{
internalFormat = GL_RGB16I;
textureFormatID = angle::Format::ID::R16G16B16_SINT;
vkTextureFormat = VK_FORMAT_R16G16B16_SINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16_SINT;
vkBufferFormat = VK_FORMAT_R16G16B16_SINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16B16_SNORM:
{
internalFormat = GL_RGB16_SNORM_EXT;
textureFormatID = angle::Format::ID::R16G16B16_SNORM;
vkTextureFormat = VK_FORMAT_R16G16B16_SNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16_SNORM;
vkBufferFormat = VK_FORMAT_R16G16B16_SNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16B16_SSCALED:
{
internalFormat = GL_RGB16_SSCALED_ANGLEX;
textureFormatID = angle::Format::ID::R16G16B16_SSCALED;
vkTextureFormat = VK_FORMAT_R16G16B16_SSCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16_SSCALED;
vkBufferFormat = VK_FORMAT_R16G16B16_SSCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16B16_UINT:
{
internalFormat = GL_RGB16UI;
textureFormatID = angle::Format::ID::R16G16B16_UINT;
vkTextureFormat = VK_FORMAT_R16G16B16_UINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16_UINT;
vkBufferFormat = VK_FORMAT_R16G16B16_UINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16B16_UNORM:
{
internalFormat = GL_RGB16_EXT;
textureFormatID = angle::Format::ID::R16G16B16_UNORM;
vkTextureFormat = VK_FORMAT_R16G16B16_UNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16_UNORM;
vkBufferFormat = VK_FORMAT_R16G16B16_UNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16B16_USCALED:
{
internalFormat = GL_RGB16_USCALED_ANGLEX;
textureFormatID = angle::Format::ID::R16G16B16_USCALED;
vkTextureFormat = VK_FORMAT_R16G16B16_USCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16B16_USCALED;
vkBufferFormat = VK_FORMAT_R16G16B16_USCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16_FLOAT:
{
internalFormat = GL_RG16F;
textureFormatID = angle::Format::ID::R16G16_FLOAT;
vkTextureFormat = VK_FORMAT_R16G16_SFLOAT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16_FLOAT;
vkBufferFormat = VK_FORMAT_R16G16_SFLOAT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16_SINT:
{
internalFormat = GL_RG16I;
textureFormatID = angle::Format::ID::R16G16_SINT;
vkTextureFormat = VK_FORMAT_R16G16_SINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16_SINT;
vkBufferFormat = VK_FORMAT_R16G16_SINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16_SNORM:
{
internalFormat = GL_RG16_SNORM_EXT;
textureFormatID = angle::Format::ID::R16G16_SNORM;
vkTextureFormat = VK_FORMAT_R16G16_SNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16_SNORM;
vkBufferFormat = VK_FORMAT_R16G16_SNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16_SSCALED:
{
internalFormat = GL_RG16_SSCALED_ANGLEX;
textureFormatID = angle::Format::ID::R16G16_SSCALED;
vkTextureFormat = VK_FORMAT_R16G16_SSCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16_SSCALED;
vkBufferFormat = VK_FORMAT_R16G16_SSCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16_UINT:
{
internalFormat = GL_RG16UI;
textureFormatID = angle::Format::ID::R16G16_UINT;
vkTextureFormat = VK_FORMAT_R16G16_UINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16_UINT;
vkBufferFormat = VK_FORMAT_R16G16_UINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16_UNORM:
{
internalFormat = GL_RG16_EXT;
textureFormatID = angle::Format::ID::R16G16_UNORM;
vkTextureFormat = VK_FORMAT_R16G16_UNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16_UNORM;
vkBufferFormat = VK_FORMAT_R16G16_UNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16G16_USCALED:
{
internalFormat = GL_RG16_USCALED_ANGLEX;
textureFormatID = angle::Format::ID::R16G16_USCALED;
vkTextureFormat = VK_FORMAT_R16G16_USCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16G16_USCALED;
vkBufferFormat = VK_FORMAT_R16G16_USCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16_FLOAT:
{
internalFormat = GL_R16F;
textureFormatID = angle::Format::ID::R16_FLOAT;
vkTextureFormat = VK_FORMAT_R16_SFLOAT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16_FLOAT;
vkBufferFormat = VK_FORMAT_R16_SFLOAT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16_SINT:
{
internalFormat = GL_R16I;
textureFormatID = angle::Format::ID::R16_SINT;
vkTextureFormat = VK_FORMAT_R16_SINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16_SINT;
vkBufferFormat = VK_FORMAT_R16_SINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16_SNORM:
{
internalFormat = GL_R16_SNORM_EXT;
textureFormatID = angle::Format::ID::R16_SNORM;
vkTextureFormat = VK_FORMAT_R16_SNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16_SNORM;
vkBufferFormat = VK_FORMAT_R16_SNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16_SSCALED:
{
internalFormat = GL_R16_SSCALED_ANGLEX;
textureFormatID = angle::Format::ID::R16_SSCALED;
vkTextureFormat = VK_FORMAT_R16_SSCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16_SSCALED;
vkBufferFormat = VK_FORMAT_R16_SSCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16_UINT:
{
internalFormat = GL_R16UI;
textureFormatID = angle::Format::ID::R16_UINT;
vkTextureFormat = VK_FORMAT_R16_UINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16_UINT;
vkBufferFormat = VK_FORMAT_R16_UINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16_UNORM:
{
internalFormat = GL_R16_EXT;
textureFormatID = angle::Format::ID::R16_UNORM;
vkTextureFormat = VK_FORMAT_R16_UNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16_UNORM;
vkBufferFormat = VK_FORMAT_R16_UNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R16_USCALED:
{
internalFormat = GL_R16_USCALED_ANGLEX;
textureFormatID = angle::Format::ID::R16_USCALED;
vkTextureFormat = VK_FORMAT_R16_USCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R16_USCALED;
vkBufferFormat = VK_FORMAT_R16_USCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R32G32B32A32_FIXED:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::R32G32B32A32_FLOAT:
{
internalFormat = GL_RGBA32F;
textureFormatID = angle::Format::ID::R32G32B32A32_FLOAT;
vkTextureFormat = VK_FORMAT_R32G32B32A32_SFLOAT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R32G32B32A32_FLOAT;
vkBufferFormat = VK_FORMAT_R32G32B32A32_SFLOAT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R32G32B32A32_SINT:
{
internalFormat = GL_RGBA32I;
textureFormatID = angle::Format::ID::R32G32B32A32_SINT;
vkTextureFormat = VK_FORMAT_R32G32B32A32_SINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R32G32B32A32_SINT;
vkBufferFormat = VK_FORMAT_R32G32B32A32_SINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R32G32B32A32_SNORM:
// This format is not implemented in Vulkan.
......@@ -1073,15 +888,13 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::R32G32B32A32_UINT:
{
internalFormat = GL_RGBA32UI;
textureFormatID = angle::Format::ID::R32G32B32A32_UINT;
vkTextureFormat = VK_FORMAT_R32G32B32A32_UINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R32G32B32A32_UINT;
vkBufferFormat = VK_FORMAT_R32G32B32A32_UINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R32G32B32A32_UNORM:
// This format is not implemented in Vulkan.
......@@ -1096,26 +909,22 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::R32G32B32_FLOAT:
{
internalFormat = GL_RGB32F;
textureFormatID = angle::Format::ID::R32G32B32_FLOAT;
vkTextureFormat = VK_FORMAT_R32G32B32_SFLOAT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R32G32B32_FLOAT;
vkBufferFormat = VK_FORMAT_R32G32B32_SFLOAT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R32G32B32_SINT:
{
internalFormat = GL_RGB32I;
textureFormatID = angle::Format::ID::R32G32B32_SINT;
vkTextureFormat = VK_FORMAT_R32G32B32_SINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R32G32B32_SINT;
vkBufferFormat = VK_FORMAT_R32G32B32_SINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R32G32B32_SNORM:
// This format is not implemented in Vulkan.
......@@ -1126,15 +935,13 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::R32G32B32_UINT:
{
internalFormat = GL_RGB32UI;
textureFormatID = angle::Format::ID::R32G32B32_UINT;
vkTextureFormat = VK_FORMAT_R32G32B32_UINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R32G32B32_UINT;
vkBufferFormat = VK_FORMAT_R32G32B32_UINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R32G32B32_UNORM:
// This format is not implemented in Vulkan.
......@@ -1149,26 +956,22 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::R32G32_FLOAT:
{
internalFormat = GL_RG32F;
textureFormatID = angle::Format::ID::R32G32_FLOAT;
vkTextureFormat = VK_FORMAT_R32G32_SFLOAT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R32G32_FLOAT;
vkBufferFormat = VK_FORMAT_R32G32_SFLOAT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R32G32_SINT:
{
internalFormat = GL_RG32I;
textureFormatID = angle::Format::ID::R32G32_SINT;
vkTextureFormat = VK_FORMAT_R32G32_SINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R32G32_SINT;
vkBufferFormat = VK_FORMAT_R32G32_SINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R32G32_SNORM:
// This format is not implemented in Vulkan.
......@@ -1179,15 +982,13 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::R32G32_UINT:
{
internalFormat = GL_RG32UI;
textureFormatID = angle::Format::ID::R32G32_UINT;
vkTextureFormat = VK_FORMAT_R32G32_UINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R32G32_UINT;
vkBufferFormat = VK_FORMAT_R32G32_UINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R32G32_UNORM:
// This format is not implemented in Vulkan.
......@@ -1202,26 +1003,22 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::R32_FLOAT:
{
internalFormat = GL_R32F;
textureFormatID = angle::Format::ID::R32_FLOAT;
vkTextureFormat = VK_FORMAT_R32_SFLOAT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R32_FLOAT;
vkBufferFormat = VK_FORMAT_R32_SFLOAT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R32_SINT:
{
internalFormat = GL_R32I;
textureFormatID = angle::Format::ID::R32_SINT;
vkTextureFormat = VK_FORMAT_R32_SINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R32_SINT;
vkBufferFormat = VK_FORMAT_R32_SINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R32_SNORM:
// This format is not implemented in Vulkan.
......@@ -1232,15 +1029,13 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::R32_UINT:
{
internalFormat = GL_R32UI;
textureFormatID = angle::Format::ID::R32_UINT;
vkTextureFormat = VK_FORMAT_R32_UINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R32_UINT;
vkBufferFormat = VK_FORMAT_R32_UINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R32_UNORM:
// This format is not implemented in Vulkan.
......@@ -1251,70 +1046,58 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::R4G4B4A4_UNORM:
{
internalFormat = GL_RGBA4;
textureFormatID = angle::Format::ID::R8G8B8A8_UNORM;
vkTextureFormat = VK_FORMAT_R8G8B8A8_UNORM;
bufferFormatID = angle::Format::ID::NONE;
vkBufferFormat = VK_FORMAT_UNDEFINED;
dataInitializerFunction = nullptr;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R4G4B4A4_UNORM;
vkBufferFormat = VK_FORMAT_R4G4B4A4_UNORM_PACK16;
break;
}
case angle::Format::ID::R5G5B5A1_UNORM:
{
internalFormat = GL_RGB5_A1;
textureFormatID = angle::Format::ID::A1R5G5B5_UNORM;
vkTextureFormat = VK_FORMAT_A1R5G5B5_UNORM_PACK16;
bufferFormatID = angle::Format::ID::NONE;
vkBufferFormat = VK_FORMAT_UNDEFINED;
dataInitializerFunction = nullptr;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R5G5B5A1_UNORM;
vkBufferFormat = VK_FORMAT_R5G5B5A1_UNORM_PACK16;
break;
}
case angle::Format::ID::R5G6B5_UNORM:
{
internalFormat = GL_RGB565;
textureFormatID = angle::Format::ID::R5G6B5_UNORM;
vkTextureFormat = VK_FORMAT_R5G6B5_UNORM_PACK16;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R5G6B5_UNORM;
vkBufferFormat = VK_FORMAT_R5G6B5_UNORM_PACK16;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8B8A8_SINT:
{
internalFormat = GL_RGBA8I;
textureFormatID = angle::Format::ID::R8G8B8A8_SINT;
vkTextureFormat = VK_FORMAT_R8G8B8A8_SINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8B8A8_SINT;
vkBufferFormat = VK_FORMAT_R8G8B8A8_SINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8B8A8_SNORM:
{
internalFormat = GL_RGBA8_SNORM;
textureFormatID = angle::Format::ID::R8G8B8A8_SNORM;
vkTextureFormat = VK_FORMAT_R8G8B8A8_SNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8B8A8_SNORM;
vkBufferFormat = VK_FORMAT_R8G8B8A8_SNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8B8A8_SSCALED:
{
internalFormat = GL_RGBA8_SSCALED_ANGLEX;
textureFormatID = angle::Format::ID::R8G8B8A8_SSCALED;
vkTextureFormat = VK_FORMAT_R8G8B8A8_SSCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8B8A8_SSCALED;
vkBufferFormat = VK_FORMAT_R8G8B8A8_SSCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8B8A8_TYPELESS:
// This format is not implemented in Vulkan.
......@@ -1325,258 +1108,214 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
case angle::Format::ID::R8G8B8A8_UINT:
{
internalFormat = GL_RGBA8UI;
textureFormatID = angle::Format::ID::R8G8B8A8_UINT;
vkTextureFormat = VK_FORMAT_R8G8B8A8_UINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8B8A8_UINT;
vkBufferFormat = VK_FORMAT_R8G8B8A8_UINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8B8A8_UNORM:
{
internalFormat = GL_RGBA8;
textureFormatID = angle::Format::ID::R8G8B8A8_UNORM;
vkTextureFormat = VK_FORMAT_R8G8B8A8_UNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8B8A8_UNORM;
vkBufferFormat = VK_FORMAT_R8G8B8A8_UNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8B8A8_UNORM_SRGB:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::R8G8B8A8_USCALED:
{
internalFormat = GL_RGBA8_USCALED_ANGLEX;
textureFormatID = angle::Format::ID::R8G8B8A8_USCALED;
vkTextureFormat = VK_FORMAT_R8G8B8A8_USCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8B8A8_USCALED;
vkBufferFormat = VK_FORMAT_R8G8B8A8_USCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8B8_SINT:
{
internalFormat = GL_RGB8I;
textureFormatID = angle::Format::ID::R8G8B8_SINT;
vkTextureFormat = VK_FORMAT_R8G8B8_SINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8B8_SINT;
vkBufferFormat = VK_FORMAT_R8G8B8_SINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8B8_SNORM:
{
internalFormat = GL_RGB8_SNORM;
textureFormatID = angle::Format::ID::R8G8B8_SNORM;
vkTextureFormat = VK_FORMAT_R8G8B8_SNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8B8_SNORM;
vkBufferFormat = VK_FORMAT_R8G8B8_SNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8B8_SSCALED:
{
internalFormat = GL_RGB8_SSCALED_ANGLEX;
textureFormatID = angle::Format::ID::R8G8B8_SSCALED;
vkTextureFormat = VK_FORMAT_R8G8B8_SSCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8B8_SSCALED;
vkBufferFormat = VK_FORMAT_R8G8B8_SSCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8B8_UINT:
{
internalFormat = GL_RGB8UI;
textureFormatID = angle::Format::ID::R8G8B8_UINT;
vkTextureFormat = VK_FORMAT_R8G8B8_UINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8B8_UINT;
vkBufferFormat = VK_FORMAT_R8G8B8_UINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8B8_UNORM:
{
internalFormat = GL_RGB8;
textureFormatID = angle::Format::ID::R8G8B8A8_UNORM;
vkTextureFormat = VK_FORMAT_R8G8B8A8_UNORM;
textureInitializerFunction = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
bufferFormatID = angle::Format::ID::R8G8B8_UNORM;
vkBufferFormat = VK_FORMAT_R8G8B8_UNORM;
dataInitializerFunction = Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>;
break;
}
case angle::Format::ID::R8G8B8_UNORM_SRGB:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::R8G8B8_USCALED:
{
internalFormat = GL_RGB8_USCALED_ANGLEX;
textureFormatID = angle::Format::ID::R8G8B8_USCALED;
vkTextureFormat = VK_FORMAT_R8G8B8_USCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8B8_USCALED;
vkBufferFormat = VK_FORMAT_R8G8B8_USCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8_SINT:
{
internalFormat = GL_RG8I;
textureFormatID = angle::Format::ID::R8G8_SINT;
vkTextureFormat = VK_FORMAT_R8G8_SINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8_SINT;
vkBufferFormat = VK_FORMAT_R8G8_SINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8_SNORM:
{
internalFormat = GL_RG8_SNORM;
textureFormatID = angle::Format::ID::R8G8_SNORM;
vkTextureFormat = VK_FORMAT_R8G8_SNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8_SNORM;
vkBufferFormat = VK_FORMAT_R8G8_SNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8_SSCALED:
{
internalFormat = GL_RG8_SSCALED_ANGLEX;
textureFormatID = angle::Format::ID::R8G8_SSCALED;
vkTextureFormat = VK_FORMAT_R8G8_SSCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8_SSCALED;
vkBufferFormat = VK_FORMAT_R8G8_SSCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8_UINT:
{
internalFormat = GL_RG8UI;
textureFormatID = angle::Format::ID::R8G8_UINT;
vkTextureFormat = VK_FORMAT_R8G8_UINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8_UINT;
vkBufferFormat = VK_FORMAT_R8G8_UINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8_UNORM:
{
internalFormat = GL_RG8;
textureFormatID = angle::Format::ID::R8G8_UNORM;
vkTextureFormat = VK_FORMAT_R8G8_UNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8_UNORM;
vkBufferFormat = VK_FORMAT_R8G8_UNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8G8_USCALED:
{
internalFormat = GL_RG8_USCALED_ANGLEX;
textureFormatID = angle::Format::ID::R8G8_USCALED;
vkTextureFormat = VK_FORMAT_R8G8_USCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8G8_USCALED;
vkBufferFormat = VK_FORMAT_R8G8_USCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8_SINT:
{
internalFormat = GL_R8I;
textureFormatID = angle::Format::ID::R8_SINT;
vkTextureFormat = VK_FORMAT_R8_SINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8_SINT;
vkBufferFormat = VK_FORMAT_R8_SINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8_SNORM:
{
internalFormat = GL_R8_SNORM;
textureFormatID = angle::Format::ID::R8_SNORM;
vkTextureFormat = VK_FORMAT_R8_SNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8_SNORM;
vkBufferFormat = VK_FORMAT_R8_SNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8_SSCALED:
{
internalFormat = GL_R8_SSCALED_ANGLEX;
textureFormatID = angle::Format::ID::R8_SSCALED;
vkTextureFormat = VK_FORMAT_R8_SSCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8_SSCALED;
vkBufferFormat = VK_FORMAT_R8_SSCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8_UINT:
{
internalFormat = GL_R8UI;
textureFormatID = angle::Format::ID::R8_UINT;
vkTextureFormat = VK_FORMAT_R8_UINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8_UINT;
vkBufferFormat = VK_FORMAT_R8_UINT;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8_UNORM:
{
internalFormat = GL_R8;
textureFormatID = angle::Format::ID::R8_UNORM;
vkTextureFormat = VK_FORMAT_R8_UNORM;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8_UNORM;
vkBufferFormat = VK_FORMAT_R8_UNORM;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R8_USCALED:
{
internalFormat = GL_R8_USCALED_ANGLEX;
textureFormatID = angle::Format::ID::R8_USCALED;
vkTextureFormat = VK_FORMAT_R8_USCALED;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::R8_USCALED;
vkBufferFormat = VK_FORMAT_R8_USCALED;
dataInitializerFunction = nullptr;
break;
}
case angle::Format::ID::R9G9B9E5_SHAREDEXP:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::S8_UINT:
{
internalFormat = GL_STENCIL_INDEX8;
textureFormatID = angle::Format::ID::S8_UINT;
vkTextureFormat = VK_FORMAT_S8_UINT;
textureInitializerFunction = nullptr;
bufferFormatID = angle::Format::ID::S8_UINT;
vkBufferFormat = VK_FORMAT_S8_UINT;
dataInitializerFunction = nullptr;
break;
}
default:
UNREACHABLE();
......
......@@ -42,6 +42,20 @@ void FillTextureFormatCaps(const VkFormatProperties &formatProperties,
outTextureCaps->renderbuffer = outTextureCaps->textureAttachment;
}
bool HasFullTextureFormatSupport(VkPhysicalDevice physicalDevice, VkFormat vkFormat)
{
VkFormatProperties formatProperties;
vk::GetFormatProperties(physicalDevice, vkFormat, &formatProperties);
constexpr uint32_t kBitsColor =
(VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT);
constexpr uint32_t kBitsDepth = (VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT);
return HasFormatFeatureBits(kBitsColor, formatProperties) ||
HasFormatFeatureBits(kBitsDepth, formatProperties);
}
} // anonymous namespace
namespace vk
......@@ -70,20 +84,6 @@ void GetFormatProperties(VkPhysicalDevice physicalDevice,
}
}
bool HasFullFormatSupport(VkPhysicalDevice physicalDevice, VkFormat vkFormat)
{
VkFormatProperties formatProperties;
GetFormatProperties(physicalDevice, vkFormat, &formatProperties);
constexpr uint32_t kBitsColor =
(VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT);
constexpr uint32_t kBitsDepth = (VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT);
return HasFormatFeatureBits(kBitsColor, formatProperties) ||
HasFormatFeatureBits(kBitsDepth, formatProperties);
}
// Format implementation.
Format::Format()
: angleFormatID(angle::Format::ID::NONE),
......@@ -92,9 +92,46 @@ Format::Format()
vkTextureFormat(VK_FORMAT_UNDEFINED),
bufferFormatID(angle::Format::ID::NONE),
vkBufferFormat(VK_FORMAT_UNDEFINED),
dataInitializerFunction(nullptr),
loadFunctions()
textureInitializerFunction(nullptr),
textureLoadFunctions()
{
}
void Format::initTextureFallback(VkPhysicalDevice physicalDevice,
angle::Format::ID format,
VkFormat vkFormat,
InitializeTextureDataFunction initializer,
angle::Format::ID fallbackFormat,
VkFormat fallbackVkFormat,
InitializeTextureDataFunction fallbackInitializer)
{
ASSERT(format != angle::Format::ID::NONE);
ASSERT(fallbackFormat != angle::Format::ID::NONE);
if (HasFullTextureFormatSupport(physicalDevice, vkFormat))
{
textureFormatID = format;
vkTextureFormat = vkFormat;
textureInitializerFunction = initializer;
}
else
{
textureFormatID = fallbackFormat;
vkTextureFormat = fallbackVkFormat;
textureInitializerFunction = fallbackInitializer;
ASSERT(HasFullTextureFormatSupport(physicalDevice, vkTextureFormat));
}
}
void Format::initBufferFallback(VkPhysicalDevice physicalDevice,
angle::Format::ID format,
VkFormat vkFormat,
angle::Format::ID fallbackFormat,
VkFormat fallbackVkFormat)
{
ASSERT(format != angle::Format::ID::NONE);
ASSERT(fallbackFormat != angle::Format::ID::NONE);
UNIMPLEMENTED();
}
const angle::Format &Format::textureFormat() const
......@@ -141,7 +178,7 @@ void FormatTable::initialize(VkPhysicalDevice physicalDevice,
const angle::Format &angleFormat = angle::Format::Get(formatID);
mFormatData[formatIndex].initialize(physicalDevice, angleFormat);
const GLenum internalFormat = mFormatData[formatIndex].internalFormat;
mFormatData[formatIndex].loadFunctions =
mFormatData[formatIndex].textureLoadFunctions =
GetLoadFunctionsMap(internalFormat, mFormatData[formatIndex].textureFormatID);
mFormatData[formatIndex].angleFormatID = formatID;
......
......@@ -41,6 +41,20 @@ struct Format final : private angle::NonCopyable
// This is an auto-generated method in vk_format_table_autogen.cpp.
void initialize(VkPhysicalDevice physicalDevice, const angle::Format &angleFormat);
void initTextureFallback(VkPhysicalDevice physicalDevice,
angle::Format::ID format,
VkFormat vkFormat,
InitializeTextureDataFunction initializer,
angle::Format::ID fallbackFormat,
VkFormat fallbackVkFormat,
InitializeTextureDataFunction fallbackInitializer);
void initBufferFallback(VkPhysicalDevice physicalDevice,
angle::Format::ID format,
VkFormat vkFormat,
angle::Format::ID fallbackFormat,
VkFormat fallbackVkFormat);
const angle::Format &textureFormat() const;
const angle::Format &bufferFormat() const;
const angle::Format &angleFormat() const;
......@@ -51,8 +65,8 @@ struct Format final : private angle::NonCopyable
VkFormat vkTextureFormat;
angle::Format::ID bufferFormatID;
VkFormat vkBufferFormat;
InitializeTextureDataFunction dataInitializerFunction;
LoadFunctionMap loadFunctions;
InitializeTextureDataFunction textureInitializerFunction;
LoadFunctionMap textureLoadFunctions;
};
bool operator==(const Format &lhs, const Format &rhs);
......@@ -83,8 +97,6 @@ class FormatTable final : angle::NonCopyable
// initialized to 0.
const VkFormatProperties &GetMandatoryFormatSupport(VkFormat vkFormat);
bool HasFullFormatSupport(VkPhysicalDevice physicalDevice, VkFormat vkFormat);
} // namespace vk
} // namespace rx
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment