Compare commits
2 Commits
2dd60fee7f
...
0e789b6f47
Author | SHA1 | Date | |
---|---|---|---|
0e789b6f47 | |||
29aa76a917 |
@ -46,7 +46,7 @@ private:
|
||||
|
||||
bool InitAutoMaterial()
|
||||
{
|
||||
mtl::Material2DCreateConfig cfg(device->GetDeviceAttribute(),"VertexColor2D",PrimitiveType::Lines);
|
||||
mtl::Material2DCreateConfig cfg(device->GetDevAttr(),"VertexColor2D",PrimitiveType::Lines);
|
||||
|
||||
cfg.coordinate_system=CoordinateSystem2D::NDC;
|
||||
cfg.local_to_world=false;
|
||||
|
@ -47,7 +47,7 @@ private:
|
||||
|
||||
bool InitPlaneGridMP()
|
||||
{
|
||||
mtl::Material3DCreateConfig cfg(device->GetDeviceAttribute(),"VertexLuminance3D",PrimitiveType::Lines);
|
||||
mtl::Material3DCreateConfig cfg(device->GetDevAttr(),"VertexLuminance3D",PrimitiveType::Lines);
|
||||
|
||||
cfg.local_to_world=true;
|
||||
|
||||
@ -73,7 +73,7 @@ private:
|
||||
|
||||
bool InitBillboardMP()
|
||||
{
|
||||
mtl::BillboardMaterialCreateConfig cfg(device->GetDeviceAttribute(),"Billboard2D",PrimitiveType::Billboard);
|
||||
mtl::BillboardMaterialCreateConfig cfg(device->GetDevAttr(),"Billboard2D",PrimitiveType::Billboard);
|
||||
|
||||
{
|
||||
cfg.fixed_size=true;
|
||||
|
@ -47,7 +47,7 @@ private:
|
||||
bool InitMaterial()
|
||||
{
|
||||
{
|
||||
mtl::Material2DCreateConfig cfg(GetDeviceAttribute(),"VertexColor2D",PrimitiveType::Triangles);
|
||||
mtl::Material2DCreateConfig cfg(GetDevAttr(),"VertexColor2D",PrimitiveType::Triangles);
|
||||
|
||||
cfg.coordinate_system=CoordinateSystem2D::NDC;
|
||||
cfg.local_to_world=true;
|
||||
|
@ -48,7 +48,7 @@ private:
|
||||
bool InitMaterial()
|
||||
{
|
||||
{
|
||||
mtl::Material2DCreateConfig cfg(GetDeviceAttribute(),"PureColor2D",PrimitiveType::Triangles);
|
||||
mtl::Material2DCreateConfig cfg(GetDevAttr(),"PureColor2D",PrimitiveType::Triangles);
|
||||
|
||||
cfg.coordinate_system=CoordinateSystem2D::NDC;
|
||||
cfg.local_to_world=true;
|
||||
|
@ -87,7 +87,7 @@ private:
|
||||
|
||||
bool InitAutoMaterial()
|
||||
{
|
||||
mtl::Material2DCreateConfig cfg(GetDeviceAttribute(),"VertexColor2d",PrimitiveType::Triangles);
|
||||
mtl::Material2DCreateConfig cfg(GetDevAttr(),"VertexColor2d",PrimitiveType::Triangles);
|
||||
|
||||
cfg.coordinate_system=CoordinateSystem2D::NDC;
|
||||
cfg.local_to_world=false;
|
||||
|
@ -46,7 +46,7 @@ private:
|
||||
|
||||
bool InitMaterial()
|
||||
{
|
||||
mtl::Material2DCreateConfig cfg(GetDeviceAttribute(),"VertexColor2D",PrimitiveType::Triangles);
|
||||
mtl::Material2DCreateConfig cfg(GetDevAttr(),"VertexColor2D",PrimitiveType::Triangles);
|
||||
|
||||
VILConfig vil_config;
|
||||
|
||||
|
@ -80,7 +80,7 @@ namespace
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool InitGizmoResource2D(GPUDevice *device)
|
||||
bool InitGizmoResource2D(VulkanDevice *device)
|
||||
{
|
||||
if(!gizmo_rr)
|
||||
return(false);
|
||||
@ -88,7 +88,7 @@ namespace
|
||||
RenderPass *render_pass=device->GetRenderPass();
|
||||
|
||||
{
|
||||
mtl::Material3DCreateConfig cfg(device->GetDeviceAttribute(),"VertexLuminance3D",PrimitiveType::Lines);
|
||||
mtl::Material3DCreateConfig cfg(device->GetDevAttr(),"VertexLuminance3D",PrimitiveType::Lines);
|
||||
|
||||
cfg.mtl_name="VertexLuminance3D"; //注意必须用不同名字,未来改名材质文件名+cfg hash名
|
||||
cfg.local_to_world=true;
|
||||
@ -134,7 +134,7 @@ namespace
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool InitGizmoResource3D(GPUDevice *device)
|
||||
bool InitGizmoResource3D(VulkanDevice *device)
|
||||
{
|
||||
if(!gizmo_rr)
|
||||
return(false);
|
||||
@ -142,7 +142,7 @@ namespace
|
||||
RenderPass *render_pass=device->GetRenderPass();
|
||||
|
||||
{
|
||||
mtl::Material3DCreateConfig cfg(device->GetDeviceAttribute(),"Gizmo3D",PrimitiveType::Triangles);
|
||||
mtl::Material3DCreateConfig cfg(device->GetDevAttr(),"Gizmo3D",PrimitiveType::Triangles);
|
||||
|
||||
cfg.local_to_world=true;
|
||||
cfg.material_instance=true;
|
||||
@ -272,7 +272,7 @@ bool InitGizmoResource(RenderResource *rr)
|
||||
|
||||
gizmo_rr=rr;
|
||||
|
||||
GPUDevice *device=gizmo_rr->GetDevice();
|
||||
VulkanDevice *device=gizmo_rr->GetDevice();
|
||||
|
||||
if(!InitGizmoResource3D(device))
|
||||
return(false);
|
||||
|
@ -49,7 +49,7 @@ private:
|
||||
|
||||
bool InitMDP()
|
||||
{
|
||||
mtl::Material3DCreateConfig cfg(device->GetDeviceAttribute(),"MetricCellsGrid",PrimitiveType::Fan);
|
||||
mtl::Material3DCreateConfig cfg(device->GetDevAttr(),"MetricCellsGrid",PrimitiveType::Fan);
|
||||
|
||||
cfg.local_to_world=true;
|
||||
|
||||
|
@ -26,7 +26,7 @@ private:
|
||||
|
||||
bool InitMDP()
|
||||
{
|
||||
mtl::Material3DCreateConfig cfg(device->GetDeviceAttribute(),"VertexLuminance3D",PrimitiveType::Lines);
|
||||
mtl::Material3DCreateConfig cfg(device->GetDevAttr(),"VertexLuminance3D",PrimitiveType::Lines);
|
||||
|
||||
cfg.local_to_world=true;
|
||||
cfg.position_format=VAT_VEC2;
|
||||
|
@ -51,7 +51,7 @@ private:
|
||||
|
||||
bool InitMaterialAndPipeline()
|
||||
{
|
||||
mtl::Material3DCreateConfig cfg(device->GetDeviceAttribute(),"VertexLuminance2D",PrimitiveType::Lines);
|
||||
mtl::Material3DCreateConfig cfg(device->GetDevAttr(),"VertexLuminance2D",PrimitiveType::Lines);
|
||||
|
||||
cfg.local_to_world=true;
|
||||
|
||||
|
@ -104,7 +104,7 @@ private:
|
||||
|
||||
bool InitVertexLumMP()
|
||||
{
|
||||
mtl::Material3DCreateConfig cfg(device->GetDeviceAttribute(),"VertexLuminance3D",PrimitiveType::Lines);
|
||||
mtl::Material3DCreateConfig cfg(device->GetDevAttr(),"VertexLuminance3D",PrimitiveType::Lines);
|
||||
|
||||
cfg.local_to_world=true;
|
||||
|
||||
@ -132,7 +132,7 @@ private:
|
||||
|
||||
bool InitBlinnPhongSunLightMP()
|
||||
{
|
||||
mtl::Material3DCreateConfig cfg(device->GetDeviceAttribute(),"BlinnPhong3D",PrimitiveType::Triangles);
|
||||
mtl::Material3DCreateConfig cfg(device->GetDevAttr(),"BlinnPhong3D",PrimitiveType::Triangles);
|
||||
|
||||
cfg.local_to_world=true;
|
||||
cfg.material_instance=true;
|
||||
|
@ -38,8 +38,8 @@ int main(int,char **)
|
||||
{
|
||||
Window * win =nullptr;
|
||||
VulkanInstance * inst =nullptr;
|
||||
GPUDevice * device =nullptr;
|
||||
const GPUPhysicalDevice * physical_device =nullptr;
|
||||
VulkanDevice * device =nullptr;
|
||||
const VulkanPhyDevice * physical_device =nullptr;
|
||||
|
||||
inst=InitVulkanInstance();
|
||||
|
||||
|
@ -12,7 +12,7 @@ using namespace hgl;
|
||||
using namespace hgl::graph;
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
Texture2D *CreateTexture2DFromFile(GPUDevice *device,const OSString &filename);
|
||||
Texture2D *CreateTexture2DFromFile(VulkanDevice *device,const OSString &filename);
|
||||
VK_NAMESPACE_END
|
||||
|
||||
constexpr uint32_t SCREEN_WIDTH=256;
|
||||
@ -51,7 +51,7 @@ private:
|
||||
|
||||
bool InitMaterial()
|
||||
{
|
||||
mtl::Material2DCreateConfig cfg(device->GetDeviceAttribute(),"PureTexture2D",PrimitiveType::Fan);
|
||||
mtl::Material2DCreateConfig cfg(device->GetDevAttr(),"PureTexture2D",PrimitiveType::Fan);
|
||||
|
||||
cfg.coordinate_system=CoordinateSystem2D::NDC;
|
||||
cfg.local_to_world=false;
|
||||
|
@ -12,7 +12,7 @@ using namespace hgl;
|
||||
using namespace hgl::graph;
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
Texture2D *CreateTexture2DFromFile(GPUDevice *device,const OSString &filename);
|
||||
Texture2D *CreateTexture2DFromFile(VulkanDevice *device,const OSString &filename);
|
||||
VK_NAMESPACE_END
|
||||
|
||||
constexpr uint32_t SCREEN_WIDTH=256;
|
||||
@ -47,7 +47,7 @@ private:
|
||||
|
||||
bool InitMaterial()
|
||||
{
|
||||
mtl::Material2DCreateConfig cfg(device->GetDeviceAttribute(),"RectTexture2D",PrimitiveType::SolidRectangles);
|
||||
mtl::Material2DCreateConfig cfg(device->GetDevAttr(),"RectTexture2D",PrimitiveType::SolidRectangles);
|
||||
|
||||
cfg.coordinate_system=CoordinateSystem2D::ZeroToOne;
|
||||
cfg.local_to_world=false;
|
||||
|
@ -13,7 +13,7 @@ using namespace hgl;
|
||||
using namespace hgl::graph;
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
//Texture2D *CreateTexture2DFromFile(GPUDevice *device,const OSString &filename);
|
||||
//Texture2D *CreateTexture2DFromFile(VulkanDevice *device,const OSString &filename);
|
||||
VK_NAMESPACE_END
|
||||
|
||||
constexpr uint32_t SCREEN_WIDTH=256;
|
||||
@ -91,7 +91,7 @@ private:
|
||||
|
||||
bool InitMaterial()
|
||||
{
|
||||
mtl::Material2DCreateConfig cfg(device->GetDeviceAttribute(),"RectTexture2DArray",PrimitiveType::SolidRectangles);
|
||||
mtl::Material2DCreateConfig cfg(device->GetDevAttr(),"RectTexture2DArray",PrimitiveType::SolidRectangles);
|
||||
|
||||
cfg.coordinate_system=CoordinateSystem2D::ZeroToOne;
|
||||
cfg.local_to_world=true;
|
||||
|
@ -103,7 +103,7 @@ private:
|
||||
|
||||
const VkFormat GetCandidateFormat(const VkFormat *fmt_list, const uint count)
|
||||
{
|
||||
auto pd = device->GetPhysicalDevice();
|
||||
auto pd = device->GetPhyDevice();
|
||||
|
||||
for (uint i = 0; i < count; i++)
|
||||
if (pd->IsColorAttachmentOptimal(fmt_list[i]))
|
||||
@ -118,7 +118,7 @@ private:
|
||||
|
||||
const VkFormat GetDepthCandidateFormat()
|
||||
{
|
||||
auto pd = device->GetPhysicalDevice();
|
||||
auto pd = device->GetPhyDevice();
|
||||
|
||||
for (VkFormat fmt : depth_candidate_format)
|
||||
if (pd->IsDepthAttachmentOptimal(fmt))
|
||||
|
@ -16,7 +16,7 @@ using namespace hgl;
|
||||
using namespace hgl::graph;
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
Texture2D *CreateTexture2DFromFile(GPUDevice *device,const OSString &filename);
|
||||
Texture2D *CreateTexture2DFromFile(VulkanDevice *device,const OSString &filename);
|
||||
VK_NAMESPACE_END
|
||||
|
||||
constexpr uint32_t SCREEN_WIDTH=1280;
|
||||
@ -139,7 +139,7 @@ private:
|
||||
|
||||
#ifdef _DEBUG
|
||||
{
|
||||
auto da=device->GetDeviceAttribute();
|
||||
auto da=device->GetDevAttr();
|
||||
|
||||
if(da->debug_maker)
|
||||
{
|
||||
@ -172,7 +172,7 @@ private:
|
||||
|
||||
#ifdef _DEBUG
|
||||
{
|
||||
auto da=device->GetDeviceAttribute();
|
||||
auto da=device->GetDevAttr();
|
||||
|
||||
VkQueue q=*(gbuffer.rt->GetQueue());
|
||||
VkFramebuffer fbo= gbuffer.rt->GetFramebuffer()->GetFramebuffer();
|
||||
@ -229,7 +229,7 @@ private:
|
||||
|
||||
#ifdef _DEBUG
|
||||
{
|
||||
auto da=device->GetDeviceAttribute();
|
||||
auto da=device->GetDevAttr();
|
||||
|
||||
if(da->debug_maker)
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ private:
|
||||
VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
||||
0.0f,
|
||||
VK_TRUE,
|
||||
device->GetPhysicalDevice()->GetMaxSamplerAnisotropy(),
|
||||
device->GetPhyDevice()->GetMaxSamplerAnisotropy(),
|
||||
false,
|
||||
VK_COMPARE_OP_NEVER,
|
||||
0.0f,
|
||||
|
@ -53,7 +53,7 @@ protected:
|
||||
|
||||
protected:
|
||||
|
||||
GPUDevice * device =nullptr;
|
||||
VulkanDevice * device =nullptr;
|
||||
RenderPass * device_render_pass =nullptr;
|
||||
SwapchainRenderTarget * sc_render_target =nullptr;
|
||||
|
||||
@ -216,7 +216,7 @@ public:
|
||||
cmd_buf=hgl_zero_new<RenderCmdBuffer *>(swap_chain_count);
|
||||
|
||||
for(int32_t i=0;i<swap_chain_count;i++)
|
||||
cmd_buf[i]=device->CreateRenderCommandBuffer(device->GetPhysicalDevice()->GetDeviceName()+AnsiString(":RenderCmdBuffer_")+AnsiString::numberOf(i));
|
||||
cmd_buf[i]=device->CreateRenderCommandBuffer(device->GetPhyDevice()->GetDeviceName()+AnsiString(":RenderCmdBuffer_")+AnsiString::numberOf(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,8 @@ namespace hgl
|
||||
public:
|
||||
|
||||
graph::RenderFramework * GetRenderFramework (){return render_framework;}
|
||||
graph::GPUDevice * GetDevice (){return render_framework->GetDevice();}
|
||||
graph::GPUDeviceAttribute * GetDeviceAttribute (){return render_framework->GetDeviceAttribute();}
|
||||
graph::VulkanDevice * GetDevice (){return render_framework->GetDevice();}
|
||||
graph::VulkanDevAttr * GetDevAttr (){return render_framework->GetDevAttr();}
|
||||
|
||||
const VkExtent2D & GetExtent2D (){return cur_render_target->GetExtent();}
|
||||
|
||||
@ -82,7 +82,7 @@ namespace hgl
|
||||
graph::MaterialInstance *CreateMaterialInstance(const AnsiString &mtl_name,graph::mtl::MaterialCreateConfig *mtl_cfg,const graph::VILConfig *vil_cfg=nullptr)
|
||||
{
|
||||
AutoDelete<graph::mtl::MaterialCreateInfo> mci=graph::mtl::CreateMaterialCreateInfo(
|
||||
GetDeviceAttribute(),
|
||||
GetDevAttr(),
|
||||
"VertexColor2D",mtl_cfg); //这个是使用名称创建
|
||||
|
||||
return db->CreateMaterialInstance(mci,vil_cfg);
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
*/
|
||||
class MaterialRenderList
|
||||
{
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
RenderCmdBuffer *cmd_buf;
|
||||
|
||||
RenderPipelineIndex rp_index;
|
||||
@ -106,7 +106,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
MaterialRenderList(GPUDevice *d,bool l2w,const RenderPipelineIndex &rpi);
|
||||
MaterialRenderList(VulkanDevice *d,bool l2w,const RenderPipelineIndex &rpi);
|
||||
~MaterialRenderList();
|
||||
|
||||
void Add(SceneNode *);
|
||||
|
@ -13,7 +13,7 @@ class PrimitiveCreater
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUDevice * device;
|
||||
VulkanDevice * device;
|
||||
VertexDataManager * vdm;
|
||||
|
||||
const VIL * vil;
|
||||
@ -36,7 +36,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
PrimitiveCreater(GPUDevice *,const VIL *);
|
||||
PrimitiveCreater(VulkanDevice *,const VIL *);
|
||||
PrimitiveCreater(VertexDataManager *);
|
||||
virtual ~PrimitiveCreater();
|
||||
|
||||
|
@ -27,7 +27,7 @@ class RenderFramework:public io::WindowEvent
|
||||
Window * win =nullptr;
|
||||
VulkanInstance * inst =nullptr;
|
||||
|
||||
GPUDevice * device =nullptr;
|
||||
VulkanDevice * device =nullptr;
|
||||
|
||||
RenderResource * render_resource =nullptr;
|
||||
|
||||
@ -50,10 +50,10 @@ protected:
|
||||
public:
|
||||
|
||||
Window * GetWindow ()const{return win;}
|
||||
GPUDevice * GetDevice ()const{return device;}
|
||||
VulkanDevice * GetDevice ()const{return device;}
|
||||
VkDevice GetVkDevice ()const{return device->GetDevice();}
|
||||
const GPUPhysicalDevice * GetPhysicalDevice ()const{return device->GetPhysicalDevice();}
|
||||
GPUDeviceAttribute * GetDeviceAttribute ()const{return device->GetDeviceAttribute();}
|
||||
const VulkanPhyDevice * GetPhyDevice ()const{return device->GetPhyDevice();}
|
||||
VulkanDevAttr * GetDevAttr ()const{return device->GetDevAttr();}
|
||||
|
||||
RenderResource * GetRenderResource ()const{return render_resource;}
|
||||
|
||||
|
@ -18,7 +18,7 @@ namespace hgl
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUDevice * device;
|
||||
VulkanDevice * device;
|
||||
|
||||
CameraInfo * camera_info; ///<相机信息
|
||||
|
||||
@ -31,7 +31,7 @@ namespace hgl
|
||||
|
||||
public:
|
||||
|
||||
RenderList(GPUDevice *);
|
||||
RenderList(VulkanDevice *);
|
||||
virtual ~RenderList()=default;
|
||||
|
||||
virtual void SetCamera(CameraInfo *ci){camera_info=ci;} ///<设置相机信息
|
||||
|
@ -41,9 +41,9 @@ class GraphModule;
|
||||
class RenderFramework;
|
||||
|
||||
class VulkanInstance;
|
||||
class GPUPhysicalDevice;
|
||||
class GPUDevice;
|
||||
struct GPUDeviceAttribute;
|
||||
class VulkanPhyDevice;
|
||||
class VulkanDevice;
|
||||
struct VulkanDevAttr;
|
||||
class DeviceQueue;
|
||||
class ImageView;
|
||||
class Framebuffer;
|
||||
@ -84,7 +84,7 @@ class IndexBuffer;
|
||||
class VABMap;
|
||||
class IBMap;
|
||||
|
||||
class GPUCmdBuffer;
|
||||
class VulkanCmdBuffer;
|
||||
class RenderCmdBuffer;
|
||||
class TextureCmdBuffer;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#ifndef HGL_GRAPH_VULKAN_ARRAY_BUFFER_INCLUDE
|
||||
#define HGL_GRAPH_VULKAN_ARRAY_BUFFER_INCLUDE
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
#include<hgl/graph/VKDynamicBufferAccess.h>
|
||||
@ -15,7 +14,7 @@ namespace hgl
|
||||
* GPU数据阵列缓冲区<br>
|
||||
* 它用于储存多份相同格式的数据,常用于多物件渲染,instance等
|
||||
*/
|
||||
class GPUArrayBuffer
|
||||
class VulkanArrayBuffer
|
||||
{
|
||||
protected:
|
||||
|
||||
@ -33,13 +32,13 @@ namespace hgl
|
||||
|
||||
private:
|
||||
|
||||
GPUArrayBuffer(VKMemoryAllocator *,const uint,const uint);
|
||||
VulkanArrayBuffer(VKMemoryAllocator *,const uint,const uint);
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
public:
|
||||
|
||||
virtual ~GPUArrayBuffer();
|
||||
virtual ~VulkanArrayBuffer();
|
||||
|
||||
const uint32_t GetAlignSize()const{return align_size;} ///<数据对齐字节数
|
||||
const uint32_t GetRangeSize()const{return range_size;} ///<单次渲染访问最大字节数
|
||||
@ -71,7 +70,6 @@ namespace hgl
|
||||
|
||||
dba->Restart();
|
||||
}
|
||||
};//class GPUArrayBuffer
|
||||
};//class VulkanArrayBuffer
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_VULKAN_ARRAY_BUFFER_INCLUDE
|
||||
|
@ -20,7 +20,7 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
friend class VertexAttribBuffer;
|
||||
friend class IndexBuffer;
|
||||
template<typename T> friend class IndirectCommandBuffer;
|
||||
|
@ -1,5 +1,4 @@
|
||||
#ifndef HGL_GRAPH_VULKAN_COMMAND_BUFFER_INCLUDE
|
||||
#define HGL_GRAPH_VULKAN_COMMAND_BUFFER_INCLUDE
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
#include<hgl/graph/VKVABList.h>
|
||||
@ -8,11 +7,11 @@
|
||||
#include<hgl/graph/VKRenderable.h>
|
||||
#include<hgl/color/Color4f.h>
|
||||
VK_NAMESPACE_BEGIN
|
||||
class GPUCmdBuffer
|
||||
class VulkanCmdBuffer
|
||||
{
|
||||
protected:
|
||||
|
||||
const GPUDeviceAttribute *dev_attr;
|
||||
const VulkanDevAttr *dev_attr;
|
||||
|
||||
VkCommandBuffer cmd_buf;
|
||||
|
||||
@ -20,8 +19,8 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
GPUCmdBuffer(const GPUDeviceAttribute *attr,VkCommandBuffer cb);
|
||||
virtual ~GPUCmdBuffer();
|
||||
VulkanCmdBuffer(const VulkanDevAttr *attr,VkCommandBuffer cb);
|
||||
virtual ~VulkanCmdBuffer();
|
||||
|
||||
operator VkCommandBuffer(){return cmd_buf;}
|
||||
operator const VkCommandBuffer()const{return cmd_buf;}
|
||||
@ -48,11 +47,11 @@ public:
|
||||
void BeginRegion(const AnsiString &,const Color4f &){}
|
||||
void EndRegion(){}
|
||||
#endif//_DEBUG
|
||||
};//class GPUCmdBuffer
|
||||
};//class VulkanCmdBuffer
|
||||
|
||||
class DescriptorBinding;
|
||||
|
||||
class RenderCmdBuffer:public GPUCmdBuffer
|
||||
class RenderCmdBuffer:public VulkanCmdBuffer
|
||||
{
|
||||
uint32_t cv_count;
|
||||
VkClearValue *clear_values;
|
||||
@ -70,7 +69,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
RenderCmdBuffer(const GPUDeviceAttribute *attr,VkCommandBuffer cb);
|
||||
RenderCmdBuffer(const VulkanDevAttr *attr,VkCommandBuffer cb);
|
||||
~RenderCmdBuffer();
|
||||
|
||||
void SetDescriptorBinding(DescriptorBinding *db) { desc_binding=db; }
|
||||
@ -79,7 +78,7 @@ public:
|
||||
{
|
||||
desc_binding=nullptr;
|
||||
|
||||
return GPUCmdBuffer::End();
|
||||
return VulkanCmdBuffer::End();
|
||||
}
|
||||
|
||||
void SetRenderArea(const VkRect2D &ra){render_area=ra;}
|
||||
@ -256,15 +255,15 @@ public:
|
||||
|
||||
Draw(ri->GetDataBuffer(),ri->GetRenderData());
|
||||
}
|
||||
};//class RenderCmdBuffer:public GPUCmdBuffer
|
||||
};//class RenderCmdBuffer:public VulkanCmdBuffer
|
||||
|
||||
class TextureCmdBuffer:public GPUCmdBuffer
|
||||
class TextureCmdBuffer:public VulkanCmdBuffer
|
||||
{
|
||||
VkImageMemoryBarrier imageMemoryBarrier;
|
||||
|
||||
public:
|
||||
|
||||
TextureCmdBuffer(const GPUDeviceAttribute *attr,VkCommandBuffer cb):GPUCmdBuffer(attr,cb)
|
||||
TextureCmdBuffer(const VulkanDevAttr *attr,VkCommandBuffer cb):VulkanCmdBuffer(attr,cb)
|
||||
{
|
||||
imageMemoryBarrier.sType=VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||
imageMemoryBarrier.pNext=nullptr;
|
||||
@ -301,6 +300,5 @@ public:
|
||||
0, nullptr,
|
||||
1, &imageMemoryBarrier);
|
||||
}
|
||||
};//class TextureCmdBuffer:public GPUCmdBuffer
|
||||
};//class TextureCmdBuffer:public VulkanCmdBuffer
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_COMMAND_BUFFER_INCLUDE
|
||||
|
@ -1,5 +1,4 @@
|
||||
#ifndef HGL_GRAPH_VULKAN_DEVICE_INCLUDE
|
||||
#define HGL_GRAPH_VULKAN_DEVICE_INCLUDE
|
||||
#pragma once
|
||||
|
||||
#include<hgl/type/ArrayList.h>
|
||||
#include<hgl/type/String.h>
|
||||
@ -21,16 +20,16 @@ VK_NAMESPACE_BEGIN
|
||||
class TileData;
|
||||
class TileFont;
|
||||
class FontSource;
|
||||
class GPUArrayBuffer;
|
||||
class VulkanArrayBuffer;
|
||||
class IndirectDrawBuffer;
|
||||
class IndirectDrawIndexedBuffer;
|
||||
class IndirectDispatchBuffer;
|
||||
|
||||
struct CopyBufferToImageInfo;
|
||||
|
||||
class GPUDevice
|
||||
class VulkanDevice
|
||||
{
|
||||
GPUDeviceAttribute *attr;
|
||||
VulkanDevAttr *attr;
|
||||
|
||||
private:
|
||||
|
||||
@ -40,18 +39,18 @@ private:
|
||||
|
||||
friend class VulkanDeviceCreater;
|
||||
|
||||
GPUDevice(GPUDeviceAttribute *da);
|
||||
VulkanDevice(VulkanDevAttr *da);
|
||||
|
||||
public:
|
||||
|
||||
virtual ~GPUDevice();
|
||||
virtual ~VulkanDevice();
|
||||
|
||||
operator VkDevice () {return attr->device;}
|
||||
GPUDeviceAttribute *GetDeviceAttribute () {return attr;}
|
||||
VulkanDevAttr * GetDevAttr () {return attr;}
|
||||
|
||||
VkSurfaceKHR GetSurface () {return attr->surface;}
|
||||
VkDevice GetDevice ()const {return attr->device;}
|
||||
const GPUPhysicalDevice * GetPhysicalDevice ()const {return attr->physical_device;}
|
||||
const VulkanPhyDevice * GetPhyDevice ()const {return attr->physical_device;}
|
||||
|
||||
VkDescriptorPool GetDescriptorPool () {return attr->desc_pool;}
|
||||
VkPipelineCache GetPipelineCache () {return attr->pipeline_cache;}
|
||||
@ -132,8 +131,8 @@ public: //Buffer相关
|
||||
|
||||
#undef CREATE_BUFFER_OBJECT
|
||||
|
||||
GPUArrayBuffer *CreateArrayInUBO(const VkDeviceSize &uint_size);
|
||||
GPUArrayBuffer *CreateArrayInSSBO(const VkDeviceSize &uint_size);
|
||||
VulkanArrayBuffer *CreateArrayInUBO(const VkDeviceSize &uint_size);
|
||||
VulkanArrayBuffer *CreateArrayInSSBO(const VkDeviceSize &uint_size);
|
||||
|
||||
public: //间接绘制
|
||||
|
||||
@ -173,6 +172,5 @@ public:
|
||||
TileData *CreateTileData(const VkFormat video_format,const uint width,const uint height,const uint count); ///<创建一个Tile数据集
|
||||
|
||||
TileFont *CreateTileFont(FontSource *fs,int limit_count=-1); ///<创建一个Tile字体
|
||||
};//class GPUDevice
|
||||
};//class VulkanDevice
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_DEVICE_INCLUDE
|
||||
|
@ -11,10 +11,10 @@ VK_NAMESPACE_BEGIN
|
||||
|
||||
constexpr uint32_t ERROR_FAMILY_INDEX=UINT32_MAX;
|
||||
|
||||
struct GPUDeviceAttribute
|
||||
struct VulkanDevAttr
|
||||
{
|
||||
VulkanInstance * instance =nullptr;
|
||||
const GPUPhysicalDevice * physical_device =nullptr;
|
||||
const VulkanPhyDevice * physical_device =nullptr;
|
||||
|
||||
VkPhysicalDeviceDriverPropertiesKHR driver_properties;
|
||||
|
||||
@ -55,8 +55,8 @@ struct GPUDeviceAttribute
|
||||
|
||||
public:
|
||||
|
||||
GPUDeviceAttribute(VulkanInstance *inst,const GPUPhysicalDevice *pd,VkSurfaceKHR s);
|
||||
~GPUDeviceAttribute();
|
||||
VulkanDevAttr(VulkanInstance *inst,const VulkanPhyDevice *pd,VkSurfaceKHR s);
|
||||
~VulkanDevAttr();
|
||||
|
||||
int GetMemoryType(uint32_t typeBits,VkMemoryPropertyFlags properties) const;
|
||||
|
||||
@ -75,5 +75,5 @@ public:
|
||||
{
|
||||
return instance->GetDeviceProc<T>(device,name);
|
||||
}
|
||||
};//class GPUDeviceAttribute
|
||||
};//class VulkanDevAttr
|
||||
VK_NAMESPACE_END
|
||||
|
@ -238,7 +238,7 @@ protected:
|
||||
|
||||
VulkanInstance *instance;
|
||||
Window *window;
|
||||
const GPUPhysicalDevice *physical_device;
|
||||
const VulkanPhyDevice *physical_device;
|
||||
|
||||
VulkanHardwareRequirement require;
|
||||
|
||||
@ -274,14 +274,14 @@ public:
|
||||
|
||||
virtual void ChooseSurfaceFormat();
|
||||
|
||||
virtual GPUDevice *CreateRenderDevice();
|
||||
virtual VulkanDevice *CreateRenderDevice();
|
||||
|
||||
public:
|
||||
|
||||
virtual GPUDevice *Create();
|
||||
virtual VulkanDevice *Create();
|
||||
};//class VulkanDeviceCreater
|
||||
|
||||
inline GPUDevice *CreateRenderDevice( VulkanInstance *vi,
|
||||
inline VulkanDevice *CreateRenderDevice( VulkanInstance *vi,
|
||||
Window *win,
|
||||
const VulkanHardwareRequirement *req=nullptr,
|
||||
const PreferFormats * spf_color =&PreferSDR,
|
||||
@ -293,35 +293,35 @@ inline GPUDevice *CreateRenderDevice( VulkanInstance *vi,
|
||||
return vdc.Create();
|
||||
}
|
||||
|
||||
inline GPUDevice *CreateRenderDeviceLDR(VulkanInstance *vi,
|
||||
inline VulkanDevice *CreateRenderDeviceLDR(VulkanInstance *vi,
|
||||
Window *win,
|
||||
const VulkanHardwareRequirement *req=nullptr)
|
||||
{
|
||||
return CreateRenderDevice(vi,win,req,&PreferLDR,&PreferNonlinear,&PreferDepth);
|
||||
}
|
||||
|
||||
inline GPUDevice *CreateRenderDeviceSDR(VulkanInstance *vi,
|
||||
inline VulkanDevice *CreateRenderDeviceSDR(VulkanInstance *vi,
|
||||
Window *win,
|
||||
const VulkanHardwareRequirement *req=nullptr)
|
||||
{
|
||||
return CreateRenderDevice(vi,win,req,&PreferSDR,&PreferNonlinear,&PreferDepth);
|
||||
}
|
||||
|
||||
inline GPUDevice *CreateRenderDeviceHDR16( VulkanInstance *vi,
|
||||
inline VulkanDevice *CreateRenderDeviceHDR16( VulkanInstance *vi,
|
||||
Window *win,
|
||||
const VulkanHardwareRequirement *req=nullptr)
|
||||
{
|
||||
return CreateRenderDevice(vi,win,req,&PreferHDR16,&PreferLinear,&PreferDepth);
|
||||
}
|
||||
|
||||
inline GPUDevice *CreateRenderDeviceHDR32( VulkanInstance *vi,
|
||||
inline VulkanDevice *CreateRenderDeviceHDR32( VulkanInstance *vi,
|
||||
Window *win,
|
||||
const VulkanHardwareRequirement *req=nullptr)
|
||||
{
|
||||
return CreateRenderDevice(vi,win,req,&PreferHDR32,&PreferLinear,&PreferDepth);
|
||||
}
|
||||
|
||||
inline GPUDevice *CreateRenderDeviceHDR(VulkanInstance *vi,
|
||||
inline VulkanDevice *CreateRenderDeviceHDR(VulkanInstance *vi,
|
||||
Window *win,
|
||||
const VulkanHardwareRequirement *req=nullptr)
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ private:
|
||||
index=0;
|
||||
}
|
||||
|
||||
friend class GPUArrayBuffer;
|
||||
friend class VulkanArrayBuffer;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -10,7 +10,7 @@ class Fence
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
Fence(VkDevice d,VkFence f)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ class IndexBuffer:public DeviceBuffer
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
IndexBuffer(VkDevice d,const DeviceBufferData &vb,IndexType it,uint32_t _count):DeviceBuffer(d,vb)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
IndirectCommandBuffer(VkDevice d,const DeviceBufferData &vb,const uint32_t mc):DeviceBuffer(d,vb)
|
||||
{
|
||||
@ -46,7 +46,7 @@ public:
|
||||
|
||||
class IndirectDrawBuffer:public IndirectCommandBuffer<VkDrawIndirectCommand>
|
||||
{
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
public:
|
||||
|
||||
@ -64,7 +64,7 @@ public:
|
||||
|
||||
class IndirectDrawIndexedBuffer:public IndirectCommandBuffer<VkDrawIndexedIndirectCommand>
|
||||
{
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
public:
|
||||
|
||||
@ -82,7 +82,7 @@ public:
|
||||
|
||||
class IndirectDispatchBuffer:public IndirectCommandBuffer<VkDispatchIndirectCommand>
|
||||
{
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -62,7 +62,7 @@ VK_NAMESPACE_BEGIN
|
||||
|
||||
VKDebugOut *debug_out;
|
||||
|
||||
ObjectList<GPUPhysicalDevice> physical_devices;
|
||||
ObjectList<VulkanPhyDevice> physical_devices;
|
||||
|
||||
private:
|
||||
|
||||
@ -80,8 +80,8 @@ VK_NAMESPACE_BEGIN
|
||||
|
||||
operator VkInstance (){return inst;}
|
||||
|
||||
const ObjectList<GPUPhysicalDevice> &GetDeviceList ()const {return physical_devices;}
|
||||
const GPUPhysicalDevice * GetDevice (VkPhysicalDeviceType)const;
|
||||
const ObjectList<VulkanPhyDevice> &GetDeviceList ()const {return physical_devices;}
|
||||
const VulkanPhyDevice * GetDevice (VkPhysicalDeviceType)const;
|
||||
|
||||
template<typename T>
|
||||
T *GetInstanceProc(const char *name)
|
||||
|
@ -16,7 +16,7 @@ class DeviceMemory
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
DeviceMemory(VkDevice dev,VkDeviceMemory dm,const VkMemoryRequirements &mr,const uint32 i,const uint32_t p,const VkDeviceSize cas);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
VK_NAMESPACE_BEGIN
|
||||
class VKMemoryAllocator:public AbstractMemoryAllocator
|
||||
{
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
|
||||
uint32_t buffer_usage_flag_bits;
|
||||
|
||||
@ -29,7 +29,7 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
VKMemoryAllocator(GPUDevice *,const uint32_t flags,const VkDeviceSize r);
|
||||
VKMemoryAllocator(VulkanDevice *,const uint32_t flags,const VkDeviceSize r);
|
||||
~VKMemoryAllocator();
|
||||
|
||||
void Free() override {/* DON'T RUN ANY OPERATION.*/}
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include<hgl/type/SortedSet.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
class GPUPhysicalDevice
|
||||
class VulkanPhyDevice
|
||||
{
|
||||
VkInstance instance=nullptr;
|
||||
VkPhysicalDevice physical_device=nullptr;
|
||||
@ -46,8 +46,8 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
GPUPhysicalDevice(VkInstance,VkPhysicalDevice);
|
||||
~GPUPhysicalDevice()=default;
|
||||
VulkanPhyDevice(VkInstance,VkPhysicalDevice);
|
||||
~VulkanPhyDevice()=default;
|
||||
|
||||
operator VkPhysicalDevice() {return physical_device;}
|
||||
operator const VkPhysicalDevice()const {return physical_device;}
|
||||
@ -207,5 +207,5 @@ public:
|
||||
}
|
||||
|
||||
const bool SupportDynamicState() const {return dynamic_state;}
|
||||
};//class GPUPhysicalDevice
|
||||
};//class VulkanPhyDevice
|
||||
VK_NAMESPACE_END
|
||||
|
@ -19,7 +19,7 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
DeviceQueue(VkDevice dev,VkQueue q,Fence **,const uint32_t fc);
|
||||
|
||||
@ -42,7 +42,7 @@ public:
|
||||
bool WaitFence(const bool wait_all=true,const uint64_t time_out=HGL_NANO_SEC_PER_SEC);
|
||||
|
||||
bool Submit(const VkCommandBuffer *cmd_buf,const uint32_t count,Semaphore *wait_sem,Semaphore *complete_sem);
|
||||
bool Submit(GPUCmdBuffer *cmd_buf,Semaphore *wait_sem,Semaphore *complete_sem);
|
||||
bool Submit(VulkanCmdBuffer *cmd_buf,Semaphore *wait_sem,Semaphore *complete_sem);
|
||||
};//class DeviceQueue
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_SUBMIT_QUEUE_INCLUDE
|
||||
|
@ -11,13 +11,13 @@ class RenderContext
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
|
||||
VkExtent2D extent;
|
||||
|
||||
public:
|
||||
|
||||
RenderContext(GPUDevice *,const VkExtent2D &);
|
||||
RenderContext(VulkanDevice *,const VkExtent2D &);
|
||||
virtual ~RenderContext();
|
||||
|
||||
void Prepare(
|
||||
|
@ -43,7 +43,7 @@ constexpr const size_t VK_SHADER_STAGE_TYPE_COUNT=20;//GetBitOffset((uint32_t)VK
|
||||
*/
|
||||
class RenderResource
|
||||
{
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
|
||||
ShaderModuleMapByName shader_module_by_name[VK_SHADER_STAGE_TYPE_COUNT];
|
||||
Map<AnsiString,Material *> material_by_name;
|
||||
@ -75,7 +75,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
GPUDevice *GetDevice(){return device;}
|
||||
VulkanDevice *GetDevice(){return device;}
|
||||
|
||||
//注:并非一定要走这里,这里只是提供一个注册和自动绑定的机制
|
||||
DescriptorBinding static_descriptor; ///<静态属性描述符绑定管理
|
||||
@ -83,7 +83,7 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
RenderResource(GPUDevice *dev):device(dev),
|
||||
RenderResource(VulkanDevice *dev):device(dev),
|
||||
static_descriptor(DescriptorSetType::Static),
|
||||
global_descriptor(DescriptorSetType::Global)
|
||||
{}
|
||||
|
@ -29,7 +29,7 @@ class IRenderTarget
|
||||
public:
|
||||
|
||||
RenderFramework * GetRenderFramework ()const{return render_framework;}
|
||||
GPUDevice * GetDevice ()const;
|
||||
VulkanDevice * GetDevice ()const;
|
||||
VkDevice GetVkDevice ()const;
|
||||
DescriptorBinding * GetDescriptorBinding(){return &desc_binding;}
|
||||
|
||||
|
@ -12,7 +12,7 @@ class Sampler
|
||||
|
||||
protected:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
Sampler(VkDevice dev,VkSampler s)
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ class Semaphore
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
Semaphore(VkDevice d,VkSemaphore s)
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ class VkTextureLoader:public L
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
GPUBuffer *buf;
|
||||
|
||||
T *tex;
|
||||
@ -18,7 +18,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
VkTextureLoader(GPUDevice *dev,const bool am)
|
||||
VkTextureLoader(VulkanDevice *dev,const bool am)
|
||||
{
|
||||
device =dev;
|
||||
buf =nullptr;
|
||||
|
@ -12,7 +12,7 @@ class VertexAttribBuffer:public DeviceBuffer
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
VertexAttribBuffer(VkDevice d,const DeviceBufferData &vb,VkFormat fmt,uint32_t _stride,uint32_t _count):DeviceBuffer(d,vb)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ VK_NAMESPACE_BEGIN
|
||||
|
||||
class VertexDataManager
|
||||
{
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
|
||||
protected:
|
||||
|
||||
@ -30,10 +30,10 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
VertexDataManager(GPUDevice *dev,const VIL *_vil);
|
||||
VertexDataManager(VulkanDevice *dev,const VIL *_vil);
|
||||
~VertexDataManager();
|
||||
|
||||
GPUDevice * GetDevice ()const{return device;} ///<取得GPU设备
|
||||
VulkanDevice * GetDevice ()const{return device;} ///<取得GPU设备
|
||||
|
||||
const VIL * GetVIL ()const{return vil;} ///<取得顶点输入格式列表
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace hgl
|
||||
*/
|
||||
class TextPrimitive:public Primitive
|
||||
{
|
||||
GPUDevice * device;
|
||||
VulkanDevice * device;
|
||||
Material * mtl;
|
||||
|
||||
uint max_count; ///<缓冲区最大容量
|
||||
@ -36,7 +36,7 @@ namespace hgl
|
||||
|
||||
public:
|
||||
|
||||
TextPrimitive(GPUDevice *,Material *,uint mc=1024);
|
||||
TextPrimitive(VulkanDevice *,Material *,uint mc=1024);
|
||||
|
||||
public:
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace hgl
|
||||
|
||||
class TextRender
|
||||
{
|
||||
GPUDevice * device;
|
||||
VulkanDevice * device;
|
||||
RenderResource * db;
|
||||
|
||||
Material * material;
|
||||
@ -37,8 +37,8 @@ namespace hgl
|
||||
|
||||
private:
|
||||
|
||||
friend TextRender *CreateTextRender(GPUDevice *,FontSource *,RenderPass *,DeviceBuffer *,int limit=-1);
|
||||
TextRender(GPUDevice *dev,FontSource *);
|
||||
friend TextRender *CreateTextRender(VulkanDevice *,FontSource *,RenderPass *,DeviceBuffer *,int limit=-1);
|
||||
TextRender(VulkanDevice *dev,FontSource *);
|
||||
|
||||
bool InitTileFont(int limit);
|
||||
bool InitTextLayoutEngine();
|
||||
@ -82,7 +82,7 @@ namespace hgl
|
||||
* 创建一个文本渲染器
|
||||
* @param limit 节数限制(-1表示自动)
|
||||
*/
|
||||
TextRender *CreateTextRender(GPUDevice *,FontSource *,RenderPass *,DeviceBuffer *,int limit);
|
||||
TextRender *CreateTextRender(VulkanDevice *,FontSource *,RenderPass *,DeviceBuffer *,int limit);
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_TEXT_RENDER_INCLUDE
|
||||
|
@ -16,10 +16,10 @@ class GraphModule
|
||||
public:
|
||||
|
||||
RenderFramework * GetRenderFramework ()const{return render_framework;} ///<取得渲染框架
|
||||
GPUDevice * GetDevice (); ///<取得GPU设备
|
||||
VulkanDevice * GetDevice (); ///<取得GPU设备
|
||||
VkDevice GetVkDevice ()const; ///<取得VkDevice
|
||||
const GPUPhysicalDevice * GetPhysicalDevice ()const; ///<取得物理设备
|
||||
GPUDeviceAttribute *GetDeviceAttribute ()const; ///<取得设备属性
|
||||
const VulkanPhyDevice * GetPhyDevice ()const; ///<取得物理设备
|
||||
VulkanDevAttr *GetDevAttr ()const; ///<取得设备属性
|
||||
VkPipelineCache GetPipelineCache ()const; ///<取得PipelineCache
|
||||
|
||||
public:
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
public:
|
||||
|
||||
RenderFramework * GetRenderFramework ()const{return render_framework;} ///<取得渲染框架
|
||||
GPUDevice * GetDevice ()const; ///<取得GPU设备
|
||||
VulkanDevice * GetDevice ()const; ///<取得GPU设备
|
||||
|
||||
public:
|
||||
|
||||
|
@ -22,6 +22,6 @@ public:
|
||||
|
||||
#define RENDER_MODULE_CLASS(class_name) class class_name:public GraphModuleInherit<class_name,RenderModule>
|
||||
|
||||
#define RENDER_MODULE_CONSTRUCT(class_name) class_name::class_name(GPUDevice *dev):GraphModuleInherit<class_name,RenderModule>(dev,#class_name)
|
||||
#define RENDER_MODULE_CONSTRUCT(class_name) class_name::class_name(VulkanDevice *dev):GraphModuleInherit<class_name,RenderModule>(dev,#class_name)
|
||||
|
||||
VK_NAMESPACE_END
|
||||
|
@ -52,13 +52,13 @@ public:
|
||||
|
||||
DEFINE_MATERIAL_FACTORY_CLASS(VertexColor2D,CreateVertexColor2D,const Material2DCreateConfig)
|
||||
|
||||
MaterialCreateInfo *CreatePureColor2D(const GPUDeviceAttribute *dev_attr,const Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreatePureColor2D(const VulkanDevAttr *dev_attr,const Material2DCreateConfig *);
|
||||
|
||||
MaterialCreateInfo *CreateLerpLine2D(const GPUDeviceAttribute *dev_attr,const Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreateLerpLine2D(const VulkanDevAttr *dev_attr,const Material2DCreateConfig *);
|
||||
|
||||
MaterialCreateInfo *CreatePureTexture2D(const GPUDeviceAttribute *dev_attr,const Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreateRectTexture2D(const GPUDeviceAttribute *dev_attr,Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreateRectTexture2DArray(const GPUDeviceAttribute *dev_attr,Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreatePureTexture2D(const VulkanDevAttr *dev_attr,const Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreateRectTexture2D(const VulkanDevAttr *dev_attr,Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreateRectTexture2DArray(const VulkanDevAttr *dev_attr,Material2DCreateConfig *);
|
||||
|
||||
// 为什么有了LoadMaterialFromFile,还需要保留以上Create系列函数?
|
||||
|
||||
@ -72,6 +72,6 @@ MaterialCreateInfo *CreateRectTexture2DArray(const GPUDeviceAttribute *dev_attr,
|
||||
* @param cfg 材质创建参数
|
||||
* @return 材质创建信息
|
||||
*/
|
||||
MaterialCreateInfo *LoadMaterialFromFile(const GPUDeviceAttribute *dev_attr,const AnsiString &mtl_name,Material2DCreateConfig *cfg); ///<从文件加载材质
|
||||
MaterialCreateInfo *LoadMaterialFromFile(const VulkanDevAttr *dev_attr,const AnsiString &mtl_name,Material2DCreateConfig *cfg); ///<从文件加载材质
|
||||
|
||||
STD_MTL_NAMESPACE_END
|
||||
|
@ -50,10 +50,10 @@ public:
|
||||
}
|
||||
};//struct Material3DCreateConfig:public MaterialCreateConfig
|
||||
|
||||
MaterialCreateInfo *CreateVertexColor3D(const GPUDeviceAttribute *dev_attr,const Material3DCreateConfig *);
|
||||
MaterialCreateInfo *CreateVertexLuminance3D(const GPUDeviceAttribute *dev_attr,const Material3DCreateConfig *);
|
||||
MaterialCreateInfo *CreateVertexColor3D(const VulkanDevAttr *dev_attr,const Material3DCreateConfig *);
|
||||
MaterialCreateInfo *CreateVertexLuminance3D(const VulkanDevAttr *dev_attr,const Material3DCreateConfig *);
|
||||
|
||||
MaterialCreateInfo *CreateMaterialGizmo3D(const GPUDeviceAttribute *dev_attr,const Material3DCreateConfig *cfg);
|
||||
MaterialCreateInfo *CreateMaterialGizmo3D(const VulkanDevAttr *dev_attr,const Material3DCreateConfig *cfg);
|
||||
|
||||
struct BillboardMaterialCreateConfig:public Material3DCreateConfig
|
||||
{
|
||||
@ -66,7 +66,7 @@ public:
|
||||
using Material3DCreateConfig::Material3DCreateConfig;
|
||||
};
|
||||
|
||||
MaterialCreateInfo *CreateBillboard2D(const GPUDeviceAttribute *dev_attr,mtl::BillboardMaterialCreateConfig *);
|
||||
MaterialCreateInfo *CreateBillboard2D(const VulkanDevAttr *dev_attr,mtl::BillboardMaterialCreateConfig *);
|
||||
|
||||
/**
|
||||
* 从文件加载材质
|
||||
@ -74,5 +74,5 @@ MaterialCreateInfo *CreateBillboard2D(const GPUDeviceAttribute *dev_attr,mtl::Bi
|
||||
* @param cfg 材质创建参数
|
||||
* @return 材质创建信息
|
||||
*/
|
||||
MaterialCreateInfo *LoadMaterialFromFile(const GPUDeviceAttribute *dev_attr,const AnsiString &name,Material3DCreateConfig *cfg);
|
||||
MaterialCreateInfo *LoadMaterialFromFile(const VulkanDevAttr *dev_attr,const AnsiString &name,Material3DCreateConfig *cfg);
|
||||
STD_MTL_NAMESPACE_END
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
|
||||
//virtual const CoordinateSystem2D get2DCoordinateSystem()const=0;
|
||||
|
||||
virtual MaterialCreateInfo *Create(const GPUDeviceAttribute *dev_attr,MaterialCreateConfig *)=0;
|
||||
virtual MaterialCreateInfo *Create(const VulkanDevAttr *dev_attr,MaterialCreateConfig *)=0;
|
||||
|
||||
};//class MaterialFactory
|
||||
|
||||
@ -45,7 +45,7 @@ public:
|
||||
};//class RegistryMaterialFactoryClass
|
||||
|
||||
#define DEFINE_MATERIAL_FACTORY_CLASS(name,create_func,cfg_type) \
|
||||
MaterialCreateInfo *Create##name(const GPUDeviceAttribute *dev_attr,cfg_type *); \
|
||||
MaterialCreateInfo *Create##name(const VulkanDevAttr *dev_attr,cfg_type *); \
|
||||
\
|
||||
namespace \
|
||||
{ \
|
||||
@ -59,7 +59,7 @@ namespace \
|
||||
return mtl_name; \
|
||||
} \
|
||||
\
|
||||
MaterialCreateInfo *Create(const GPUDeviceAttribute *dev_attr,MaterialCreateConfig *cfg) override \
|
||||
MaterialCreateInfo *Create(const VulkanDevAttr *dev_attr,MaterialCreateConfig *cfg) override \
|
||||
{ \
|
||||
return create_func(dev_attr,(cfg_type *)cfg); \
|
||||
} \
|
||||
@ -68,16 +68,16 @@ namespace \
|
||||
static RegistryMaterialFactoryClass<MaterialFactory##name> MaterialFactoryInstance_##name; \
|
||||
}
|
||||
|
||||
MaterialCreateInfo *CreateMaterialCreateInfo(const GPUDeviceAttribute *dev_attr,const MaterialName &,MaterialCreateConfig *cfg);
|
||||
MaterialCreateInfo *CreateMaterialCreateInfo(const VulkanDevAttr *dev_attr,const MaterialName &,MaterialCreateConfig *cfg);
|
||||
|
||||
inline MaterialCreateInfo *CreateMaterialCreateInfo(const GPUDeviceAttribute *dev_attr,const char *mtl_name,MaterialCreateConfig *cfg)
|
||||
inline MaterialCreateInfo *CreateMaterialCreateInfo(const VulkanDevAttr *dev_attr,const char *mtl_name,MaterialCreateConfig *cfg)
|
||||
{
|
||||
MaterialName mtl_id_name(mtl_name);
|
||||
|
||||
return CreateMaterialCreateInfo(dev_attr,mtl_id_name,cfg);
|
||||
}
|
||||
|
||||
inline MaterialCreateInfo *CreateMaterialCreateInfo(const GPUDeviceAttribute *dev_attr,const AnsiString &mtl_name,MaterialCreateConfig *cfg)
|
||||
inline MaterialCreateInfo *CreateMaterialCreateInfo(const VulkanDevAttr *dev_attr,const AnsiString &mtl_name,MaterialCreateConfig *cfg)
|
||||
{
|
||||
MaterialName mtl_id_name(mtl_name);
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace hgl::graph
|
||||
class ShaderCreateInfoVertex;
|
||||
class ShaderCreateInfoGeometry;
|
||||
class ShaderCreateInfoFragment;
|
||||
struct GPUDeviceAttribute;
|
||||
struct VulkanDevAttr;
|
||||
|
||||
namespace mtl
|
||||
{
|
||||
@ -51,7 +51,7 @@ namespace hgl::graph
|
||||
StdMaterial(const MaterialCreateConfig *);
|
||||
virtual ~StdMaterial()=default;
|
||||
|
||||
virtual MaterialCreateInfo *Create(const GPUDeviceAttribute *dev_attr);
|
||||
virtual MaterialCreateInfo *Create(const VulkanDevAttr *dev_attr);
|
||||
};//class StdMaterial
|
||||
}//namespace mtl
|
||||
}//namespace hgl::graph
|
||||
|
@ -10,7 +10,7 @@ namespace hgl
|
||||
{
|
||||
namespace vulkan
|
||||
{
|
||||
class GPUDevice;
|
||||
class VulkanDevice;
|
||||
}//namespace vulkan
|
||||
|
||||
constexpr VkFormat DefaultRenderTargetFormat=UPF_ABGR8; ///<缺省窗体绘图表面格式
|
||||
@ -19,7 +19,7 @@ namespace hgl
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
|
||||
ObjectMap<Form *,ThemeForm> form_list;
|
||||
|
||||
@ -33,7 +33,7 @@ namespace hgl
|
||||
|
||||
public:
|
||||
|
||||
ThemeEngine(GPUDevice *dev){device=dev;}
|
||||
ThemeEngine(VulkanDevice *dev){device=dev;}
|
||||
virtual ~ThemeEngine()=default;
|
||||
|
||||
virtual bool Init()=0;
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace hgl::graph
|
||||
{
|
||||
struct GPUDeviceAttribute;
|
||||
struct VulkanDevAttr;
|
||||
struct UBODescriptor;
|
||||
|
||||
namespace mtl
|
||||
@ -89,7 +89,7 @@ namespace hgl::graph
|
||||
|
||||
bool AddSampler(const VkShaderStageFlagBits flag_bits,const DescriptorSetType set_type,const SamplerType &st,const AnsiString &name);
|
||||
|
||||
bool CreateShader(const GPUDeviceAttribute *dev_attr);
|
||||
bool CreateShader(const VulkanDevAttr *dev_attr);
|
||||
};//class MaterialCreateInfo
|
||||
}//namespace mtl
|
||||
}//namespace hgl::graph
|
||||
|
@ -4,7 +4,7 @@ namespace hgl
|
||||
{
|
||||
namespace gui
|
||||
{
|
||||
ThemeEngine *CreateDefaultThemeEngine(GPUDevice *dev)
|
||||
ThemeEngine *CreateDefaultThemeEngine(VulkanDevice *dev)
|
||||
{
|
||||
return(new DefaultThemeEngine(dev));
|
||||
}
|
||||
|
@ -12,9 +12,9 @@ namespace hgl
|
||||
ThemeEngine *default_theme_engine=nullptr;
|
||||
}//namespace
|
||||
|
||||
ThemeEngine *CreateDefaultThemeEngine(GPUDevice *dev);
|
||||
ThemeEngine *CreateDefaultThemeEngine(VulkanDevice *dev);
|
||||
|
||||
ThemeEngine *GetDefaultThemeEngine(GPUDevice *dev)
|
||||
ThemeEngine *GetDefaultThemeEngine(VulkanDevice *dev)
|
||||
{
|
||||
if(!default_theme_engine)
|
||||
default_theme_engine=CreateDefaultThemeEngine(dev);
|
||||
@ -22,7 +22,7 @@ namespace hgl
|
||||
return default_theme_engine;
|
||||
}
|
||||
|
||||
ThemeEngine *CreateThemeEngine(GPUDevice *dev)
|
||||
ThemeEngine *CreateThemeEngine(VulkanDevice *dev)
|
||||
{
|
||||
return GetDefaultThemeEngine();
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include"vulkan/VKPrimitiveData.h"
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
PrimitiveCreater::PrimitiveCreater(GPUDevice *dev,const VIL *v)
|
||||
PrimitiveCreater::PrimitiveCreater(VulkanDevice *dev,const VIL *v)
|
||||
{
|
||||
device =dev;
|
||||
vdm =nullptr;
|
||||
|
@ -8,7 +8,7 @@ namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
VertexDataManager::VertexDataManager(GPUDevice *dev,const VIL *_vil)
|
||||
VertexDataManager::VertexDataManager(VulkanDevice *dev,const VIL *_vil)
|
||||
{
|
||||
device=dev;
|
||||
|
||||
|
@ -399,7 +399,7 @@ namespace
|
||||
}
|
||||
}//namespace
|
||||
|
||||
void OutputPhysicalDeviceCaps(const GPUPhysicalDevice *pd)
|
||||
void OutputPhysicalDeviceCaps(const VulkanPhyDevice *pd)
|
||||
{
|
||||
const VkPhysicalDeviceProperties &pdp=pd->GetProperties();
|
||||
|
||||
|
@ -114,7 +114,7 @@ Texture2DArray *TextureManager::CreateTexture2DArray(const uint32_t w,const uint
|
||||
}
|
||||
|
||||
//
|
||||
//bool GPUDevice::CommitTexture2DArray(Texture2DArray *tex,DeviceBuffer *buf,VkPipelineStageFlags destinationStage)
|
||||
//bool VulkanDevice::CommitTexture2DArray(Texture2DArray *tex,DeviceBuffer *buf,VkPipelineStageFlags destinationStage)
|
||||
//{
|
||||
// if(!tex||!buf)return(false);
|
||||
//
|
||||
@ -123,7 +123,7 @@ Texture2DArray *TextureManager::CreateTexture2DArray(const uint32_t w,const uint
|
||||
// return CopyBufferToImageArray(tex,buf,&buffer_image_copy,destinationStage);
|
||||
//}
|
||||
//
|
||||
//bool GPUDevice::CommitTexture2DArrayMipmaps(Texture2DArray *tex,DeviceBuffer *buf,const VkExtent3D &extent,uint32_t total_bytes)
|
||||
//bool VulkanDevice::CommitTexture2DArrayMipmaps(Texture2DArray *tex,DeviceBuffer *buf,const VkExtent3D &extent,uint32_t total_bytes)
|
||||
//{
|
||||
// if(!tex||!buf
|
||||
// ||extent.width*extent.height<=0)
|
||||
@ -169,7 +169,7 @@ Texture2DArray *TextureManager::CreateTexture2DArray(const uint32_t w,const uint
|
||||
// return CopyBufferToImageArray(tex,buf,buffer_image_copy,miplevel,VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
||||
//}
|
||||
//
|
||||
//bool GPUDevice::ChangeTexture2DArray(Texture2DArray *tex,DeviceBuffer *buf,const ArrayList<Image2DRegion> &ir_list,const uint32_t base_layer,const uint32_t layer_count,VkPipelineStageFlags destinationStage)
|
||||
//bool VulkanDevice::ChangeTexture2DArray(Texture2DArray *tex,DeviceBuffer *buf,const ArrayList<Image2DRegion> &ir_list,const uint32_t base_layer,const uint32_t layer_count,VkPipelineStageFlags destinationStage)
|
||||
//{
|
||||
// if(!tex||!buf||ir_list.GetCount()<=0)
|
||||
// return(false);
|
||||
|
@ -148,7 +148,7 @@ bool TextureManager::CommitTextureCubeMipmaps(TextureCube *tex,DeviceBuffer *buf
|
||||
return CopyBufferToImageCube(tex,buf,buffer_image_copy,miplevel,VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
||||
}
|
||||
|
||||
//bool GPUDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,const ArrayList<Image2DRegion> &ir_list,VkPipelineStageFlags destinationStage)
|
||||
//bool VulkanDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,const ArrayList<Image2DRegion> &ir_list,VkPipelineStageFlags destinationStage)
|
||||
//{
|
||||
// if(!tex||!buf||ir_list.GetCount()<=0)
|
||||
// return(false);
|
||||
@ -188,7 +188,7 @@ bool TextureManager::CommitTextureCubeMipmaps(TextureCube *tex,DeviceBuffer *buf
|
||||
// return result;
|
||||
//}
|
||||
//
|
||||
//bool GPUDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,uint32_t left,uint32_t top,uint32_t width,uint32_t height,VkPipelineStageFlags destinationStage)
|
||||
//bool VulkanDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,uint32_t left,uint32_t top,uint32_t width,uint32_t height,VkPipelineStageFlags destinationStage)
|
||||
//{
|
||||
// if(!tex||!buf
|
||||
// ||left<0||left+width>tex->GetWidth()
|
||||
@ -205,7 +205,7 @@ bool TextureManager::CommitTextureCubeMipmaps(TextureCube *tex,DeviceBuffer *buf
|
||||
// return result;
|
||||
//}
|
||||
//
|
||||
//bool GPUDevice::ChangeTexture2D(Texture2D *tex,void *data,uint32_t left,uint32_t top,uint32_t width,uint32_t height,uint32_t size,VkPipelineStageFlags destinationStage)
|
||||
//bool VulkanDevice::ChangeTexture2D(Texture2D *tex,void *data,uint32_t left,uint32_t top,uint32_t width,uint32_t height,uint32_t size,VkPipelineStageFlags destinationStage)
|
||||
//{
|
||||
// if(!tex||!data
|
||||
// ||left<0||left+width>tex->GetWidth()
|
||||
|
@ -8,28 +8,28 @@ namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
GPUArrayBuffer *GPUDevice::CreateArrayInUBO(const VkDeviceSize &item_length)
|
||||
VulkanArrayBuffer *VulkanDevice::CreateArrayInUBO(const VkDeviceSize &item_length)
|
||||
{
|
||||
const uint align_size=hgl_align<VkDeviceSize>(item_length,GetUBOAlign());
|
||||
|
||||
auto vk_ma=new VKMemoryAllocator(this,VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,align_size);
|
||||
|
||||
return(new GPUArrayBuffer(vk_ma,align_size,GetUBORange()));
|
||||
return(new VulkanArrayBuffer(vk_ma,align_size,GetUBORange()));
|
||||
}
|
||||
|
||||
GPUArrayBuffer *GPUDevice::CreateArrayInSSBO(const VkDeviceSize &item_length)
|
||||
VulkanArrayBuffer *VulkanDevice::CreateArrayInSSBO(const VkDeviceSize &item_length)
|
||||
{
|
||||
const uint align_size=hgl_align<VkDeviceSize>(item_length,GetSSBOAlign());
|
||||
|
||||
auto vk_ma=new VKMemoryAllocator(this,VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,align_size);
|
||||
|
||||
return(new GPUArrayBuffer(vk_ma,align_size,GetSSBORange()));
|
||||
return(new VulkanArrayBuffer(vk_ma,align_size,GetSSBORange()));
|
||||
}
|
||||
}//namespace graph
|
||||
|
||||
namespace graph
|
||||
{
|
||||
GPUArrayBuffer::GPUArrayBuffer(VKMemoryAllocator *va,const uint as,const uint rs)
|
||||
VulkanArrayBuffer::VulkanArrayBuffer(VKMemoryAllocator *va,const uint as,const uint rs)
|
||||
{
|
||||
vk_ma=va;
|
||||
align_size=as;
|
||||
@ -40,17 +40,17 @@ namespace hgl
|
||||
coll=new Collection(align_size,mb);
|
||||
}
|
||||
|
||||
GPUArrayBuffer::~GPUArrayBuffer()
|
||||
VulkanArrayBuffer::~VulkanArrayBuffer()
|
||||
{
|
||||
delete coll;
|
||||
}
|
||||
|
||||
DeviceBuffer *GPUArrayBuffer::GetBuffer()
|
||||
DeviceBuffer *VulkanArrayBuffer::GetBuffer()
|
||||
{
|
||||
return vk_ma->GetBuffer();
|
||||
}
|
||||
|
||||
uint32 GPUArrayBuffer::Alloc(const uint32 max_count) ///<预分配空间
|
||||
uint32 VulkanArrayBuffer::Alloc(const uint32 max_count) ///<预分配空间
|
||||
{
|
||||
if(!coll->Alloc(max_count))
|
||||
return(0);
|
||||
@ -58,17 +58,17 @@ namespace hgl
|
||||
return coll->GetAllocCount();
|
||||
}
|
||||
|
||||
void GPUArrayBuffer::Clear()
|
||||
void VulkanArrayBuffer::Clear()
|
||||
{
|
||||
coll->Clear();
|
||||
}
|
||||
|
||||
void *GPUArrayBuffer::Map(const uint32 start,const uint32 count)
|
||||
void *VulkanArrayBuffer::Map(const uint32 start,const uint32 count)
|
||||
{
|
||||
return coll->Map(start,count);
|
||||
}
|
||||
|
||||
void GPUArrayBuffer::Flush(const uint32 count)
|
||||
void VulkanArrayBuffer::Flush(const uint32 count)
|
||||
{
|
||||
vk_ma->Flush(count*align_size);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include<hgl/graph/VKDeviceAttribute.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
GPUCmdBuffer::GPUCmdBuffer(const GPUDeviceAttribute *attr,VkCommandBuffer cb)
|
||||
VulkanCmdBuffer::VulkanCmdBuffer(const VulkanDevAttr *attr,VkCommandBuffer cb)
|
||||
{
|
||||
dev_attr=attr;
|
||||
cmd_buf=cb;
|
||||
@ -10,12 +10,12 @@ GPUCmdBuffer::GPUCmdBuffer(const GPUDeviceAttribute *attr,VkCommandBuffer cb)
|
||||
cmd_begin=false;
|
||||
}
|
||||
|
||||
GPUCmdBuffer::~GPUCmdBuffer()
|
||||
VulkanCmdBuffer::~VulkanCmdBuffer()
|
||||
{
|
||||
vkFreeCommandBuffers(dev_attr->device,dev_attr->cmd_pool,1,&cmd_buf);
|
||||
}
|
||||
|
||||
bool GPUCmdBuffer::Begin()
|
||||
bool VulkanCmdBuffer::Begin()
|
||||
{
|
||||
CommandBufferBeginInfo cmd_buf_info;
|
||||
|
||||
@ -29,19 +29,19 @@ bool GPUCmdBuffer::Begin()
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void GPUCmdBuffer::SetDebugName(const AnsiString &object_name)
|
||||
void VulkanCmdBuffer::SetDebugName(const AnsiString &object_name)
|
||||
{
|
||||
if(dev_attr->debug_utils)
|
||||
dev_attr->debug_utils->SetCommandBuffer(cmd_buf,object_name);
|
||||
}
|
||||
|
||||
void GPUCmdBuffer::BeginRegion(const AnsiString ®ion_name,const Color4f &color)
|
||||
void VulkanCmdBuffer::BeginRegion(const AnsiString ®ion_name,const Color4f &color)
|
||||
{
|
||||
if(dev_attr->debug_utils)
|
||||
dev_attr->debug_utils->CmdBegin(cmd_buf,region_name,color);
|
||||
}
|
||||
|
||||
void GPUCmdBuffer::EndRegion()
|
||||
void VulkanCmdBuffer::EndRegion()
|
||||
{
|
||||
if(dev_attr->debug_utils)
|
||||
dev_attr->debug_utils->CmdEnd(cmd_buf);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include<hgl/graph/VKRenderTarget.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
RenderCmdBuffer::RenderCmdBuffer(const GPUDeviceAttribute *attr,VkCommandBuffer cb):GPUCmdBuffer(attr,cb)
|
||||
RenderCmdBuffer::RenderCmdBuffer(const VulkanDevAttr *attr,VkCommandBuffer cb):VulkanCmdBuffer(attr,cb)
|
||||
{
|
||||
cv_count=0;
|
||||
clear_values=nullptr;
|
||||
|
@ -3,17 +3,17 @@
|
||||
#include<hgl/graph/VKCommandBuffer.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
GPUDevice::GPUDevice(GPUDeviceAttribute *da)
|
||||
VulkanDevice::VulkanDevice(VulkanDevAttr *da)
|
||||
{
|
||||
attr=da;
|
||||
}
|
||||
|
||||
GPUDevice::~GPUDevice()
|
||||
VulkanDevice::~VulkanDevice()
|
||||
{
|
||||
delete attr;
|
||||
}
|
||||
|
||||
VkCommandBuffer GPUDevice::CreateCommandBuffer(const AnsiString &name)
|
||||
VkCommandBuffer VulkanDevice::CreateCommandBuffer(const AnsiString &name)
|
||||
{
|
||||
if(!attr->cmd_pool)
|
||||
return(VK_NULL_HANDLE);
|
||||
@ -39,7 +39,7 @@ VkCommandBuffer GPUDevice::CreateCommandBuffer(const AnsiString &name)
|
||||
return cmd_buf;
|
||||
}
|
||||
|
||||
RenderCmdBuffer *GPUDevice::CreateRenderCommandBuffer(const AnsiString &name)
|
||||
RenderCmdBuffer *VulkanDevice::CreateRenderCommandBuffer(const AnsiString &name)
|
||||
{
|
||||
VkCommandBuffer cb=CreateCommandBuffer(name);
|
||||
|
||||
@ -48,7 +48,7 @@ RenderCmdBuffer *GPUDevice::CreateRenderCommandBuffer(const AnsiString &name)
|
||||
return(new RenderCmdBuffer(attr,cb));
|
||||
}
|
||||
|
||||
TextureCmdBuffer *GPUDevice::CreateTextureCommandBuffer(const AnsiString &name)
|
||||
TextureCmdBuffer *VulkanDevice::CreateTextureCommandBuffer(const AnsiString &name)
|
||||
{
|
||||
VkCommandBuffer cb=CreateCommandBuffer(name);
|
||||
|
||||
@ -61,7 +61,7 @@ TextureCmdBuffer *GPUDevice::CreateTextureCommandBuffer(const AnsiString &name)
|
||||
* 创建栅栏
|
||||
* @param create_signaled 是否创建初始信号
|
||||
*/
|
||||
Fence *GPUDevice::CreateFence(bool create_signaled)
|
||||
Fence *VulkanDevice::CreateFence(bool create_signaled)
|
||||
{
|
||||
FenceCreateInfo fenceInfo(create_signaled?VK_FENCE_CREATE_SIGNALED_BIT:0);
|
||||
|
||||
@ -73,7 +73,7 @@ Fence *GPUDevice::CreateFence(bool create_signaled)
|
||||
return(new Fence(attr->device,fence));
|
||||
}
|
||||
|
||||
Semaphore *GPUDevice::CreateGPUSemaphore()
|
||||
Semaphore *VulkanDevice::CreateGPUSemaphore()
|
||||
{
|
||||
SemaphoreCreateInfo SemaphoreCreateInfo;
|
||||
|
||||
@ -85,7 +85,7 @@ Semaphore *GPUDevice::CreateGPUSemaphore()
|
||||
return(new Semaphore(attr->device,sem));
|
||||
}
|
||||
|
||||
DeviceQueue *GPUDevice::CreateQueue(const uint32_t fence_count,const bool create_signaled)
|
||||
DeviceQueue *VulkanDevice::CreateQueue(const uint32_t fence_count,const bool create_signaled)
|
||||
{
|
||||
if(fence_count<=0)return(nullptr);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
VK_NAMESPACE_BEGIN
|
||||
void SavePipelineCacheData(VkDevice device,VkPipelineCache cache,const VkPhysicalDeviceProperties &pdp);
|
||||
|
||||
GPUDeviceAttribute::GPUDeviceAttribute(VulkanInstance *inst,const GPUPhysicalDevice *pd,VkSurfaceKHR s)
|
||||
VulkanDevAttr::VulkanDevAttr(VulkanInstance *inst,const VulkanPhyDevice *pd,VkSurfaceKHR s)
|
||||
{
|
||||
instance=inst;
|
||||
physical_device=pd;
|
||||
@ -18,7 +18,7 @@ GPUDeviceAttribute::GPUDeviceAttribute(VulkanInstance *inst,const GPUPhysicalDev
|
||||
GetQueueFamily();
|
||||
}
|
||||
|
||||
GPUDeviceAttribute::~GPUDeviceAttribute()
|
||||
VulkanDevAttr::~VulkanDevAttr()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if(debug_utils)
|
||||
@ -44,12 +44,12 @@ GPUDeviceAttribute::~GPUDeviceAttribute()
|
||||
instance->DestroySurface(surface);
|
||||
}
|
||||
|
||||
int GPUDeviceAttribute::GetMemoryType(uint32_t typeBits,VkMemoryPropertyFlags properties) const
|
||||
int VulkanDevAttr::GetMemoryType(uint32_t typeBits,VkMemoryPropertyFlags properties) const
|
||||
{
|
||||
return physical_device->GetMemoryType(typeBits,properties);
|
||||
}
|
||||
|
||||
void GPUDeviceAttribute::RefreshSurfaceCaps()
|
||||
void VulkanDevAttr::RefreshSurfaceCaps()
|
||||
{
|
||||
VkPhysicalDevice pdevice = *physical_device;
|
||||
|
||||
@ -80,7 +80,7 @@ void GPUDeviceAttribute::RefreshSurfaceCaps()
|
||||
}
|
||||
}
|
||||
|
||||
void GPUDeviceAttribute::GetSurfacePresentMode()
|
||||
void VulkanDevAttr::GetSurfacePresentMode()
|
||||
{
|
||||
uint32_t mode_count;
|
||||
|
||||
@ -95,7 +95,7 @@ void GPUDeviceAttribute::GetSurfacePresentMode()
|
||||
present_modes.Clear();
|
||||
}
|
||||
|
||||
void GPUDeviceAttribute::GetQueueFamily()
|
||||
void VulkanDevAttr::GetQueueFamily()
|
||||
{
|
||||
VkPhysicalDevice pdevice = *physical_device;
|
||||
|
||||
|
@ -5,12 +5,12 @@
|
||||
#include<iostream>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
const VkDeviceSize GPUDevice::GetUBOAlign (){return attr->physical_device->GetUBOAlign();}
|
||||
const VkDeviceSize GPUDevice::GetSSBOAlign (){return attr->physical_device->GetSSBOAlign();}
|
||||
const VkDeviceSize GPUDevice::GetUBORange (){return attr->physical_device->GetUBORange();}
|
||||
const VkDeviceSize GPUDevice::GetSSBORange (){return attr->physical_device->GetSSBORange();}
|
||||
const VkDeviceSize VulkanDevice::GetUBOAlign (){return attr->physical_device->GetUBOAlign();}
|
||||
const VkDeviceSize VulkanDevice::GetSSBOAlign (){return attr->physical_device->GetSSBOAlign();}
|
||||
const VkDeviceSize VulkanDevice::GetUBORange (){return attr->physical_device->GetUBORange();}
|
||||
const VkDeviceSize VulkanDevice::GetSSBORange (){return attr->physical_device->GetSSBORange();}
|
||||
|
||||
bool GPUDevice::CreateBuffer(DeviceBufferData *buf,VkBufferUsageFlags buf_usage,VkDeviceSize range,VkDeviceSize size,const void *data,SharingMode sharing_mode)
|
||||
bool VulkanDevice::CreateBuffer(DeviceBufferData *buf,VkBufferUsageFlags buf_usage,VkDeviceSize range,VkDeviceSize size,const void *data,SharingMode sharing_mode)
|
||||
{
|
||||
if(size<=0)return(false);
|
||||
|
||||
@ -55,7 +55,7 @@ bool GPUDevice::CreateBuffer(DeviceBufferData *buf,VkBufferUsageFlags buf_usage,
|
||||
return(false);
|
||||
}
|
||||
|
||||
VAB *GPUDevice::CreateVAB(VkFormat format,uint32_t count,const void *data,SharingMode sharing_mode)
|
||||
VAB *VulkanDevice::CreateVAB(VkFormat format,uint32_t count,const void *data,SharingMode sharing_mode)
|
||||
{
|
||||
if(count==0)return(nullptr);
|
||||
|
||||
@ -63,7 +63,7 @@ VAB *GPUDevice::CreateVAB(VkFormat format,uint32_t count,const void *data,Sharin
|
||||
|
||||
if(stride==0)
|
||||
{
|
||||
std::cerr<<"format["<<format<<"] stride length is 0,please use \"GPUDevice::CreateBuffer(VkBufferUsageFlags,VkDeviceSize,VkSharingMode)\" function.";
|
||||
std::cerr<<"format["<<format<<"] stride length is 0,please use \"VulkanDevice::CreateBuffer(VkBufferUsageFlags,VkDeviceSize,VkSharingMode)\" function.";
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ VAB *GPUDevice::CreateVAB(VkFormat format,uint32_t count,const void *data,Sharin
|
||||
return(new VertexAttribBuffer(attr->device,buf,format,stride,count));
|
||||
}
|
||||
|
||||
const IndexType GPUDevice::ChooseIndexType(const VkDeviceSize &vertex_count)const
|
||||
const IndexType VulkanDevice::ChooseIndexType(const VkDeviceSize &vertex_count)const
|
||||
{
|
||||
if(vertex_count<=0)return(IndexType::ERR);
|
||||
|
||||
@ -88,7 +88,7 @@ const IndexType GPUDevice::ChooseIndexType(const VkDeviceSize &vertex_count)cons
|
||||
return IndexType::ERR;
|
||||
}
|
||||
|
||||
const bool GPUDevice::CheckIndexType(const IndexType it,const VkDeviceSize &vertex_count)const
|
||||
const bool VulkanDevice::CheckIndexType(const IndexType it,const VkDeviceSize &vertex_count)const
|
||||
{
|
||||
if(vertex_count<=0)return(false);
|
||||
|
||||
@ -101,7 +101,7 @@ const bool GPUDevice::CheckIndexType(const IndexType it,const VkDeviceSize &vert
|
||||
return(false);
|
||||
}
|
||||
|
||||
IndexBuffer *GPUDevice::CreateIBO(IndexType index_type,uint32_t count,const void *data,SharingMode sharing_mode)
|
||||
IndexBuffer *VulkanDevice::CreateIBO(IndexType index_type,uint32_t count,const void *data,SharingMode sharing_mode)
|
||||
{
|
||||
if(count==0)return(nullptr);
|
||||
|
||||
@ -122,7 +122,7 @@ IndexBuffer *GPUDevice::CreateIBO(IndexType index_type,uint32_t count,const void
|
||||
return(new IndexBuffer(attr->device,buf,index_type,count));
|
||||
}
|
||||
|
||||
DeviceBuffer *GPUDevice::CreateBuffer(VkBufferUsageFlags buf_usage,VkDeviceSize range,VkDeviceSize size,const void *data,SharingMode sharing_mode)
|
||||
DeviceBuffer *VulkanDevice::CreateBuffer(VkBufferUsageFlags buf_usage,VkDeviceSize range,VkDeviceSize size,const void *data,SharingMode sharing_mode)
|
||||
{
|
||||
if(size<=0)return(nullptr);
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
VK_NAMESPACE_BEGIN
|
||||
VkPipelineCache CreatePipelineCache(VkDevice device,const VkPhysicalDeviceProperties &);
|
||||
|
||||
void SetShaderCompilerVersion(const GPUPhysicalDevice *);
|
||||
void SetShaderCompilerVersion(const VulkanPhyDevice *);
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugUtils *CreateDebugUtils(VkDevice);
|
||||
@ -47,7 +47,7 @@ void LogSurfaceFormat(const VkSurfaceFormatKHR *surface_format_list,const uint32
|
||||
|
||||
namespace
|
||||
{
|
||||
void SetDeviceExtension(CharPointerList *ext_list,const GPUPhysicalDevice *physical_device,const VulkanHardwareRequirement &require)
|
||||
void SetDeviceExtension(CharPointerList *ext_list,const VulkanPhyDevice *physical_device,const VulkanHardwareRequirement &require)
|
||||
{
|
||||
ext_list->Add(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||
|
||||
@ -117,7 +117,7 @@ namespace
|
||||
#undef FEATURE_COPY
|
||||
}
|
||||
|
||||
void GetDeviceQueue(GPUDeviceAttribute *attr)
|
||||
void GetDeviceQueue(VulkanDevAttr *attr)
|
||||
{
|
||||
vkGetDeviceQueue(attr->device,attr->graphics_family,0,&attr->graphics_queue);
|
||||
|
||||
@ -201,7 +201,7 @@ constexpr size_t VK_DRIVER_ID_RANGE_SIZE=VK_DRIVER_ID_END_RANGE-VK_DRIVER_ID_BEG
|
||||
#endif//VK_DRIVER_ID_RANGE_SIZE
|
||||
|
||||
#ifdef _DEBUG
|
||||
void OutputPhysicalDeviceCaps(const GPUPhysicalDevice *);
|
||||
void OutputPhysicalDeviceCaps(const VulkanPhyDevice *);
|
||||
#endif//_DEBUG
|
||||
|
||||
VkDevice VulkanDeviceCreater::CreateDevice(const uint32_t graphics_family)
|
||||
@ -293,11 +293,11 @@ void VulkanDeviceCreater::ChooseSurfaceFormat()
|
||||
surface_format.colorSpace=VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
|
||||
}
|
||||
|
||||
GPUDevice *VulkanDeviceCreater::CreateRenderDevice()
|
||||
VulkanDevice *VulkanDeviceCreater::CreateRenderDevice()
|
||||
{
|
||||
GPUDeviceAttribute *device_attr=new GPUDeviceAttribute(instance,physical_device,surface);
|
||||
VulkanDevAttr *device_attr=new VulkanDevAttr(instance,physical_device,surface);
|
||||
|
||||
AutoDelete<GPUDeviceAttribute> auto_delete(device_attr);
|
||||
AutoDelete<VulkanDevAttr> auto_delete(device_attr);
|
||||
|
||||
if(device_attr->graphics_family==ERROR_FAMILY_INDEX)
|
||||
return(nullptr);
|
||||
@ -359,7 +359,7 @@ GPUDevice *VulkanDeviceCreater::CreateRenderDevice()
|
||||
}
|
||||
#endif//_DEBUG
|
||||
|
||||
return(new GPUDevice(device_attr));
|
||||
return(new VulkanDevice(device_attr));
|
||||
}
|
||||
|
||||
VulkanDeviceCreater::VulkanDeviceCreater( VulkanInstance *vi,
|
||||
@ -469,7 +469,7 @@ bool VulkanDeviceCreater::RequirementCheck()
|
||||
return(true);
|
||||
}
|
||||
|
||||
GPUDevice *VulkanDeviceCreater::Create()
|
||||
VulkanDevice *VulkanDeviceCreater::Create()
|
||||
{
|
||||
if(!instance||!window)
|
||||
return(nullptr);
|
||||
@ -494,7 +494,7 @@ GPUDevice *VulkanDeviceCreater::Create()
|
||||
extent.width =window->GetWidth();
|
||||
extent.height =window->GetHeight();
|
||||
|
||||
GPUDevice *device=CreateRenderDevice();
|
||||
VulkanDevice *device=CreateRenderDevice();
|
||||
|
||||
if(!device)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ namespace
|
||||
}
|
||||
}//namespace
|
||||
|
||||
MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorManager *desc_manager,const PipelineLayoutData *pld,const DescriptorSetType &desc_set_type)
|
||||
MaterialParameters *VulkanDevice::CreateMP(const MaterialDescriptorManager *desc_manager,const PipelineLayoutData *pld,const DescriptorSetType &desc_set_type)
|
||||
{
|
||||
if(!desc_manager||!pld)return(nullptr);
|
||||
RANGE_CHECK_RETURN_NULLPTR(desc_set_type)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include<hgl/graph/VKDevice.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
DeviceMemory *GPUDevice::CreateMemory(VkImage image,const uint32_t flag)
|
||||
DeviceMemory *VulkanDevice::CreateMemory(VkImage image,const uint32_t flag)
|
||||
{
|
||||
VkMemoryRequirements memReqs;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include<hgl/graph/VKDevice.h>
|
||||
#include<hgl/graph/VKSampler.h>
|
||||
VK_NAMESPACE_BEGIN
|
||||
Sampler *GPUDevice::CreateSampler(VkSamplerCreateInfo *sci)
|
||||
Sampler *VulkanDevice::CreateSampler(VkSamplerCreateInfo *sci)
|
||||
{
|
||||
static VkSamplerCreateInfo default_sampler_create_info=
|
||||
{
|
||||
@ -38,7 +38,7 @@ Sampler *GPUDevice::CreateSampler(VkSamplerCreateInfo *sci)
|
||||
return(new Sampler(attr->device,sampler));
|
||||
}
|
||||
|
||||
Sampler *GPUDevice::CreateSampler(Texture *tex)
|
||||
Sampler *VulkanDevice::CreateSampler(Texture *tex)
|
||||
{
|
||||
VkSamplerCreateInfo sci=
|
||||
{
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
bool GPUDevice::CreateIndirectCommandBuffer(DeviceBufferData *buf,const uint32_t cmd_count,const uint32_t cmd_size,SharingMode sharing_mode)
|
||||
bool VulkanDevice::CreateIndirectCommandBuffer(DeviceBufferData *buf,const uint32_t cmd_count,const uint32_t cmd_size,SharingMode sharing_mode)
|
||||
{
|
||||
const uint32_t size=cmd_count*cmd_size;
|
||||
|
||||
@ -12,7 +12,7 @@ bool GPUDevice::CreateIndirectCommandBuffer(DeviceBufferData *buf,const uint32_t
|
||||
return CreateBuffer(buf,VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT,size,size,nullptr,sharing_mode);
|
||||
}
|
||||
|
||||
IndirectDrawBuffer *GPUDevice::CreateIndirectDrawBuffer(const uint32_t cmd_count,SharingMode sm)
|
||||
IndirectDrawBuffer *VulkanDevice::CreateIndirectDrawBuffer(const uint32_t cmd_count,SharingMode sm)
|
||||
{
|
||||
DeviceBufferData buf;
|
||||
|
||||
@ -22,7 +22,7 @@ IndirectDrawBuffer *GPUDevice::CreateIndirectDrawBuffer(const uint32_t cmd_count
|
||||
return(new IndirectDrawBuffer(attr->device,buf,cmd_count));
|
||||
}
|
||||
|
||||
IndirectDrawIndexedBuffer *GPUDevice::CreateIndirectDrawIndexedBuffer(const uint32_t cmd_count,SharingMode sm)
|
||||
IndirectDrawIndexedBuffer *VulkanDevice::CreateIndirectDrawIndexedBuffer(const uint32_t cmd_count,SharingMode sm)
|
||||
{
|
||||
DeviceBufferData buf;
|
||||
|
||||
@ -32,7 +32,7 @@ IndirectDrawIndexedBuffer *GPUDevice::CreateIndirectDrawIndexedBuffer(const uint
|
||||
return(new IndirectDrawIndexedBuffer(attr->device,buf,cmd_count));
|
||||
}
|
||||
|
||||
IndirectDispatchBuffer *GPUDevice::CreateIndirectDispatchBuffer(const uint32_t cmd_count,SharingMode sm)
|
||||
IndirectDispatchBuffer *VulkanDevice::CreateIndirectDispatchBuffer(const uint32_t cmd_count,SharingMode sm)
|
||||
{
|
||||
DeviceBufferData buf;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include<iostream>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
GPUDevice *CreateRenderDevice(VkInstance,const GPUPhysicalDevice *,Window *);
|
||||
VulkanDevice *CreateRenderDevice(VkInstance,const VulkanPhyDevice *,Window *);
|
||||
|
||||
void CheckInstanceLayer(CharPointerList &layer_list,CreateInstanceLayerInfo *layer_info);
|
||||
|
||||
@ -80,7 +80,7 @@ VulkanInstance::VulkanInstance(VkInstance i,VKDebugOut *out)
|
||||
vkEnumeratePhysicalDevices(inst, &gpu_count,pd_list);
|
||||
|
||||
for(uint32_t i=0;i<gpu_count;i++)
|
||||
physical_devices.Add(new GPUPhysicalDevice(inst,pd_list[i]));
|
||||
physical_devices.Add(new VulkanPhyDevice(inst,pd_list[i]));
|
||||
|
||||
delete[] pd_list;
|
||||
}
|
||||
@ -96,9 +96,9 @@ VulkanInstance::~VulkanInstance()
|
||||
vkDestroyInstance(inst,nullptr);
|
||||
}
|
||||
|
||||
const GPUPhysicalDevice *VulkanInstance::GetDevice(VkPhysicalDeviceType type)const
|
||||
const VulkanPhyDevice *VulkanInstance::GetDevice(VkPhysicalDeviceType type)const
|
||||
{
|
||||
for(GPUPhysicalDevice *pd:physical_devices)
|
||||
for(VulkanPhyDevice *pd:physical_devices)
|
||||
if(pd->GetDeviceType()==type)
|
||||
return(pd);
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include<hgl/graph/VKMemory.h>
|
||||
#include<hgl/graph/VKPhysicalDevice.h>
|
||||
VK_NAMESPACE_BEGIN
|
||||
DeviceMemory *GPUDevice::CreateMemory(const VkMemoryRequirements &req,uint32_t properties)
|
||||
DeviceMemory *VulkanDevice::CreateMemory(const VkMemoryRequirements &req,uint32_t properties)
|
||||
{
|
||||
const int index=attr->physical_device->GetMemoryType(req.memoryTypeBits,properties);
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include<hgl/graph/VKBuffer.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
VKMemoryAllocator::VKMemoryAllocator(GPUDevice *d,const uint32_t flags,const VkDeviceSize r)
|
||||
VKMemoryAllocator::VKMemoryAllocator(VulkanDevice *d,const uint32_t flags,const VkDeviceSize r)
|
||||
{
|
||||
device=d;
|
||||
buffer_usage_flag_bits=flags;
|
||||
|
@ -55,7 +55,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
GPUPhysicalDevice::GPUPhysicalDevice(VkInstance inst,VkPhysicalDevice pd)
|
||||
VulkanPhyDevice::VulkanPhyDevice(VkInstance inst,VkPhysicalDevice pd)
|
||||
{
|
||||
instance=inst;
|
||||
physical_device=pd;
|
||||
@ -179,7 +179,7 @@ GPUPhysicalDevice::GPUPhysicalDevice(VkInstance inst,VkPhysicalDevice pd)
|
||||
dynamic_state=CheckExtensionSupport(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME);
|
||||
}
|
||||
|
||||
const bool GPUPhysicalDevice::GetLayerVersion(const AnsiString &name,uint32_t &spec,uint32_t &impl)const
|
||||
const bool VulkanPhyDevice::GetLayerVersion(const AnsiString &name,uint32_t &spec,uint32_t &impl)const
|
||||
{
|
||||
for(const VkLayerProperties &lp:layer_properties)
|
||||
{
|
||||
@ -195,7 +195,7 @@ const bool GPUPhysicalDevice::GetLayerVersion(const AnsiString &name,uint32_t &s
|
||||
return(false);
|
||||
}
|
||||
|
||||
const uint32_t GPUPhysicalDevice::GetExtensionVersion(const AnsiString &name)const
|
||||
const uint32_t VulkanPhyDevice::GetExtensionVersion(const AnsiString &name)const
|
||||
{
|
||||
for(const VkExtensionProperties &ep:extension_properties)
|
||||
{
|
||||
@ -206,7 +206,7 @@ const uint32_t GPUPhysicalDevice::GetExtensionVersion(const AnsiString &name)con
|
||||
return 0;
|
||||
}
|
||||
|
||||
const bool GPUPhysicalDevice::CheckExtensionSupport(const AnsiString &name)const
|
||||
const bool VulkanPhyDevice::CheckExtensionSupport(const AnsiString &name)const
|
||||
{
|
||||
for(const VkExtensionProperties &ep:extension_properties)
|
||||
{
|
||||
@ -217,7 +217,7 @@ const bool GPUPhysicalDevice::CheckExtensionSupport(const AnsiString &name)const
|
||||
return(false);
|
||||
}
|
||||
|
||||
const int GPUPhysicalDevice::GetMemoryType(uint32_t typeBits,VkMemoryPropertyFlags properties)const
|
||||
const int VulkanPhyDevice::GetMemoryType(uint32_t typeBits,VkMemoryPropertyFlags properties)const
|
||||
{
|
||||
// Search memtypes to find first index with those properties
|
||||
for(uint32_t i=0; i<memory_properties.memoryTypeCount; i++)
|
||||
@ -233,7 +233,7 @@ const int GPUPhysicalDevice::GetMemoryType(uint32_t typeBits,VkMemoryPropertyFla
|
||||
return -1;
|
||||
}
|
||||
|
||||
VkFormat GPUPhysicalDevice::GetDepthFormat(bool lower_to_high)const
|
||||
VkFormat VulkanPhyDevice::GetDepthFormat(bool lower_to_high)const
|
||||
{
|
||||
constexpr VkFormat depthFormats[] =
|
||||
{
|
||||
@ -261,7 +261,7 @@ VkFormat GPUPhysicalDevice::GetDepthFormat(bool lower_to_high)const
|
||||
return result;
|
||||
}
|
||||
|
||||
VkFormat GPUPhysicalDevice::GetDepthStencilFormat(bool lower_to_high)const
|
||||
VkFormat VulkanPhyDevice::GetDepthStencilFormat(bool lower_to_high)const
|
||||
{
|
||||
constexpr VkFormat depthStencilFormats[] =
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include<hgl/graph/VKMaterialDescriptorManager.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
PipelineLayoutData *GPUDevice::CreatePipelineLayoutData(const MaterialDescriptorManager *desc_manager)
|
||||
PipelineLayoutData *VulkanDevice::CreatePipelineLayoutData(const MaterialDescriptorManager *desc_manager)
|
||||
{
|
||||
PipelineLayoutData *pld=hgl_zero_new<PipelineLayoutData>();
|
||||
|
||||
|
@ -114,11 +114,11 @@ void PrimitiveData::UnmapAll()
|
||||
namespace
|
||||
{
|
||||
/**
|
||||
* 直接使用GPUDevice创建VAB/IBO,并在释构时释放
|
||||
* 直接使用VulkanDevice创建VAB/IBO,并在释构时释放
|
||||
*/
|
||||
class PrimitiveDataPrivateBuffer:public PrimitiveData
|
||||
{
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
|
||||
public:
|
||||
|
||||
@ -129,7 +129,7 @@ namespace
|
||||
|
||||
public:
|
||||
|
||||
PrimitiveDataPrivateBuffer(GPUDevice *dev,const VIL *_vil,const uint32_t vc):PrimitiveData(_vil,vc)
|
||||
PrimitiveDataPrivateBuffer(VulkanDevice *dev,const VIL *_vil,const uint32_t vc):PrimitiveData(_vil,vc)
|
||||
{
|
||||
device=dev;
|
||||
}
|
||||
@ -230,7 +230,7 @@ namespace
|
||||
};//class PrimitiveDataVDM:public PrimitiveData
|
||||
}//namespace
|
||||
|
||||
PrimitiveData *CreatePrimitiveData(GPUDevice *dev,const VIL *_vil,const uint32_t vc)
|
||||
PrimitiveData *CreatePrimitiveData(VulkanDevice *dev,const VIL *_vil,const uint32_t vc)
|
||||
{
|
||||
if(!dev)return(nullptr);
|
||||
if(!_vil)return(nullptr);
|
||||
|
@ -68,6 +68,6 @@ public:
|
||||
|
||||
};//class PrimitiveData
|
||||
|
||||
PrimitiveData *CreatePrimitiveData(GPUDevice *dev,const VIL *_vil,const uint32_t vc);
|
||||
PrimitiveData *CreatePrimitiveData(VulkanDevice *dev,const VIL *_vil,const uint32_t vc);
|
||||
PrimitiveData *CreatePrimitiveData(VertexDataManager *vdm,const uint32_t vc);
|
||||
VK_NAMESPACE_END
|
||||
|
@ -96,7 +96,7 @@ bool DeviceQueue::Submit(const VkCommandBuffer *cmd_buf,const uint32_t cb_count,
|
||||
return(result==VK_SUCCESS);
|
||||
}
|
||||
|
||||
bool DeviceQueue::Submit(GPUCmdBuffer *cmd_buf,Semaphore *wait_sem,Semaphore *complete_sem)
|
||||
bool DeviceQueue::Submit(VulkanCmdBuffer *cmd_buf,Semaphore *wait_sem,Semaphore *complete_sem)
|
||||
{
|
||||
if(cmd_buf->IsBegin())
|
||||
cmd_buf->End();
|
||||
|
@ -183,20 +183,20 @@ Material *RenderResource::CreateMaterial(const mtl::MaterialCreateInfo *mci)
|
||||
|
||||
namespace mtl
|
||||
{
|
||||
MaterialCreateInfo *LoadMaterialFromFile(const GPUDeviceAttribute *dev_attr,const AnsiString &, Material2DCreateConfig *);
|
||||
MaterialCreateInfo *LoadMaterialFromFile(const GPUDeviceAttribute *dev_attr,const AnsiString &, Material3DCreateConfig *);
|
||||
MaterialCreateInfo *LoadMaterialFromFile(const VulkanDevAttr *dev_attr,const AnsiString &, Material2DCreateConfig *);
|
||||
MaterialCreateInfo *LoadMaterialFromFile(const VulkanDevAttr *dev_attr,const AnsiString &, Material3DCreateConfig *);
|
||||
}
|
||||
|
||||
Material *RenderResource::LoadMaterial(const AnsiString &mtl_name,mtl::Material2DCreateConfig *cfg)
|
||||
{
|
||||
AutoDelete<mtl::MaterialCreateInfo> mci=mtl::LoadMaterialFromFile(device->GetDeviceAttribute(),mtl_name,cfg);
|
||||
AutoDelete<mtl::MaterialCreateInfo> mci=mtl::LoadMaterialFromFile(device->GetDevAttr(),mtl_name,cfg);
|
||||
|
||||
return this->CreateMaterial(mci);
|
||||
}
|
||||
|
||||
Material *RenderResource::LoadMaterial(const AnsiString &mtl_name,mtl::Material3DCreateConfig *cfg)
|
||||
{
|
||||
AutoDelete<mtl::MaterialCreateInfo> mci=mtl::LoadMaterialFromFile(device->GetDeviceAttribute(),mtl_name,cfg);
|
||||
AutoDelete<mtl::MaterialCreateInfo> mci=mtl::LoadMaterialFromFile(device->GetDevAttr(),mtl_name,cfg);
|
||||
|
||||
return this->CreateMaterial(mci);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
GPUDevice *IRenderTarget::GetDevice ()const{return render_framework->GetDevice();}
|
||||
VulkanDevice *IRenderTarget::GetDevice ()const{return render_framework->GetDevice();}
|
||||
VkDevice IRenderTarget::GetVkDevice()const{return render_framework->GetDevice()->GetDevice();}
|
||||
|
||||
IRenderTarget::IRenderTarget(RenderFramework *rf,const VkExtent2D &ext):desc_binding(DescriptorSetType::RenderTarget)
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
}
|
||||
};//struct ShaderModuleCreateInfo
|
||||
|
||||
ShaderModule *GPUDevice::CreateShaderModule(VkShaderStageFlagBits shader_stage_flag_bit,const uint32_t *spv_data,const size_t spv_size)
|
||||
ShaderModule *VulkanDevice::CreateShaderModule(VkShaderStageFlagBits shader_stage_flag_bit,const uint32_t *spv_data,const size_t spv_size)
|
||||
{
|
||||
if(!spv_data||spv_size<4)return(nullptr);
|
||||
|
||||
|
@ -69,7 +69,7 @@ TileData *TextureManager::CreateTileData(const VkFormat format,const uint width,
|
||||
if(width<=0||height<=0||count<=0)
|
||||
return(nullptr);
|
||||
|
||||
const uint32_t max_2d_texture=GetPhysicalDevice()->GetMaxImage2D();
|
||||
const uint32_t max_2d_texture=GetPhyDevice()->GetMaxImage2D();
|
||||
|
||||
uint tex_width,tex_height;
|
||||
|
||||
|
@ -7,7 +7,7 @@ namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
TextPrimitive::TextPrimitive(GPUDevice *dev,Material *m,uint mc):Primitive(mc)
|
||||
TextPrimitive::TextPrimitive(VulkanDevice *dev,Material *m,uint mc):Primitive(mc)
|
||||
{
|
||||
device=dev;
|
||||
mtl=m;
|
||||
|
@ -10,7 +10,7 @@ namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
TextRender::TextRender(GPUDevice *dev,FontSource *fs)
|
||||
TextRender::TextRender(VulkanDevice *dev,FontSource *fs)
|
||||
{
|
||||
device=dev;
|
||||
db=new RenderResource(device);
|
||||
@ -209,7 +209,7 @@ namespace hgl
|
||||
return AcquireFontSource(fnt);
|
||||
}
|
||||
|
||||
TextRender *CreateTextRender(GPUDevice *dev,FontSource *fs,RenderPass *rp,DeviceBuffer *ubo_camera_info,int limit)
|
||||
TextRender *CreateTextRender(VulkanDevice *dev,FontSource *fs,RenderPass *rp,DeviceBuffer *ubo_camera_info,int limit)
|
||||
{
|
||||
if(!dev||!rp||!ubo_camera_info)
|
||||
return(nullptr);
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
GPUDevice * GraphModule::GetDevice () {return render_framework->GetDevice();}
|
||||
VulkanDevice * GraphModule::GetDevice () {return render_framework->GetDevice();}
|
||||
VkDevice GraphModule::GetVkDevice ()const {return render_framework->GetVkDevice();}
|
||||
const GPUPhysicalDevice * GraphModule::GetPhysicalDevice ()const {return render_framework->GetPhysicalDevice();}
|
||||
GPUDeviceAttribute *GraphModule::GetDeviceAttribute ()const {return render_framework->GetDeviceAttribute();}
|
||||
const VulkanPhyDevice * GraphModule::GetPhyDevice ()const {return render_framework->GetPhyDevice();}
|
||||
VulkanDevAttr *GraphModule::GetDevAttr ()const {return render_framework->GetDevAttr();}
|
||||
|
||||
VkPipelineCache GraphModule::GetPipelineCache ()const {return render_framework->GetDeviceAttribute()->pipeline_cache;}
|
||||
VkPipelineCache GraphModule::GetPipelineCache ()const {return render_framework->GetDevAttr()->pipeline_cache;}
|
||||
|
||||
VK_NAMESPACE_END
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
GPUDevice *GraphModuleManager::GetDevice()const
|
||||
VulkanDevice *GraphModuleManager::GetDevice()const
|
||||
{
|
||||
return render_framework->GetDevice();
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ RenderPass *RenderPassManager::CreateRenderPass(const ArrayList<VkAttachmentDesc
|
||||
RenderPass *RenderPassManager::AcquireRenderPass(const RenderbufferInfo *rbi,const uint subpass_count)
|
||||
{
|
||||
{
|
||||
const auto *phy_dev=GetPhysicalDevice();
|
||||
const auto *phy_dev=GetPhyDevice();
|
||||
|
||||
for(const VkFormat &fmt:rbi->GetColorFormatList())
|
||||
if(!phy_dev->IsColorAttachmentOptimal(fmt))
|
||||
|
@ -46,7 +46,7 @@ RenderTarget *RenderTargetManager::CreateRT(const FramebufferInfo *fbi,RenderPas
|
||||
{
|
||||
RenderTargetData *rtd=new RenderTargetData{};
|
||||
|
||||
GPUDevice *dev=GetDevice();
|
||||
VulkanDevice *dev=GetDevice();
|
||||
|
||||
rtd->fbo =fb;
|
||||
rtd->queue =dev->CreateQueue(fence_count,false);
|
||||
|
@ -22,7 +22,7 @@ namespace
|
||||
// return swapchain_extent;
|
||||
//}
|
||||
|
||||
VkSwapchainKHR CreateVulkanSwapChain(const GPUDeviceAttribute *dev_attr)
|
||||
VkSwapchainKHR CreateVulkanSwapChain(const VulkanDevAttr *dev_attr)
|
||||
{
|
||||
VkSwapchainCreateInfoKHR swapchain_ci;
|
||||
|
||||
@ -111,8 +111,8 @@ bool SwapchainModule::CreateSwapchainFBO(Swapchain *swapchain)
|
||||
swapchain->sc_image=hgl_zero_new<SwapchainImage>(swapchain->image_count);
|
||||
|
||||
AnsiString num_string;
|
||||
GPUDevice *device=GetDevice();
|
||||
auto *dev_attr=GetDeviceAttribute();
|
||||
VulkanDevice *device=GetDevice();
|
||||
auto *dev_attr=GetDevAttr();
|
||||
|
||||
for(uint32_t i=0;i<swapchain->image_count;i++)
|
||||
{
|
||||
@ -150,7 +150,7 @@ bool SwapchainModule::CreateSwapchainFBO(Swapchain *swapchain)
|
||||
|
||||
Swapchain *SwapchainModule::CreateSwapchain()
|
||||
{
|
||||
auto *dev_attr=GetDeviceAttribute();
|
||||
auto *dev_attr=GetDevAttr();
|
||||
|
||||
if(!dev_attr)
|
||||
return(nullptr);
|
||||
@ -197,7 +197,7 @@ bool SwapchainModule::CreateSwapchainRenderTarget()
|
||||
if(!swapchain)
|
||||
return(false);
|
||||
|
||||
GPUDevice *device=GetDevice();
|
||||
VulkanDevice *device=GetDevice();
|
||||
|
||||
SwapchainRenderTargetData *rtd_list=new SwapchainRenderTargetData[swapchain->image_count];
|
||||
SwapchainRenderTargetData *rtd=rtd_list;
|
||||
@ -241,7 +241,7 @@ SwapchainModule::SwapchainModule(RenderFramework *rf,TextureManager *tm,RenderTa
|
||||
rt_manager=rtm;
|
||||
rp_manager=rpm;
|
||||
|
||||
auto *dev_attr=GetDeviceAttribute();
|
||||
auto *dev_attr=GetDevAttr();
|
||||
|
||||
SwapchainRenderbufferInfo rbi(dev_attr->surface_format.format,dev_attr->physical_device->GetDepthFormat());
|
||||
|
||||
@ -262,7 +262,7 @@ void SwapchainModule::OnResize(const VkExtent2D &extent)
|
||||
{
|
||||
SAFE_CLEAR(sc_render_target)
|
||||
|
||||
GPUDeviceAttribute *dev_attr=GetDeviceAttribute();
|
||||
VulkanDevAttr *dev_attr=GetDevAttr();
|
||||
|
||||
dev_attr->RefreshSurfaceCaps();
|
||||
|
||||
|
@ -6,13 +6,13 @@
|
||||
VK_NAMESPACE_BEGIN
|
||||
const VkFormatProperties TextureManager::GetFormatProperties(const VkFormat format) const
|
||||
{
|
||||
return GetPhysicalDevice()->GetFormatProperties(format);
|
||||
return GetPhyDevice()->GetFormatProperties(format);
|
||||
}
|
||||
|
||||
GRAPH_MODULE_CONSTRUCT(TextureManager)
|
||||
{
|
||||
auto dev=GetDevice();
|
||||
auto phy_device=GetPhysicalDevice();
|
||||
auto phy_device=GetPhyDevice();
|
||||
|
||||
texture_cmd_buf=dev->CreateTextureCommandBuffer(phy_device->GetDeviceName()+AnsiString(":TexCmdBuffer"));
|
||||
|
||||
|
@ -72,7 +72,7 @@ const int RenderNode::compare(const RenderNode &other)const
|
||||
return -1;
|
||||
}
|
||||
|
||||
MaterialRenderList::MaterialRenderList(GPUDevice *d,bool l2w,const RenderPipelineIndex &rpi)
|
||||
MaterialRenderList::MaterialRenderList(VulkanDevice *d,bool l2w,const RenderPipelineIndex &rpi)
|
||||
{
|
||||
device=d;
|
||||
cmd_buf=nullptr;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include<hgl/graph/mtl/UBOCommon.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
RenderAssignBuffer::RenderAssignBuffer(GPUDevice *dev,Material *mtl)
|
||||
RenderAssignBuffer::RenderAssignBuffer(VulkanDevice *dev,Material *mtl)
|
||||
{
|
||||
hgl_zero(*this);
|
||||
|
||||
|
@ -41,7 +41,7 @@ class RenderAssignBuffer
|
||||
|
||||
private:
|
||||
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
|
||||
Material *material;
|
||||
|
||||
@ -80,7 +80,7 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
RenderAssignBuffer(GPUDevice *dev,Material *);
|
||||
RenderAssignBuffer(VulkanDevice *dev,Material *);
|
||||
~RenderAssignBuffer(){Clear();}
|
||||
|
||||
//下一代,将MaterialInstanceSets使用提前化,这样不用每一次绘制都重新写入MI DATA,可以提升效率。
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user