More texture work

This commit is contained in:
Henrik Rydgard 2016-01-09 21:54:57 +01:00
parent dced84c9fc
commit 78d5fff2fe
3 changed files with 17 additions and 10 deletions

View file

@ -320,7 +320,7 @@ static const CommandTableEntry commandTable[] = {
{ GE_CMD_BOUNDINGBOX, FLAG_EXECUTE, 0, &GPU_Vulkan::Execute_BoundingBox }, // + FLUSHBEFORE when we implement... or not, do we need to?
// Changing the vertex type requires us to flush.
{ GE_CMD_VERTEXTYPE, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTEONCHANGE, 0, &GPU_Vulkan::Execute_VertexType },
{ GE_CMD_VERTEXTYPE, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTEONCHANGE, DIRTY_PROJMATRIX, &GPU_Vulkan::Execute_VertexType },
{ GE_CMD_BEZIER, FLAG_FLUSHBEFORE | FLAG_EXECUTE, 0, &GPU_Vulkan::Execute_Bezier },
{ GE_CMD_SPLINE, FLAG_FLUSHBEFORE | FLAG_EXECUTE, 0, &GPU_Vulkan::Execute_Spline },

View file

@ -34,6 +34,7 @@ void ConvertProjMatrixToVulkan(Matrix4x4 & in);
// Pretty much full. Will need more bits for more fine grained dirty tracking for lights.
enum {
DIRTY_PROJMATRIX = (1 << 0),
// 1 << 1 is free
DIRTY_FOGCOLOR = (1 << 2),
DIRTY_FOGCOEF = (1 << 3),
DIRTY_TEXENV = (1 << 4),
@ -58,7 +59,7 @@ enum {
DIRTY_DEPTHRANGE = (1 << 20),
DIRTY_WORLDMATRIX = (1 << 21),
DIRTY_VIEWMATRIX = (1 << 22), // Maybe we'll fold this into projmatrix eventually
DIRTY_VIEWMATRIX = (1 << 22),
DIRTY_TEXMATRIX = (1 << 23),
DIRTY_BONEMATRIX0 = (1 << 24),
DIRTY_BONEMATRIX1 = (1 << 25),

View file

@ -1281,6 +1281,7 @@ void TextureCacheVulkan::SetTexture() {
lastBoundTexture = nullptr;
}
delete entry->vkTex;
entry->vkTex = nullptr;
}
}
// Clear the reliable bit if set.
@ -1363,10 +1364,6 @@ void TextureCacheVulkan::SetTexture() {
return;
}
entry->vkTex = new CachedTextureVulkan();
lastBoundTexture = entry->vkTex;
// Adjust maxLevel to actually present levels..
bool badMipSizes = false;
for (u32 i = 0; i <= maxLevel; i++) {
@ -1443,9 +1440,17 @@ void TextureCacheVulkan::SetTexture() {
}
// Ready or not, here I go...
if (replaceImages) {
if (!entry->vkTex) {
DebugBreak();
}
} else {
entry->vkTex = new CachedTextureVulkan();
entry->vkTex->texture_ = new VulkanTexture();
VulkanTexture *image = entry->vkTex->texture_;
image->Create(vulkan_, w, h, dstFmt);
}
lastBoundTexture = entry->vkTex;
// GLES2 doesn't have support for a "Max lod" which is critical as PSP games often
// don't specify mips all the way down. As a result, we either need to manually generate
@ -1453,6 +1458,7 @@ void TextureCacheVulkan::SetTexture() {
// be as good quality as the game's own (might even be better in some cases though).
// Always load base level texture here
LoadTextureLevel(*entry, 0, replaceImages, scaleFactor, dstFmt);
// Mipmapping only enable when texture scaling disable
@ -1790,7 +1796,7 @@ void TextureCacheVulkan::LoadTextureLevel(TexCacheEntry &entry, int level, bool
if (replaceImages) {
// TODO: No support for texture shadows
DebugBreak();
// DebugBreak();
}
PROFILE_THIS_SCOPE("loadtex");