Upgrade Utility

This commit is contained in:
Jérôme Leclercq
2021-05-24 19:10:53 +02:00
parent b936946154
commit cce32a64d4
120 changed files with 2328 additions and 2971 deletions

View File

@@ -31,9 +31,9 @@ namespace Nz
GL::BufferTarget target;
switch (m_type)
{
case BufferType_Index: target = GL::BufferTarget::ElementArray; break;
case BufferType_Uniform: target = GL::BufferTarget::Uniform; break;
case BufferType_Vertex: target = GL::BufferTarget::Array; break;
case BufferType::Index: target = GL::BufferTarget::ElementArray; break;
case BufferType::Uniform: target = GL::BufferTarget::Uniform; break;
case BufferType::Vertex: target = GL::BufferTarget::Array; break;
default:
throw std::runtime_error("unknown buffer type 0x" + NumberToString(UnderlyingCast(m_type), 16));
@@ -41,12 +41,12 @@ namespace Nz
GLenum hint = GL_STREAM_COPY;
if (usage & BufferUsage_Dynamic)
if (usage & BufferUsage::Dynamic)
hint = GL_DYNAMIC_DRAW;
else if (usage & BufferUsage_DeviceLocal)
else if (usage & BufferUsage::DeviceLocal)
hint = GL_STATIC_DRAW;
if (usage & BufferUsage_DirectMapping)
if (usage & BufferUsage::DirectMapping)
hint = GL_DYNAMIC_COPY;
m_buffer.Reset(target, size, nullptr, hint);
@@ -60,7 +60,7 @@ namespace Nz
DataStorage OpenGLBuffer::GetStorage() const
{
return DataStorage_Hardware;
return DataStorage::Hardware;
}
void* OpenGLBuffer::Map(BufferAccess access, UInt64 offset, UInt64 size)
@@ -68,7 +68,7 @@ namespace Nz
GLbitfield accessBit = 0;
switch (access)
{
case BufferAccess_DiscardAndWrite:
case BufferAccess::DiscardAndWrite:
accessBit |= GL_MAP_WRITE_BIT;
if (offset == 0 && size == m_size)
accessBit |= GL_MAP_INVALIDATE_BUFFER_BIT;
@@ -77,15 +77,15 @@ namespace Nz
break;
case BufferAccess_ReadOnly:
case BufferAccess::ReadOnly:
accessBit |= GL_MAP_READ_BIT;
break;
case BufferAccess_ReadWrite:
case BufferAccess::ReadWrite:
accessBit |= GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
break;
case BufferAccess_WriteOnly:
case BufferAccess::WriteOnly:
accessBit |= GL_MAP_WRITE_BIT;
break;

View File

@@ -18,39 +18,39 @@ namespace Nz
{
switch (component)
{
case ComponentType_Color:
case ComponentType::Color:
attrib.normalized = GL_TRUE;
attrib.size = 4;
attrib.type = GL_UNSIGNED_BYTE;
return;
case ComponentType_Float1:
case ComponentType_Float2:
case ComponentType_Float3:
case ComponentType_Float4:
case ComponentType::Float1:
case ComponentType::Float2:
case ComponentType::Float3:
case ComponentType::Float4:
attrib.normalized = GL_FALSE;
attrib.size = (component - ComponentType_Float1 + 1);
attrib.size = (UnderlyingCast(component) - UnderlyingCast(ComponentType::Float1) + 1);
attrib.type = GL_FLOAT;
return;
case ComponentType_Int1:
case ComponentType_Int2:
case ComponentType_Int3:
case ComponentType_Int4:
case ComponentType::Int1:
case ComponentType::Int2:
case ComponentType::Int3:
case ComponentType::Int4:
attrib.normalized = GL_FALSE;
attrib.size = (component - ComponentType_Int1 + 1);
attrib.size = (UnderlyingCast(component) - UnderlyingCast(ComponentType::Int1) + 1);
attrib.type = GL_INT;
return;
case ComponentType_Double1:
case ComponentType_Double2:
case ComponentType_Double3:
case ComponentType_Double4:
case ComponentType_Quaternion:
case ComponentType::Double1:
case ComponentType::Double2:
case ComponentType::Double3:
case ComponentType::Double4:
case ComponentType::Quaternion:
break;
}
throw std::runtime_error("component type 0x" + NumberToString(component, 16) + " is not handled");
throw std::runtime_error("component type 0x" + NumberToString(UnderlyingCast(component), 16) + " is not handled");
}
}

View File

@@ -30,12 +30,12 @@ namespace Nz
GLenum attachment;
switch (PixelFormatInfo::GetContent(textureFormat))
{
case PixelFormatContent_ColorRGBA:
case PixelFormatContent::ColorRGBA:
attachment = static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + colorAttachmentCount);
colorAttachmentCount++;
break;
case PixelFormatContent_Depth:
case PixelFormatContent::Depth:
if (hasDepth)
throw std::runtime_error("a framebuffer can only have one depth attachment");
@@ -43,7 +43,7 @@ namespace Nz
hasDepth = true;
break;
case PixelFormatContent_DepthStencil:
case PixelFormatContent::DepthStencil:
if (hasDepth)
throw std::runtime_error("a framebuffer can only have one depth attachment");
@@ -55,7 +55,7 @@ namespace Nz
hasStencil = true;
break;
case PixelFormatContent_Stencil:
case PixelFormatContent::Stencil:
if (hasStencil)
throw std::runtime_error("a framebuffer can only have one stencil attachment");
@@ -63,7 +63,7 @@ namespace Nz
hasStencil = true;
break;
case PixelFormatContent_Undefined:
case PixelFormatContent::Undefined:
default:
throw std::runtime_error("unhandled pixel format " + PixelFormatInfo::GetName(textureFormat));
}

View File

@@ -105,7 +105,7 @@ namespace Nz
if (OpenGLBuffer* glBuffer = static_cast<OpenGLBuffer*>(uboBinding.buffer))
{
if (glBuffer->GetType() != BufferType_Uniform)
if (glBuffer->GetType() != BufferType::Uniform)
throw std::runtime_error("expected uniform buffer");
uboDescriptor.buffer = glBuffer->GetBuffer().GetObjectId();

View File

@@ -22,23 +22,23 @@ namespace Nz
switch (params.type)
{
case ImageType_1D:
case ImageType::E1D:
break;
case ImageType_1D_Array:
case ImageType::E1D_Array:
break;
case ImageType_2D:
case ImageType::E2D:
m_texture.TexStorage2D(params.mipmapLevel, format->internalFormat, params.width, params.height);
break;
case ImageType_2D_Array:
case ImageType::E2D_Array:
break;
case ImageType_3D:
case ImageType::E3D:
break;
case ImageType_Cubemap:
case ImageType::Cubemap:
break;
default:
@@ -79,23 +79,23 @@ namespace Nz
switch (m_params.type)
{
case ImageType_1D:
case ImageType::E1D:
break;
case ImageType_1D_Array:
case ImageType::E1D_Array:
break;
case ImageType_2D:
case ImageType::E2D:
m_texture.TexSubImage2D(0, 0, 0, m_params.width, m_params.height, format->format, format->type, ptr);
break;
case ImageType_2D_Array:
case ImageType::E2D_Array:
break;
case ImageType_3D:
case ImageType::E3D:
break;
case ImageType_Cubemap:
case ImageType::Cubemap:
break;
default: