Skip to content

CalcBufferSize #342

Open
Open
@tigerssj

Description

@tigerssj

hello! follow is code snippet in the file applications/_plugins/common/texture_utils.cpp, in the function
CMP_DWORD CalcBufferSize(CMP_FORMAT format, CMP_DWORD dwWidth, CMP_DWORD dwHeight, CMP_DWORD dwPitch, CMP_BYTE nBlockWidth, CMP_BYTE nBlockHeight);

why the channel count of the formats CMP_FORMAT_RG_16 and CMP_FORMAT_RG_16F is 4? I think it has 2 channels

case CMP_FORMAT_RG_16:
case CMP_FORMAT_RG_16F:
return ((dwPitch) ? (dwPitch * dwHeight) : (dwWidth * 2 * sizeof(CMP_WORD) * dwHeight));

and the formats CMP_FORMAT_R_16 and CMP_FORMAT_R_16F has 1 channel, so:
return ((dwPitch) ? (dwPitch * dwHeight) : (dwWidth * 1* sizeof(CMP_WORD) * dwHeight));

Am I wrong?
Why isn't it the case here?

here is the source codes:
case CMP_FORMAT_ARGB_16:
case CMP_FORMAT_ABGR_16:
case CMP_FORMAT_RGBA_16:
case CMP_FORMAT_BGRA_16:
case CMP_FORMAT_ARGB_16F:
case CMP_FORMAT_ABGR_16F:
case CMP_FORMAT_RGBA_16F:
case CMP_FORMAT_BGRA_16F:
return ((dwPitch) ? (dwPitch * dwHeight) : (dwWidth * 4 * sizeof(CMP_WORD) * dwHeight));

case CMP_FORMAT_RG_16:
case CMP_FORMAT_RG_16F:
    return ((dwPitch) ? (dwPitch * dwHeight) : (dwWidth * 4 * sizeof(CMP_WORD) * dwHeight));

case CMP_FORMAT_R_16:
case CMP_FORMAT_R_16F:
    return ((dwPitch) ? (dwPitch * dwHeight) : (dwWidth * 4 * sizeof(CMP_WORD) * dwHeight));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions