diff --git a/qrenderdoc/Code/FormatElement.cpp b/qrenderdoc/Code/FormatElement.cpp index e9b4d47e6..f1c5e3130 100644 --- a/qrenderdoc/Code/FormatElement.cpp +++ b/qrenderdoc/Code/FormatElement.cpp @@ -554,7 +554,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons ret.push_back((float)((packed >> 10) & 0x1f) / 31.0f); ret.push_back(((packed & 0x8000) > 0) ? 1.0f : 0.0f); - if(format.bgraOrder()) + if(format.BGRAOrder()) { QVariant tmp = ret[2]; ret[2] = ret[0]; @@ -569,7 +569,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons ret.push_back((float)((packed >> 5) & 0x3f) / 63.0f); ret.push_back((float)((packed >> 11) & 0x1f) / 31.0f); - if(format.bgraOrder()) + if(format.BGRAOrder()) { QVariant tmp = ret[2]; ret[2] = ret[0]; @@ -585,7 +585,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons ret.push_back((float)((packed >> 8) & 0xf) / 15.0f); ret.push_back((float)((packed >> 12) & 0xf) / 15.0f); - if(format.bgraOrder()) + if(format.BGRAOrder()) { QVariant tmp = ret[2]; ret[2] = ret[0]; @@ -604,7 +604,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons uint32_t b = (packed >> 20) & 0x3ff; uint32_t a = (packed >> 30) & 0x003; - if(format.bgraOrder()) + if(format.BGRAOrder()) { uint32_t tmp = b; b = r; @@ -838,7 +838,7 @@ QVariantList FormatElement::GetVariants(const byte *&data, const byte *end) cons } } - if(format.bgraOrder()) + if(format.BGRAOrder()) { QVariant tmp = ret[2]; ret[2] = ret[0]; diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp index b638b00e2..be3b20f5b 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp @@ -1790,7 +1790,7 @@ void GLPipelineStateViewer::setState() format = tex->format.Name(); typeName = ToQStr(tex->type); - if(tex->format.srgbCorrected() && !state.framebuffer.framebufferSRGB) + if(tex->format.SRGBCorrected() && !state.framebuffer.framebufferSRGB) format += lit(" (GL_FRAMEBUFFER_SRGB = 0)"); } diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index 45be21e08..6522ef547 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -840,7 +840,7 @@ void TextureViewer::UI_UpdateStatusText() float g = qBound(0.0f, m_CurHoverValue.floatValue[1], 1.0f); float b = qBound(0.0f, m_CurHoverValue.floatValue[2], 1.0f); - if(tex.format.srgbCorrected() || (tex.creationFlags & TextureCategory::SwapBuffer)) + if(tex.format.SRGBCorrected() || (tex.creationFlags & TextureCategory::SwapBuffer)) { r = powf(r, 1.0f / 2.2f); g = powf(g, 1.0f / 2.2f); @@ -1411,7 +1411,7 @@ void TextureViewer::UI_UpdateChannels() } else { - if(tex != NULL && !tex->format.srgbCorrected()) + if(tex != NULL && !tex->format.SRGBCorrected()) ENABLE(ui->gammaDisplay); else DISABLE(ui->gammaDisplay); @@ -1420,7 +1420,7 @@ void TextureViewer::UI_UpdateChannels() !ui->gammaDisplay->isEnabled() || ui->gammaDisplay->isChecked(); } - if(tex != NULL && tex->format.srgbCorrected()) + if(tex != NULL && tex->format.SRGBCorrected()) m_TexDisplay.linearDisplayAsGamma = false; bool dsv = false; diff --git a/renderdoc/api/replay/data_types.h b/renderdoc/api/replay/data_types.h index 621406153..eaf366cb9 100644 --- a/renderdoc/api/replay/data_types.h +++ b/renderdoc/api/replay/data_types.h @@ -179,11 +179,11 @@ struct ResourceFormat DOCUMENT(R"(:return: ``True`` if the components are to be read in ``BGRA`` order. :rtype: ``bool`` )"); - bool bgraOrder() const { return (flags & ResourceFormat_BGRA) != 0; } + bool BGRAOrder() const { return (flags & ResourceFormat_BGRA) != 0; } DOCUMENT(R"(:return: ``True`` if the components are SRGB corrected on read and write. :rtype: ``bool`` )"); - bool srgbCorrected() const { return (flags & ResourceFormat_SRGB) != 0; } + bool SRGBCorrected() const { return (flags & ResourceFormat_SRGB) != 0; } DOCUMENT(R"(Get the subsampling rate for a YUV format. Only valid when :data:`type` is a YUV format like :attr:`ResourceFormatType.YUV8`. @@ -192,7 +192,7 @@ For other formats, 0 is returned. :return: The subsampling rate, e.g. 444 for 4:4:4 or 420 for 4:2:0 :rtype: ``int`` )"); - uint32_t yuvSubsampling() const + uint32_t YUVSubsampling() const { if(flags & ResourceFormat_444) return 444; @@ -211,7 +211,7 @@ For other formats, 1 is returned. :return: The number of planes :rtype: ``int`` )"); - uint32_t yuvPlaneCount() const + uint32_t YUVPlaneCount() const { if(flags & ResourceFormat_3Planes) return 3; @@ -220,11 +220,11 @@ For other formats, 1 is returned. return 1; } - DOCUMENT(R"(Set BGRA order flag. See :meth:`bgraOrder`. + DOCUMENT(R"(Set BGRA order flag. See :meth:`BGRAOrder`. :param bool flag: The new flag value. )"); - void setBgraOrder(bool flag) + void SetBGRAOrder(bool flag) { if(flag) flags |= ResourceFormat_BGRA; @@ -232,11 +232,11 @@ For other formats, 1 is returned. flags &= ~ResourceFormat_BGRA; } - DOCUMENT(R"(Set SRGB correction flag. See :meth:`srgbCorrected`. + DOCUMENT(R"(Set SRGB correction flag. See :meth:`SRGBCorrected`. :param bool flag: The new flag value. )"); - void setSrgbCorrected(bool flag) + void SetSRGBCorrected(bool flag) { if(flag) flags |= ResourceFormat_SRGB; @@ -244,13 +244,13 @@ For other formats, 1 is returned. flags &= ~ResourceFormat_SRGB; } - DOCUMENT(R"(Set YUV subsampling rate. See :meth:`yuvSubsampling`. + DOCUMENT(R"(Set YUV subsampling rate. See :meth:`YUVSubsampling`. The value should be e.g. 444 for 4:4:4 or 422 for 4:2:2. Invalid values will result in 0 being set. :param int subsample: The new subsampling rate. )"); - void setYUVSubsampling(uint32_t subsampling) + void SetYUVSubsampling(uint32_t subsampling) { flags &= ~ResourceFormat_SubSample_Mask; if(subsampling == 444) @@ -261,13 +261,13 @@ The value should be e.g. 444 for 4:4:4 or 422 for 4:2:2. Invalid values will res flags |= ResourceFormat_420; } - DOCUMENT(R"(Set number of YUV planes. See :meth:`yuvPlaneCount`. + DOCUMENT(R"(Set number of YUV planes. See :meth:`YUVPlaneCount`. Invalid values will result in 1 being set. :param int planes: The new number of YUV planes. )"); - void setYUVPlaneCount(uint32_t planes) + void SetYUVPlaneCount(uint32_t planes) { flags &= ~ResourceFormat_Planes_Mask; if(planes == 2) diff --git a/renderdoc/api/replay/pipestate.inl b/renderdoc/api/replay/pipestate.inl index 7377530db..1dcacff73 100644 --- a/renderdoc/api/replay/pipestate.inl +++ b/renderdoc/api/replay/pipestate.inl @@ -821,7 +821,7 @@ rdcarray PipeState::GetVertexInputs() const ret[a].format.compCount = (uint8_t)compCount; ret[a].format.compType = compType; ret[a].format.type = ResourceFormatType::Regular; - ret[a].format.setSrgbCorrected(false); + ret[a].format.SetSRGBCorrected(false); } } diff --git a/renderdoc/common/dds_readwrite.cpp b/renderdoc/common/dds_readwrite.cpp index 125c5adc9..3fa89480f 100644 --- a/renderdoc/common/dds_readwrite.cpp +++ b/renderdoc/common/dds_readwrite.cpp @@ -252,17 +252,17 @@ ResourceFormat DXGIFormat2ResourceFormat(DXGI_FORMAT format) case DXGI_FORMAT_BC1_UNORM: case DXGI_FORMAT_BC1_UNORM_SRGB: special.type = ResourceFormatType::BC1; - special.setSrgbCorrected(format == DXGI_FORMAT_BC1_UNORM_SRGB); + special.SetSRGBCorrected(format == DXGI_FORMAT_BC1_UNORM_SRGB); return special; case DXGI_FORMAT_BC2_UNORM: case DXGI_FORMAT_BC2_UNORM_SRGB: special.type = ResourceFormatType::BC2; - special.setSrgbCorrected(format == DXGI_FORMAT_BC2_UNORM_SRGB); + special.SetSRGBCorrected(format == DXGI_FORMAT_BC2_UNORM_SRGB); return special; case DXGI_FORMAT_BC3_UNORM: case DXGI_FORMAT_BC3_UNORM_SRGB: special.type = ResourceFormatType::BC3; - special.setSrgbCorrected(format == DXGI_FORMAT_BC3_UNORM_SRGB); + special.SetSRGBCorrected(format == DXGI_FORMAT_BC3_UNORM_SRGB); return special; case DXGI_FORMAT_BC4_UNORM: case DXGI_FORMAT_BC4_SNORM: @@ -282,7 +282,7 @@ ResourceFormat DXGIFormat2ResourceFormat(DXGI_FORMAT format) case DXGI_FORMAT_BC7_UNORM: case DXGI_FORMAT_BC7_UNORM_SRGB: special.type = ResourceFormatType::BC7; - special.setSrgbCorrected(format == DXGI_FORMAT_BC7_UNORM_SRGB); + special.SetSRGBCorrected(format == DXGI_FORMAT_BC7_UNORM_SRGB); return special; case DXGI_FORMAT_R10G10B10A2_UNORM: case DXGI_FORMAT_R10G10B10A2_UINT: @@ -291,18 +291,18 @@ ResourceFormat DXGIFormat2ResourceFormat(DXGI_FORMAT format) return special; case DXGI_FORMAT_R11G11B10_FLOAT: special.type = ResourceFormatType::R11G11B10; return special; case DXGI_FORMAT_B5G6R5_UNORM: - fmt8.setBgraOrder(true); + fmt8.SetBGRAOrder(true); special.type = ResourceFormatType::R5G6B5; return special; case DXGI_FORMAT_B5G5R5A1_UNORM: - fmt8.setBgraOrder(true); + fmt8.SetBGRAOrder(true); special.type = ResourceFormatType::R5G5B5A1; return special; case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: special.type = ResourceFormatType::R9G9B9E5; return special; case DXGI_FORMAT_B4G4R4A4_UNORM: - fmt8.setBgraOrder(true); + fmt8.SetBGRAOrder(true); special.type = ResourceFormatType::R4G4B4A4; return special; case DXGI_FORMAT_D24_UNORM_S8_UINT: special.type = ResourceFormatType::D24S8; return special; @@ -398,7 +398,7 @@ ResourceFormat DXGIFormat2ResourceFormat(DXGI_FORMAT format) return fmt8; case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: fmt8.compType = CompType::UNorm; - fmt8.setSrgbCorrected(true); + fmt8.SetSRGBCorrected(true); fmt8.compCount = 4; return fmt8; case DXGI_FORMAT_R8G8B8A8_UNORM: fmt8.compCount = 4; return fmt8; @@ -406,8 +406,8 @@ ResourceFormat DXGIFormat2ResourceFormat(DXGI_FORMAT format) case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: fmt8.compType = CompType::UNorm; fmt8.compCount = 4; - fmt8.setBgraOrder(true); - fmt8.setSrgbCorrected(format == DXGI_FORMAT_B8G8R8A8_UNORM_SRGB); + fmt8.SetBGRAOrder(true); + fmt8.SetSRGBCorrected(format == DXGI_FORMAT_B8G8R8A8_UNORM_SRGB); return fmt8; case DXGI_FORMAT_R8G8_UINT: @@ -442,11 +442,11 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) switch(format.type) { case ResourceFormatType::BC1: - return format.srgbCorrected() ? DXGI_FORMAT_BC1_UNORM_SRGB : DXGI_FORMAT_BC1_UNORM; + return format.SRGBCorrected() ? DXGI_FORMAT_BC1_UNORM_SRGB : DXGI_FORMAT_BC1_UNORM; case ResourceFormatType::BC2: - return format.srgbCorrected() ? DXGI_FORMAT_BC2_UNORM_SRGB : DXGI_FORMAT_BC2_UNORM; + return format.SRGBCorrected() ? DXGI_FORMAT_BC2_UNORM_SRGB : DXGI_FORMAT_BC2_UNORM; case ResourceFormatType::BC3: - return format.srgbCorrected() ? DXGI_FORMAT_BC3_UNORM_SRGB : DXGI_FORMAT_BC3_UNORM; + return format.SRGBCorrected() ? DXGI_FORMAT_BC3_UNORM_SRGB : DXGI_FORMAT_BC3_UNORM; case ResourceFormatType::BC4: return format.compType == CompType::UNorm ? DXGI_FORMAT_BC4_UNORM : DXGI_FORMAT_BC4_SNORM; case ResourceFormatType::BC5: @@ -454,20 +454,20 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) case ResourceFormatType::BC6: return format.compType == CompType::UNorm ? DXGI_FORMAT_BC6H_UF16 : DXGI_FORMAT_BC6H_SF16; case ResourceFormatType::BC7: - return format.srgbCorrected() ? DXGI_FORMAT_BC7_UNORM_SRGB : DXGI_FORMAT_BC7_UNORM; + return format.SRGBCorrected() ? DXGI_FORMAT_BC7_UNORM_SRGB : DXGI_FORMAT_BC7_UNORM; case ResourceFormatType::R10G10B10A2: return format.compType == CompType::UNorm ? DXGI_FORMAT_R10G10B10A2_UNORM : DXGI_FORMAT_R10G10B10A2_UINT; case ResourceFormatType::R11G11B10: return DXGI_FORMAT_R11G11B10_FLOAT; case ResourceFormatType::R5G6B5: - RDCASSERT(format.bgraOrder()); + RDCASSERT(format.BGRAOrder()); return DXGI_FORMAT_B5G6R5_UNORM; case ResourceFormatType::R5G5B5A1: - RDCASSERT(format.bgraOrder()); + RDCASSERT(format.BGRAOrder()); return DXGI_FORMAT_B5G5R5A1_UNORM; case ResourceFormatType::R9G9B9E5: return DXGI_FORMAT_R9G9B9E5_SHAREDEXP; case ResourceFormatType::R4G4B4A4: - RDCASSERT(format.bgraOrder()); + RDCASSERT(format.BGRAOrder()); return DXGI_FORMAT_B4G4R4A4_UNORM; case ResourceFormatType::D24S8: return DXGI_FORMAT_D24_UNORM_S8_UINT; case ResourceFormatType::D32S8: return DXGI_FORMAT_D32_FLOAT_S8X24_UINT; @@ -518,16 +518,16 @@ DXGI_FORMAT ResourceFormat2DXGIFormat(ResourceFormat format) case CompType::SNorm: return DXGI_FORMAT_R8G8B8A8_SNORM; default: case CompType::UNorm: - if(format.srgbCorrected()) + if(format.SRGBCorrected()) { - if(format.bgraOrder()) + if(format.BGRAOrder()) return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; else return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; } else { - if(format.bgraOrder()) + if(format.BGRAOrder()) return DXGI_FORMAT_B8G8R8A8_UNORM; else return DXGI_FORMAT_R8G8B8A8_UNORM; @@ -764,7 +764,7 @@ bool write_dds_to_file(FILE *f, const dds_data &data) header.ddspf.dwBBitMask = 0x00ff0000; header.ddspf.dwABitMask = 0xff000000; - if(data.format.bgraOrder()) + if(data.format.BGRAOrder()) std::swap(header.ddspf.dwRBitMask, header.ddspf.dwBBitMask); } else if(data.format.type == ResourceFormatType::BC1) @@ -982,7 +982,7 @@ dds_data load_dds_from_file(FILE *f) ret.format.type = ResourceFormatType::Regular; if(header.ddspf.dwBBitMask < header.ddspf.dwRBitMask) - ret.format.setBgraOrder(true); + ret.format.SetBGRAOrder(true); } uint32_t bytesPerPixel = 1; diff --git a/renderdoc/core/image_viewer.cpp b/renderdoc/core/image_viewer.cpp index a214daf7d..2b53e43cc 100644 --- a/renderdoc/core/image_viewer.cpp +++ b/renderdoc/core/image_viewer.cpp @@ -463,12 +463,12 @@ void ImageViewer::RefreshFile() rgba8_unorm.compCount = 4; rgba8_unorm.compType = CompType::UNorm; rgba8_unorm.type = ResourceFormatType::Regular; - rgba8_unorm.setSrgbCorrected(true); + rgba8_unorm.SetSRGBCorrected(true); ResourceFormat rgba32_float = rgba8_unorm; rgba32_float.compByteWidth = 4; rgba32_float.compType = CompType::Float; - rgba32_float.setSrgbCorrected(false); + rgba32_float.SetSRGBCorrected(false); texDetails.creationFlags = TextureCategory::SwapBuffer | TextureCategory::ColorTarget; texDetails.cubemap = false; diff --git a/renderdoc/core/replay_proxy.cpp b/renderdoc/core/replay_proxy.cpp index 4af065dd1..965a02f45 100644 --- a/renderdoc/core/replay_proxy.cpp +++ b/renderdoc/core/replay_proxy.cpp @@ -2121,9 +2121,9 @@ void ReplayProxy::RemapProxyTextureIfNeeded(TextureDescription &tex, GetTextureD params.remap = RemapTexture::RGBA8; } - // since the texture type is unsupported, remove the bgraOrder() flag and remap it to RGBA - if(tex.format.bgraOrder() && m_APIProps.localRenderer == GraphicsAPI::OpenGL) - tex.format.setBgraOrder(false); + // since the texture type is unsupported, remove the BGRAOrder() flag and remap it to RGBA + if(tex.format.BGRAOrder() && m_APIProps.localRenderer == GraphicsAPI::OpenGL) + tex.format.SetBGRAOrder(false); switch(params.remap) { diff --git a/renderdoc/driver/d3d11/d3d11_device.cpp b/renderdoc/driver/d3d11/d3d11_device.cpp index 9d6e237c6..bc6723013 100644 --- a/renderdoc/driver/d3d11/d3d11_device.cpp +++ b/renderdoc/driver/d3d11/d3d11_device.cpp @@ -1667,7 +1667,7 @@ bool WrappedID3D11Device::EndFrameCapture(void *dev, void *wnd) fp.pitch = mapped.RowPitch; fp.stride = fmt.compByteWidth * fmt.compCount; fp.bpc = fmt.compByteWidth; - fp.bgra = fmt.bgraOrder(); + fp.bgra = fmt.BGRAOrder(); fp.max_width = maxSize; fp.pitch_requirement = 8; switch(fmt.type) diff --git a/renderdoc/driver/d3d11/d3d11_pixelhistory.cpp b/renderdoc/driver/d3d11/d3d11_pixelhistory.cpp index ebf0add2c..e3e410f04 100644 --- a/renderdoc/driver/d3d11/d3d11_pixelhistory.cpp +++ b/renderdoc/driver/d3d11/d3d11_pixelhistory.cpp @@ -2470,7 +2470,7 @@ vector D3D11Replay::PixelHistory(vector events, R mod.postMod.col.floatValue[c] = ConvertFromHalf(uint16_t(mod.postMod.col.uintValue[c])); } } - else if(fmt.compType == CompType::UNorm && fmt.compByteWidth == 1 && fmt.srgbCorrected()) + else if(fmt.compType == CompType::UNorm && fmt.compByteWidth == 1 && fmt.SRGBCorrected()) { RDCASSERT(fmt.compByteWidth == 1); diff --git a/renderdoc/driver/d3d11/d3d11_shaderdebug.cpp b/renderdoc/driver/d3d11/d3d11_shaderdebug.cpp index c844e3110..9a379c6e2 100644 --- a/renderdoc/driver/d3d11/d3d11_shaderdebug.cpp +++ b/renderdoc/driver/d3d11/d3d11_shaderdebug.cpp @@ -817,19 +817,19 @@ ShaderDebugTrace D3D11Replay::DebugVertex(uint32_t eventId, uint32_t vertid, uin } else if(fmt.type == ResourceFormatType::R5G5B5A1) { - RDCASSERT(fmt.bgraOrder()); + RDCASSERT(fmt.BGRAOrder()); uint16_t packed = ((uint16_t *)srcData)[0]; *v4 = ConvertFromB5G5R5A1(packed); } else if(fmt.type == ResourceFormatType::R5G6B5) { - RDCASSERT(fmt.bgraOrder()); + RDCASSERT(fmt.BGRAOrder()); uint16_t packed = ((uint16_t *)srcData)[0]; *v3 = ConvertFromB5G6R5(packed); } else if(fmt.type == ResourceFormatType::R4G4B4A4) { - RDCASSERT(fmt.bgraOrder()); + RDCASSERT(fmt.BGRAOrder()); uint16_t packed = ((uint16_t *)srcData)[0]; *v4 = ConvertFromB4G4R4A4(packed); } @@ -927,7 +927,7 @@ ShaderDebugTrace D3D11Replay::DebugVertex(uint32_t eventId, uint32_t vertid, uin } } - if(fmt.bgraOrder()) + if(fmt.BGRAOrder()) { RDCASSERT(fmt.compCount == 4); std::swap(ret.inputs[i].value.fv[2], ret.inputs[i].value.fv[0]); diff --git a/renderdoc/driver/d3d12/d3d12_device.cpp b/renderdoc/driver/d3d12/d3d12_device.cpp index 3b2998b47..f038ad151 100644 --- a/renderdoc/driver/d3d12/d3d12_device.cpp +++ b/renderdoc/driver/d3d12/d3d12_device.cpp @@ -1638,7 +1638,7 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd) fp.pitch = layout.Footprint.RowPitch; fp.stride = fmt.compByteWidth * fmt.compCount; fp.bpc = fmt.compByteWidth; - fp.bgra = fmt.bgraOrder(); + fp.bgra = fmt.BGRAOrder(); fp.max_width = maxSize; fp.pitch_requirement = 8; switch(fmt.type) diff --git a/renderdoc/driver/dxgi/dxgi_common.cpp b/renderdoc/driver/dxgi/dxgi_common.cpp index 41bb04b17..621bda34f 100644 --- a/renderdoc/driver/dxgi/dxgi_common.cpp +++ b/renderdoc/driver/dxgi/dxgi_common.cpp @@ -1817,20 +1817,20 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt) case ResourceFormatType::R11G11B10: ret = DXGI_FORMAT_R11G11B10_FLOAT; break; case ResourceFormatType::R5G6B5: // only support bgra order - if(!fmt.bgraOrder()) + if(!fmt.BGRAOrder()) return DXGI_FORMAT_UNKNOWN; ret = DXGI_FORMAT_B5G6R5_UNORM; break; case ResourceFormatType::R5G5B5A1: // only support bgra order - if(!fmt.bgraOrder()) + if(!fmt.BGRAOrder()) return DXGI_FORMAT_UNKNOWN; ret = DXGI_FORMAT_B5G5R5A1_UNORM; break; case ResourceFormatType::R9G9B9E5: ret = DXGI_FORMAT_R9G9B9E5_SHAREDEXP; break; case ResourceFormatType::R4G4B4A4: // only support bgra order - if(!fmt.bgraOrder()) + if(!fmt.BGRAOrder()) return DXGI_FORMAT_UNKNOWN; ret = DXGI_FORMAT_B4G4R4A4_UNORM; break; @@ -1838,8 +1838,8 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt) case ResourceFormatType::D32S8: ret = DXGI_FORMAT_R32G8X24_TYPELESS; break; case ResourceFormatType::YUV8: { - int subsampling = fmt.yuvSubsampling(); - int planeCount = fmt.yuvPlaneCount(); + int subsampling = fmt.YUVSubsampling(); + int planeCount = fmt.YUVPlaneCount(); if(subsampling == 444) { // only support AYUV - 4 components @@ -1877,8 +1877,8 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt) } case ResourceFormatType::YUV10: { - int subsampling = fmt.yuvSubsampling(); - int planeCount = fmt.yuvPlaneCount(); + int subsampling = fmt.YUVSubsampling(); + int planeCount = fmt.YUVPlaneCount(); if(subsampling == 444) { // only support Y410 - 4 components @@ -1915,8 +1915,8 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt) } case ResourceFormatType::YUV16: { - int subsampling = fmt.yuvSubsampling(); - int planeCount = fmt.yuvPlaneCount(); + int subsampling = fmt.YUVSubsampling(); + int planeCount = fmt.YUVPlaneCount(); if(subsampling == 444) { // only support Y416 - 4 components @@ -1962,7 +1962,7 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt) else return DXGI_FORMAT_UNKNOWN; - if(fmt.bgraOrder()) + if(fmt.BGRAOrder()) ret = DXGI_FORMAT_B8G8R8A8_UNORM; } else if(fmt.compCount == 3) @@ -2016,7 +2016,7 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt) else return DXGI_FORMAT_UNKNOWN; - if(fmt.srgbCorrected()) + if(fmt.SRGBCorrected()) ret = GetSRGBFormat(ret); return ret; @@ -2029,7 +2029,7 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) ret.compCount = ret.compByteWidth = 0; ret.compType = CompType::Float; - ret.setSrgbCorrected(IsSRGBFormat(fmt)); + ret.SetSRGBCorrected(IsSRGBFormat(fmt)); switch(fmt) { @@ -2371,7 +2371,7 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_B8G8R8A8_TYPELESS: case DXGI_FORMAT_B8G8R8X8_TYPELESS: case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: - case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: ret.setBgraOrder(true); break; + case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: ret.SetBGRAOrder(true); break; default: break; } @@ -2416,11 +2416,11 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_R11G11B10_FLOAT: ret.type = ResourceFormatType::R11G11B10; break; case DXGI_FORMAT_B5G6R5_UNORM: ret.type = ResourceFormatType::R5G6B5; - ret.setBgraOrder(true); + ret.SetBGRAOrder(true); break; case DXGI_FORMAT_B5G5R5A1_UNORM: ret.type = ResourceFormatType::R5G5B5A1; - ret.setBgraOrder(true); + ret.SetBGRAOrder(true); break; case DXGI_FORMAT_R9G9B9E5_SHAREDEXP: ret.type = ResourceFormatType::R9G9B9E5; break; @@ -2457,7 +2457,7 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) { case DXGI_FORMAT_AYUV: case DXGI_FORMAT_Y410: - case DXGI_FORMAT_Y416: ret.setYUVSubsampling(444); + case DXGI_FORMAT_Y416: ret.SetYUVSubsampling(444); default: break; } @@ -2466,7 +2466,7 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_YUY2: case DXGI_FORMAT_Y210: case DXGI_FORMAT_Y216: - case DXGI_FORMAT_P208: ret.setYUVSubsampling(422); + case DXGI_FORMAT_P208: ret.SetYUVSubsampling(422); default: break; } @@ -2474,7 +2474,7 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) { case DXGI_FORMAT_NV12: case DXGI_FORMAT_P010: - case DXGI_FORMAT_P016: ret.setYUVSubsampling(420); + case DXGI_FORMAT_P016: ret.SetYUVSubsampling(420); default: break; } @@ -2483,7 +2483,7 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_NV12: case DXGI_FORMAT_P010: case DXGI_FORMAT_P016: - case DXGI_FORMAT_P208: ret.setYUVPlaneCount(2); + case DXGI_FORMAT_P208: ret.SetYUVPlaneCount(2); } break; @@ -2502,7 +2502,7 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_B4G4R4A4_UNORM: ret.type = ResourceFormatType::R4G4B4A4; - ret.setBgraOrder(true); + ret.SetBGRAOrder(true); break; case DXGI_FORMAT_UNKNOWN: ret.type = ResourceFormatType::Undefined; break; @@ -2665,7 +2665,7 @@ TEST_CASE("DXGI formats", "[format][d3d]") if(IsSRGBFormat(f)) { - CHECK(fmt.srgbCorrected()); + CHECK(fmt.SRGBCorrected()); } } }; @@ -2688,7 +2688,7 @@ TEST_CASE("DXGI formats", "[format][d3d]") ResourceFormat convfmt = MakeResourceFormat(conv); - CHECK(!convfmt.srgbCorrected()); + CHECK(!convfmt.SRGBCorrected()); } if(fmt.type == ResourceFormatType::BC1 || fmt.type == ResourceFormatType::BC2 || @@ -2703,7 +2703,7 @@ TEST_CASE("DXGI formats", "[format][d3d]") ResourceFormat convfmt = MakeResourceFormat(conv); - CHECK(convfmt.srgbCorrected()); + CHECK(convfmt.SRGBCorrected()); } if(f == DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM) @@ -2727,7 +2727,7 @@ TEST_CASE("DXGI formats", "[format][d3d]") DXGI_FORMAT typeless = GetTypelessFormat(f); DXGI_FORMAT typed = GetTypedFormat(typeless, typeHint); - if(fmt.srgbCorrected()) + if(fmt.SRGBCorrected()) typed = GetSRGBFormat(typed); CHECK(f == typed); diff --git a/renderdoc/driver/gl/gl_common.cpp b/renderdoc/driver/gl/gl_common.cpp index e2fabaf23..658b4cb60 100644 --- a/renderdoc/driver/gl/gl_common.cpp +++ b/renderdoc/driver/gl/gl_common.cpp @@ -1736,7 +1736,7 @@ ResourceFormat MakeResourceFormat(GLenum target, GLenum fmt) ret.compByteWidth = 1; ret.compCount = 1; ret.compType = CompType::UNorm; - ret.setSrgbCorrected(false); + ret.SetSRGBCorrected(false); return ret; } @@ -1774,7 +1774,7 @@ ResourceFormat MakeResourceFormat(GLenum target, GLenum fmt) case eGL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB: case eGL_COMPRESSED_SRGB8_ETC2: case eGL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: - case eGL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: ret.setSrgbCorrected(true); break; + case eGL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: ret.SetSRGBCorrected(true); break; default: break; } @@ -1918,7 +1918,7 @@ ResourceFormat MakeResourceFormat(GLenum target, GLenum fmt) if(iscol == GL_TRUE) { if(fmt == eGL_BGRA8_EXT || fmt == eGL_BGRA) - ret.setBgraOrder(true); + ret.SetBGRAOrder(true); // colour format @@ -1980,7 +1980,7 @@ ResourceFormat MakeResourceFormat(GLenum target, GLenum fmt) } GL.glGetInternalformativ(target, fmt, eGL_COLOR_ENCODING, sizeof(GLint), &data[0]); - ret.setSrgbCorrected(edata[0] == eGL_SRGB); + ret.SetSRGBCorrected(edata[0] == eGL_SRGB); } else if(isdepth == GL_TRUE || isstencil == GL_TRUE) { @@ -2043,19 +2043,19 @@ GLenum MakeGLFormat(ResourceFormat fmt) case ResourceFormatType::BC1: { if(fmt.compCount == 3) - ret = fmt.srgbCorrected() ? eGL_COMPRESSED_SRGB_S3TC_DXT1_EXT + ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB_S3TC_DXT1_EXT : eGL_COMPRESSED_RGB_S3TC_DXT1_EXT; else - ret = fmt.srgbCorrected() ? eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT + ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT : eGL_COMPRESSED_RGBA_S3TC_DXT1_EXT; break; } case ResourceFormatType::BC2: - ret = fmt.srgbCorrected() ? eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT + ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT : eGL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break; case ResourceFormatType::BC3: - ret = fmt.srgbCorrected() ? eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT + ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT : eGL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break; case ResourceFormatType::BC4: @@ -2071,15 +2071,15 @@ GLenum MakeGLFormat(ResourceFormat fmt) : eGL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB; break; case ResourceFormatType::BC7: - ret = fmt.srgbCorrected() ? eGL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB + ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB : eGL_COMPRESSED_RGBA_BPTC_UNORM_ARB; break; case ResourceFormatType::ETC2: { if(fmt.compCount == 3) - ret = fmt.srgbCorrected() ? eGL_COMPRESSED_SRGB8_ETC2 : eGL_COMPRESSED_RGB8_ETC2; + ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB8_ETC2 : eGL_COMPRESSED_RGB8_ETC2; else - ret = fmt.srgbCorrected() ? eGL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 + ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 : eGL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2; break; } @@ -2092,7 +2092,7 @@ GLenum MakeGLFormat(ResourceFormat fmt) ret = fmt.compType == CompType::SNorm ? eGL_COMPRESSED_SIGNED_RG11_EAC : eGL_COMPRESSED_RG11_EAC; else - ret = fmt.srgbCorrected() ? eGL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC + ret = fmt.SRGBCorrected() ? eGL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : eGL_COMPRESSED_RGBA8_ETC2_EAC; break; } @@ -2117,11 +2117,11 @@ GLenum MakeGLFormat(ResourceFormat fmt) } else if(fmt.compCount == 4) { - if(fmt.srgbCorrected()) + if(fmt.SRGBCorrected()) { ret = eGL_SRGB8_ALPHA8; } - else if(fmt.bgraOrder()) + else if(fmt.BGRAOrder()) { ret = eGL_BGRA8_EXT; } @@ -2171,7 +2171,7 @@ GLenum MakeGLFormat(ResourceFormat fmt) } else if(fmt.compCount == 3) { - if(fmt.srgbCorrected()) + if(fmt.SRGBCorrected()) { ret = eGL_SRGB8; } diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index acfd52543..5a6f52dd2 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -858,7 +858,7 @@ void GLReplay::SavePipelineState() { fmt.compByteWidth = 1; fmt.compCount = 4; - fmt.setBgraOrder(true); + fmt.SetBGRAOrder(true); fmt.compType = CompType::UNorm; if(type == eGL_UNSIGNED_INT_2_10_10_10_REV || type == eGL_INT_2_10_10_10_REV) @@ -3005,7 +3005,7 @@ ResourceId GLReplay::CreateProxyTexture(const TextureDescription &templateTex) } // Swizzle R/B channels only for non BGRA textures - if(templateTex.format.bgraOrder() && target != eGL_NONE && baseFormat != eGL_BGRA) + if(templateTex.format.BGRAOrder() && target != eGL_NONE && baseFormat != eGL_BGRA) { if(HasExt[ARB_texture_swizzle] || HasExt[EXT_texture_swizzle]) { @@ -3204,7 +3204,7 @@ bool GLReplay::IsTextureSupported(const ResourceFormat &format) // BGRA is not accepted as an internal format in case of GL // EXT_texture_format_BGRA8888 is required for creating BGRA proxy textures in case of GLES - if(format.bgraOrder()) + if(format.BGRAOrder()) return IsGLES && HasExt[EXT_texture_format_BGRA8888]; return true; diff --git a/renderdoc/driver/vulkan/vk_core.cpp b/renderdoc/driver/vulkan/vk_core.cpp index 5d1162866..b3804c934 100644 --- a/renderdoc/driver/vulkan/vk_core.cpp +++ b/renderdoc/driver/vulkan/vk_core.cpp @@ -1580,7 +1580,7 @@ bool WrappedVulkan::EndFrameCapture(void *dev, void *wnd) fp.pitch = rowPitch; fp.stride = fmt.compByteWidth * fmt.compCount; fp.bpc = fmt.compByteWidth; - fp.bgra = fmt.bgraOrder(); + fp.bgra = fmt.BGRAOrder(); fp.max_width = maxSize; fp.pitch_requirement = 8; switch(fmt.type) diff --git a/renderdoc/driver/vulkan/vk_resources.cpp b/renderdoc/driver/vulkan/vk_resources.cpp index c448633ce..01e2249de 100644 --- a/renderdoc/driver/vulkan/vk_resources.cpp +++ b/renderdoc/driver/vulkan/vk_resources.cpp @@ -547,7 +547,7 @@ void GetYUVShaderParameters(VkFormat f, Vec4u &YUVDownsampleRate, Vec4u &YUVACha { ResourceFormat fmt = MakeResourceFormat(f); - switch(fmt.yuvSubsampling()) + switch(fmt.YUVSubsampling()) { case 444: YUVDownsampleRate.x = 1; @@ -563,7 +563,7 @@ void GetYUVShaderParameters(VkFormat f, Vec4u &YUVDownsampleRate, Vec4u &YUVACha break; default: break; } - YUVDownsampleRate.z = fmt.yuvPlaneCount(); + YUVDownsampleRate.z = fmt.YUVPlaneCount(); switch(fmt.type) { case ResourceFormatType::YUV8: YUVDownsampleRate.w = 8; break; @@ -1334,7 +1334,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_B8G8R8G8_422_UNORM: case VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16: case VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16: - case VK_FORMAT_B16G16R16G16_422_UNORM: ret.setBgraOrder(true); break; + case VK_FORMAT_B16G16R16G16_422_UNORM: ret.SetBGRAOrder(true); break; default: break; } @@ -1566,7 +1566,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG: case VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG: case VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG: - case VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG: ret.setSrgbCorrected(true); break; + case VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG: ret.SetSRGBCorrected(true); break; default: break; } @@ -1878,7 +1878,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) if(IsYUVFormat(fmt)) { - ret.setYUVPlaneCount(GetYUVPlaneCount(fmt)); + ret.SetYUVPlaneCount(GetYUVPlaneCount(fmt)); switch(fmt) { @@ -1889,7 +1889,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16: case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16: case VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM: - case VK_FORMAT_G16_B16R16_2PLANE_420_UNORM: ret.setYUVSubsampling(420); break; + case VK_FORMAT_G16_B16R16_2PLANE_420_UNORM: ret.SetYUVSubsampling(420); break; case VK_FORMAT_G8B8G8R8_422_UNORM: case VK_FORMAT_B8G8R8G8_422_UNORM: case VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM: @@ -1905,7 +1905,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_G16B16G16R16_422_UNORM: case VK_FORMAT_B16G16R16G16_422_UNORM: case VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM: - case VK_FORMAT_G16_B16R16_2PLANE_422_UNORM: ret.setYUVSubsampling(422); break; + case VK_FORMAT_G16_B16R16_2PLANE_422_UNORM: ret.SetYUVSubsampling(422); break; case VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM: case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16: case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16: @@ -1915,7 +1915,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16: case VK_FORMAT_R12X4_UNORM_PACK16: case VK_FORMAT_R12X4G12X4_UNORM_2PACK16: - case VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16: ret.setYUVSubsampling(444); break; + case VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16: ret.SetYUVSubsampling(444); break; default: break; } } @@ -1935,16 +1935,16 @@ VkFormat MakeVkFormat(ResourceFormat fmt) case ResourceFormatType::BC1: { if(fmt.compCount == 3) - ret = fmt.srgbCorrected() ? VK_FORMAT_BC1_RGB_SRGB_BLOCK : VK_FORMAT_BC1_RGB_UNORM_BLOCK; + ret = fmt.SRGBCorrected() ? VK_FORMAT_BC1_RGB_SRGB_BLOCK : VK_FORMAT_BC1_RGB_UNORM_BLOCK; else - ret = fmt.srgbCorrected() ? VK_FORMAT_BC1_RGBA_SRGB_BLOCK : VK_FORMAT_BC1_RGBA_UNORM_BLOCK; + ret = fmt.SRGBCorrected() ? VK_FORMAT_BC1_RGBA_SRGB_BLOCK : VK_FORMAT_BC1_RGBA_UNORM_BLOCK; break; } case ResourceFormatType::BC2: - ret = fmt.srgbCorrected() ? VK_FORMAT_BC2_SRGB_BLOCK : VK_FORMAT_BC2_UNORM_BLOCK; + ret = fmt.SRGBCorrected() ? VK_FORMAT_BC2_SRGB_BLOCK : VK_FORMAT_BC2_UNORM_BLOCK; break; case ResourceFormatType::BC3: - ret = fmt.srgbCorrected() ? VK_FORMAT_BC3_SRGB_BLOCK : VK_FORMAT_BC3_UNORM_BLOCK; + ret = fmt.SRGBCorrected() ? VK_FORMAT_BC3_SRGB_BLOCK : VK_FORMAT_BC3_UNORM_BLOCK; break; case ResourceFormatType::BC4: ret = fmt.compType == CompType::SNorm ? VK_FORMAT_BC4_SNORM_BLOCK : VK_FORMAT_BC4_UNORM_BLOCK; @@ -1957,15 +1957,15 @@ VkFormat MakeVkFormat(ResourceFormat fmt) : VK_FORMAT_BC6H_UFLOAT_BLOCK; break; case ResourceFormatType::BC7: - ret = fmt.srgbCorrected() ? VK_FORMAT_BC7_SRGB_BLOCK : VK_FORMAT_BC7_UNORM_BLOCK; + ret = fmt.SRGBCorrected() ? VK_FORMAT_BC7_SRGB_BLOCK : VK_FORMAT_BC7_UNORM_BLOCK; break; case ResourceFormatType::ETC2: { if(fmt.compCount == 3) - ret = fmt.srgbCorrected() ? VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK + ret = fmt.SRGBCorrected() ? VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK : VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; else - ret = fmt.srgbCorrected() ? VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK + ret = fmt.SRGBCorrected() ? VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK : VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK; break; } @@ -1981,34 +1981,34 @@ VkFormat MakeVkFormat(ResourceFormat fmt) } case ResourceFormatType::R10G10B10A2: if(fmt.compType == CompType::UNorm) - ret = fmt.bgraOrder() ? VK_FORMAT_A2R10G10B10_UNORM_PACK32 + ret = fmt.BGRAOrder() ? VK_FORMAT_A2R10G10B10_UNORM_PACK32 : VK_FORMAT_A2B10G10R10_UNORM_PACK32; else if(fmt.compType == CompType::UInt) - ret = fmt.bgraOrder() ? VK_FORMAT_A2R10G10B10_UINT_PACK32 + ret = fmt.BGRAOrder() ? VK_FORMAT_A2R10G10B10_UINT_PACK32 : VK_FORMAT_A2B10G10R10_UINT_PACK32; else if(fmt.compType == CompType::UScaled) - ret = fmt.bgraOrder() ? VK_FORMAT_A2R10G10B10_USCALED_PACK32 + ret = fmt.BGRAOrder() ? VK_FORMAT_A2R10G10B10_USCALED_PACK32 : VK_FORMAT_A2B10G10R10_USCALED_PACK32; else if(fmt.compType == CompType::SNorm) - ret = fmt.bgraOrder() ? VK_FORMAT_A2R10G10B10_SNORM_PACK32 + ret = fmt.BGRAOrder() ? VK_FORMAT_A2R10G10B10_SNORM_PACK32 : VK_FORMAT_A2B10G10R10_SNORM_PACK32; else if(fmt.compType == CompType::SInt) - ret = fmt.bgraOrder() ? VK_FORMAT_A2R10G10B10_SINT_PACK32 + ret = fmt.BGRAOrder() ? VK_FORMAT_A2R10G10B10_SINT_PACK32 : VK_FORMAT_A2B10G10R10_SINT_PACK32; else if(fmt.compType == CompType::SScaled) - ret = fmt.bgraOrder() ? VK_FORMAT_A2R10G10B10_SSCALED_PACK32 + ret = fmt.BGRAOrder() ? VK_FORMAT_A2R10G10B10_SSCALED_PACK32 : VK_FORMAT_A2B10G10R10_SSCALED_PACK32; break; case ResourceFormatType::R11G11B10: ret = VK_FORMAT_B10G11R11_UFLOAT_PACK32; break; case ResourceFormatType::R5G6B5: - ret = fmt.bgraOrder() ? VK_FORMAT_B5G6R5_UNORM_PACK16 : VK_FORMAT_R5G6B5_UNORM_PACK16; + ret = fmt.BGRAOrder() ? VK_FORMAT_B5G6R5_UNORM_PACK16 : VK_FORMAT_R5G6B5_UNORM_PACK16; break; case ResourceFormatType::R5G5B5A1: - ret = fmt.bgraOrder() ? VK_FORMAT_B5G5R5A1_UNORM_PACK16 : VK_FORMAT_R5G5B5A1_UNORM_PACK16; + ret = fmt.BGRAOrder() ? VK_FORMAT_B5G5R5A1_UNORM_PACK16 : VK_FORMAT_R5G5B5A1_UNORM_PACK16; break; case ResourceFormatType::R9G9B9E5: ret = VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; break; case ResourceFormatType::R4G4B4A4: - ret = fmt.bgraOrder() ? VK_FORMAT_B4G4R4A4_UNORM_PACK16 : VK_FORMAT_R4G4B4A4_UNORM_PACK16; + ret = fmt.BGRAOrder() ? VK_FORMAT_B4G4R4A4_UNORM_PACK16 : VK_FORMAT_R4G4B4A4_UNORM_PACK16; break; case ResourceFormatType::R4G4: ret = VK_FORMAT_R4G4_UNORM_PACK8; break; case ResourceFormatType::D16S8: ret = VK_FORMAT_D16_UNORM_S8_UINT; break; @@ -2016,8 +2016,8 @@ VkFormat MakeVkFormat(ResourceFormat fmt) case ResourceFormatType::D32S8: ret = VK_FORMAT_D32_SFLOAT_S8_UINT; break; case ResourceFormatType::YUV8: { - int subsampling = fmt.yuvSubsampling(); - int planeCount = fmt.yuvPlaneCount(); + int subsampling = fmt.YUVSubsampling(); + int planeCount = fmt.YUVPlaneCount(); // don't support anything but 3 components if(fmt.compCount != 3) @@ -2031,7 +2031,7 @@ VkFormat MakeVkFormat(ResourceFormat fmt) else if(subsampling == 422) { if(planeCount == 1) - return fmt.bgraOrder() ? VK_FORMAT_B8G8R8G8_422_UNORM : VK_FORMAT_G8B8G8R8_422_UNORM; + return fmt.BGRAOrder() ? VK_FORMAT_B8G8R8G8_422_UNORM : VK_FORMAT_G8B8G8R8_422_UNORM; else if(planeCount == 2) return VK_FORMAT_G8_B8R8_2PLANE_422_UNORM; else if(planeCount == 3) @@ -2051,8 +2051,8 @@ VkFormat MakeVkFormat(ResourceFormat fmt) } case ResourceFormatType::YUV10: { - int subsampling = fmt.yuvSubsampling(); - int planeCount = fmt.yuvPlaneCount(); + int subsampling = fmt.YUVSubsampling(); + int planeCount = fmt.YUVPlaneCount(); if(fmt.compCount == 1) { @@ -2082,7 +2082,7 @@ VkFormat MakeVkFormat(ResourceFormat fmt) else if(subsampling == 422) { if(planeCount == 1) - return fmt.bgraOrder() ? VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 + return fmt.BGRAOrder() ? VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 : VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16; else if(planeCount == 2) return VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16; @@ -2103,8 +2103,8 @@ VkFormat MakeVkFormat(ResourceFormat fmt) } case ResourceFormatType::YUV12: { - int subsampling = fmt.yuvSubsampling(); - int planeCount = fmt.yuvPlaneCount(); + int subsampling = fmt.YUVSubsampling(); + int planeCount = fmt.YUVPlaneCount(); if(fmt.compCount == 1) { @@ -2134,7 +2134,7 @@ VkFormat MakeVkFormat(ResourceFormat fmt) else if(subsampling == 422) { if(planeCount == 1) - return fmt.bgraOrder() ? VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 + return fmt.BGRAOrder() ? VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 : VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16; else if(planeCount == 2) return VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16; @@ -2155,8 +2155,8 @@ VkFormat MakeVkFormat(ResourceFormat fmt) } case ResourceFormatType::YUV16: { - int subsampling = fmt.yuvSubsampling(); - int planeCount = fmt.yuvPlaneCount(); + int subsampling = fmt.YUVSubsampling(); + int planeCount = fmt.YUVPlaneCount(); if(subsampling == 444) { @@ -2166,7 +2166,7 @@ VkFormat MakeVkFormat(ResourceFormat fmt) else if(subsampling == 422) { if(planeCount == 1) - return fmt.bgraOrder() ? VK_FORMAT_B16G16R16G16_422_UNORM + return fmt.BGRAOrder() ? VK_FORMAT_B16G16R16G16_422_UNORM : VK_FORMAT_G16B16G16R16_422_UNORM; else if(planeCount == 2) return VK_FORMAT_G16_B16R16_2PLANE_422_UNORM; @@ -2190,9 +2190,9 @@ VkFormat MakeVkFormat(ResourceFormat fmt) } else if(fmt.compCount == 4) { - if(fmt.srgbCorrected()) + if(fmt.SRGBCorrected()) { - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8A8_SRGB : VK_FORMAT_R8G8B8A8_SRGB; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8A8_SRGB : VK_FORMAT_R8G8B8A8_SRGB; } else if(fmt.compByteWidth == 8) { @@ -2238,17 +2238,17 @@ VkFormat MakeVkFormat(ResourceFormat fmt) else if(fmt.compByteWidth == 1) { if(fmt.compType == CompType::SInt) - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8A8_SINT : VK_FORMAT_R8G8B8A8_SINT; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8A8_SINT : VK_FORMAT_R8G8B8A8_SINT; else if(fmt.compType == CompType::UInt) - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8A8_UINT : VK_FORMAT_R8G8B8A8_UINT; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8A8_UINT : VK_FORMAT_R8G8B8A8_UINT; else if(fmt.compType == CompType::SNorm) - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8A8_SNORM : VK_FORMAT_R8G8B8A8_SNORM; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8A8_SNORM : VK_FORMAT_R8G8B8A8_SNORM; else if(fmt.compType == CompType::UNorm) - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8A8_UNORM : VK_FORMAT_R8G8B8A8_UNORM; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8A8_UNORM : VK_FORMAT_R8G8B8A8_UNORM; else if(fmt.compType == CompType::SScaled) - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8A8_SSCALED : VK_FORMAT_R8G8B8A8_SSCALED; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8A8_SSCALED : VK_FORMAT_R8G8B8A8_SSCALED; else if(fmt.compType == CompType::UScaled) - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8A8_USCALED : VK_FORMAT_R8G8B8A8_USCALED; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8A8_USCALED : VK_FORMAT_R8G8B8A8_USCALED; else RDCERR("Unrecognised component type"); } @@ -2259,9 +2259,9 @@ VkFormat MakeVkFormat(ResourceFormat fmt) } else if(fmt.compCount == 3) { - if(fmt.srgbCorrected()) + if(fmt.SRGBCorrected()) { - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8_SRGB : VK_FORMAT_R8G8B8_SRGB; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8_SRGB : VK_FORMAT_R8G8B8_SRGB; } else if(fmt.compByteWidth == 8) { @@ -2307,17 +2307,17 @@ VkFormat MakeVkFormat(ResourceFormat fmt) else if(fmt.compByteWidth == 1) { if(fmt.compType == CompType::SInt) - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8_SINT : VK_FORMAT_R8G8B8_SINT; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8_SINT : VK_FORMAT_R8G8B8_SINT; else if(fmt.compType == CompType::UInt) - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8_UINT : VK_FORMAT_R8G8B8_UINT; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8_UINT : VK_FORMAT_R8G8B8_UINT; else if(fmt.compType == CompType::SNorm) - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8_SNORM : VK_FORMAT_R8G8B8_SNORM; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8_SNORM : VK_FORMAT_R8G8B8_SNORM; else if(fmt.compType == CompType::UNorm) - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8_UNORM : VK_FORMAT_R8G8B8_UNORM; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8_UNORM : VK_FORMAT_R8G8B8_UNORM; else if(fmt.compType == CompType::SScaled) - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8_SSCALED : VK_FORMAT_R8G8B8_SSCALED; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8_SSCALED : VK_FORMAT_R8G8B8_SSCALED; else if(fmt.compType == CompType::UScaled) - ret = fmt.bgraOrder() ? VK_FORMAT_B8G8R8_USCALED : VK_FORMAT_R8G8B8_USCALED; + ret = fmt.BGRAOrder() ? VK_FORMAT_B8G8R8_USCALED : VK_FORMAT_R8G8B8_USCALED; else RDCERR("Unrecognised component type"); } @@ -2328,7 +2328,7 @@ VkFormat MakeVkFormat(ResourceFormat fmt) } else if(fmt.compCount == 2) { - if(fmt.srgbCorrected()) + if(fmt.SRGBCorrected()) { ret = VK_FORMAT_R8G8_SRGB; } @@ -2397,7 +2397,7 @@ VkFormat MakeVkFormat(ResourceFormat fmt) } else if(fmt.compCount == 1) { - if(fmt.srgbCorrected()) + if(fmt.SRGBCorrected()) { ret = VK_FORMAT_R8_SRGB; } @@ -3111,7 +3111,7 @@ TEST_CASE("Vulkan formats", "[format][vulkan]") if(IsSRGBFormat(f)) { - CHECK(fmt.srgbCorrected()); + CHECK(fmt.SRGBCorrected()); } } }; diff --git a/renderdoc/replay/entry_points.cpp b/renderdoc/replay/entry_points.cpp index 4a02633f1..8d135fe41 100644 --- a/renderdoc/replay/entry_points.cpp +++ b/renderdoc/replay/entry_points.cpp @@ -620,15 +620,15 @@ static std::string ResourceFormatName(const ResourceFormat &fmt) case ResourceFormatType::BC1: if(fmt.compType == CompType::Typeless) return "BC1_TYPELESS"; - return fmt.srgbCorrected() ? "BC1_SRGB" : "BC1_UNORM"; + return fmt.SRGBCorrected() ? "BC1_SRGB" : "BC1_UNORM"; case ResourceFormatType::BC2: if(fmt.compType == CompType::Typeless) return "BC2_TYPELESS"; - return fmt.srgbCorrected() ? "BC2_SRGB" : "BC2_UNORM"; + return fmt.SRGBCorrected() ? "BC2_SRGB" : "BC2_UNORM"; case ResourceFormatType::BC3: if(fmt.compType == CompType::Typeless) return "BC3_TYPELESS"; - return fmt.srgbCorrected() ? "BC3_SRGB" : "BC3_UNORM"; + return fmt.SRGBCorrected() ? "BC3_SRGB" : "BC3_UNORM"; case ResourceFormatType::BC4: if(fmt.compType == CompType::Typeless) return "BC4_TYPELESS"; @@ -644,8 +644,8 @@ static std::string ResourceFormatName(const ResourceFormat &fmt) case ResourceFormatType::BC7: if(fmt.compType == CompType::Typeless) return "BC7_TYPELESS"; - return fmt.srgbCorrected() ? "BC7_SRGB" : "BC7_UNORM"; - case ResourceFormatType::ETC2: return fmt.srgbCorrected() ? "ETC2_SRGB" : "ETC_UNORM"; + return fmt.SRGBCorrected() ? "BC7_SRGB" : "BC7_UNORM"; + case ResourceFormatType::ETC2: return fmt.SRGBCorrected() ? "ETC2_SRGB" : "ETC_UNORM"; case ResourceFormatType::EAC: { if(fmt.compCount == 1) @@ -654,19 +654,19 @@ static std::string ResourceFormatName(const ResourceFormat &fmt) return fmt.compType == CompType::UNorm ? "EAC_RG_UNORM" : "EAC_RG_SNORM"; } case ResourceFormatType::ASTC: - return fmt.srgbCorrected() ? "ASTC_SRGB" : "ASTC_UNORM"; + return fmt.SRGBCorrected() ? "ASTC_SRGB" : "ASTC_UNORM"; // 10:10:10 A2 is the only format that can have all the usual format types (unorm, snorm, // etc). So we break and handle it like any other format below. case ResourceFormatType::R10G10B10A2: - ret = fmt.bgraOrder() ? "B10G10R10A2" : "R10G10B10A2"; + ret = fmt.BGRAOrder() ? "B10G10R10A2" : "R10G10B10A2"; break; case ResourceFormatType::R11G11B10: return "R11G11B10_FLOAT"; - case ResourceFormatType::R5G6B5: return fmt.bgraOrder() ? "R5G6B5_UNORM" : "B5G6R5_UNORM"; + case ResourceFormatType::R5G6B5: return fmt.BGRAOrder() ? "R5G6B5_UNORM" : "B5G6R5_UNORM"; case ResourceFormatType::R5G5B5A1: - return fmt.bgraOrder() ? "R5G5B5A1_UNORM" : "B5G5R5A1_UNORM"; + return fmt.BGRAOrder() ? "R5G5B5A1_UNORM" : "B5G5R5A1_UNORM"; case ResourceFormatType::R9G9B9E5: return "R9G9B9E5_FLOAT"; case ResourceFormatType::R4G4B4A4: - return fmt.bgraOrder() ? "R4G4B4A4_UNORM" : "B4G4R4A4_UNORM"; + return fmt.BGRAOrder() ? "R4G4B4A4_UNORM" : "B4G4R4A4_UNORM"; case ResourceFormatType::R4G4: return "R4G4_UNORM"; case ResourceFormatType::D16S8: return fmt.compType == CompType::Typeless ? "D16S8_TYPELESS" : "D16S8"; @@ -691,8 +691,8 @@ static std::string ResourceFormatName(const ResourceFormat &fmt) default: break; } - uint32_t planeCount = fmt.yuvPlaneCount(); - uint32_t subsampling = fmt.yuvSubsampling(); + uint32_t planeCount = fmt.YUVPlaneCount(); + uint32_t subsampling = fmt.YUVSubsampling(); // special case formats that don't match the FOURCC format if(yuvbits == 8 && planeCount == 2 && subsampling == 420) @@ -741,14 +741,14 @@ static std::string ResourceFormatName(const ResourceFormat &fmt) { char comps[] = "RGBA"; - if(fmt.bgraOrder()) + if(fmt.BGRAOrder()) std::swap(comps[0], comps[2]); for(uint32_t i = 0; i < fmt.compCount; i++) ret += StringFormat::Fmt("%c%u", comps[i], fmt.compByteWidth * 8); } - if(fmt.srgbCorrected()) + if(fmt.SRGBCorrected()) return ret + "_SRGB"; switch(fmt.compType) diff --git a/renderdoc/replay/replay_controller.cpp b/renderdoc/replay/replay_controller.cpp index 97e7a1641..aea091d84 100644 --- a/renderdoc/replay/replay_controller.cpp +++ b/renderdoc/replay/replay_controller.cpp @@ -140,7 +140,7 @@ float ConvertComponent(const ResourceFormat &fmt, const byte *data) } else if(fmt.compType == CompType::UNorm) { - if(fmt.srgbCorrected()) + if(fmt.SRGBCorrected()) return SRGB8_lookuptable[*u8]; else return float(*u8) / 255.0f; @@ -855,7 +855,7 @@ bool ReplayController::SaveTexture(const TextureSave &saveData, const char *path // for non-HDR always downcast if we're not already RGBA8 unorm if(sd.destType != FileType::DDS && sd.destType != FileType::HDR && sd.destType != FileType::EXR && (td.format.compByteWidth != 1 || td.format.compCount != 4 || - td.format.compType != CompType::UNorm || td.format.bgraOrder())) + td.format.compType != CompType::UNorm || td.format.BGRAOrder())) downcast = true; // for HDR & EXR we can convert from most regular types as well as 10.10.10.2 and 11.11.10 @@ -1428,7 +1428,7 @@ bool ReplayController::SaveTexture(const TextureSave &saveData, const char *path srcData += pixStride; } - if(saveFmt.bgraOrder()) + if(saveFmt.BGRAOrder()) std::swap(r, b); // HDR can't represent negative values diff --git a/renderdoc/replay/replay_driver.cpp b/renderdoc/replay/replay_driver.cpp index b0002b999..44b05e973 100644 --- a/renderdoc/replay/replay_driver.cpp +++ b/renderdoc/replay/replay_driver.cpp @@ -351,7 +351,7 @@ FloatVector HighlightCache::InterpretVertex(const byte *data, uint32_t vert, out++; } - if(fmt.bgraOrder()) + if(fmt.BGRAOrder()) { FloatVector reversed; reversed.x = ret.z; diff --git a/util/test/rdtest/analyse.py b/util/test/rdtest/analyse.py index eb043d6d6..1d6600e77 100644 --- a/util/test/rdtest/analyse.py +++ b/util/test/rdtest/analyse.py @@ -177,7 +177,7 @@ def unpack_data(fmt: rd.ResourceFormat, data: bytes, data_offset: int): value = tuple((float(value[i]) if (value[i] == max_neg) else (float(value[i]) / divisor)) for i in value) # If the format is BGRA, swap the two components - if fmt.bgraOrder(): + if fmt.BGRAOrder(): value = tuple(value[i] for i in [2, 1, 0, 3]) return value