shannon.woods@transgaming.com | bdf2d80 | 2013-02-28 23:16:20 +0000 | [diff] [blame] | 1 | #include "precompiled.h" |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 2 | // |
Geoff Lang | eeba6e1 | 2014-02-03 13:12:30 -0500 | [diff] [blame] | 3 | // Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved. |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 4 | // Use of this source code is governed by a BSD-style license that can be |
| 5 | // found in the LICENSE file. |
| 6 | // |
| 7 | |
| 8 | // BufferStorage9.cpp Defines the BufferStorage9 class. |
| 9 | |
Geoff Lang | d47e0fc | 2013-08-29 11:40:43 -0400 | [diff] [blame] | 10 | #include "libGLESv2/renderer/d3d9/BufferStorage9.h" |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 11 | #include "common/debug.h" |
Jamie Madill | 80b9528 | 2014-05-06 13:57:43 -0400 | [diff] [blame] | 12 | #include "libGLESv2/main.h" |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 13 | |
| 14 | namespace rx |
| 15 | { |
| 16 | |
| 17 | BufferStorage9::BufferStorage9() |
Geoff Lang | 876dc72 | 2014-05-01 17:10:24 -0400 | [diff] [blame] | 18 | : mSize(0) |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 19 | { |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | BufferStorage9::~BufferStorage9() |
| 23 | { |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | BufferStorage9 *BufferStorage9::makeBufferStorage9(BufferStorage *bufferStorage) |
| 27 | { |
| 28 | ASSERT(HAS_DYNAMIC_TYPE(BufferStorage9*, bufferStorage)); |
| 29 | return static_cast<BufferStorage9*>(bufferStorage); |
| 30 | } |
| 31 | |
| 32 | void *BufferStorage9::getData() |
| 33 | { |
Geoff Lang | 876dc72 | 2014-05-01 17:10:24 -0400 | [diff] [blame] | 34 | return mMemory.data(); |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 35 | } |
| 36 | |
Geoff Lang | 876dc72 | 2014-05-01 17:10:24 -0400 | [diff] [blame] | 37 | void BufferStorage9::setData(const void* data, size_t size, size_t offset) |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 38 | { |
Geoff Lang | 876dc72 | 2014-05-01 17:10:24 -0400 | [diff] [blame] | 39 | if (offset + size > mMemory.size()) |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 40 | { |
Geoff Lang | 876dc72 | 2014-05-01 17:10:24 -0400 | [diff] [blame] | 41 | mMemory.resize(offset + size); |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | mSize = std::max(mSize, offset + size); |
Geoff Lang | 6350f73 | 2013-05-31 09:41:46 -0400 | [diff] [blame] | 45 | if (data) |
| 46 | { |
Geoff Lang | 876dc72 | 2014-05-01 17:10:24 -0400 | [diff] [blame] | 47 | memcpy(mMemory.data() + offset, data, size); |
Geoff Lang | 6350f73 | 2013-05-31 09:41:46 -0400 | [diff] [blame] | 48 | } |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 49 | } |
| 50 | |
Geoff Lang | 876dc72 | 2014-05-01 17:10:24 -0400 | [diff] [blame] | 51 | void BufferStorage9::copyData(BufferStorage* sourceStorage, size_t size, size_t sourceOffset, size_t destOffset) |
shannon.woods%transgaming.com@gtempaccount.com | ab30bab | 2013-04-13 03:39:24 +0000 | [diff] [blame] | 52 | { |
| 53 | BufferStorage9* source = makeBufferStorage9(sourceStorage); |
| 54 | if (source) |
| 55 | { |
Geoff Lang | 876dc72 | 2014-05-01 17:10:24 -0400 | [diff] [blame] | 56 | memcpy(mMemory.data() + destOffset, source->mMemory.data() + sourceOffset, size); |
shannon.woods%transgaming.com@gtempaccount.com | ab30bab | 2013-04-13 03:39:24 +0000 | [diff] [blame] | 57 | } |
| 58 | } |
| 59 | |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 60 | void BufferStorage9::clear() |
| 61 | { |
| 62 | mSize = 0; |
| 63 | } |
| 64 | |
Geoff Lang | eeba6e1 | 2014-02-03 13:12:30 -0500 | [diff] [blame] | 65 | void BufferStorage9::markTransformFeedbackUsage() |
| 66 | { |
| 67 | UNREACHABLE(); |
| 68 | } |
| 69 | |
Geoff Lang | 876dc72 | 2014-05-01 17:10:24 -0400 | [diff] [blame] | 70 | size_t BufferStorage9::getSize() const |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 71 | { |
| 72 | return mSize; |
| 73 | } |
| 74 | |
| 75 | bool BufferStorage9::supportsDirectBinding() const |
| 76 | { |
| 77 | return false; |
| 78 | } |
| 79 | |
Jamie Madill | d9fa3b9 | 2014-02-19 10:30:51 -0500 | [diff] [blame] | 80 | // We do not suppot buffer mapping facility in D3D9 |
| 81 | bool BufferStorage9::isMapped() const |
| 82 | { |
| 83 | UNREACHABLE(); |
| 84 | return false; |
| 85 | } |
| 86 | |
| 87 | void *BufferStorage9::map(GLbitfield access) |
| 88 | { |
| 89 | UNREACHABLE(); |
| 90 | return NULL; |
| 91 | } |
| 92 | |
| 93 | void BufferStorage9::unmap() |
| 94 | { |
| 95 | UNREACHABLE(); |
| 96 | } |
| 97 | |
shannon.woods@transgaming.com | b91187c | 2013-02-28 23:07:45 +0000 | [diff] [blame] | 98 | } |