mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 14:18:31 +09:00
[Fix] (MG_Impl/Texture): read PBO if pixels == NULL at TexSubImage2D
This commit is contained in:
@@ -52,7 +52,9 @@ namespace MobileGL {
|
|||||||
TextureInputFormat textureInputFormat = MG_Util::ConvertGLEnumToTextureInputFormat(format);
|
TextureInputFormat textureInputFormat = MG_Util::ConvertGLEnumToTextureInputFormat(format);
|
||||||
TexturePixelDataType texturePixelDataType = MG_Util::ConvertGLEnumToTexturePixelDataType(type);
|
TexturePixelDataType texturePixelDataType = MG_Util::ConvertGLEnumToTexturePixelDataType(type);
|
||||||
// TextureInternalFormat textureInternalFormat = MG_Util::ConvertGLEnumToTextureInternalFormat(format);
|
// TextureInternalFormat textureInternalFormat = MG_Util::ConvertGLEnumToTextureInternalFormat(format);
|
||||||
|
MGLOG_D("TexSubImage2D_State: (%d, %d), format = %s, pixels = %p", width, height,
|
||||||
|
MG_Util::ConvertTextureInputFormatToString(textureInputFormat).c_str(),
|
||||||
|
pixels);
|
||||||
// ===================== Error Checking ==============================
|
// ===================== Error Checking ==============================
|
||||||
if (!TextureImpl::ValidateTexturePixelDataType(texturePixelDataType)) return;
|
if (!TextureImpl::ValidateTexturePixelDataType(texturePixelDataType)) return;
|
||||||
if (!TextureImpl::ValidateTextureInputFormat(textureInputFormat)) return;
|
if (!TextureImpl::ValidateTextureInputFormat(textureInputFormat)) return;
|
||||||
@@ -61,7 +63,6 @@ namespace MobileGL {
|
|||||||
if (!TextureImpl::ValidateTextureSizeWithTextureUploadTarget(textureUploadingTarget, width, height)) return;
|
if (!TextureImpl::ValidateTextureSizeWithTextureUploadTarget(textureUploadingTarget, width, height)) return;
|
||||||
if (!TextureImpl::ValidateTextureSizeRange(width, height)) return;
|
if (!TextureImpl::ValidateTextureSizeRange(width, height)) return;
|
||||||
if (!TextureImpl::ValidateTextureLevelWithUploadTarget(textureUploadingTarget, level)) return;
|
if (!TextureImpl::ValidateTextureLevelWithUploadTarget(textureUploadingTarget, level)) return;
|
||||||
if (!pixels) return;
|
|
||||||
|
|
||||||
// TODO: GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the
|
// TODO: GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the
|
||||||
// GL_PIXEL_UNPACK_BUFFER target and the buffer object's data store is currently mapped.
|
// GL_PIXEL_UNPACK_BUFFER target and the buffer object's data store is currently mapped.
|
||||||
@@ -109,6 +110,13 @@ namespace MobileGL {
|
|||||||
reinterpret_cast<SizeT>(pixels);
|
reinterpret_cast<SizeT>(pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!originalPixels) {
|
||||||
|
MG_State::pGLContext->RecordError(
|
||||||
|
ErrorCode::InvalidOperation,
|
||||||
|
MakeShared<GenericErrorInfo>("MG_Impl/GLImpl", __func__, "No data supplied from pixels parameter and no PBO bound."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void* processedPixels = MG_Util::PixelStoreProcessor::ProcessTexturePixelsDataUnpack(
|
void* processedPixels = MG_Util::PixelStoreProcessor::ProcessTexturePixelsDataUnpack(
|
||||||
originalPixels, MG_State::pGLContext->GetPixelStoreParameters(true), textureInternalFormat, textureInputFormat, texturePixelDataType, {width, height, 1},
|
originalPixels, MG_State::pGLContext->GetPixelStoreParameters(true), textureInternalFormat, textureInputFormat, texturePixelDataType, {width, height, 1},
|
||||||
false /*TODO*/, inputSize);
|
false /*TODO*/, inputSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user