to advance ShaderResource/VKBuffer
This commit is contained in:
parent
f76235ef5c
commit
967c66569b
@ -1 +1 @@
|
||||
Subproject commit fccbd425e23f0b82f2953313fd8bacf7a01c5379
|
||||
Subproject commit c4f5e3d339dac74cfb48f7cf17ea18e51990c709
|
@ -1,6 +1,3 @@
|
||||
// 2.RectanglePrimivate
|
||||
// 该示例是texture_rect的进化,演示使用GeometryShader画矩形
|
||||
|
||||
#include"VulkanAppFramework.h"
|
||||
#include<hgl/graph/vulkan/VKTexture.h>
|
||||
#include<hgl/graph/vulkan/VKSampler.h>
|
||||
|
@ -36,8 +36,8 @@ namespace hgl
|
||||
}
|
||||
|
||||
virtual VkFormat GetDataType ()const=0; ///<取得数据类型
|
||||
// const uint32_t GetDataBytes ()const{return comp_stride;} ///<取得每数据字节数
|
||||
// const uint32_t GetComponent ()const{return dc_num; } ///<取数缓冲区元数据数量
|
||||
const uint32_t GetDataBytes ()const{return comp_stride;} ///<取得每数据字节数
|
||||
const uint32_t GetComponent ()const{return dc_num; } ///<取数缓冲区元数据数量
|
||||
const uint32_t GetCount ()const{return count; } ///<取得数据数量
|
||||
const uint32_t GetStride ()const{return stride;} ///<取得每一组数据字节数
|
||||
void * GetData ()const{return mem_data;} ///<取得数据指针
|
||||
|
@ -9,6 +9,7 @@ VK_NAMESPACE_BEGIN
|
||||
{
|
||||
AnsiString name;
|
||||
uint location;
|
||||
uint component;
|
||||
VkFormat format;
|
||||
};//struct ShaderStage
|
||||
|
||||
@ -60,7 +61,8 @@ VK_NAMESPACE_BEGIN
|
||||
ShaderStageList &GetStageInputs(){return stage_inputs;}
|
||||
ShaderStageList &GetStageOutputs(){return stage_outputs;}
|
||||
|
||||
const int GetStageInputBinding(const AnsiString &);
|
||||
const ShaderStage *GetStage(const AnsiString &)const;
|
||||
const int GetStageInputBinding(const AnsiString &)const;
|
||||
|
||||
const ShaderDescriptorList *GetDescriptorList()const{return descriptor_list;}
|
||||
ShaderDescriptorList *GetDescriptorList(VkDescriptorType desc_type)
|
||||
|
@ -72,6 +72,7 @@ public:
|
||||
* 获取输入流绑定点,需要注意的时,这里获取的binding并非是shader中的binding/location,而是绑定顺序的序列号。对应vkCmdBindVertexBuffer的缓冲区序列号
|
||||
*/
|
||||
const int GetStageInputBinding(const AnsiString &name)const{return shader_resource->GetStageInputBinding(name);}
|
||||
const ShaderStage * GetStage(const AnsiString &name)const{return shader_resource->GetStage(name);}
|
||||
|
||||
const uint32_t GetAttrCount()const{return attr_count;}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include<hgl/graph/vulkan/VKBuffer.h>
|
||||
#include<hgl/graph/VertexBuffer.h>
|
||||
#include<spirv_cross/spirv_common.hpp>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
Buffer::~Buffer()
|
||||
@ -6,4 +8,14 @@ Buffer::~Buffer()
|
||||
if(buf.memory)delete buf.memory;
|
||||
vkDestroyBuffer(device,buf.buffer,nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
VertexBufferCreater *CreateVBO(const uint32_t base_type,const uint32_t vecsize,const uint32_t vertex_count)
|
||||
{
|
||||
if(vecsize==1)return(new VB1f(vertex_count));else
|
||||
if(vecsize==2)return(new VB2f(vertex_count));else
|
||||
if(vecsize==3)return(new VB3f(vertex_count));else
|
||||
if(vecsize==4)return(new VB4f(vertex_count));else
|
||||
}
|
||||
VK_NAMESPACE_END
|
||||
|
@ -33,7 +33,7 @@ namespace hgl
|
||||
|
||||
bool MakeCharBitmap(FontBitmap *,u32char) override; ///<产生字体数据
|
||||
int GetLineHeight()const override{return LineHeight;} ///<取得行高
|
||||
int GetCharWidth(const u32char &) override;
|
||||
int GetCharAdvWidth(const u32char &) override;
|
||||
};//class WinBitmapFont
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
|
@ -28,7 +28,6 @@ VK_NAMESPACE_BEGIN
|
||||
const uint32 total_bytes=AccessByPointer(data,uint32);
|
||||
|
||||
int basetype;
|
||||
int vec_size;
|
||||
int str_len;
|
||||
|
||||
ShaderStage *ss;
|
||||
@ -39,9 +38,9 @@ VK_NAMESPACE_BEGIN
|
||||
|
||||
ss->location=*data++;
|
||||
basetype=*data++;
|
||||
vec_size=*data++;
|
||||
ss->component=*data++;
|
||||
|
||||
ss->format=VK_NAMESPACE::GetVulkanFormat(basetype,vec_size);
|
||||
ss->format=VK_NAMESPACE::GetVulkanFormat(basetype,ss->component);
|
||||
|
||||
str_len=*data++;
|
||||
ss->name.SetString((char *)data,str_len);
|
||||
@ -86,7 +85,23 @@ VK_NAMESPACE_BEGIN
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
const int ShaderResource::GetStageInputBinding(const AnsiString &name)
|
||||
const ShaderStage *ShaderResource::GetStage(const AnsiString &name) const
|
||||
{
|
||||
const int count=stage_inputs.GetCount();
|
||||
ShaderStage **ss=stage_inputs.GetData();
|
||||
|
||||
for(int i=0;i<count;i++)
|
||||
{
|
||||
if(name==(*ss)->name)
|
||||
return *ss;
|
||||
|
||||
++ss;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const int ShaderResource::GetStageInputBinding(const AnsiString &name) const
|
||||
{
|
||||
const int count=stage_inputs.GetCount();
|
||||
ShaderStage **ss=stage_inputs.GetData();
|
||||
|
Loading…
x
Reference in New Issue
Block a user