blob: 489a0401cb6a6265857854092cb8d3104b2794c4 [file] [log] [blame]
shannon.woods@transgaming.combdf2d802013-02-28 23:16:20 +00001#include "precompiled.h"
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +00002//
Geoff Langeeba6e12014-02-03 13:12:30 -05003// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +00004// 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 Langd47e0fc2013-08-29 11:40:43 -040010#include "libGLESv2/renderer/d3d9/BufferStorage9.h"
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +000011#include "common/debug.h"
Jamie Madill80b95282014-05-06 13:57:43 -040012#include "libGLESv2/main.h"
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +000013
14namespace rx
15{
16
17BufferStorage9::BufferStorage9()
Geoff Lang876dc722014-05-01 17:10:24 -040018 : mSize(0)
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +000019{
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +000020}
21
22BufferStorage9::~BufferStorage9()
23{
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +000024}
25
26BufferStorage9 *BufferStorage9::makeBufferStorage9(BufferStorage *bufferStorage)
27{
28 ASSERT(HAS_DYNAMIC_TYPE(BufferStorage9*, bufferStorage));
29 return static_cast<BufferStorage9*>(bufferStorage);
30}
31
32void *BufferStorage9::getData()
33{
Geoff Lang876dc722014-05-01 17:10:24 -040034 return mMemory.data();
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +000035}
36
Geoff Lang876dc722014-05-01 17:10:24 -040037void BufferStorage9::setData(const void* data, size_t size, size_t offset)
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +000038{
Geoff Lang876dc722014-05-01 17:10:24 -040039 if (offset + size > mMemory.size())
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +000040 {
Geoff Lang876dc722014-05-01 17:10:24 -040041 mMemory.resize(offset + size);
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +000042 }
43
44 mSize = std::max(mSize, offset + size);
Geoff Lang6350f732013-05-31 09:41:46 -040045 if (data)
46 {
Geoff Lang876dc722014-05-01 17:10:24 -040047 memcpy(mMemory.data() + offset, data, size);
Geoff Lang6350f732013-05-31 09:41:46 -040048 }
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +000049}
50
Geoff Lang876dc722014-05-01 17:10:24 -040051void BufferStorage9::copyData(BufferStorage* sourceStorage, size_t size, size_t sourceOffset, size_t destOffset)
shannon.woods%transgaming.com@gtempaccount.comab30bab2013-04-13 03:39:24 +000052{
53 BufferStorage9* source = makeBufferStorage9(sourceStorage);
54 if (source)
55 {
Geoff Lang876dc722014-05-01 17:10:24 -040056 memcpy(mMemory.data() + destOffset, source->mMemory.data() + sourceOffset, size);
shannon.woods%transgaming.com@gtempaccount.comab30bab2013-04-13 03:39:24 +000057 }
58}
59
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +000060void BufferStorage9::clear()
61{
62 mSize = 0;
63}
64
Geoff Langeeba6e12014-02-03 13:12:30 -050065void BufferStorage9::markTransformFeedbackUsage()
66{
67 UNREACHABLE();
68}
69
Geoff Lang876dc722014-05-01 17:10:24 -040070size_t BufferStorage9::getSize() const
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +000071{
72 return mSize;
73}
74
75bool BufferStorage9::supportsDirectBinding() const
76{
77 return false;
78}
79
Jamie Madilld9fa3b92014-02-19 10:30:51 -050080// We do not suppot buffer mapping facility in D3D9
81bool BufferStorage9::isMapped() const
82{
83 UNREACHABLE();
84 return false;
85}
86
87void *BufferStorage9::map(GLbitfield access)
88{
89 UNREACHABLE();
90 return NULL;
91}
92
93void BufferStorage9::unmap()
94{
95 UNREACHABLE();
96}
97
shannon.woods@transgaming.comb91187c2013-02-28 23:07:45 +000098}