Bug 1425488 - Reset last fenceId on write to buffers. - r=lenzak

MozReview-Commit-ID: HwPpGWKNA9W
This commit is contained in:
Jeff Gilbert 2017-12-20 16:31:58 -08:00
Родитель c9146314e9
Коммит 93dacf53b5
5 изменённых файлов: 28 добавлений и 8 удалений

Просмотреть файл

@ -86,6 +86,8 @@ WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
const ScopedLazyBind readBind(gl, readTarget, readBuffer);
const ScopedLazyBind writeBind(gl, writeTarget, writeBuffer);
gl->fCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
writeBuffer->ResetLastUpdateFenceId();
}
void
@ -132,16 +134,16 @@ WebGL2Context::GetBufferSubData(GLenum target, GLintptr srcByteOffset,
case LOCAL_GL_STREAM_READ:
case LOCAL_GL_DYNAMIC_READ:
if (mCompletedFenceId < buffer->mLastUpdateFenceId) {
GeneratePerfWarning("%s: Reading from a buffer without checking for previous"
" command completion likely causes pipeline stalls."
" Please use FenceSync.",
funcName);
GenerateWarning("%s: Reading from a buffer without checking for previous"
" command completion likely causes pipeline stalls."
" Please use FenceSync.",
funcName);
}
break;
default:
GeneratePerfWarning("%s: Reading from a buffer with usage other than *_READ"
" causes pipeline stalls. Copy through a STREAM_READ buffer.",
funcName);
GenerateWarning("%s: Reading from a buffer with usage other than *_READ"
" causes pipeline stalls. Copy through a STREAM_READ buffer.",
funcName);
break;
}

Просмотреть файл

@ -166,6 +166,8 @@ WebGLBuffer::BufferData(GLenum target, size_t size, const void* data, GLenum usa
mIndexRanges.clear();
}
}
ResetLastUpdateFenceId();
}
void
@ -197,6 +199,8 @@ WebGLBuffer::BufferSubData(GLenum target, size_t dstByteOffset, size_t dataLen,
const ScopedLazyBind lazyBind(gl, target, this);
gl->fBufferSubData(target, dstByteOffset, dataLen, uploadData);
ResetLastUpdateFenceId();
}
bool
@ -409,6 +413,12 @@ WebGLBuffer::ValidateCanBindToTarget(const char* funcName, GLenum target)
return false;
}
void
WebGLBuffer::ResetLastUpdateFenceId() const
{
mLastUpdateFenceId = mContext->mNextFenceId;
}
JSObject*
WebGLBuffer::WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto)
{

Просмотреть файл

@ -105,7 +105,7 @@ protected:
size_t mByteLength;
size_t mTFBindCount;
size_t mNonTFBindCount;
uint64_t mLastUpdateFenceId = 0;
mutable uint64_t mLastUpdateFenceId = 0;
struct IndexRange final {
GLenum type;
@ -128,6 +128,8 @@ protected:
public:
CacheMapInvalidator mFetchInvalidator;
void ResetLastUpdateFenceId() const;
};
} // namespace mozilla

Просмотреть файл

@ -337,6 +337,10 @@ public:
*out_error = true;
return;
}
// Technically we don't know that this will be updated yet, but we can
// speculatively mark it.
buffer->ResetLastUpdateFenceId();
}
}

Просмотреть файл

@ -1423,6 +1423,8 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum
const ScopedLazyBind lazyBind(gl, LOCAL_GL_PIXEL_PACK_BUFFER, buffer);
ReadPixelsImpl(x, y, width, height, format, type, (void*)offset, bytesAfterOffset);
buffer->ResetLastUpdateFenceId();
}
static webgl::PackingInfo