renamed to DynamicBufferAccess instead of UBODynamicAccess
This commit is contained in:
parent
d163f914c7
commit
ba6af7a596
@ -2,7 +2,7 @@
|
|||||||
#define HGL_GRAPH_VULKAN_ARRAY_BUFFER_INCLUDE
|
#define HGL_GRAPH_VULKAN_ARRAY_BUFFER_INCLUDE
|
||||||
|
|
||||||
#include<hgl/graph/VK.h>
|
#include<hgl/graph/VK.h>
|
||||||
#include<hgl/graph/VKUBODynamic.h>
|
#include<hgl/graph/VKDynamicBufferAccess.h>
|
||||||
namespace hgl
|
namespace hgl
|
||||||
{
|
{
|
||||||
class Collection;
|
class Collection;
|
||||||
@ -50,26 +50,26 @@ namespace hgl
|
|||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool Start(UBODynamicAccess<T> *ubo_access,const uint32 start,const uint32 count)
|
bool Start(DynamicBufferAccess<T> *dba,const uint32 start,const uint32 count)
|
||||||
{
|
{
|
||||||
if(!ubo_access)return(false);
|
if(!dba)return(false);
|
||||||
|
|
||||||
void *ptr=Map(start,count);
|
void *ptr=Map(start,count);
|
||||||
|
|
||||||
if(!ptr)return(false);
|
if(!ptr)return(false);
|
||||||
|
|
||||||
ubo_access->Start((uchar *)ptr,align_size,count);
|
dba->Start((uchar *)ptr,align_size,count);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void End(UBODynamicAccess<T> *ubo_access)
|
void End(DynamicBufferAccess<T> *dba)
|
||||||
{
|
{
|
||||||
if(!ubo_access)return;
|
if(!dba)return;
|
||||||
|
|
||||||
Flush(ubo_access->GetCount());
|
Flush(dba->GetCount());
|
||||||
|
|
||||||
ubo_access->Restart();
|
dba->Restart();
|
||||||
}
|
}
|
||||||
};//class GPUArrayBuffer
|
};//class GPUArrayBuffer
|
||||||
}//namespace graph
|
}//namespace graph
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
#ifndef HGL_GRAPH_UBO_DYNAMIC_INCLUDE
|
#ifndef HGL_GRAPH_DYNAMIC_BUFFER_ACCESS_INCLUDE
|
||||||
#define HGL_GRAPH_UBO_DYNAMIC_INCLUDE
|
#define HGL_GRAPH_DYNAMIC_BUFFER_ACCESS_INCLUDE
|
||||||
|
|
||||||
#include<hgl/graph/VKArrayBuffer.h>
|
#include<hgl/graph/VKArrayBuffer.h>
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
|
template<typename T> class DynamicBufferAccess
|
||||||
template<typename T> class UBODynamicAccess
|
|
||||||
{
|
{
|
||||||
uchar *pointer;
|
uchar *pointer;
|
||||||
uchar *current;
|
uchar *current;
|
||||||
|
|
||||||
uint unit_size;
|
uint align_size;
|
||||||
|
|
||||||
uint count;
|
uint count;
|
||||||
uint index;
|
uint index;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
UBODynamicAccess()
|
DynamicBufferAccess()
|
||||||
{
|
{
|
||||||
Restart();
|
Restart();
|
||||||
}
|
}
|
||||||
@ -25,15 +24,15 @@ private:
|
|||||||
{
|
{
|
||||||
pointer=nullptr;
|
pointer=nullptr;
|
||||||
current=nullptr;
|
current=nullptr;
|
||||||
unit_size=0;
|
align_size=0;
|
||||||
count=0;
|
count=0;
|
||||||
index=0;
|
index=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start(uchar *buf,const uint us,const uint c)
|
void Start(uchar *buf,const uint as,const uint c)
|
||||||
{
|
{
|
||||||
current=pointer=buf;
|
current=pointer=buf;
|
||||||
unit_size=us;
|
align_size=as;
|
||||||
count=c;
|
count=c;
|
||||||
index=0;
|
index=0;
|
||||||
}
|
}
|
||||||
@ -44,7 +43,7 @@ public:
|
|||||||
|
|
||||||
const uint GetCount()const{return count;}
|
const uint GetCount()const{return count;}
|
||||||
const uint GetCurrentIndex()const{return index;}
|
const uint GetCurrentIndex()const{return index;}
|
||||||
const uint GetOffsetBytes()const{return index*unit_size;}
|
const uint GetOffsetBytes()const{return index*align_size;}
|
||||||
|
|
||||||
bool Write(uchar *src)
|
bool Write(uchar *src)
|
||||||
{
|
{
|
||||||
@ -52,7 +51,7 @@ public:
|
|||||||
if(index>=count)return(false);
|
if(index>=count)return(false);
|
||||||
|
|
||||||
memcpy(current,src,sizeof(T));
|
memcpy(current,src,sizeof(T));
|
||||||
current+=unit_size;
|
current+=align_size;
|
||||||
++index;
|
++index;
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
@ -67,7 +66,7 @@ public:
|
|||||||
for(uint i=0;i<c;i++)
|
for(uint i=0;i<c;i++)
|
||||||
{
|
{
|
||||||
memcpy(current,src,sizeof(T));
|
memcpy(current,src,sizeof(T));
|
||||||
current+=unit_size;
|
current+=align_size;
|
||||||
src+=sizeof(T);
|
src+=sizeof(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,6 +74,6 @@ public:
|
|||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
};//template<typename T> class UBODynamicAccess
|
};//template<typename T> class DynamicBufferAccess
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
#endif//HGL_GRAPH_UBO_DYNAMIC_INCLUDE
|
#endif//HGL_GRAPH_DYNAMIC_BUFFER_ACCESS_INCLUDE
|
@ -185,7 +185,7 @@ SET(VK_MATERIAL_SOURCE ${SG_INCLUDE_PATH}/VKMaterial.h
|
|||||||
${SG_INCLUDE_PATH}/VKMaterialParameters.h
|
${SG_INCLUDE_PATH}/VKMaterialParameters.h
|
||||||
${SG_INCLUDE_PATH}/VKMaterialInstance.h
|
${SG_INCLUDE_PATH}/VKMaterialInstance.h
|
||||||
${SG_INCLUDE_PATH}/VKDescriptorBindingManage.h
|
${SG_INCLUDE_PATH}/VKDescriptorBindingManage.h
|
||||||
${SG_INCLUDE_PATH}/VKUBODynamic.h
|
${SG_INCLUDE_PATH}/VKDynamicBufferAccess.h
|
||||||
Vulkan/VKDescriptorBindingManage.cpp
|
Vulkan/VKDescriptorBindingManage.cpp
|
||||||
Vulkan/VKMaterial.cpp
|
Vulkan/VKMaterial.cpp
|
||||||
Vulkan/VKMaterialParameters.cpp
|
Vulkan/VKMaterialParameters.cpp
|
||||||
|
@ -124,7 +124,7 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ubo_align=mvp_array->GetUnitSize();
|
ubo_align=mvp_array->GetAlignSize();
|
||||||
|
|
||||||
char *mp=(char *)(mvp_array->Map(0,count));
|
char *mp=(char *)(mvp_array->Map(0,count));
|
||||||
Renderable **ri=ri_list.GetData();
|
Renderable **ri=ri_list.GetData();
|
||||||
|
@ -125,7 +125,7 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// ubo_align=mvp_array->GetUnitSize();
|
// ubo_align=mvp_array->GetAlignSize();
|
||||||
|
|
||||||
// char *mp=(char *)(mvp_array->Map(0,count));
|
// char *mp=(char *)(mvp_array->Map(0,count));
|
||||||
Renderable **ri=ri_list.GetData();
|
Renderable **ri=ri_list.GetData();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user