mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-09 04:38:30 +09:00
[Fix] (Types, GL_Texture): Memcpy insanity, proxy texture fix
This commit is contained in:
@@ -111,7 +111,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
(invalidate ? GL_MAP_INVALIDATE_BUFFER_BIT : 0) | GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
|
||||
const void* data = stateBufferObject->GetDataReadOnly()->data();
|
||||
if (mappedData) {
|
||||
Memcpy(reinterpret_cast<const void*>(reinterpret_cast<const char*>(data) + range.start), mappedData,
|
||||
Memcpy(mappedData, ((const char*)(data) + range.start),
|
||||
range.end - range.start);
|
||||
MGLOG_D("Mapped buffer data successfully for object with ID: %u", m_backendBufferId);
|
||||
MG_External::GLES::glUnmapBuffer(TempBufferTarget);
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace MobileGL {
|
||||
SizeT srcOffset = row * width * bytesPerPixel;
|
||||
|
||||
if (dstOffset + width * bytesPerPixel < data.size()) {
|
||||
Memcpy(srcData + srcOffset, data.data() + dstOffset, width * bytesPerPixel);
|
||||
Memcpy(data.data() + dstOffset, srcData + srcOffset, width * bytesPerPixel);
|
||||
} else {
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidOperation,
|
||||
@@ -286,7 +286,8 @@ namespace MobileGL {
|
||||
|
||||
// ======================= Processing ================================
|
||||
SharedPtr<MG_State::GLState::ITextureObject> textureObject = nullptr;
|
||||
if (TextureImpl::IsProxyTextureTarget(textureUploadingTarget)) {
|
||||
Bool isProxy = TextureImpl::IsProxyTextureTarget(textureUploadingTarget);
|
||||
if (isProxy) {
|
||||
textureObject =
|
||||
TextureImpl::pProxyTextureManager->CreateOrReplaceProxyTextureObject(textureUploadingTarget);
|
||||
} else {
|
||||
@@ -300,14 +301,14 @@ namespace MobileGL {
|
||||
if (!TextureImpl::ValidateTextureObject(textureObject)) return;
|
||||
|
||||
// ======================= Processing ================================
|
||||
SizeT imageSize =
|
||||
SizeT imageSize = isProxy ? 0 :
|
||||
MG_Util::CalculateInputTextureImageSize(textureInternalFormat,
|
||||
texturePixelDataType,
|
||||
{width, height, 1});
|
||||
|
||||
textureObject->SetInternalFormat(textureInternalFormat);
|
||||
MG_State::GLState::MipmapLevelInput mipmap = MG_State::GLState::MipmapLevelInput(
|
||||
{width, height, 1}, level, false, 0, {const_cast<void*>(pixels), imageSize});
|
||||
{width, height, 1}, level, false, 0, {const_cast<void*>(isProxy ? pixels : nullptr), imageSize});
|
||||
textureObject->SetMipmapLevel(mipmap);
|
||||
}
|
||||
|
||||
|
||||
@@ -189,9 +189,10 @@ namespace MobileGL {
|
||||
Bool dirty = true;
|
||||
|
||||
MipmapLevelInternal(const MipmapLevelInput& input) : MipmapLevelBase(input) {
|
||||
data.resize(input.inputData.size);
|
||||
if (input.inputData.data && input.inputData.size > 0) {
|
||||
const Uint8* src = static_cast<const Uint8*>(input.inputData.data);
|
||||
data.assign(src, src + input.inputData.size);
|
||||
Memcpy(data.data(), src, input.inputData.size);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace MobileGL {
|
||||
inline constexpr void Copy(const T* src, T* dest, SizeT count) {
|
||||
std::copy(src, src + count, dest);
|
||||
}
|
||||
inline constexpr void Memcpy(const void* src, void* dest, SizeT size) {
|
||||
inline constexpr void Memcpy(void* dest, const void* src, SizeT size) {
|
||||
std::memcpy(dest, src, size);
|
||||
}
|
||||
template <typename... Ts>
|
||||
|
||||
Reference in New Issue
Block a user