Backed out changeset bdc40c000b29 (bug 1533525) for build bustages on WebGLTypes.h . CLOSED TREE

This commit is contained in:
Narcis Beleuzu 2019-04-10 03:17:41 +03:00
Родитель a513ab4d25
Коммит f12656eec3
6 изменённых файлов: 30 добавлений и 36 удалений

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

@ -39,16 +39,15 @@ class WebGL2Context : public WebGLContext {
// Buffer objects - WebGL2ContextBuffers.cpp // Buffer objects - WebGL2ContextBuffers.cpp
void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, void CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
WebGLintptr readOffset, WebGLintptr writeOffset, GLintptr readOffset, GLintptr writeOffset,
WebGLsizeiptr size); GLsizeiptr size);
private: private:
template <typename BufferT> template <typename BufferT>
void GetBufferSubDataT(GLenum target, WebGLintptr offset, void GetBufferSubDataT(GLenum target, GLintptr offset, const BufferT& data);
const BufferT& data);
public: public:
void GetBufferSubData(GLenum target, WebGLintptr srcByteOffset, void GetBufferSubData(GLenum target, GLintptr srcByteOffset,
const dom::ArrayBufferView& dstData, const dom::ArrayBufferView& dstData,
GLuint dstElemOffset, GLuint dstElemCountOverride); GLuint dstElemOffset, GLuint dstElemCountOverride);
@ -304,7 +303,7 @@ class WebGL2Context : public WebGLContext {
void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count,
GLsizei instanceCount); GLsizei instanceCount);
void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, 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, 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 BindBufferBase(GLenum target, GLuint index, WebGLBuffer* buffer);
void BindBufferRange(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, virtual JS::Value GetParameter(JSContext* cx, GLenum pname,
ErrorResult& rv) override; ErrorResult& rv) override;

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

@ -15,9 +15,8 @@ namespace mozilla {
// Buffer objects // Buffer objects
void WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget, void WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
WebGLintptr readOffset, GLintptr readOffset, GLintptr writeOffset,
WebGLintptr writeOffset, GLsizeiptr size) {
WebGLsizeiptr size) {
const FuncScope funcScope(*this, "copyBufferSubData"); const FuncScope funcScope(*this, "copyBufferSubData");
if (IsContextLost()) return; if (IsContextLost()) return;
@ -33,14 +32,9 @@ void WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
return; return;
} }
if (!CheckedInt<GLintptr>(readOffset).isValid() || const auto fnValidateOffsetSize = [&](const char* info, GLintptr offset,
!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 WebGLBuffer* buffer) { 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()) { if (!neededBytes.isValid() || neededBytes.value() > buffer->ByteLength()) {
ErrorInvalidValue("Invalid %s range.", info); ErrorInvalidValue("Invalid %s range.", info);
return false; return false;
@ -54,6 +48,9 @@ void WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
} }
if (readBuffer == writeBuffer) { if (readBuffer == writeBuffer) {
MOZ_ASSERT((CheckedInt<WebGLsizeiptr>(readOffset) + size).isValid());
MOZ_ASSERT((CheckedInt<WebGLsizeiptr>(writeOffset) + size).isValid());
const bool separate = const bool separate =
(readOffset + size <= writeOffset || writeOffset + size <= readOffset); (readOffset + size <= writeOffset || writeOffset + size <= readOffset);
if (!separate) { if (!separate) {
@ -84,7 +81,7 @@ void WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
writeBuffer->ResetLastUpdateFenceId(); writeBuffer->ResetLastUpdateFenceId();
} }
void WebGL2Context::GetBufferSubData(GLenum target, WebGLintptr srcByteOffset, void WebGL2Context::GetBufferSubData(GLenum target, GLintptr srcByteOffset,
const dom::ArrayBufferView& dstData, const dom::ArrayBufferView& dstData,
GLuint dstElemOffset, GLuint dstElemOffset,
GLuint dstElemCountOverride) { GLuint dstElemCountOverride) {
@ -109,9 +106,8 @@ void WebGL2Context::GetBufferSubData(GLenum target, WebGLintptr srcByteOffset,
//// ////
if (!CheckedInt<GLintptr>(srcByteOffset).isValid() || if (!CheckedInt<GLsizeiptr>(byteLen).isValid()) {
!CheckedInt<GLsizeiptr>(byteLen).isValid()) { ErrorOutOfMemory("Size too large.");
ErrorOutOfMemory("offset or size too large for platform.");
return; return;
} }
const GLsizeiptr glByteLen(byteLen); const GLsizeiptr glByteLen(byteLen);

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

@ -84,7 +84,7 @@ static bool ValidateBufferUsageEnum(WebGLContext* webgl, GLenum usage) {
return false; 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) { GLenum usage) {
// Careful: data.Length() could conceivably be any uint32_t, but GLsizeiptr // Careful: data.Length() could conceivably be any uint32_t, but GLsizeiptr
// is like intptr_t. // is like intptr_t.
@ -151,13 +151,12 @@ void WebGLBuffer::BufferData(GLenum target, uint64_t size, const void* data,
ResetLastUpdateFenceId(); ResetLastUpdateFenceId();
} }
void WebGLBuffer::BufferSubData(GLenum target, uint64_t dstByteOffset, void WebGLBuffer::BufferSubData(GLenum target, size_t dstByteOffset,
uint64_t dataLen, const void* data) const { size_t dataLen, const void* data) const {
if (!ValidateRange(dstByteOffset, dataLen)) return; if (!ValidateRange(dstByteOffset, dataLen)) return;
if (!CheckedInt<GLintptr>(dstByteOffset).isValid() || if (!CheckedInt<GLintptr>(dataLen).isValid())
!CheckedInt<GLsizeiptr>(dataLen).isValid()) return mContext->ErrorOutOfMemory("Size too large.");
return mContext->ErrorOutOfMemory("offset or size too large for platform.");
//// ////

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

@ -49,8 +49,8 @@ class WebGLBuffer final : public nsWrapperCache,
JS::Handle<JSObject*> givenProto) override; JS::Handle<JSObject*> givenProto) override;
bool ValidateCanBindToTarget(GLenum target); bool ValidateCanBindToTarget(GLenum target);
void BufferData(GLenum target, uint64_t size, const void* data, GLenum usage); void BufferData(GLenum target, size_t size, const void* data, GLenum usage);
void BufferSubData(GLenum target, uint64_t dstByteOffset, uint64_t dataLen, void BufferSubData(GLenum target, size_t dstByteOffset, size_t dataLen,
const void* data) const; const void* data) const;
//// ////

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

@ -958,7 +958,7 @@ class WebGLContext : public nsICanvasRenderingContextInternal,
WebGLintptr offset, WebGLsizeiptr size); WebGLintptr offset, WebGLsizeiptr size);
private: 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); GLenum usage);
public: public:
@ -972,7 +972,7 @@ class WebGLContext : public nsICanvasRenderingContextInternal,
private: private:
void BufferSubDataImpl(GLenum target, WebGLsizeiptr dstByteOffset, void BufferSubDataImpl(GLenum target, WebGLsizeiptr dstByteOffset,
uint64_t srcDataLen, const uint8_t* srcData); size_t srcDataLen, const uint8_t* srcData);
public: public:
void BufferSubData(GLenum target, WebGLsizeiptr dstByteOffset, 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 uint8_t* data, GLenum usage) {
const auto& buffer = ValidateBufferSelection(target); const auto& buffer = ValidateBufferSelection(target);
if (!buffer) return; if (!buffer) return;
@ -310,8 +310,8 @@ void WebGLContext::BufferData(GLenum target, WebGLsizeiptr size, GLenum usage) {
const UniqueBuffer zeroBuffer(calloc(checkedSize.value(), 1u)); const UniqueBuffer zeroBuffer(calloc(checkedSize.value(), 1u));
if (!zeroBuffer) return ErrorOutOfMemory("Failed to allocate zeros."); if (!zeroBuffer) return ErrorOutOfMemory("Failed to allocate zeros.");
BufferDataImpl(target, uint64_t{checkedSize.value()}, BufferDataImpl(target, checkedSize.value(), (const uint8_t*)zeroBuffer.get(),
(const uint8_t*)zeroBuffer.get(), usage); usage);
} }
void WebGLContext::BufferData(GLenum target, 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, 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"); const FuncScope funcScope(*this, "bufferSubData");
if (!ValidateNonNegative("byteOffset", dstByteOffset)) return; if (!ValidateNonNegative("byteOffset", dstByteOffset)) return;
@ -354,7 +354,7 @@ void WebGLContext::BufferSubDataImpl(GLenum target, WebGLsizeiptr dstByteOffset,
const auto& buffer = ValidateBufferSelection(target); const auto& buffer = ValidateBufferSelection(target);
if (!buffer) return; if (!buffer) return;
buffer->BufferSubData(target, uint64_t(dstByteOffset), dataLen, data); buffer->BufferSubData(target, size_t(dstByteOffset), dataLen, data);
} }
//// ////