3 #ifndef SYNCHRONIZED_TEXTURE_HEAP_HOST_H
4 #define SYNCHRONIZED_TEXTURE_HEAP_HOST_H
9 #include "synchronized_texture_heap_base.h"
13 #include <boost/shared_ptr.hpp>
14 #include <boost/shared_array.hpp>
21 namespace Synchronized {
31 template<
int t_ColorFormat >
40 inline Pointer Allocate(
unsigned int const logSize )
const;
43 inline void Synchronize()
const;
46 struct Pointer :
public boost::shared_array< Color< t_ColorFormat > const > {
48 typedef typename boost::shared_ptr< Color< t_ColorFormat >
const >::element_type element_type;
52 inline Pointer( Pointer
const& other );
55 inline void Assign(
size_t const index, element_type
const& data )
const;
60 inline Pointer( Color< t_ColorFormat >* array );
63 friend struct TextureHeap;
75 template<
int t_ColorFormat >
76 TextureHeap< t_ColorFormat, PLATFORM_HOST >::Pointer::Pointer() {
80 template<
int t_ColorFormat >
81 TextureHeap< t_ColorFormat, PLATFORM_HOST >::Pointer::Pointer( Pointer
const& other ) : boost::shared_array< Color< t_ColorFormat > const >( other ) {
85 template<
int t_ColorFormat >
86 void TextureHeap< t_ColorFormat, PLATFORM_HOST >::Pointer::Assign(
size_t const index, element_type
const& data )
const {
88 *
const_cast< Color< t_ColorFormat >*
>( boost::shared_array< Color< t_ColorFormat >
const >::get() + index ) = data;
92 template<
int t_ColorFormat >
93 TextureHeap< t_ColorFormat, PLATFORM_HOST >::Pointer::Pointer( Color< t_ColorFormat >* array ) : boost::shared_array< Color< t_ColorFormat > const >( array ) {
104 template<
int t_ColorFormat >
105 TextureHeap< t_ColorFormat, PLATFORM_HOST >::TextureHeap() {
109 template<
int t_ColorFormat >
110 typename TextureHeap< t_ColorFormat, PLATFORM_HOST >::Pointer TextureHeap< t_ColorFormat, PLATFORM_HOST >::Allocate(
unsigned int const logSize )
const {
112 return Pointer(
new Color< t_ColorFormat >[ 1 << ( 3 * logSize ) ] );
116 template<
int t_ColorFormat >
117 void TextureHeap< t_ColorFormat, PLATFORM_HOST >::Synchronize()
const {
128 #endif // SYNCHRONIZED_TEXTURE_HEAP_HOST_H