Utility: Rework PixelFormat (WIP)
Former-commit-id: 1ab609e753783d9767ba23fd4cab9390453bf729
This commit is contained in:
@@ -44,12 +44,23 @@ namespace Nz
|
||||
2 // AttachmentPoint_Stencil
|
||||
};
|
||||
|
||||
AttachmentPoint formatTypeToAttachment[PixelFormatTypeType_Max+1] =
|
||||
AttachmentPoint FormatTypeToAttachment(PixelFormatType format)
|
||||
{
|
||||
AttachmentPoint_Color, // PixelFormatTypeType_Color
|
||||
AttachmentPoint_Depth, // PixelFormatTypeType_Depth
|
||||
AttachmentPoint_DepthStencil, // PixelFormatTypeType_DepthStencil
|
||||
AttachmentPoint_Stencil // PixelFormatTypeType_Stencil
|
||||
const PixelFormatInfo& info = PixelFormat::GetInfo(format);
|
||||
switch (info.content)
|
||||
{
|
||||
case PixelFormatContent_ColorRGBA:
|
||||
return AttachmentPoint_Color;
|
||||
|
||||
case PixelFormatContent_DepthStencil:
|
||||
return (!info.greenMask.TestAny()) ? AttachmentPoint_Depth : AttachmentPoint_DepthStencil;
|
||||
|
||||
case PixelFormatContent_Stencil:
|
||||
return AttachmentPoint_Stencil;
|
||||
}
|
||||
|
||||
NazaraInternalError("Unexpected pixel format content: 0x" + String::Number(info.content, 16));
|
||||
return AttachmentPoint_Max;
|
||||
};
|
||||
|
||||
GLuint lockedPrevious = 0;
|
||||
@@ -118,9 +129,9 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
AttachmentPoint targetAttachmentPoint = formatTypeToAttachment[PixelFormat::GetType(buffer->GetFormat())];
|
||||
AttachmentPoint targetAttachmentPoint = FormatTypeToAttachment(buffer->GetFormat());
|
||||
if (targetAttachmentPoint != attachmentPoint && targetAttachmentPoint != AttachmentPoint_DepthStencil &&
|
||||
attachmentPoint != AttachmentPoint_Depth && attachmentPoint != AttachmentPoint_Stencil)
|
||||
attachmentPoint != AttachmentPoint_Depth && attachmentPoint != AttachmentPoint_Stencil)
|
||||
{
|
||||
NazaraError("Pixel format type does not match attachment point type");
|
||||
return false;
|
||||
@@ -230,7 +241,7 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
AttachmentPoint targetAttachmentPoint = formatTypeToAttachment[PixelFormat::GetType(texture->GetFormat())];
|
||||
AttachmentPoint targetAttachmentPoint = FormatTypeToAttachment(texture->GetFormat());
|
||||
if (targetAttachmentPoint != attachmentPoint && targetAttachmentPoint != AttachmentPoint_DepthStencil &&
|
||||
attachmentPoint != AttachmentPoint_Depth && attachmentPoint != AttachmentPoint_Stencil)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user