Move CalcNumMips to common header so GL code can access it

This commit is contained in:
baldurk
2014-11-28 21:12:17 +00:00
parent c1c6d635d9
commit 4a79ac8039
4 changed files with 17 additions and 17 deletions
+15
View File
@@ -223,6 +223,21 @@ bool FindDiffRange(void *a, void *b, size_t bufSize, size_t &diffStart, size_t &
return diffStart < bufSize;
}
uint32_t CalcNumMips(int w, int h, int d)
{
int mipLevels = 1;
while(w > 1 || h > 1 || d > 1)
{
w = RDCMAX(1, w>>1);
h = RDCMAX(1, h>>1);
d = RDCMAX(1, d>>1);
mipLevels++;
}
return mipLevels;
}
static string &logfile()
{
static string fn;
+2
View File
@@ -26,6 +26,7 @@
#pragma once
#include <stddef.h>
#include <stdint.h>
#include "globalconfig.h"
@@ -84,6 +85,7 @@ inline T AlignUp16(T x) { return (x+0xf) & (~0xf); }
#define MAKE_FOURCC(a, b, c, d) (((uint32_t)(d) << 24) | ((uint32_t)(c) << 16) | ((uint32_t)(b) << 8) | (uint32_t)(a))
bool FindDiffRange(void *a, void *b, size_t bufSize, size_t &diffStart, size_t &diffEnd);
uint32_t CalcNumMips(int Width, int Height, int Depth);
/////////////////////////////////////////////////
// Debugging features
@@ -64,21 +64,6 @@ map<ResourceId,WrappedID3D11Texture3D::TextureEntry> WrappedTexture<ID3D11Textur
map<ResourceId,WrappedID3D11Buffer::BufferEntry> WrappedID3D11Buffer::m_BufferList;
map<ResourceId,WrappedShader::ShaderEntry> WrappedShader::m_ShaderList;
UINT CalcNumMips(int w, int h, int d)
{
int mipLevels = 1;
while(w > 1 || h > 1 || d > 1)
{
w = RDCMAX(1, w>>1);
h = RDCMAX(1, h>>1);
d = RDCMAX(1, d>>1);
mipLevels++;
}
return mipLevels;
}
UINT GetMipForSubresource(ID3D11Resource *res, int Subresource)
{
D3D11_RESOURCE_DIMENSION dim;
-2
View File
@@ -67,8 +67,6 @@ UINT GetByteSize(ID3D11Texture1D *tex, int SubResource);
UINT GetByteSize(ID3D11Texture2D *tex, int SubResource);
UINT GetByteSize(ID3D11Texture3D *tex, int SubResource);
UINT CalcNumMips(int Width, int Height, int Depth);
UINT GetMipForSubresource(ID3D11Resource *res, int Subresource);
// returns block size for block-compressed formats