Minor optimization/cleanup

This commit is contained in:
Henrik Rydgård 2022-12-10 12:05:40 +01:00
parent 4ec1e2a175
commit cdb830f390
5 changed files with 11 additions and 22 deletions

View File

@ -219,19 +219,14 @@ int u8_strlen(const char *s)
}
/* reads the next utf-8 sequence out of a string, updating an index */
uint32_t u8_nextchar(const char *s, int *i)
{
uint32_t ch = 0;
int sz = 0;
do {
ch <<= 6;
ch += (unsigned char)s[(*i)++];
sz++;
} while (s[*i] && !isutf(s[*i]));
ch -= offsetsFromUTF8[sz-1];
return ch;
uint32_t u8_nextchar(const char *s, int *i) {
uint32_t ch = 0;
int sz = 0;
do {
ch = (ch << 6) + (unsigned char)s[(*i)++];
sz++;
} while (s[*i] && ((s[*i]) & 0xC0) == 0x80);
return ch - offsetsFromUTF8[sz - 1];
}
uint32_t u8_nextchar_unsafe(const char *s, int *i) {

View File

@ -38,8 +38,6 @@ public:
return tag_;
}
void Touch() {}
// Used in image copies, etc.
VkImage GetImage() const { return image_; }

View File

@ -348,7 +348,6 @@ public:
VkImageView GetImageView() {
if (vkTex_) {
vkTex_->Touch();
return vkTex_->GetImageView();
}
return VK_NULL_HANDLE; // This would be bad.
@ -356,7 +355,6 @@ public:
VkImageView GetImageArrayView() {
if (vkTex_) {
vkTex_->Touch();
return vkTex_->GetImageArrayView();
}
return VK_NULL_HANDLE; // This would be bad.
@ -673,8 +671,6 @@ VulkanTexture *VKContext::GetNullTexture() {
}
nullTexture_->UploadMip(cmdInit, 0, w, h, 0, bindBuf, bindOffset, w);
nullTexture_->EndCreate(cmdInit, false, VK_PIPELINE_STAGE_TRANSFER_BIT);
} else {
nullTexture_->Touch();
}
return nullTexture_;
}

View File

@ -285,7 +285,9 @@ void DrawBuffer::DrawImageRotated(ImageID atlas_image, float x, float y, float s
{u1, image->v2},
};
for (int i = 0; i < 6; i++) {
rot(v[i], angle, x, y);
if (angle != 0.0f) {
rot(v[i], angle, x, y);
}
V(v[i][0], v[i][1], 0, color, uv[i][0], uv[i][1]);
}
}

View File

@ -404,8 +404,6 @@ void TextureCacheVulkan::BindTexture(TexCacheEntry *entry) {
return;
}
entry->vkTex->Touch();
int maxLevel = (entry->status & TexCacheEntry::STATUS_NO_MIPS) ? 0 : entry->maxLevel;
SamplerCacheKey samplerKey = GetSamplingParams(maxLevel, entry);
curSampler_ = samplerCache_.GetOrCreateSampler(samplerKey);