support .shader file(version 1)
This commit is contained in:
parent
fd25567f13
commit
54e5531fc4
@ -151,7 +151,7 @@ private:
|
||||
|
||||
return tl_engine.Init();
|
||||
}
|
||||
|
||||
|
||||
bool InitTextRenderable()
|
||||
{
|
||||
UTF16String str;
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include<hgl/filesystem/FileSystem.h>
|
||||
#include<hgl/graph/InlineGeometry.h>
|
||||
#include<hgl/graph/RenderableInstance.h>
|
||||
#include<hgl/graph/VertexBuffer.h>
|
||||
#include<hgl/graph/VertexBufferData.h>
|
||||
|
||||
#include<hgl/graph/data/SceneNodeData.h>
|
||||
|
||||
|
@ -20,13 +20,15 @@ VK_NAMESPACE_BEGIN
|
||||
uint binding;
|
||||
};//struct ShaderStage
|
||||
|
||||
using ShaderStageList =ObjectList<ShaderStage>;
|
||||
using ShaderBindingList =List<uint32_t>;
|
||||
using ShaderStageList =ObjectList<ShaderStage>;
|
||||
using DescriptorSetList =List<uint32_t>;
|
||||
using DescriptorBindingList =List<uint32_t>;
|
||||
|
||||
struct ShaderDescriptorList
|
||||
{
|
||||
AnsiStringList name_list;
|
||||
ShaderBindingList binding_list;
|
||||
AnsiStringList name_list;
|
||||
DescriptorSetList set_list;
|
||||
DescriptorBindingList binding_list;
|
||||
};
|
||||
|
||||
#ifndef VK_DESCRIPTOR_TYPE_BEGIN_RANGE
|
||||
@ -88,7 +90,7 @@ VK_NAMESPACE_BEGIN
|
||||
ShaderDescriptorList &GetSampler(){return descriptor_list[VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER];}
|
||||
|
||||
const int GetBinding (VkDescriptorType desc_type,const AnsiString &name)const;
|
||||
const ShaderBindingList * GetBindingList (VkDescriptorType desc_type)const
|
||||
const DescriptorBindingList * GetBindingList (VkDescriptorType desc_type)const
|
||||
{
|
||||
if(desc_type<VK_DESCRIPTOR_TYPE_BEGIN_RANGE
|
||||
||desc_type>VK_DESCRIPTOR_TYPE_END_RANGE)return nullptr;
|
||||
|
@ -97,7 +97,7 @@ public: //Buffer相关
|
||||
VAB * CreateVAB (VkFormat format,uint32_t count, VkSharingMode sharing_mode=VK_SHARING_MODE_EXCLUSIVE){return CreateVAB(format,count,nullptr,sharing_mode);}
|
||||
VAB * CreateVAB (const VAD *vad, VkSharingMode sharing_mode=VK_SHARING_MODE_EXCLUSIVE){return CreateVAB(vad->GetVulkanFormat(),vad->GetCount(),vad->GetData(),sharing_mode);}
|
||||
|
||||
IndexBuffer * CreateIBO (VkIndexType index_type,uint32_t count,const void *data,VkSharingMode sharing_mode=VK_SHARING_MODE_EXCLUSIVE);
|
||||
IndexBuffer * CreateIBO (VkIndexType index_type,uint32_t count,const void * data,VkSharingMode sharing_mode=VK_SHARING_MODE_EXCLUSIVE);
|
||||
IndexBuffer * CreateIBO16 ( uint32_t count,const uint16 *data,VkSharingMode sharing_mode=VK_SHARING_MODE_EXCLUSIVE){return CreateIBO(VK_INDEX_TYPE_UINT16,count,(void *)data,sharing_mode);}
|
||||
IndexBuffer * CreateIBO32 ( uint32_t count,const uint32 *data,VkSharingMode sharing_mode=VK_SHARING_MODE_EXCLUSIVE){return CreateIBO(VK_INDEX_TYPE_UINT32,count,(void *)data,sharing_mode);}
|
||||
|
||||
|
@ -26,10 +26,10 @@ public:
|
||||
|
||||
void Bind(const uint32_t binding,VkDescriptorType,VkShaderStageFlagBits);
|
||||
void Bind(const uint32_t *binding,const uint32_t count,VkDescriptorType type,VkShaderStageFlagBits stage);
|
||||
void Bind(const ShaderBindingList &sbl,VkDescriptorType type,VkShaderStageFlagBits stage)
|
||||
void Bind(const DescriptorBindingList &dbl,VkDescriptorType type,VkShaderStageFlagBits stage)
|
||||
{
|
||||
if(sbl.GetCount()>0)
|
||||
Bind(sbl.GetData(),sbl.GetCount(),type,stage);
|
||||
if(dbl.GetCount()>0)
|
||||
Bind(dbl.GetData(),dbl.GetCount(),type,stage);
|
||||
}
|
||||
|
||||
void Bind(const ShaderDescriptorList *sdl,VkShaderStageFlagBits stage)
|
||||
|
@ -53,7 +53,7 @@ VK_NAMESPACE_BEGIN
|
||||
return data;
|
||||
}
|
||||
|
||||
const uint8 *LoadShaderDescriptor(ShaderDescriptorList *sd_list,const uint8 *data)
|
||||
const uint8 *LoadShaderDescriptor(const uint8_t version,ShaderDescriptorList *sd_list,const uint8 *data)
|
||||
{
|
||||
const uint32 total_bytes=AccessByPointer(data,uint32);
|
||||
|
||||
@ -63,6 +63,9 @@ VK_NAMESPACE_BEGIN
|
||||
|
||||
for(uint i=0;i<count;i++)
|
||||
{
|
||||
if(version>=1)
|
||||
sd_list->set_list.Add(*data++);
|
||||
|
||||
sd_list->binding_list.Add(*data++);
|
||||
str_len=*data++;
|
||||
sd_list->name_list.Add(AnsiString((char *)data,str_len));
|
||||
@ -174,7 +177,7 @@ VK_NAMESPACE_BEGIN
|
||||
{
|
||||
desc_type=AccessByPointer(filedata,uint32);
|
||||
|
||||
filedata=LoadShaderDescriptor(sr->GetDescriptorList((VkDescriptorType)desc_type),filedata);
|
||||
filedata=LoadShaderDescriptor(version,sr->GetDescriptorList((VkDescriptorType)desc_type),filedata);
|
||||
}
|
||||
|
||||
return sr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user