render: only upload to texture if data was passed

This commit is contained in:
itsmattkc
2022-07-26 10:37:56 -07:00
parent b0446e237b
commit 3caa5352f8
+3 -2
View File
@@ -42,7 +42,6 @@ TexturePtr Renderer::CreateTexture(const VideoParams &params, const void *data,
&& it->depth == params.effective_depth()
&& it->format == params.format()
&& it->channel_count == params.channel_count()) {
this->Flush();
v = it->handle;
texture_cache_.erase(it);
break;
@@ -53,8 +52,10 @@ TexturePtr Renderer::CreateTexture(const VideoParams &params, const void *data,
if (v.isNull()) {
v = CreateNativeTexture(params.effective_width(), params.effective_height(), params.effective_depth(),
params.format(), params.channel_count(), data, linesize);
} else {
} else if (data) {
UploadToTexture(v, params, data, linesize);
} else {
this->Flush();
}
return CreateTextureFromNativeHandle(v, params);