зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset bdc40c000b29 (bug 1533525) for build bustages on WebGLTypes.h . CLOSED TREE
This commit is contained in:
Родитель
a513ab4d25
Коммит
f12656eec3
|
@ -39,16 +39,15 @@ class WebGL2Context : public WebGLContext {
|
|||
// Buffer objects - WebGL2ContextBuffers.cpp
|
||||
|
||||
void CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
|
||||
WebGLintptr readOffset, WebGLintptr writeOffset,
|
||||
WebGLsizeiptr size);
|
||||
GLintptr readOffset, GLintptr writeOffset,
|
||||
GLsizeiptr size);
|
||||
|
||||
private:
|
||||
template <typename BufferT>
|
||||
void GetBufferSubDataT(GLenum target, WebGLintptr offset,
|
||||
const BufferT& data);
|
||||
void GetBufferSubDataT(GLenum target, GLintptr offset, const BufferT& data);
|
||||
|
||||
public:
|
||||
void GetBufferSubData(GLenum target, WebGLintptr srcByteOffset,
|
||||
void GetBufferSubData(GLenum target, GLintptr srcByteOffset,
|
||||
const dom::ArrayBufferView& dstData,
|
||||
GLuint dstElemOffset, GLuint dstElemCountOverride);
|
||||
|
||||
|
@ -304,7 +303,7 @@ class WebGL2Context : public WebGLContext {
|
|||
void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count,
|
||||
GLsizei instanceCount);
|
||||
void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
|
||||
WebGLintptr offset, GLsizei instanceCount);
|
||||
GLintptr offset, GLsizei instanceCount);
|
||||
*/
|
||||
|
||||
void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
|
||||
|
@ -406,7 +405,7 @@ class WebGL2Context : public WebGLContext {
|
|||
/*
|
||||
void BindBufferBase(GLenum target, GLuint index, WebGLBuffer* buffer);
|
||||
void BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer,
|
||||
WebGLintptr offset, WebGLsizeiptr size);
|
||||
GLintptr offset, GLsizeiptr size);
|
||||
*/
|
||||
virtual JS::Value GetParameter(JSContext* cx, GLenum pname,
|
||||
ErrorResult& rv) override;
|
||||
|
|
|
@ -15,9 +15,8 @@ namespace mozilla {
|
|||
// Buffer objects
|
||||
|
||||
void WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
|
||||
WebGLintptr readOffset,
|
||||
WebGLintptr writeOffset,
|
||||
WebGLsizeiptr size) {
|
||||
GLintptr readOffset, GLintptr writeOffset,
|
||||
GLsizeiptr size) {
|
||||
const FuncScope funcScope(*this, "copyBufferSubData");
|
||||
if (IsContextLost()) return;
|
||||
|
||||
|
@ -33,14 +32,9 @@ void WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!CheckedInt<GLintptr>(readOffset).isValid() ||
|
||||
!CheckedInt<GLintptr>(writeOffset).isValid() ||
|
||||
!CheckedInt<GLsizeiptr>(size).isValid())
|
||||
return ErrorOutOfMemory("offset or size too large for platform.");
|
||||
|
||||
const auto fnValidateOffsetSize = [&](const char* info, WebGLintptr offset,
|
||||
const auto fnValidateOffsetSize = [&](const char* info, GLintptr offset,
|
||||
const WebGLBuffer* buffer) {
|
||||
const auto neededBytes = CheckedInt<uint64_t>(offset) + size;
|
||||
const auto neededBytes = CheckedInt<size_t>(offset) + size;
|
||||
if (!neededBytes.isValid() || neededBytes.value() > buffer->ByteLength()) {
|
||||
ErrorInvalidValue("Invalid %s range.", info);
|
||||
return false;
|
||||
|
@ -54,6 +48,9 @@ void WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
|
|||
}
|
||||
|
||||
if (readBuffer == writeBuffer) {
|
||||
MOZ_ASSERT((CheckedInt<WebGLsizeiptr>(readOffset) + size).isValid());
|
||||
MOZ_ASSERT((CheckedInt<WebGLsizeiptr>(writeOffset) + size).isValid());
|
||||
|
||||
const bool separate =
|
||||
(readOffset + size <= writeOffset || writeOffset + size <= readOffset);
|
||||
if (!separate) {
|
||||
|
@ -84,7 +81,7 @@ void WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
|
|||
writeBuffer->ResetLastUpdateFenceId();
|
||||
}
|
||||
|
||||
void WebGL2Context::GetBufferSubData(GLenum target, WebGLintptr srcByteOffset,
|
||||
void WebGL2Context::GetBufferSubData(GLenum target, GLintptr srcByteOffset,
|
||||
const dom::ArrayBufferView& dstData,
|
||||
GLuint dstElemOffset,
|
||||
GLuint dstElemCountOverride) {
|
||||
|
@ -109,9 +106,8 @@ void WebGL2Context::GetBufferSubData(GLenum target, WebGLintptr srcByteOffset,
|
|||
|
||||
////
|
||||
|
||||
if (!CheckedInt<GLintptr>(srcByteOffset).isValid() ||
|
||||
!CheckedInt<GLsizeiptr>(byteLen).isValid()) {
|
||||
ErrorOutOfMemory("offset or size too large for platform.");
|
||||
if (!CheckedInt<GLsizeiptr>(byteLen).isValid()) {
|
||||
ErrorOutOfMemory("Size too large.");
|
||||
return;
|
||||
}
|
||||
const GLsizeiptr glByteLen(byteLen);
|
||||
|
|
|
@ -84,7 +84,7 @@ static bool ValidateBufferUsageEnum(WebGLContext* webgl, GLenum usage) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void WebGLBuffer::BufferData(GLenum target, uint64_t size, const void* data,
|
||||
void WebGLBuffer::BufferData(GLenum target, size_t size, const void* data,
|
||||
GLenum usage) {
|
||||
// Careful: data.Length() could conceivably be any uint32_t, but GLsizeiptr
|
||||
// is like intptr_t.
|
||||
|
@ -151,13 +151,12 @@ void WebGLBuffer::BufferData(GLenum target, uint64_t size, const void* data,
|
|||
ResetLastUpdateFenceId();
|
||||
}
|
||||
|
||||
void WebGLBuffer::BufferSubData(GLenum target, uint64_t dstByteOffset,
|
||||
uint64_t dataLen, const void* data) const {
|
||||
void WebGLBuffer::BufferSubData(GLenum target, size_t dstByteOffset,
|
||||
size_t dataLen, const void* data) const {
|
||||
if (!ValidateRange(dstByteOffset, dataLen)) return;
|
||||
|
||||
if (!CheckedInt<GLintptr>(dstByteOffset).isValid() ||
|
||||
!CheckedInt<GLsizeiptr>(dataLen).isValid())
|
||||
return mContext->ErrorOutOfMemory("offset or size too large for platform.");
|
||||
if (!CheckedInt<GLintptr>(dataLen).isValid())
|
||||
return mContext->ErrorOutOfMemory("Size too large.");
|
||||
|
||||
////
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ class WebGLBuffer final : public nsWrapperCache,
|
|||
JS::Handle<JSObject*> givenProto) override;
|
||||
|
||||
bool ValidateCanBindToTarget(GLenum target);
|
||||
void BufferData(GLenum target, uint64_t size, const void* data, GLenum usage);
|
||||
void BufferSubData(GLenum target, uint64_t dstByteOffset, uint64_t dataLen,
|
||||
void BufferData(GLenum target, size_t size, const void* data, GLenum usage);
|
||||
void BufferSubData(GLenum target, size_t dstByteOffset, size_t dataLen,
|
||||
const void* data) const;
|
||||
|
||||
////
|
||||
|
|
|
@ -958,7 +958,7 @@ class WebGLContext : public nsICanvasRenderingContextInternal,
|
|||
WebGLintptr offset, WebGLsizeiptr size);
|
||||
|
||||
private:
|
||||
void BufferDataImpl(GLenum target, uint64_t dataLen, const uint8_t* data,
|
||||
void BufferDataImpl(GLenum target, size_t dataLen, const uint8_t* data,
|
||||
GLenum usage);
|
||||
|
||||
public:
|
||||
|
@ -972,7 +972,7 @@ class WebGLContext : public nsICanvasRenderingContextInternal,
|
|||
|
||||
private:
|
||||
void BufferSubDataImpl(GLenum target, WebGLsizeiptr dstByteOffset,
|
||||
uint64_t srcDataLen, const uint8_t* srcData);
|
||||
size_t srcDataLen, const uint8_t* srcData);
|
||||
|
||||
public:
|
||||
void BufferSubData(GLenum target, WebGLsizeiptr dstByteOffset,
|
||||
|
|
|
@ -285,7 +285,7 @@ void WebGLContext::BindBufferRange(GLenum target, GLuint index,
|
|||
|
||||
////////////////////////////////////////
|
||||
|
||||
void WebGLContext::BufferDataImpl(GLenum target, uint64_t dataLen,
|
||||
void WebGLContext::BufferDataImpl(GLenum target, size_t dataLen,
|
||||
const uint8_t* data, GLenum usage) {
|
||||
const auto& buffer = ValidateBufferSelection(target);
|
||||
if (!buffer) return;
|
||||
|
@ -310,8 +310,8 @@ void WebGLContext::BufferData(GLenum target, WebGLsizeiptr size, GLenum usage) {
|
|||
const UniqueBuffer zeroBuffer(calloc(checkedSize.value(), 1u));
|
||||
if (!zeroBuffer) return ErrorOutOfMemory("Failed to allocate zeros.");
|
||||
|
||||
BufferDataImpl(target, uint64_t{checkedSize.value()},
|
||||
(const uint8_t*)zeroBuffer.get(), usage);
|
||||
BufferDataImpl(target, checkedSize.value(), (const uint8_t*)zeroBuffer.get(),
|
||||
usage);
|
||||
}
|
||||
|
||||
void WebGLContext::BufferData(GLenum target,
|
||||
|
@ -346,7 +346,7 @@ void WebGLContext::BufferData(GLenum target, const dom::ArrayBufferView& src,
|
|||
////////////////////////////////////////
|
||||
|
||||
void WebGLContext::BufferSubDataImpl(GLenum target, WebGLsizeiptr dstByteOffset,
|
||||
uint64_t dataLen, const uint8_t* data) {
|
||||
size_t dataLen, const uint8_t* data) {
|
||||
const FuncScope funcScope(*this, "bufferSubData");
|
||||
|
||||
if (!ValidateNonNegative("byteOffset", dstByteOffset)) return;
|
||||
|
@ -354,7 +354,7 @@ void WebGLContext::BufferSubDataImpl(GLenum target, WebGLsizeiptr dstByteOffset,
|
|||
const auto& buffer = ValidateBufferSelection(target);
|
||||
if (!buffer) return;
|
||||
|
||||
buffer->BufferSubData(target, uint64_t(dstByteOffset), dataLen, data);
|
||||
buffer->BufferSubData(target, size_t(dstByteOffset), dataLen, data);
|
||||
}
|
||||
|
||||
////
|
||||
|
|
Загрузка…
Ссылка в новой задаче