Commit ba365939 by Jamie Madill Committed by Commit Bot

Rename angle::Format::ID to angle::FormatID.

This allow for predeclaring the enum. It solves some include dependency issues. Bug: angleproject:2729 Change-Id: Ibbbab0796e466c62848404ba277c5f454fd9ac62 Reviewed-on: https://chromium-review.googlesource.com/1142299 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarFrank Henigman <fjhenigman@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent d754eb56
...@@ -6,15 +6,15 @@ ...@@ -6,15 +6,15 @@
"ANGLE format:src/libANGLE/renderer/angle_format_map.json": "ANGLE format:src/libANGLE/renderer/angle_format_map.json":
"ea6dfe3ebbc86e04f0d4b9f568ba22ae", "ea6dfe3ebbc86e04f0d4b9f568ba22ae",
"ANGLE format:src/libANGLE/renderer/gen_angle_format_table.py": "ANGLE format:src/libANGLE/renderer/gen_angle_format_table.py":
"dcb81c64e2c89f57a7105ab07ef0ffd0", "68e7a56c323a44170656478f2bcc9ff8",
"ANGLE load functions table:src/libANGLE/renderer/gen_load_functions_table.py": "ANGLE load functions table:src/libANGLE/renderer/gen_load_functions_table.py":
"3fa54bf0a8911fa0cb102e569f1facbb", "8afc7eecce2a3ba9f0b4beacb1aa7fe2",
"ANGLE load functions table:src/libANGLE/renderer/load_functions_data.json": "ANGLE load functions table:src/libANGLE/renderer/load_functions_data.json":
"21a603f6224d3b6cd606b71dca0ae181", "21a603f6224d3b6cd606b71dca0ae181",
"D3D11 format:src/libANGLE/renderer/angle_format.py": "D3D11 format:src/libANGLE/renderer/angle_format.py":
"b18ca0fe4835114a4a2f54977b19e798", "b18ca0fe4835114a4a2f54977b19e798",
"D3D11 format:src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py": "D3D11 format:src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py":
"1ab3a192c6bb23a926d0a5d0ed84cbf3", "15fb2a9b3f81e39a22090bce2f071185",
"D3D11 format:src/libANGLE/renderer/d3d/d3d11/texture_format_data.json": "D3D11 format:src/libANGLE/renderer/d3d/d3d11/texture_format_data.json":
"fde460b6823388a8f27082ec266ad64f", "fde460b6823388a8f27082ec266ad64f",
"D3D11 format:src/libANGLE/renderer/d3d/d3d11/texture_format_map.json": "D3D11 format:src/libANGLE/renderer/d3d/d3d11/texture_format_map.json":
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
"Vulkan format:src/libANGLE/renderer/angle_format_map.json": "Vulkan format:src/libANGLE/renderer/angle_format_map.json":
"ea6dfe3ebbc86e04f0d4b9f568ba22ae", "ea6dfe3ebbc86e04f0d4b9f568ba22ae",
"Vulkan format:src/libANGLE/renderer/vulkan/gen_vk_format_table.py": "Vulkan format:src/libANGLE/renderer/vulkan/gen_vk_format_table.py":
"2ecc99c12cd41bda7107a7d9ffe3786c", "4a69cb1e69194ca237b94642edbd3f69",
"Vulkan format:src/libANGLE/renderer/vulkan/vk_format_map.json": "Vulkan format:src/libANGLE/renderer/vulkan/vk_format_map.json":
"d1afcd16318ca0a19550d713eb23b85a", "d1afcd16318ca0a19550d713eb23b85a",
"Vulkan internal shader programs:src/libANGLE/renderer/vulkan/gen_vk_internal_shaders.py": "Vulkan internal shader programs:src/libANGLE/renderer/vulkan/gen_vk_internal_shaders.py":
......
...@@ -102,8 +102,8 @@ TextureCapsMap::~TextureCapsMap() ...@@ -102,8 +102,8 @@ TextureCapsMap::~TextureCapsMap()
void TextureCapsMap::insert(GLenum internalFormat, const TextureCaps &caps) void TextureCapsMap::insert(GLenum internalFormat, const TextureCaps &caps)
{ {
angle::Format::ID formatID = angle::Format::InternalFormatToID(internalFormat); angle::FormatID formatID = angle::Format::InternalFormatToID(internalFormat);
get(formatID) = caps; get(formatID) = caps;
} }
void TextureCapsMap::clear() void TextureCapsMap::clear()
...@@ -113,21 +113,21 @@ void TextureCapsMap::clear() ...@@ -113,21 +113,21 @@ void TextureCapsMap::clear()
const TextureCaps &TextureCapsMap::get(GLenum internalFormat) const const TextureCaps &TextureCapsMap::get(GLenum internalFormat) const
{ {
angle::Format::ID formatID = angle::Format::InternalFormatToID(internalFormat); angle::FormatID formatID = angle::Format::InternalFormatToID(internalFormat);
return get(formatID); return get(formatID);
} }
const TextureCaps &TextureCapsMap::get(angle::Format::ID formatID) const const TextureCaps &TextureCapsMap::get(angle::FormatID formatID) const
{ {
return mFormatData[static_cast<size_t>(formatID)]; return mFormatData[static_cast<size_t>(formatID)];
} }
TextureCaps &TextureCapsMap::get(angle::Format::ID formatID) TextureCaps &TextureCapsMap::get(angle::FormatID formatID)
{ {
return mFormatData[static_cast<size_t>(formatID)]; return mFormatData[static_cast<size_t>(formatID)];
} }
void TextureCapsMap::set(angle::Format::ID formatID, const TextureCaps &caps) void TextureCapsMap::set(angle::FormatID formatID, const TextureCaps &caps)
{ {
get(formatID) = caps; get(formatID) = caps;
} }
......
...@@ -71,13 +71,13 @@ class TextureCapsMap final : angle::NonCopyable ...@@ -71,13 +71,13 @@ class TextureCapsMap final : angle::NonCopyable
void clear(); void clear();
// Prefer using angle::Format methods. // Prefer using angle::Format methods.
const TextureCaps &get(angle::Format::ID formatID) const; const TextureCaps &get(angle::FormatID formatID) const;
void set(angle::Format::ID formatID, const TextureCaps &caps); void set(angle::FormatID formatID, const TextureCaps &caps);
private: private:
TextureCaps &get(angle::Format::ID formatID); TextureCaps &get(angle::FormatID formatID);
// Indexed by angle::Format::ID // Indexed by angle::FormatID
std::array<TextureCaps, angle::kNumANGLEFormats> mFormatData; std::array<TextureCaps, angle::kNumANGLEFormats> mFormatData;
}; };
......
...@@ -314,11 +314,11 @@ struct VertexFormat : private angle::NonCopyable ...@@ -314,11 +314,11 @@ struct VertexFormat : private angle::NonCopyable
bool pureInteger; bool pureInteger;
}; };
angle::Format::ID GetVertexFormatID(GLenum type, angle::FormatID GetVertexFormatID(GLenum type,
GLboolean normalized, GLboolean normalized,
GLuint components, GLuint components,
bool pureInteger); bool pureInteger);
angle::Format::ID GetVertexFormatID(const VertexAttribute &attrib); angle::FormatID GetVertexFormatID(const VertexAttribute &attrib);
VertexFormatType GetVertexFormatType(GLenum type, VertexFormatType GetVertexFormatType(GLenum type,
GLboolean normalized, GLboolean normalized,
GLuint components, GLuint components,
......
...@@ -16,12 +16,11 @@ ...@@ -16,12 +16,11 @@
namespace angle namespace angle
{ {
enum class FormatID;
struct Format final : private angle::NonCopyable struct Format final : private angle::NonCopyable
{ {
enum class ID; constexpr Format(FormatID id,
constexpr Format(ID id,
GLenum glFormat, GLenum glFormat,
GLenum fboFormat, GLenum fboFormat,
rx::MipGenerationFunction mipGen, rx::MipGenerationFunction mipGen,
...@@ -38,12 +37,12 @@ struct Format final : private angle::NonCopyable ...@@ -38,12 +37,12 @@ struct Format final : private angle::NonCopyable
GLuint pixelBytes, GLuint pixelBytes,
bool isBlock); bool isBlock);
static const Format &Get(ID id); static const Format &Get(FormatID id);
static ID InternalFormatToID(GLenum internalFormat); static FormatID InternalFormatToID(GLenum internalFormat);
constexpr bool hasDepthOrStencilBits() const; constexpr bool hasDepthOrStencilBits() const;
ID id; FormatID id;
// The closest matching GL internal format for the storage this format uses. Note that this // The closest matching GL internal format for the storage this format uses. Note that this
// may be a different internal format than the one this ANGLE format is used for. // may be a different internal format than the one this ANGLE format is used for.
...@@ -75,7 +74,7 @@ struct Format final : private angle::NonCopyable ...@@ -75,7 +74,7 @@ struct Format final : private angle::NonCopyable
bool isBlock; bool isBlock;
}; };
constexpr Format::Format(ID id, constexpr Format::Format(FormatID id,
GLenum glFormat, GLenum glFormat,
GLenum fboFormat, GLenum fboFormat,
rx::MipGenerationFunction mipGen, rx::MipGenerationFunction mipGen,
...@@ -116,6 +115,6 @@ constexpr bool Format::hasDepthOrStencilBits() const ...@@ -116,6 +115,6 @@ constexpr bool Format::hasDepthOrStencilBits() const
} }
} // namespace angle } // namespace angle
#include "libANGLE/renderer/Format_ID_autogen.inl" #include "libANGLE/renderer/FormatID_autogen.inc"
#endif // LIBANGLE_RENDERER_FORMAT_H_ #endif // LIBANGLE_RENDERER_FORMAT_H_
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
namespace angle namespace angle
{ {
enum class Format::ID enum class FormatID
{ {
NONE, NONE,
A16_FLOAT, A16_FLOAT,
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
#include "libANGLE/renderer/d3d/SwapChainD3D.h" #include "libANGLE/renderer/d3d/SwapChainD3D.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h" #include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
#include <tchar.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
#include <tchar.h>
#include <algorithm> #include <algorithm>
namespace rx namespace rx
...@@ -101,29 +101,29 @@ egl::Error SurfaceD3D::initialize(const egl::Display *display) ...@@ -101,29 +101,29 @@ egl::Error SurfaceD3D::initialize(const egl::Display *display)
&mColorFormat)); &mColorFormat));
if (mState.attributes.contains(EGL_GL_COLORSPACE)) if (mState.attributes.contains(EGL_GL_COLORSPACE))
{ {
if (mColorFormat->id != angle::Format::ID::R8G8B8A8_TYPELESS && if (mColorFormat->id != angle::FormatID::R8G8B8A8_TYPELESS &&
mColorFormat->id != angle::Format::ID::B8G8R8A8_TYPELESS) mColorFormat->id != angle::FormatID::B8G8R8A8_TYPELESS)
{ {
return egl::EglBadMatch() return egl::EglBadMatch()
<< "EGL_GL_COLORSPACE may only be specified for TYPELESS textures"; << "EGL_GL_COLORSPACE may only be specified for TYPELESS textures";
} }
} }
if (mColorFormat->id == angle::Format::ID::R8G8B8A8_TYPELESS) if (mColorFormat->id == angle::FormatID::R8G8B8A8_TYPELESS)
{ {
EGLAttrib colorspace = EGLAttrib colorspace =
mState.attributes.get(EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR); mState.attributes.get(EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR);
if (colorspace == EGL_GL_COLORSPACE_SRGB) if (colorspace == EGL_GL_COLORSPACE_SRGB)
{ {
mColorFormat = &angle::Format::Get(angle::Format::ID::R8G8B8A8_TYPELESS_SRGB); mColorFormat = &angle::Format::Get(angle::FormatID::R8G8B8A8_TYPELESS_SRGB);
} }
} }
if (mColorFormat->id == angle::Format::ID::B8G8R8A8_TYPELESS) if (mColorFormat->id == angle::FormatID::B8G8R8A8_TYPELESS)
{ {
EGLAttrib colorspace = EGLAttrib colorspace =
mState.attributes.get(EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR); mState.attributes.get(EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR);
if (colorspace == EGL_GL_COLORSPACE_SRGB) if (colorspace == EGL_GL_COLORSPACE_SRGB)
{ {
mColorFormat = &angle::Format::Get(angle::Format::ID::B8G8R8A8_TYPELESS_SRGB); mColorFormat = &angle::Format::Get(angle::FormatID::B8G8R8A8_TYPELESS_SRGB);
} }
} }
mRenderTargetFormat = mColorFormat->fboImplementationInternalFormat; mRenderTargetFormat = mColorFormat->fboImplementationInternalFormat;
...@@ -171,13 +171,13 @@ egl::Error SurfaceD3D::resetSwapChain(const egl::Display *display) ...@@ -171,13 +171,13 @@ egl::Error SurfaceD3D::resetSwapChain(const egl::Display *display)
return egl::EglBadSurface() << "Could not retrieve the window dimensions"; return egl::EglBadSurface() << "Could not retrieve the window dimensions";
} }
width = windowRect.right - windowRect.left; width = windowRect.right - windowRect.left;
height = windowRect.bottom - windowRect.top; height = windowRect.bottom - windowRect.top;
} }
else else
{ {
// non-window surface - size is determined at creation // non-window surface - size is determined at creation
width = mWidth; width = mWidth;
height = mHeight; height = mHeight;
} }
...@@ -221,7 +221,7 @@ egl::Error SurfaceD3D::resizeSwapChain(DisplayD3D *displayD3D, ...@@ -221,7 +221,7 @@ egl::Error SurfaceD3D::resizeSwapChain(DisplayD3D *displayD3D,
return egl::Error(status); return egl::Error(status);
} }
mWidth = backbufferWidth; mWidth = backbufferWidth;
mHeight = backbufferHeight; mHeight = backbufferHeight;
return egl::NoError(); return egl::NoError();
...@@ -247,8 +247,8 @@ egl::Error SurfaceD3D::resetSwapChain(DisplayD3D *displayD3D, ...@@ -247,8 +247,8 @@ egl::Error SurfaceD3D::resetSwapChain(DisplayD3D *displayD3D,
return egl::Error(status); return egl::Error(status);
} }
mWidth = backbufferWidth; mWidth = backbufferWidth;
mHeight = backbufferHeight; mHeight = backbufferHeight;
mSwapIntervalDirty = false; mSwapIntervalDirty = false;
return egl::NoError(); return egl::NoError();
...@@ -298,23 +298,24 @@ egl::Error SurfaceD3D::swapRect(DisplayD3D *displayD3D, ...@@ -298,23 +298,24 @@ egl::Error SurfaceD3D::swapRect(DisplayD3D *displayD3D,
egl::Error SurfaceD3D::checkForOutOfDateSwapChain(DisplayD3D *displayD3D) egl::Error SurfaceD3D::checkForOutOfDateSwapChain(DisplayD3D *displayD3D)
{ {
RECT client; RECT client;
int clientWidth = getWidth(); int clientWidth = getWidth();
int clientHeight = getHeight(); int clientHeight = getHeight();
bool sizeDirty = false; bool sizeDirty = false;
if (!mFixedSize && !mNativeWindow->isIconic()) if (!mFixedSize && !mNativeWindow->isIconic())
{ {
// The window is automatically resized to 150x22 when it's minimized, but the swapchain shouldn't be resized // The window is automatically resized to 150x22 when it's minimized, but the swapchain
// because that's not a useful size to render to. // shouldn't be resized because that's not a useful size to render to.
if (!mNativeWindow->getClientRect(&client)) if (!mNativeWindow->getClientRect(&client))
{ {
UNREACHABLE(); UNREACHABLE();
return egl::NoError(); return egl::NoError();
} }
// Grow the buffer now, if the window has grown. We need to grow now to avoid losing information. // Grow the buffer now, if the window has grown. We need to grow now to avoid losing
clientWidth = client.right - client.left; // information.
clientWidth = client.right - client.left;
clientHeight = client.bottom - client.top; clientHeight = client.bottom - client.top;
sizeDirty = clientWidth != getWidth() || clientHeight != getHeight(); sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
} }
if (mSwapIntervalDirty) if (mSwapIntervalDirty)
...@@ -357,7 +358,7 @@ void SurfaceD3D::setSwapInterval(EGLint interval) ...@@ -357,7 +358,7 @@ void SurfaceD3D::setSwapInterval(EGLint interval)
return; return;
} }
mSwapInterval = interval; mSwapInterval = interval;
mSwapIntervalDirty = true; mSwapIntervalDirty = true;
} }
...@@ -392,7 +393,8 @@ egl::Error SurfaceD3D::querySurfacePointerANGLE(EGLint attribute, void **value) ...@@ -392,7 +393,8 @@ egl::Error SurfaceD3D::querySurfacePointerANGLE(EGLint attribute, void **value)
{ {
*value = mSwapChain->getKeyedMutex(); *value = mSwapChain->getKeyedMutex();
} }
else UNREACHABLE(); else
UNREACHABLE();
return egl::NoError(); return egl::NoError();
} }
...@@ -437,13 +439,7 @@ WindowSurfaceD3D::WindowSurfaceD3D(const egl::SurfaceState &state, ...@@ -437,13 +439,7 @@ WindowSurfaceD3D::WindowSurfaceD3D(const egl::SurfaceState &state,
egl::Display *display, egl::Display *display,
EGLNativeWindowType window, EGLNativeWindowType window,
const egl::AttributeMap &attribs) const egl::AttributeMap &attribs)
: SurfaceD3D(state, : SurfaceD3D(state, renderer, display, window, 0, static_cast<EGLClientBuffer>(0), attribs)
renderer,
display,
window,
0,
static_cast<EGLClientBuffer>(0),
attribs)
{ {
} }
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h" #include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
#include "libANGLE/renderer/d3d/d3d11/SwapChain11.h" #include "libANGLE/renderer/d3d/d3d11/SwapChain11.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h" #include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
namespace rx namespace rx
...@@ -30,7 +30,7 @@ bool GetTextureProperties(ID3D11Resource *resource, unsigned int *mipLevels, uns ...@@ -30,7 +30,7 @@ bool GetTextureProperties(ID3D11Resource *resource, unsigned int *mipLevels, uns
SafeRelease(texture1D); SafeRelease(texture1D);
*mipLevels = texDesc.MipLevels; *mipLevels = texDesc.MipLevels;
*samples = 0; *samples = 0;
return true; return true;
} }
...@@ -43,7 +43,7 @@ bool GetTextureProperties(ID3D11Resource *resource, unsigned int *mipLevels, uns ...@@ -43,7 +43,7 @@ bool GetTextureProperties(ID3D11Resource *resource, unsigned int *mipLevels, uns
SafeRelease(texture2D); SafeRelease(texture2D);
*mipLevels = texDesc.MipLevels; *mipLevels = texDesc.MipLevels;
*samples = texDesc.SampleDesc.Count > 1 ? texDesc.SampleDesc.Count : 0; *samples = texDesc.SampleDesc.Count > 1 ? texDesc.SampleDesc.Count : 0;
return true; return true;
} }
...@@ -56,7 +56,7 @@ bool GetTextureProperties(ID3D11Resource *resource, unsigned int *mipLevels, uns ...@@ -56,7 +56,7 @@ bool GetTextureProperties(ID3D11Resource *resource, unsigned int *mipLevels, uns
SafeRelease(texture3D); SafeRelease(texture3D);
*mipLevels = texDesc.MipLevels; *mipLevels = texDesc.MipLevels;
*samples = 0; *samples = 0;
return true; return true;
} }
...@@ -69,7 +69,7 @@ unsigned int GetRTVSubresourceIndex(ID3D11Resource *resource, ID3D11RenderTarget ...@@ -69,7 +69,7 @@ unsigned int GetRTVSubresourceIndex(ID3D11Resource *resource, ID3D11RenderTarget
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc; D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
view->GetDesc(&rtvDesc); view->GetDesc(&rtvDesc);
unsigned int mipSlice = 0; unsigned int mipSlice = 0;
unsigned int arraySlice = 0; unsigned int arraySlice = 0;
switch (rtvDesc.ViewDimension) switch (rtvDesc.ViewDimension)
...@@ -130,7 +130,7 @@ unsigned int GetDSVSubresourceIndex(ID3D11Resource *resource, ID3D11DepthStencil ...@@ -130,7 +130,7 @@ unsigned int GetDSVSubresourceIndex(ID3D11Resource *resource, ID3D11DepthStencil
D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc; D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
view->GetDesc(&dsvDesc); view->GetDesc(&dsvDesc);
unsigned int mipSlice = 0; unsigned int mipSlice = 0;
unsigned int arraySlice = 0; unsigned int arraySlice = 0;
switch (dsvDesc.ViewDimension) switch (dsvDesc.ViewDimension)
...@@ -229,7 +229,7 @@ TextureRenderTarget11::TextureRenderTarget11(d3d11::RenderTargetView &&rtv, ...@@ -229,7 +229,7 @@ TextureRenderTarget11::TextureRenderTarget11(d3d11::RenderTargetView &&rtv,
{ {
mSubresourceIndex = GetRTVSubresourceIndex(mTexture.get(), mRenderTarget.get()); mSubresourceIndex = GetRTVSubresourceIndex(mTexture.get(), mRenderTarget.get());
} }
ASSERT(mFormatSet.formatID != angle::Format::ID::NONE || mWidth == 0 || mHeight == 0); ASSERT(mFormatSet.formatID != angle::FormatID::NONE || mWidth == 0 || mHeight == 0);
} }
TextureRenderTarget11::TextureRenderTarget11(d3d11::DepthStencilView &&dsv, TextureRenderTarget11::TextureRenderTarget11(d3d11::DepthStencilView &&dsv,
...@@ -258,7 +258,7 @@ TextureRenderTarget11::TextureRenderTarget11(d3d11::DepthStencilView &&dsv, ...@@ -258,7 +258,7 @@ TextureRenderTarget11::TextureRenderTarget11(d3d11::DepthStencilView &&dsv,
{ {
mSubresourceIndex = GetDSVSubresourceIndex(mTexture.get(), mDepthStencil.get()); mSubresourceIndex = GetDSVSubresourceIndex(mTexture.get(), mDepthStencil.get());
} }
ASSERT(mFormatSet.formatID != angle::Format::ID::NONE || mWidth == 0 || mHeight == 0); ASSERT(mFormatSet.formatID != angle::FormatID::NONE || mWidth == 0 || mHeight == 0);
} }
TextureRenderTarget11::~TextureRenderTarget11() TextureRenderTarget11::~TextureRenderTarget11()
......
...@@ -141,7 +141,7 @@ def get_blit_srv_format(angle_format): ...@@ -141,7 +141,7 @@ def get_blit_srv_format(angle_format):
format_entry_template = """{space}{{ format_entry_template = """{space}{{
{space} static constexpr Format info({internalFormat}, {space} static constexpr Format info({internalFormat},
{space} angle::Format::ID::{formatName}, {space} angle::FormatID::{formatName},
{space} {texFormat}, {space} {texFormat},
{space} {srvFormat}, {space} {srvFormat},
{space} {uavFormat}, {space} {uavFormat},
...@@ -157,7 +157,7 @@ format_entry_template = """{space}{{ ...@@ -157,7 +157,7 @@ format_entry_template = """{space}{{
split_format_entry_template = """{space} {condition} split_format_entry_template = """{space} {condition}
{space} {{ {space} {{
{space} static constexpr Format info({internalFormat}, {space} static constexpr Format info({internalFormat},
{space} angle::Format::ID::{formatName}, {space} angle::FormatID::{formatName},
{space} {texFormat}, {space} {texFormat},
{space} {srvFormat}, {space} {srvFormat},
{space} {uavFormat}, {space} {uavFormat},
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
#include "common/angleutils.h" #include "common/angleutils.h"
#include "common/platform.h" #include "common/platform.h"
#include "libANGLE/renderer/Format.h" #include "libANGLE/renderer/Format.h"
#include "libANGLE/renderer/renderer_utils.h"
#include "libANGLE/renderer/d3d/formatutilsD3D.h" #include "libANGLE/renderer/d3d/formatutilsD3D.h"
#include "libANGLE/renderer/renderer_utils.h"
namespace rx namespace rx
{ {
...@@ -34,7 +34,7 @@ struct Format final : private angle::NonCopyable ...@@ -34,7 +34,7 @@ struct Format final : private angle::NonCopyable
{ {
constexpr Format(); constexpr Format();
constexpr Format(GLenum internalFormat, constexpr Format(GLenum internalFormat,
angle::Format::ID formatID, angle::FormatID formatID,
DXGI_FORMAT texFormat, DXGI_FORMAT texFormat,
DXGI_FORMAT srvFormat, DXGI_FORMAT srvFormat,
DXGI_FORMAT uavFormat, DXGI_FORMAT uavFormat,
...@@ -51,7 +51,7 @@ struct Format final : private angle::NonCopyable ...@@ -51,7 +51,7 @@ struct Format final : private angle::NonCopyable
const angle::Format &format() const; const angle::Format &format() const;
GLenum internalFormat; GLenum internalFormat;
angle::Format::ID formatID; angle::FormatID formatID;
DXGI_FORMAT texFormat; DXGI_FORMAT texFormat;
DXGI_FORMAT srvFormat; DXGI_FORMAT srvFormat;
...@@ -68,7 +68,7 @@ struct Format final : private angle::NonCopyable ...@@ -68,7 +68,7 @@ struct Format final : private angle::NonCopyable
constexpr Format::Format() constexpr Format::Format()
: internalFormat(GL_NONE), : internalFormat(GL_NONE),
formatID(angle::Format::ID::NONE), formatID(angle::FormatID::NONE),
texFormat(DXGI_FORMAT_UNKNOWN), texFormat(DXGI_FORMAT_UNKNOWN),
srvFormat(DXGI_FORMAT_UNKNOWN), srvFormat(DXGI_FORMAT_UNKNOWN),
uavFormat(DXGI_FORMAT_UNKNOWN), uavFormat(DXGI_FORMAT_UNKNOWN),
...@@ -81,7 +81,7 @@ constexpr Format::Format() ...@@ -81,7 +81,7 @@ constexpr Format::Format()
} }
constexpr Format::Format(GLenum internalFormat, constexpr Format::Format(GLenum internalFormat,
angle::Format::ID formatID, angle::FormatID formatID,
DXGI_FORMAT texFormat, DXGI_FORMAT texFormat,
DXGI_FORMAT srvFormat, DXGI_FORMAT srvFormat,
DXGI_FORMAT uavFormat, DXGI_FORMAT uavFormat,
......
...@@ -780,7 +780,7 @@ egl::Error Renderer9::getD3DTextureInfo(const egl::Config *config, ...@@ -780,7 +780,7 @@ egl::Error Renderer9::getD3DTextureInfo(const egl::Config *config,
if (angleFormat) if (angleFormat)
{ {
const auto &d3dFormatInfo = d3d9::GetD3DFormatInfo(desc.Format); const auto &d3dFormatInfo = d3d9::GetD3DFormatInfo(desc.Format);
ASSERT(d3dFormatInfo.info().id != angle::Format::ID::NONE); ASSERT(d3dFormatInfo.info().id != angle::FormatID::NONE);
*angleFormat = &d3dFormatInfo.info(); *angleFormat = &d3dFormatInfo.info();
} }
...@@ -1004,7 +1004,7 @@ gl::Error Renderer9::setTexture(const gl::Context *context, ...@@ -1004,7 +1004,7 @@ gl::Error Renderer9::setTexture(const gl::Context *context,
gl::Texture *texture) gl::Texture *texture)
{ {
int d3dSamplerOffset = (type == gl::ShaderType::Fragment) ? 0 : D3DVERTEXTEXTURESAMPLER0; int d3dSamplerOffset = (type == gl::ShaderType::Fragment) ? 0 : D3DVERTEXTEXTURESAMPLER0;
int d3dSampler = index + d3dSamplerOffset; int d3dSampler = index + d3dSamplerOffset;
IDirect3DBaseTexture9 *d3dTexture = nullptr; IDirect3DBaseTexture9 *d3dTexture = nullptr;
bool forceSetTexture = false; bool forceSetTexture = false;
......
...@@ -41,7 +41,7 @@ struct D3DFormat ...@@ -41,7 +41,7 @@ struct D3DFormat
GLuint luminanceBits, GLuint luminanceBits,
GLuint depthBits, GLuint depthBits,
GLuint stencilBits, GLuint stencilBits,
angle::Format::ID formatID); angle::FormatID formatID);
const angle::Format &info() const { return angle::Format::Get(formatID); } const angle::Format &info() const { return angle::Format::Get(formatID); }
...@@ -58,7 +58,7 @@ struct D3DFormat ...@@ -58,7 +58,7 @@ struct D3DFormat
GLuint depthBits; GLuint depthBits;
GLuint stencilBits; GLuint stencilBits;
angle::Format::ID formatID; angle::FormatID formatID;
}; };
const D3DFormat &GetD3DFormatInfo(D3DFORMAT format); const D3DFormat &GetD3DFormatInfo(D3DFORMAT format);
...@@ -73,7 +73,8 @@ struct VertexFormat ...@@ -73,7 +73,8 @@ struct VertexFormat
D3DDECLTYPE nativeFormat; D3DDECLTYPE nativeFormat;
GLenum componentType; GLenum componentType;
}; };
const VertexFormat &GetVertexFormatInfo(DWORD supportedDeclTypes, gl::VertexFormatType vertexFormatType); const VertexFormat &GetVertexFormatInfo(DWORD supportedDeclTypes,
gl::VertexFormatType vertexFormatType);
struct TextureFormat struct TextureFormat
{ {
...@@ -87,9 +88,7 @@ struct TextureFormat ...@@ -87,9 +88,7 @@ struct TextureFormat
LoadImageFunction loadFunction; LoadImageFunction loadFunction;
}; };
const TextureFormat &GetTextureFormatInfo(GLenum internalFormat); const TextureFormat &GetTextureFormatInfo(GLenum internalFormat);
} }
} }
#endif // LIBANGLE_RENDERER_D3D_D3D9_FORMATUTILS9_H_ #endif // LIBANGLE_RENDERER_D3D_D3D9_FORMATUTILS9_H_
...@@ -27,7 +27,7 @@ template_autogen_h = """// GENERATED FILE - DO NOT EDIT. ...@@ -27,7 +27,7 @@ template_autogen_h = """// GENERATED FILE - DO NOT EDIT.
namespace angle namespace angle
{{ {{
enum class Format::ID enum class FormatID
{{ {{
{angle_format_enum} {angle_format_enum}
}}; }};
...@@ -63,12 +63,12 @@ static constexpr rx::FastCopyFunctionMap NoCopyFunctions; ...@@ -63,12 +63,12 @@ static constexpr rx::FastCopyFunctionMap NoCopyFunctions;
constexpr Format g_formatInfoTable[] = {{ constexpr Format g_formatInfoTable[] = {{
// clang-format off // clang-format off
{{ Format::ID::NONE, GL_NONE, GL_NONE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_NONE, 0, 0, 0, 0, 0, 0, 0, false }}, {{ FormatID::NONE, GL_NONE, GL_NONE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_NONE, 0, 0, 0, 0, 0, 0, 0, false }},
{angle_format_info_cases} // clang-format on {angle_format_info_cases} // clang-format on
}}; }};
// static // static
Format::ID Format::InternalFormatToID(GLenum internalFormat) FormatID Format::InternalFormatToID(GLenum internalFormat)
{{ {{
switch (internalFormat) switch (internalFormat)
{{ {{
...@@ -77,7 +77,7 @@ Format::ID Format::InternalFormatToID(GLenum internalFormat) ...@@ -77,7 +77,7 @@ Format::ID Format::InternalFormatToID(GLenum internalFormat)
}} }}
// static // static
const Format &Format::Get(ID id) const Format &Format::Get(FormatID id)
{{ {{
return g_formatInfoTable[static_cast<size_t>(id)]; return g_formatInfoTable[static_cast<size_t>(id)];
}} }}
...@@ -146,7 +146,7 @@ def get_color_write_function(angle_format): ...@@ -146,7 +146,7 @@ def get_color_write_function(angle_format):
return 'WriteColor<' + channel_struct + ', '+ write_component_type + '>' return 'WriteColor<' + channel_struct + ', '+ write_component_type + '>'
format_entry_template = """ {{ Format::ID::{id}, {glInternalFormat}, {fboImplementationInternalFormat}, {mipGenerationFunction}, {fastCopyFunctions}, {colorReadFunction}, {colorWriteFunction}, {namedComponentType}, {R}, {G}, {B}, {A}, {D}, {S}, {pixelBytes}, {isBlock} }}, format_entry_template = """ {{ FormatID::{id}, {glInternalFormat}, {fboImplementationInternalFormat}, {mipGenerationFunction}, {fastCopyFunctions}, {colorReadFunction}, {colorWriteFunction}, {namedComponentType}, {R}, {G}, {B}, {A}, {D}, {S}, {pixelBytes}, {isBlock} }},
""" """
def get_named_component_type(component_type): def get_named_component_type(component_type):
...@@ -234,7 +234,7 @@ def gen_enum_string(all_angle): ...@@ -234,7 +234,7 @@ def gen_enum_string(all_angle):
return enum_data return enum_data
case_template = """ case {gl_format}: case_template = """ case {gl_format}:
return Format::ID::{angle_format}; return FormatID::{angle_format};
""" """
def gen_map_switch_string(gl_to_angle): def gen_map_switch_string(gl_to_angle):
...@@ -245,7 +245,7 @@ def gen_map_switch_string(gl_to_angle): ...@@ -245,7 +245,7 @@ def gen_map_switch_string(gl_to_angle):
gl_format=gl_format, gl_format=gl_format,
angle_format=angle_format) angle_format=angle_format)
switch_data += " default:\n" switch_data += " default:\n"
switch_data += " return Format::ID::NONE;" switch_data += " return FormatID::NONE;"
return switch_data; return switch_data;
gl_to_angle = angle_format.load_forward_table('angle_format_map.json') gl_to_angle = angle_format.load_forward_table('angle_format_map.json')
...@@ -275,6 +275,6 @@ output_h = template_autogen_h.format( ...@@ -275,6 +275,6 @@ output_h = template_autogen_h.format(
angle_format_enum = enum_data, angle_format_enum = enum_data,
data_source_name = data_source_name, data_source_name = data_source_name,
num_angle_formats = num_angle_formats) num_angle_formats = num_angle_formats)
with open('Format_ID_autogen.inl', 'wt') as out_file: with open('FormatID_autogen.inc', 'wt') as out_file:
out_file.write(output_h) out_file.write(output_h)
out_file.close() out_file.close()
...@@ -75,7 +75,7 @@ void UnreachableLoadFunction(size_t width, ...@@ -75,7 +75,7 @@ void UnreachableLoadFunction(size_t width,
{load_functions_data}}} // namespace {load_functions_data}}} // namespace
LoadFunctionMap GetLoadFunctionsMap(GLenum {internal_format}, Format::ID {angle_format}) LoadFunctionMap GetLoadFunctionsMap(GLenum {internal_format}, FormatID {angle_format})
{{ {{
// clang-format off // clang-format off
switch ({internal_format}) switch ({internal_format})
...@@ -151,7 +151,7 @@ def parse_json(json_data): ...@@ -151,7 +151,7 @@ def parse_json(json_data):
func_name = load_functions_name(internal_format, angle_format) func_name = load_functions_name(internal_format, angle_format)
# Main case statements # Main case statements
table_data += s + 'case Format::ID::' + angle_format + ':\n' table_data += s + 'case FormatID::' + angle_format + ':\n'
table_data += s + ' return ' + func_name + ';\n' table_data += s + ' return ' + func_name + ';\n'
if angle_format_unknown in angle_to_type_map: if angle_format_unknown in angle_to_type_map:
......
...@@ -606,7 +606,6 @@ gl::Error BlitGL::copySubTextureCPUReadback(const gl::Context *context, ...@@ -606,7 +606,6 @@ gl::Error BlitGL::copySubTextureCPUReadback(const gl::Context *context,
uint8_t *sourceMemory = buffer->data(); uint8_t *sourceMemory = buffer->data();
uint8_t *destMemory = buffer->data() + sourceBufferSize; uint8_t *destMemory = buffer->data() + sourceBufferSize;
GLenum readPixelsFormat = GL_NONE; GLenum readPixelsFormat = GL_NONE;
ColorReadFunction readFunction = nullptr; ColorReadFunction readFunction = nullptr;
if (sourceComponentType == GL_UNSIGNED_INT) if (sourceComponentType == GL_UNSIGNED_INT)
...@@ -628,7 +627,7 @@ gl::Error BlitGL::copySubTextureCPUReadback(const gl::Context *context, ...@@ -628,7 +627,7 @@ gl::Error BlitGL::copySubTextureCPUReadback(const gl::Context *context,
mFunctions->readPixels(sourceArea.x, sourceArea.y, sourceArea.width, sourceArea.height, mFunctions->readPixels(sourceArea.x, sourceArea.y, sourceArea.width, sourceArea.height,
readPixelsFormat, GL_UNSIGNED_BYTE, sourceMemory); readPixelsFormat, GL_UNSIGNED_BYTE, sourceMemory);
angle::Format::ID destFormatID = angle::FormatID destFormatID =
angle::Format::InternalFormatToID(destInternalFormatInfo.sizedInternalFormat); angle::Format::InternalFormatToID(destInternalFormatInfo.sizedInternalFormat);
const auto &destFormatInfo = angle::Format::Get(destFormatID); const auto &destFormatInfo = angle::Format::Get(destFormatID);
CopyImageCHROMIUM( CopyImageCHROMIUM(
......
...@@ -134,7 +134,7 @@ egl::Error GetD3D9TextureInfo(EGLenum buftype, ...@@ -134,7 +134,7 @@ egl::Error GetD3D9TextureInfo(EGLenum buftype,
if (angleFormat) if (angleFormat)
{ {
const auto &d3dFormatInfo = d3d9::GetD3DFormatInfo(surfaceDesc.Format); const auto &d3dFormatInfo = d3d9::GetD3DFormatInfo(surfaceDesc.Format);
ASSERT(d3dFormatInfo.info().id != angle::Format::ID::NONE); ASSERT(d3dFormatInfo.info().id != angle::FormatID::NONE);
*angleFormat = &d3dFormatInfo.info(); *angleFormat = &d3dFormatInfo.info();
} }
...@@ -306,8 +306,8 @@ egl::Error D3DTextureSurfaceWGL::initialize(const egl::Display *display) ...@@ -306,8 +306,8 @@ egl::Error D3DTextureSurfaceWGL::initialize(const egl::Display *display)
{ {
if (mState.attributes.contains(EGL_GL_COLORSPACE)) if (mState.attributes.contains(EGL_GL_COLORSPACE))
{ {
if (mColorFormat->id != angle::Format::ID::R8G8B8A8_TYPELESS && if (mColorFormat->id != angle::FormatID::R8G8B8A8_TYPELESS &&
mColorFormat->id != angle::Format::ID::B8G8R8A8_TYPELESS) mColorFormat->id != angle::FormatID::B8G8R8A8_TYPELESS)
{ {
return egl::EglBadMatch() return egl::EglBadMatch()
<< "EGL_GL_COLORSPACE may only be specified for TYPELESS textures"; << "EGL_GL_COLORSPACE may only be specified for TYPELESS textures";
......
...@@ -14,9 +14,7 @@ ...@@ -14,9 +14,7 @@
namespace angle namespace angle
{ {
rx::LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, FormatID angleFormat);
rx::LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, Format::ID angleFormat);
} // namespace angle } // namespace angle
#endif // LIBANGLE_RENDERER_LOADFUNCTIONSTABLE_H_ #endif // LIBANGLE_RENDERER_LOADFUNCTIONSTABLE_H_
...@@ -498,9 +498,9 @@ gl::Error FramebufferVk::blit(const gl::Context *context, ...@@ -498,9 +498,9 @@ gl::Error FramebufferVk::blit(const gl::Context *context,
const gl::State &glState = context->getGLState(); const gl::State &glState = context->getGLState();
const gl::Framebuffer *sourceFramebuffer = glState.getReadFramebuffer(); const gl::Framebuffer *sourceFramebuffer = glState.getReadFramebuffer();
bool blitColorBuffer = (mask & GL_COLOR_BUFFER_BIT) != 0; bool blitColorBuffer = (mask & GL_COLOR_BUFFER_BIT) != 0;
bool blitDepthBuffer = (mask & GL_DEPTH_BUFFER_BIT) != 0; bool blitDepthBuffer = (mask & GL_DEPTH_BUFFER_BIT) != 0;
bool blitStencilBuffer = (mask & GL_STENCIL_BUFFER_BIT) != 0; bool blitStencilBuffer = (mask & GL_STENCIL_BUFFER_BIT) != 0;
vk::CommandBuffer *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(beginWriteResource(contextVk, &commandBuffer)); ANGLE_TRY(beginWriteResource(contextVk, &commandBuffer));
...@@ -637,11 +637,11 @@ void FramebufferVk::blitWithCommand(vk::CommandBuffer *commandBuffer, ...@@ -637,11 +637,11 @@ void FramebufferVk::blitWithCommand(vk::CommandBuffer *commandBuffer,
readRect.y = sourceFrameBufferExtents.height - readRect.y - readRect.height; readRect.y = sourceFrameBufferExtents.height - readRect.y - readRect.height;
} }
VkImageBlit blit = {}; VkImageBlit blit = {};
blit.srcOffsets[0] = {readRect.x0(), flipSource ? readRect.y1() : readRect.y0(), 0}; blit.srcOffsets[0] = {readRect.x0(), flipSource ? readRect.y1() : readRect.y0(), 0};
blit.srcOffsets[1] = {readRect.x1(), flipSource ? readRect.y0() : readRect.y1(), 1}; blit.srcOffsets[1] = {readRect.x1(), flipSource ? readRect.y0() : readRect.y1(), 1};
blit.srcSubresource.aspectMask = aspectMask; blit.srcSubresource.aspectMask = aspectMask;
blit.srcSubresource.mipLevel = 0; blit.srcSubresource.mipLevel = 0;
blit.srcSubresource.baseArrayLayer = 0; blit.srcSubresource.baseArrayLayer = 0;
blit.srcSubresource.layerCount = 1; blit.srcSubresource.layerCount = 1;
blit.dstSubresource.aspectMask = aspectMask; blit.dstSubresource.aspectMask = aspectMask;
...@@ -1148,11 +1148,11 @@ angle::Result FramebufferVk::readPixelsImpl(ContextVk *contextVk, ...@@ -1148,11 +1148,11 @@ angle::Result FramebufferVk::readPixelsImpl(ContextVk *contextVk,
pixelBytes = angleFormat.stencilBits / 8; pixelBytes = angleFormat.stencilBits / 8;
} }
VkBuffer bufferHandle = VK_NULL_HANDLE; VkBuffer bufferHandle = VK_NULL_HANDLE;
uint8_t *readPixelBuffer = nullptr; uint8_t *readPixelBuffer = nullptr;
bool newBufferAllocated = false; bool newBufferAllocated = false;
uint32_t stagingOffset = 0; uint32_t stagingOffset = 0;
size_t allocationSize = area.width * pixelBytes * area.height; size_t allocationSize = area.width * pixelBytes * area.height;
ANGLE_TRY(mReadPixelBuffer.allocate(contextVk, allocationSize, &readPixelBuffer, &bufferHandle, ANGLE_TRY(mReadPixelBuffer.allocate(contextVk, allocationSize, &readPixelBuffer, &bufferHandle,
&stagingOffset, &newBufferAllocated)); &stagingOffset, &newBufferAllocated));
......
...@@ -95,13 +95,13 @@ class RendererVk : angle::NonCopyable ...@@ -95,13 +95,13 @@ class RendererVk : angle::NonCopyable
const vk::MemoryProperties &getMemoryProperties() const { return mMemoryProperties; } const vk::MemoryProperties &getMemoryProperties() const { return mMemoryProperties; }
// TODO(jmadill): We could pass angle::Format::ID here. // TODO(jmadill): We could pass angle::FormatID here.
const vk::Format &getFormat(GLenum internalFormat) const const vk::Format &getFormat(GLenum internalFormat) const
{ {
return mFormatTable[internalFormat]; return mFormatTable[internalFormat];
} }
const vk::Format &getFormat(angle::Format::ID formatID) const { return mFormatTable[formatID]; } const vk::Format &getFormat(angle::FormatID formatID) const { return mFormatTable[formatID]; }
angle::Result getCompatibleRenderPass(vk::Context *context, angle::Result getCompatibleRenderPass(vk::Context *context,
const vk::RenderPassDesc &desc, const vk::RenderPassDesc &desc,
......
...@@ -282,7 +282,7 @@ void VertexArrayVk::syncDirtyAttrib(ContextVk *contextVk, ...@@ -282,7 +282,7 @@ void VertexArrayVk::syncDirtyAttrib(ContextVk *contextVk,
mCurrentArrayBufferOffsets[attribIndex] = 0; mCurrentArrayBufferOffsets[attribIndex] = 0;
mCurrentArrayBufferStrides[attribIndex] = 0; mCurrentArrayBufferStrides[attribIndex] = 0;
mCurrentArrayBufferFormats[attribIndex] = mCurrentArrayBufferFormats[attribIndex] =
&renderer->getFormat(angle::Format::ID::R32G32B32A32_FLOAT); &renderer->getFormat(angle::FormatID::R32G32B32A32_FLOAT);
} }
} }
...@@ -610,7 +610,7 @@ void VertexArrayVk::updateDefaultAttrib(RendererVk *renderer, ...@@ -610,7 +610,7 @@ void VertexArrayVk::updateDefaultAttrib(RendererVk *renderer,
mCurrentArrayBufferResources[attribIndex] = nullptr; mCurrentArrayBufferResources[attribIndex] = nullptr;
mCurrentArrayBufferStrides[attribIndex] = 0; mCurrentArrayBufferStrides[attribIndex] = 0;
mCurrentArrayBufferFormats[attribIndex] = mCurrentArrayBufferFormats[attribIndex] =
&renderer->getFormat(angle::Format::ID::R32G32B32A32_FIXED); &renderer->getFormat(angle::FormatID::R32G32B32A32_FIXED);
mDirtyPackedInputs.set(attribIndex); mDirtyPackedInputs.set(attribIndex);
} }
} }
......
...@@ -57,41 +57,41 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an ...@@ -57,41 +57,41 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
}} // namespace rx }} // namespace rx
""" """
empty_format_entry_template = """case angle::Format::ID::{format_id}: empty_format_entry_template = """case angle::FormatID::{format_id}:
// This format is not implemented in Vulkan. // This format is not implemented in Vulkan.
break; break;
""" """
format_entry_template = """case angle::Format::ID::{format_id}: format_entry_template = """case angle::FormatID::{format_id}:
internalFormat = {internal_format}; internalFormat = {internal_format};
{texture_template} {texture_template}
{buffer_template} {buffer_template}
break; break;
""" """
texture_basic_template = """textureFormatID = angle::Format::ID::{texture}; texture_basic_template = """textureFormatID = angle::FormatID::{texture};
vkTextureFormat = {vk_texture_format}; vkTextureFormat = {vk_texture_format};
textureInitializerFunction = {texture_initializer};""" textureInitializerFunction = {texture_initializer};"""
texture_fallback_template = """initTextureFallback(physicalDevice, texture_fallback_template = """initTextureFallback(physicalDevice,
angle::Format::ID::{texture}, angle::FormatID::{texture},
{vk_texture_format}, {vk_texture_format},
{texture_initializer}, {texture_initializer},
angle::Format::ID::{texture_fallback}, angle::FormatID::{texture_fallback},
{vk_texture_format_fallback}, {vk_texture_format_fallback},
{texture_initializer_fallback});""" {texture_initializer_fallback});"""
buffer_basic_template = """bufferFormatID = angle::Format::ID::{buffer}; buffer_basic_template = """bufferFormatID = angle::FormatID::{buffer};
vkBufferFormat = {vk_buffer_format}; vkBufferFormat = {vk_buffer_format};
vertexLoadFunction = {vertex_load_function}; vertexLoadFunction = {vertex_load_function};
vertexLoadRequiresConversion = {vertex_load_converts};""" vertexLoadRequiresConversion = {vertex_load_converts};"""
buffer_fallback_template = """initBufferFallback(physicalDevice, buffer_fallback_template = """initBufferFallback(physicalDevice,
angle::Format::ID::{buffer}, angle::FormatID::{buffer},
{vk_buffer_format}, {vk_buffer_format},
{vertex_load_function}, {vertex_load_function},
{vertex_load_converts}, {vertex_load_converts},
angle::Format::ID::{buffer_fallback}, angle::FormatID::{buffer_fallback},
{vk_buffer_format_fallback}, {vk_buffer_format_fallback},
{vertex_load_function_fallback});""" {vertex_load_function_fallback});"""
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -93,11 +93,11 @@ void GetFormatProperties(VkPhysicalDevice physicalDevice, ...@@ -93,11 +93,11 @@ void GetFormatProperties(VkPhysicalDevice physicalDevice,
// Format implementation. // Format implementation.
Format::Format() Format::Format()
: angleFormatID(angle::Format::ID::NONE), : angleFormatID(angle::FormatID::NONE),
internalFormat(GL_NONE), internalFormat(GL_NONE),
textureFormatID(angle::Format::ID::NONE), textureFormatID(angle::FormatID::NONE),
vkTextureFormat(VK_FORMAT_UNDEFINED), vkTextureFormat(VK_FORMAT_UNDEFINED),
bufferFormatID(angle::Format::ID::NONE), bufferFormatID(angle::FormatID::NONE),
vkBufferFormat(VK_FORMAT_UNDEFINED), vkBufferFormat(VK_FORMAT_UNDEFINED),
textureInitializerFunction(nullptr), textureInitializerFunction(nullptr),
textureLoadFunctions() textureLoadFunctions()
...@@ -105,15 +105,15 @@ Format::Format() ...@@ -105,15 +105,15 @@ Format::Format()
} }
void Format::initTextureFallback(VkPhysicalDevice physicalDevice, void Format::initTextureFallback(VkPhysicalDevice physicalDevice,
angle::Format::ID format, angle::FormatID format,
VkFormat vkFormat, VkFormat vkFormat,
InitializeTextureDataFunction initializer, InitializeTextureDataFunction initializer,
angle::Format::ID fallbackFormat, angle::FormatID fallbackFormat,
VkFormat fallbackVkFormat, VkFormat fallbackVkFormat,
InitializeTextureDataFunction fallbackInitializer) InitializeTextureDataFunction fallbackInitializer)
{ {
ASSERT(format != angle::Format::ID::NONE); ASSERT(format != angle::FormatID::NONE);
ASSERT(fallbackFormat != angle::Format::ID::NONE); ASSERT(fallbackFormat != angle::FormatID::NONE);
if (HasFullTextureFormatSupport(physicalDevice, vkFormat)) if (HasFullTextureFormatSupport(physicalDevice, vkFormat))
{ {
...@@ -131,16 +131,16 @@ void Format::initTextureFallback(VkPhysicalDevice physicalDevice, ...@@ -131,16 +131,16 @@ void Format::initTextureFallback(VkPhysicalDevice physicalDevice,
} }
void Format::initBufferFallback(VkPhysicalDevice physicalDevice, void Format::initBufferFallback(VkPhysicalDevice physicalDevice,
angle::Format::ID format, angle::FormatID format,
VkFormat vkFormat, VkFormat vkFormat,
VertexCopyFunction function, VertexCopyFunction function,
bool functionConverts, bool functionConverts,
angle::Format::ID fallbackFormat, angle::FormatID fallbackFormat,
VkFormat fallbackVkFormat, VkFormat fallbackVkFormat,
VertexCopyFunction fallbackFunction) VertexCopyFunction fallbackFunction)
{ {
ASSERT(format != angle::Format::ID::NONE); ASSERT(format != angle::FormatID::NONE);
ASSERT(fallbackFormat != angle::Format::ID::NONE); ASSERT(fallbackFormat != angle::FormatID::NONE);
if (HasFullBufferFormatSupport(physicalDevice, vkFormat)) if (HasFullBufferFormatSupport(physicalDevice, vkFormat))
{ {
...@@ -199,7 +199,7 @@ void FormatTable::initialize(VkPhysicalDevice physicalDevice, ...@@ -199,7 +199,7 @@ void FormatTable::initialize(VkPhysicalDevice physicalDevice,
{ {
for (size_t formatIndex = 0; formatIndex < angle::kNumANGLEFormats; ++formatIndex) for (size_t formatIndex = 0; formatIndex < angle::kNumANGLEFormats; ++formatIndex)
{ {
const auto formatID = static_cast<angle::Format::ID>(formatIndex); const auto formatID = static_cast<angle::FormatID>(formatIndex);
const angle::Format &angleFormat = angle::Format::Get(formatID); const angle::Format &angleFormat = angle::Format::Get(formatID);
mFormatData[formatIndex].initialize(physicalDevice, angleFormat); mFormatData[formatIndex].initialize(physicalDevice, angleFormat);
const GLenum internalFormat = mFormatData[formatIndex].internalFormat; const GLenum internalFormat = mFormatData[formatIndex].internalFormat;
...@@ -231,11 +231,11 @@ void FormatTable::initialize(VkPhysicalDevice physicalDevice, ...@@ -231,11 +231,11 @@ void FormatTable::initialize(VkPhysicalDevice physicalDevice,
const Format &FormatTable::operator[](GLenum internalFormat) const const Format &FormatTable::operator[](GLenum internalFormat) const
{ {
angle::Format::ID formatID = angle::Format::InternalFormatToID(internalFormat); angle::FormatID formatID = angle::Format::InternalFormatToID(internalFormat);
return mFormatData[static_cast<size_t>(formatID)]; return mFormatData[static_cast<size_t>(formatID)];
} }
const Format &FormatTable::operator[](angle::Format::ID formatID) const const Format &FormatTable::operator[](angle::FormatID formatID) const
{ {
return mFormatData[static_cast<size_t>(formatID)]; return mFormatData[static_cast<size_t>(formatID)];
} }
......
...@@ -43,19 +43,19 @@ struct Format final : private angle::NonCopyable ...@@ -43,19 +43,19 @@ struct Format final : private angle::NonCopyable
void initialize(VkPhysicalDevice physicalDevice, const angle::Format &angleFormat); void initialize(VkPhysicalDevice physicalDevice, const angle::Format &angleFormat);
void initTextureFallback(VkPhysicalDevice physicalDevice, void initTextureFallback(VkPhysicalDevice physicalDevice,
angle::Format::ID format, angle::FormatID format,
VkFormat vkFormat, VkFormat vkFormat,
InitializeTextureDataFunction initializer, InitializeTextureDataFunction initializer,
angle::Format::ID fallbackFormat, angle::FormatID fallbackFormat,
VkFormat fallbackVkFormat, VkFormat fallbackVkFormat,
InitializeTextureDataFunction fallbackInitializer); InitializeTextureDataFunction fallbackInitializer);
void initBufferFallback(VkPhysicalDevice physicalDevice, void initBufferFallback(VkPhysicalDevice physicalDevice,
angle::Format::ID format, angle::FormatID format,
VkFormat vkFormat, VkFormat vkFormat,
VertexCopyFunction function, VertexCopyFunction function,
bool functionConverts, bool functionConverts,
angle::Format::ID fallbackFormat, angle::FormatID fallbackFormat,
VkFormat fallbackVkFormat, VkFormat fallbackVkFormat,
VertexCopyFunction fallbackFunction); VertexCopyFunction fallbackFunction);
...@@ -63,11 +63,11 @@ struct Format final : private angle::NonCopyable ...@@ -63,11 +63,11 @@ struct Format final : private angle::NonCopyable
const angle::Format &bufferFormat() const; const angle::Format &bufferFormat() const;
const angle::Format &angleFormat() const; const angle::Format &angleFormat() const;
angle::Format::ID angleFormatID; angle::FormatID angleFormatID;
GLenum internalFormat; GLenum internalFormat;
angle::Format::ID textureFormatID; angle::FormatID textureFormatID;
VkFormat vkTextureFormat; VkFormat vkTextureFormat;
angle::Format::ID bufferFormatID; angle::FormatID bufferFormatID;
VkFormat vkBufferFormat; VkFormat vkBufferFormat;
InitializeTextureDataFunction textureInitializerFunction; InitializeTextureDataFunction textureInitializerFunction;
LoadFunctionMap textureLoadFunctions; LoadFunctionMap textureLoadFunctions;
...@@ -90,10 +90,10 @@ class FormatTable final : angle::NonCopyable ...@@ -90,10 +90,10 @@ class FormatTable final : angle::NonCopyable
std::vector<GLenum> *outCompressedTextureFormats); std::vector<GLenum> *outCompressedTextureFormats);
const Format &operator[](GLenum internalFormat) const; const Format &operator[](GLenum internalFormat) const;
const Format &operator[](angle::Format::ID formatID) const; const Format &operator[](angle::FormatID formatID) const;
private: private:
// The table data is indexed by angle::Format::ID. // The table data is indexed by angle::FormatID.
std::array<Format, angle::kNumANGLEFormats> mFormatData; std::array<Format, angle::kNumANGLEFormats> mFormatData;
}; };
......
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
'libANGLE/renderer/DisplayImpl.h', 'libANGLE/renderer/DisplayImpl.h',
'libANGLE/renderer/EGLImplFactory.h', 'libANGLE/renderer/EGLImplFactory.h',
'libANGLE/renderer/FenceNVImpl.h', 'libANGLE/renderer/FenceNVImpl.h',
'libANGLE/renderer/Format_ID_autogen.inl', 'libANGLE/renderer/FormatID_autogen.inc',
'libANGLE/renderer/Format_table_autogen.cpp', 'libANGLE/renderer/Format_table_autogen.cpp',
'libANGLE/renderer/Format.h', 'libANGLE/renderer/Format.h',
'libANGLE/renderer/FramebufferAttachmentObjectImpl.h', 'libANGLE/renderer/FramebufferAttachmentObjectImpl.h',
......
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