Main Page
Namespaces
Classes
Files
File List
File Members
include
Graphics
GL4
GteGL4StructuredBuffer.h
Go to the documentation of this file.
1
// David Eberly, Geometric Tools, Redmond WA 98052
2
// Copyright (c) 1998-2017
3
// Distributed under the Boost Software License, Version 1.0.
4
// http://www.boost.org/LICENSE_1_0.txt
5
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6
// File Version: 3.0.0 (2016/06/19)
7
8
#pragma once
9
10
#include <
Graphics/GteStructuredBuffer.h
>
11
#include <
Graphics/GL4/GteGL4Buffer.h
>
12
13
namespace
gte
14
{
15
16
class
GTE_IMPEXP
GL4StructuredBuffer
:
public
GL4Buffer
17
{
18
public
:
19
// Construction.
20
GL4StructuredBuffer
(
StructuredBuffer
const
* cbuffer);
21
static
std::shared_ptr<GEObject> Create(
void
* unused,
GraphicsObject
const
*
object
);
22
23
// Member access.
24
inline
StructuredBuffer
* GetStructuredBuffer()
const
;
25
26
// Bind the structured buffer data to the specified shader
27
// storage buffer unit.
28
void
AttachToUnit(
GLint
shaderStorageBufferUnit);
29
30
// Copy the counter value to/from another buffer.
31
bool
CopyCounterValueToBuffer(
GL4Buffer
* targetBuffer,
GLint
offset
);
32
bool
CopyCounterValueFromBuffer(
GL4Buffer
* sourceBuffer,
GLint
offset);
33
34
// The number of active elements is read from GPU and stored in the
35
// StructuredBuffer object (of type CT_APPEND_CONSUME or CT_COUNTER).
36
// The result can be accessed from this object via its member function
37
// GetNumActiveElements().
38
bool
GetNumActiveElements();
39
40
// The number of active elements is written to GPU from the StructuredBuffer
41
// object (of type CT_APPEND_CONSUME or CT_COUNTER). The number of active
42
// elements can be changed in the StructuredBuffer object via its member
43
// function SetNumActiveElements.
44
bool
SetNumActiveElements();
45
46
// Override needed to handle case of a counter attached so that
47
// counter value can be updated first to know how many elements
48
// to copy back from GPU.
49
virtual
bool
CopyGpuToCpu()
override
;
50
51
protected
:
52
// Must be called by constructor.
53
virtual
void
Initialize()
override
;
54
55
private
:
56
GLint
mCounterOffset
;
57
};
58
59
inline
StructuredBuffer
*
GL4StructuredBuffer::GetStructuredBuffer
()
const
60
{
61
return
static_cast<
StructuredBuffer
*
>
(mGTObject);
62
}
63
64
}
GteStructuredBuffer.h
GLint
int GLint
Definition:
glcorearb.h:85
gte::GL4Buffer
Definition:
GteGL4Buffer.h:16
gte::GraphicsObject
Definition:
GteGraphicsObject.h:115
gte::GL4StructuredBuffer
Definition:
GteGL4StructuredBuffer.h:16
GteGL4Buffer.h
gte
Definition:
GLX/GteWICFileIO.h:16
gte::StructuredBuffer
Definition:
GteStructuredBuffer.h:15
gte::GL4StructuredBuffer::mCounterOffset
GLint mCounterOffset
Definition:
GteGL4StructuredBuffer.h:56
offset
GLintptr offset
Definition:
glcorearb.h:660
GTE_IMPEXP
#define GTE_IMPEXP
Definition:
GTEngineDEF.h:63
gte::GL4StructuredBuffer::GetStructuredBuffer
StructuredBuffer * GetStructuredBuffer() const
Definition:
GteGL4StructuredBuffer.h:59
geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:00