upgraded codes and then it can run.

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-07-28 20:17:46 +08:00
parent df80b1af3b
commit 7967150722
35 changed files with 247 additions and 48 deletions

2
CMCore

@ -1 +1 @@
Subproject commit ca3f7eb55f9e4c1fad44993b70a473f8e3c2ed00
Subproject commit 116799bc4ea02ffe85e8cb071272b1cddc2753c1

@ -1 +1 @@
Subproject commit fdd40d7c7685c674541279154f0decb3fe156c36
Subproject commit 618fda25036a1949de990d0588e87f838f15e6c8

@ -1 +1 @@
Subproject commit 65ef7052d162225a03e96a895586c3492ddd7447
Subproject commit 1c67c9e3ac8d7ccf6c05e9b67ad525a8d94fc496

2
CMUtil

@ -1 +1 @@
Subproject commit f4d19fc898e9434e93f77843975369744e59350a
Subproject commit 464272b3c156d66e6a574e5ac09e8ae08a540ecc

View File

@ -23,6 +23,7 @@
#include<hgl/graph/mtl/UBOCommon.h>
#include<hgl/color/Color.h>
#include<hgl/Time.h>
#include<hgl/log/LogInfo.h>
//#include<hgl/graph/LookAtCameraControl.h>
#include<hgl/graph/FirstPersonCameraControl.h>

View File

@ -1,7 +1,7 @@
#ifndef HGL_GRAPH_SCENE_NODE_INCLUDE
#define HGL_GRAPH_SCENE_NODE_INCLUDE
#include<hgl/type/List.h>
#include<hgl/type/ObjectList.h>
#include<hgl/graph/SceneOrient.h>
#include<hgl/graph/VK.h>
#include<hgl/graph/AABB.h>

View File

@ -3,8 +3,8 @@
#include<hgl/io/InputStream.h>
#include<hgl/type/String.h>
#include<hgl/graph/Bitmap.h>
#include<hgl/graph/VKFormat.h>
#include<hgl/graph/BitmapData.h>
namespace hgl
{
namespace graph

View File

@ -1,32 +1,17 @@
#ifndef HGL_GRAPH_TILE_DATA_INCLUDE
#define HGL_GRAPH_TILE_DATA_INCLUDE
#include<hgl/type/Map.h>
#include<hgl/type/Pool.h>
#include<hgl/type/RectScope.h>
#include<hgl/graph/Bitmap.h>
#include<hgl/graph/BitmapData.h>
#include<hgl/graph/ImageRegion.h>
#include<hgl/graph/tile/TileObject.h>
#include<hgl/graph/VKTexture.h>
VK_NAMESPACE_USING
namespace hgl
{
namespace graph
{
using TileUVPixel=RectScope2i;
using TileUVFloat=RectScope2f;
using TileUVFloatList=List<TileUVFloat>;
using TileUVFloatMap=Map<u32char,TileUVFloat>;
struct TileObject
{
int col,row; //当前tile在整个纹理中的tile位置
TileUVPixel uv_pixel; //以象素为单位的tile位置和尺寸
TileUVFloat uv_float; //以浮点为单位的tile位置和尺寸
};//struct TileObject
/**
* TileData是一种处理大量等同尺寸及格式贴图的管理机制(Tile的大小不必符合2次幂)
* Tile的增加或删除I/O消耗

View File

@ -1,6 +1,7 @@
#ifndef HGL_GRAPH_VULKAN_INCLUDE
#define HGL_GRAPH_VULKAN_INCLUDE
#include<hgl/type/List.h>
#include<hgl/math/Math.h>
#include<hgl/type/String.h>
#include<hgl/type/Map.h>

View File

@ -64,7 +64,7 @@ public:
{
if(index>=cv_count)return;
hgl_cpy(clear_values[index].color.float32,cc.rgba,4);
hgl_cpy(clear_values[index].stop_color.float32,cc.rgba,4);
}
void SetClearDepthStencil(uint32_t index,float d=1.0f,float s=0)

View File

@ -2,6 +2,7 @@
#define HGL_GRAPH_DESCRIPTOR_BINDING_MANAGE_INCLUDE
#include<hgl/type/Map.h>
#include<hgl/type/String.h>
#include<hgl/graph/VKDescriptorSetType.h>
namespace hgl
{

View File

@ -3,6 +3,7 @@
#include<hgl/graph/VK.h>
#include<hgl/type/Map.h>
#include<hgl/type/ObjectList.h>
#include<hgl/type/SortedSets.h>
VK_NAMESPACE_BEGIN
class DeviceBuffer;

View File

@ -5,8 +5,9 @@
#include<hgl/type/String.h>
#include<hgl/type/Map.h>
#include<hgl/type/RectScope.h>
#include<hgl/graph/ImageRegion.h>
#include<hgl/platform/Window.h>
#include<hgl/graph/Bitmap.h>
#include<hgl/graph/BitmapData.h>
#include<hgl/graph/font/Font.h>
#include<hgl/graph/VK.h>
#include<hgl/graph/VKDeviceAttribute.h>

View File

@ -2,7 +2,7 @@
#define HGL_GRAPH_VULKAN_INSTANCE_INCLUDE
#include<hgl/type/String.h>
#include<hgl/type/List.h>
#include<hgl/type/ObjectList.h>
#include<hgl/platform/Window.h>
#include<hgl/graph/VKPhysicalDevice.h>
#include<hgl/graph/VKDebugOut.h>

View File

@ -3,7 +3,7 @@
#include<hgl/graph/VK.h>
#include<hgl/graph/VKPipeline.h>
#include<hgl/type/List.h>
#include<hgl/type/ObjectList.h>
VK_NAMESPACE_BEGIN
/**
* RenderPass功能封装<br>

View File

@ -13,7 +13,7 @@
#include<hgl/graph/VertexAttribData.h>
#include<hgl/graph/VKRenderable.h>
#include<hgl/graph/font/TextPrimitive.h>
#include<hgl/type/ResManage.h>
#include<hgl/type/ObjectManage.h>
#include<hgl/shadergen/MaterialCreateInfo.h>
#include<hgl/graph/VKDescriptorBindingManage.h>
@ -43,14 +43,14 @@ class RenderResource
Map<AnsiString,Material *> material_by_name;
Map<OSString,Texture *> texture_by_name;
IDResManage<MaterialID, Material> rm_material; ///<材质合集
IDResManage<MaterialInstanceID, MaterialInstance> rm_material_instance; ///<材质实例合集
IDResManage<DescriptorSetID, DescriptorSet> rm_desc_sets; ///<描述符合集
IDResManage<PrimitiveID, Primitive> rm_primitives; ///<图元合集
IDResManage<BufferID, DeviceBuffer> rm_buffers; ///<顶点缓冲区合集
IDResManage<SamplerID, Sampler> rm_samplers; ///<采样器合集
IDResManage<TextureID, Texture> rm_textures; ///<纹理合集
IDResManage<RenderableID, Renderable> rm_renderables; ///<渲染实例集合集
IDObjectManage<MaterialID, Material> rm_material; ///<材质合集
IDObjectManage<MaterialInstanceID, MaterialInstance> rm_material_instance; ///<材质实例合集
IDObjectManage<DescriptorSetID, DescriptorSet> rm_desc_sets; ///<描述符合集
IDObjectManage<PrimitiveID, Primitive> rm_primitives; ///<图元合集
IDObjectManage<BufferID, DeviceBuffer> rm_buffers; ///<顶点缓冲区合集
IDObjectManage<SamplerID, Sampler> rm_samplers; ///<采样器合集
IDObjectManage<TextureID, Texture> rm_textures; ///<纹理合集
IDObjectManage<RenderableID, Renderable> rm_renderables; ///<渲染实例集合集
public:

View File

@ -4,7 +4,7 @@
#include<hgl/graph/VK.h>
#include<hgl/graph/VKMemory.h>
#include<hgl/graph/VKImageView.h>
#include<hgl/graph/Bitmap.h>
#include<hgl/graph/BitmapData.h>
#include<hgl/type/String.h>
#include<hgl/graph/VKTextureCreateInfo.h>
VK_NAMESPACE_BEGIN

View File

@ -9,6 +9,8 @@ namespace hgl
{
namespace graph
{
using TileUVFloatMap=Map<u32char,RectScope2f>;
using TileResPool=ResPool<u32char,TileObject *>;
/**

View File

@ -249,8 +249,30 @@ IF(WIN32)
IF(FORCE_DISCETE_GPU)
SET(RENDER_DEVICE_SOURCE ForceDiscreteGPU.c)
ENDIF()
SET(VULKAN_SURFACE_SOURCE Vulkan/Platform/WinVulkan.cpp)
ENDIF(WIN32)
IF(UNIX)
IF(ANDROID)
SET(VULKAN_SURFACE_SOURCE Vulkan/Platform/AndroidVulkan.cpp)
ELSE()
IF(APPLE)
ELSE()
SET(VULKAN_SURFACE_SOURCE Vulkan/Platform/XCBVulkan.cpp)
ENDIF()
ENDIF()
ENDIF(UNIX)
SOURCE_GROUP("Vulkan\\Surface" FILES ${VULKAN_SURFACE_SOURCE})
SET(VULKAN_RENDER_SOURCE ${VK_RR_SOURCE}
${VK_RR_SHADER_FILES}
${VK_RR_MATERIAL_FILES}
@ -288,4 +310,5 @@ add_cm_library(ULRE.SceneGraph "ULRE" ${SCENE_GRAPH_HEADER}
# ${FONT_LAYOUT_SOURCE}
# ${TEXT_RENDERABLE_SOURCE}
${VULKAN_RENDER_SOURCE})
${VULKAN_RENDER_SOURCE}
${VULKAN_SURFACE_SOURCE})

View File

@ -133,7 +133,7 @@ void MaterialRenderList::Stat()
RenderNode *rn=rn_list.GetData();
ri_list.ClearData();
ri_list.PreMalloc(count);
ri_list.PreAlloc(count);
mi_set.ClearData();

View File

@ -22,7 +22,7 @@ namespace hgl
tile_max_count=tile_rows*tile_cols;
tile_count=0;
to_pool.PreMalloc(tile_max_count);
to_pool.PreAlloc(tile_max_count);
{
int col=0,row=0;
TileObject **to=to_pool.GetInactiveData();

View File

@ -38,7 +38,7 @@ void DebugMaker::Begin(VkCommandBuffer cmdbuffer, const char * pMarkerName, cons
VkDebugMarkerMarkerInfoEXT markerInfo = {};
markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT;
memcpy(markerInfo.color, &color, sizeof(float) * 4);
memcpy(markerInfo.stop_color, &color, sizeof(float) * 4);
markerInfo.pMarkerName = pMarkerName;
dmf.Begin(cmdbuffer, &markerInfo);
@ -51,7 +51,7 @@ void DebugMaker::Insert(VkCommandBuffer cmdbuffer, const char *markerName, const
VkDebugMarkerMarkerInfoEXT markerInfo = {};
markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT;
memcpy(markerInfo.color, &color, sizeof(float) * 4);
memcpy(markerInfo.stop_color, &color, sizeof(float) * 4);
markerInfo.pMarkerName = markerName;
dmf.Insert(cmdbuffer, &markerInfo);

View File

@ -40,10 +40,10 @@ struct DebugUtilsLabel:public VkDebugUtilsLabelEXT
sType=VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
pNext=nullptr;
pLabelName=n;
color[0]=c.r;
color[1]=c.g;
color[2]=c.b;
color[3]=c.a;
stop_color[0]=c.r;
stop_color[1]=c.g;
stop_color[2]=c.b;
stop_color[3]=c.a;
}
};//struct DebugUtilsLabel

View File

@ -0,0 +1,29 @@
#include<hgl/platform/Vulkan.h>
#include"AndroidWindow.h"
#include<vulkan/vulkan_android.h>
namespace hgl
{
VkSurfaceKHR CreateVulkanSurface(VkInstance vk_inst,Window *w)
{
if(vk_inst==VK_NULL_HANDLE)return(VK_NULL_HANDLE);
if(!w)return(VK_NULL_HANDLE);
AndroidWindow *win=(Android *)w;
VkAndroidSurfaceCreateInfoKHR createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = nullptr;
createInfo.flags = 0;
createInfo.window = win->GetWindow();
VkSurfaceKHR surface;
VkResult res=CreateAndroidSurfaceKHR(vk_inst,&createInfo,nullptr,&surface);
if(res!=VK_SUCCESS)
return(VK_NULL_HANDLE);
return(surface);
}
}//namespace hgl

View File

@ -0,0 +1,29 @@
#include<hgl/platform/Vulkan.h>
#include"MacWindow.h"
#include<vulkan/vulkan_macos.h>
namespace hgl
{
VkSurfaceKHR CreateVulkanSurface(VkInstance vk_inst,Window *w)
{
if(vk_inst==VK_NULL_HANDLE)return(VK_NULL_HANDLE);
if(!w)return(VK_NULL_HANDLE);
MacWindow *win=(MacWindow *)w;
VkMacOSSurfaceCreateInfoMVK createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK;
createInfo.pNext = nullptr;
createInfo.flags = 0;
createInfo.pView = win->GetView();
VkSurfaceKHR surface;
VkResult res = vkCreateMacOSSurfaceMVK(vk_inst, &createInfo, nullptr, &surface);
if (res != VK_SUCCESS)
return(VK_NULL_HANDLE);
return(surface);
}
}//namespace hgl

View File

@ -0,0 +1,30 @@
#include<hgl/platform/Vulkan.h>
#include"WaylandWindow.h"
#include<vulkan/vulkan_wayland.h>
namespace hgl
{
VkSurfaceKHR CreateVulkanSurface(VkInstance vk_inst,Window *w)
{
if(vk_inst==VK_NULL_HANDLE)return(VK_NULL_HANDLE);
if(!w)return(VK_NULL_HANDLE);
WaylandWindow *win=(WaylandWindow *)w;
VkWaylandSurfaceCreateInfoKHR createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = nullptr;
createInfo.flags = 0;
createInfo.display = win->GetDisplay();
createInfo.surface = win->GetSurface();
VkSurfaceKHR surface;
VkResult res = vkCreateWaylandSurfaceKHR(vk_inst, &createInfo, nullptr, &surface);
if (res != VK_SUCCESS)
return(VK_NULL_HANDLE);
return(surface);
}
}//namespace hgl

View File

@ -0,0 +1,30 @@
#include<hgl/platform/Vulkan.h>
#include<hgl/platform/WinWindow.h>
#include<vulkan/vulkan_win32.h>
namespace hgl
{
VkSurfaceKHR CreateVulkanSurface(VkInstance vk_inst,Window *w)
{
if(vk_inst==VK_NULL_HANDLE)return(VK_NULL_HANDLE);
if(!w)return(VK_NULL_HANDLE);
WinWindow *win=(WinWindow *)w;
VkWin32SurfaceCreateInfoKHR createInfo;
createInfo.sType =VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
createInfo.pNext =nullptr;
createInfo.flags =0;
createInfo.hinstance=win->GetInstance();
createInfo.hwnd =win->GetWnd();
VkSurfaceKHR surface;
VkResult res=vkCreateWin32SurfaceKHR(vk_inst,&createInfo,nullptr,&surface);
if(res!=VK_SUCCESS)
return(VK_NULL_HANDLE);
return(surface);
}
}//namespace hgl

View File

@ -0,0 +1,30 @@
#include<hgl/platform/Vulkan.h>
#include"XCBWindow.h"
#include<vulkan/vulkan_xcb.h>
namespace hgl
{
VkSurfaceKHR CreateVulkanSurface(VkInstance vk_inst,Window *w)
{
if(vk_inst==VK_NULL_HANDLE)return(VK_NULL_HANDLE);
if(!w)return(VK_NULL_HANDLE);
XCBWindow *win=(XCBWindow *)w;
VkXcbSurfaceCreateInfoKHR createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = nullptr;
createInfo.flags = 0;
createInfo.connection = win->GetConnection();
createInfo.window = win->GetWindow();
VkSurfaceKHR surface;
VkResult res = vkCreateXcbSurfaceKHR(vk_inst, &createInfo, nullptr, &surface);
if (res != VK_SUCCESS)
return(VK_NULL_HANDLE);
return(surface);
}
}//namespace hgl

View File

@ -0,0 +1,29 @@
#include<hgl/platform/Vulkan.h>
#include"iOSWindow.h"
#include<vulkan/vulkan_ios.h>
namespace hgl
{
VkSurfaceKHR CreateVulkanSurface(VkInstance vk_inst,Window *w)
{
if(vk_inst==VK_NULL_HANDLE)return(VK_NULL_HANDLE);
if(!w)return(VK_NULL_HANDLE);
iOSWindow *win=(iOSWindow *)w;
VkIOSSurfaceCreateInfoMVK createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK;
createInfo.pNext = nullptr;
createInfo.flags = 0;
createInfo.pView = win->GetView();
VkSurfaceKHR surface;
VkResult res = vkCreateIOSSurfaceMVK(vk_inst, &createInfo, nullptr, &surface);
if (res != VK_SUCCESS)
return(VK_NULL_HANDLE);
return(surface);
}
}//namespace hgl

View File

@ -2,6 +2,7 @@
#include<hgl/graph/VKIndexBuffer.h>
#include<hgl/graph/VKVertexAttribBuffer.h>
#include<hgl/graph/VKPhysicalDevice.h>
#include<iostream>
VK_NAMESPACE_BEGIN
const VkDeviceSize GPUDevice::GetUBOAlign (){return attr->physical_device->GetUBOAlign();}

View File

@ -9,6 +9,7 @@
#include<hgl/graph/VKDevice.h>
#include<hgl/graph/VKDebugMaker.h>
#include<iostream>
#include<iomanip>
VK_NAMESPACE_BEGIN

View File

@ -6,6 +6,7 @@
#include<hgl/graph/VKShaderModuleMap.h>
#include<hgl/graph/VKVertexInputLayout.h>
#include"VKPipelineLayoutData.h"
#include<hgl/log/LogInfo.h>
VK_NAMESPACE_BEGIN

View File

@ -1,6 +1,7 @@
#include<hgl/graph/VKDevice.h>
#include<hgl/graph/VKDeviceAttribute.h>
#include<hgl/graph/VKPhysicalDevice.h>
#include<iostream>
VK_NAMESPACE_BEGIN
namespace

View File

@ -3,6 +3,7 @@
#include<hgl/graph/VKMaterialParameters.h>
#include<hgl/graph/VKMaterial.h>
#include<hgl/graph/VKVertexAttribBuffer.h>
#include<hgl/log/LogInfo.h>
VK_NAMESPACE_BEGIN
VertexInputData::VertexInputData(const uint32_t c,const uint32_t vc,const IndexBufferData *ibd)

View File

@ -1,7 +1,9 @@
#include<hgl/shadergen/ShaderCreateInfo.h>
#include<hgl/shadergen/ShaderDescriptorInfo.h>
#include"GLSLCompiler.h"
#include<hgl/graph/mtl/UBOCommon.h>
#include<hgl/log/LogInfo.h>
#include"GLSLCompiler.h"
#include"common/MFCommon.h"
namespace hgl{namespace graph{