TextureData增加初始值设置
This commit is contained in:
parent
e42e721553
commit
946cef0e11
@ -93,7 +93,7 @@ public: //Buffer相关
|
||||
|
||||
public: //material相关
|
||||
|
||||
Texture2D *CreateRefTexture2D(uint32_t width,uint32_t height,VkFormat format,VkImageAspectFlagBits flag,VkImage image,VkImageView image_view);
|
||||
Texture2D *CreateRefTexture2D(uint32_t width,uint32_t height,VkFormat format,VkImageAspectFlagBits flag,VkImage image,VkImageLayout image_layout,VkImageView image_view);
|
||||
|
||||
Texture2D *CreateTexture2D(const VkFormat video_format,void *data,uint32_t width,uint32_t height,uint32_t size,bool force_linear=false);
|
||||
bool ChangeTexture2D(Texture2D *,void *data,uint32_t left,uint32_t top,uint32_t width,uint32_t height,uint32_t size);
|
||||
|
@ -6,21 +6,14 @@
|
||||
VK_NAMESPACE_BEGIN
|
||||
struct TextureData
|
||||
{
|
||||
VkDeviceMemory memory;
|
||||
VkImage image;
|
||||
VkImageLayout image_layout;
|
||||
ImageView *image_view;
|
||||
uint32 mip_levels;
|
||||
bool linear;
|
||||
VkDeviceMemory memory =nullptr;
|
||||
VkImage image =nullptr;
|
||||
VkImageLayout image_layout=VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
ImageView * image_view =nullptr;
|
||||
uint32 mip_levels =0;
|
||||
bool linear =false;
|
||||
|
||||
bool ref; //是否是引用
|
||||
|
||||
public:
|
||||
|
||||
TextureData(bool r=false)
|
||||
{
|
||||
ref=r;
|
||||
}
|
||||
bool ref =false; //是否是引用
|
||||
};//struct TextureData
|
||||
|
||||
class Texture
|
||||
|
@ -45,14 +45,10 @@ Texture2D *Device::CreateTexture2D(const VkFormat video_format,void *data,uint32
|
||||
return(nullptr); //这个我们暂时不支持
|
||||
}
|
||||
|
||||
TextureData *tex_data=new TextureData(false);
|
||||
|
||||
tex_data->memory=nullptr;
|
||||
tex_data->image=nullptr;
|
||||
tex_data->image_view=nullptr;
|
||||
TextureData *tex_data=new TextureData;
|
||||
|
||||
tex_data->ref =false;
|
||||
tex_data->mip_levels=1;
|
||||
tex_data->linear=false;
|
||||
|
||||
if(force_linear)
|
||||
{
|
||||
@ -163,16 +159,19 @@ Texture2D *Device::CreateTexture2D(const VkFormat video_format,void *data,uint32
|
||||
return(new Texture2D(width,height,attr->device,tex_data));
|
||||
}
|
||||
|
||||
Texture2D *Device::CreateRefTexture2D(uint32_t width,uint32_t height,VkFormat format,VkImageAspectFlagBits flag,VkImage image,VkImageView image_view)
|
||||
Texture2D *Device::CreateRefTexture2D(uint32_t width,uint32_t height,VkFormat format,VkImageAspectFlagBits flag,VkImage image,VkImageLayout image_layout,VkImageView image_view)
|
||||
{
|
||||
TextureData *tex_data=new TextureData(true);
|
||||
TextureData *tex_data=new TextureData;
|
||||
|
||||
tex_data->memory=nullptr;
|
||||
tex_data->image=image;
|
||||
tex_data->image_view=CreateRefImageView(attr->device,VK_IMAGE_VIEW_TYPE_2D,format,flag,image_view);
|
||||
tex_data->ref =true;
|
||||
|
||||
tex_data->mip_levels=0;
|
||||
tex_data->linear=false;
|
||||
tex_data->memory =nullptr;
|
||||
tex_data->image =image;
|
||||
tex_data->image_layout =image_layout;
|
||||
tex_data->image_view =CreateRefImageView(attr->device,VK_IMAGE_VIEW_TYPE_2D,format,flag,image_view);
|
||||
|
||||
tex_data->mip_levels =0;
|
||||
tex_data->linear =false;
|
||||
|
||||
return(new Texture2D(width,height,attr->device,tex_data));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user