rhi: gl: Map with write+invalidate

Presumably the equivalent of D3D11_MAP_WRITE_DISCARD.
Stating READ is pointless given reading is not possible with other
backends such as D3D11.

Task-number: QTBUG-125087
Pick-to: 6.7 6.6 6.5
Change-Id: I3c0aeb2a3669d4f8c279f7ace9a8a55e92988807
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit f52018e45ff19fd487e729321b6d2d1750f33a4a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Laszlo Agocs 2024-07-03 14:57:41 +02:00 committed by Qt Cherry-pick Bot
parent 0a92c970b7
commit d049d7cdba

View File

@ -356,6 +356,10 @@ QT_BEGIN_NAMESPACE
#define GL_MAP_WRITE_BIT 0x0002
#endif
#ifndef GL_MAP_INVALIDATE_BUFFER_BIT
#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
#endif
#ifndef GL_TEXTURE_2D_MULTISAMPLE
#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
#endif
@ -5328,7 +5332,7 @@ char *QGles2Buffer::beginFullDynamicBufferUpdateForCurrentFrame()
rhiD->f->glBindBuffer(targetForDataOps, buffer);
if (rhiD->caps.properMapBuffer) {
return static_cast<char *>(rhiD->f->glMapBufferRange(targetForDataOps, 0, nonZeroSize,
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT));
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT));
} else {
// Need some storage for the data, use the otherwise unused 'data' member.
if (data.isEmpty())