Hash :
1b60d8d2
Author :
Date :
2017-02-10T14:56:55
Add artificial limits to the total memory allocated by the NULL backend. Fuzzer tests were capable of allocating very large chunks of memory by calling glBufferData with a null pointer. This sets a limit before the NULL backend starts returning out of memory GL errors. BUG=602737 Change-Id: Ic53ebcf999f951b96c1df82e4db57e949d03c908 Reviewed-on: https://chromium-review.googlesource.com/441184 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// BufferNULL.h:
// Defines the class interface for BufferNULL, implementing BufferImpl.
//
#ifndef LIBANGLE_RENDERER_NULL_BUFFERNULL_H_
#define LIBANGLE_RENDERER_NULL_BUFFERNULL_H_
#include "libANGLE/renderer/BufferImpl.h"
namespace rx
{
class AllocationTrackerNULL;
class BufferNULL : public BufferImpl
{
public:
BufferNULL(const gl::BufferState &state, AllocationTrackerNULL *allocationTracker);
~BufferNULL() override;
gl::Error setData(ContextImpl *context,
GLenum target,
const void *data,
size_t size,
GLenum usage) override;
gl::Error setSubData(ContextImpl *context,
GLenum target,
const void *data,
size_t size,
size_t offset) override;
gl::Error copySubData(ContextImpl *contextImpl,
BufferImpl *source,
GLintptr sourceOffset,
GLintptr destOffset,
GLsizeiptr size) override;
gl::Error map(ContextImpl *contextImpl, GLenum access, GLvoid **mapPtr) override;
gl::Error mapRange(ContextImpl *contextImpl,
size_t offset,
size_t length,
GLbitfield access,
GLvoid **mapPtr) override;
gl::Error unmap(ContextImpl *contextImpl, GLboolean *result) override;
gl::Error getIndexRange(GLenum type,
size_t offset,
size_t count,
bool primitiveRestartEnabled,
gl::IndexRange *outRange) override;
private:
std::vector<uint8_t> mData;
AllocationTrackerNULL *mAllocationTracker;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_NULL_BUFFERNULL_H_