Fix the wrong define being used meaning histogram/minmax were wrong

* Several places were using HGRAM_PIXELS_PER_TILE*HGRAM_PIXELS_PER_TILE
  instead of HGRAM_PIXELS_PER_TILE*HGRAM_TILES_PER_BLOCK and calculating
  blocks as too large. This meant histogram/minmax would miscalculate the
  number of blocks needed and fail to read properly from > 2048 textures
This commit is contained in:
baldurk
2014-11-02 19:04:14 +00:00
parent 05c5870326
commit 3c4f9313e2
2 changed files with 8 additions and 35 deletions
+3 -3
View File
@@ -37,7 +37,7 @@ void RENDERDOC_TileMinMaxCS(uint3 tid : SV_GroupThreadID, uint3 gid : SV_GroupID
uint3 texDim = uint3(HistogramTextureResolution);
uint blocksX = (int)ceil(float(texDim.x)/float(HGRAM_PIXELS_PER_TILE*HGRAM_PIXELS_PER_TILE));
uint blocksX = (int)ceil(float(texDim.x)/float(HGRAM_PIXELS_PER_TILE*HGRAM_TILES_PER_BLOCK));
uint2 topleft = (gid.xy*HGRAM_TILES_PER_BLOCK + tid.xy)*HGRAM_PIXELS_PER_TILE;
@@ -151,8 +151,8 @@ void RENDERDOC_ResultMinMaxCS()
{
uint3 texDim = uint3(HistogramTextureResolution);
uint blocksX = (int)ceil(float(texDim.x)/float(HGRAM_PIXELS_PER_TILE*HGRAM_PIXELS_PER_TILE));
uint blocksY = (int)ceil(float(texDim.y)/float(HGRAM_PIXELS_PER_TILE*HGRAM_PIXELS_PER_TILE));
uint blocksX = (int)ceil(float(texDim.x)/float(HGRAM_PIXELS_PER_TILE*HGRAM_TILES_PER_BLOCK));
uint blocksY = (int)ceil(float(texDim.y)/float(HGRAM_PIXELS_PER_TILE*HGRAM_TILES_PER_BLOCK));
#if UINT_TEX
uint4 minvalU = MinMaxResultSourceUInt[0];
+5 -32
View File
@@ -1088,7 +1088,7 @@ bool D3D11DebugManager::InitDebugRendering()
D3D11_BUFFER_DESC bDesc;
const uint32_t maxTexDim = 16384;
const uint32_t blockPixSize = HGRAM_TILES_PER_BLOCK*HGRAM_PIXELS_PER_TILE;
const uint32_t blockPixSize = HGRAM_PIXELS_PER_TILE*HGRAM_TILES_PER_BLOCK;
const uint32_t maxBlocksNeeded = (maxTexDim*maxTexDim)/(blockPixSize*blockPixSize);
bDesc.BindFlags = D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE;
@@ -1954,8 +1954,8 @@ bool D3D11DebugManager::GetHistogram(ResourceId texid, uint32_t sliceFace, uint3
m_pImmediateContext->CSSetShader(m_DebugRender.HistogramCS[details.texType][intIdx], NULL, 0);
int tilesX = (int)ceil(cdata.HistogramTextureResolution.x/float(HGRAM_PIXELS_PER_TILE*HGRAM_PIXELS_PER_TILE));
int tilesY = (int)ceil(cdata.HistogramTextureResolution.y/float(HGRAM_PIXELS_PER_TILE*HGRAM_PIXELS_PER_TILE));
int tilesX = (int)ceil(cdata.HistogramTextureResolution.x/float(HGRAM_PIXELS_PER_TILE*HGRAM_TILES_PER_BLOCK));
int tilesY = (int)ceil(cdata.HistogramTextureResolution.y/float(HGRAM_PIXELS_PER_TILE*HGRAM_TILES_PER_BLOCK));
m_pImmediateContext->Dispatch(tilesX, tilesY, 1);
@@ -2042,8 +2042,8 @@ bool D3D11DebugManager::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t
m_pImmediateContext->CSSetShader(m_DebugRender.TileMinMaxCS[details.texType][intIdx], NULL, 0);
int blocksX = (int)ceil(cdata.HistogramTextureResolution.x/float(HGRAM_PIXELS_PER_TILE*HGRAM_PIXELS_PER_TILE));
int blocksY = (int)ceil(cdata.HistogramTextureResolution.y/float(HGRAM_PIXELS_PER_TILE*HGRAM_PIXELS_PER_TILE));
int blocksX = (int)ceil(cdata.HistogramTextureResolution.x/float(HGRAM_PIXELS_PER_TILE*HGRAM_TILES_PER_BLOCK));
int blocksY = (int)ceil(cdata.HistogramTextureResolution.y/float(HGRAM_PIXELS_PER_TILE*HGRAM_TILES_PER_BLOCK));
m_pImmediateContext->Dispatch(blocksX, blocksY, 1);
@@ -2081,33 +2081,6 @@ bool D3D11DebugManager::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t
m_pImmediateContext->Unmap(m_DebugRender.resultStageBuff, 0);
}
/*
// debugging - copy out tile results
const uint32_t maxTexDim = 16384;
const uint32_t blockPixSize = HGRAM_TILES_PER_BLOCK*HGRAM_PIXELS_PER_TILE;
const uint32_t maxBlocksNeeded = (maxTexDim*maxTexDim)/(blockPixSize*blockPixSize);
D3D11_BUFFER_DESC bdesc;
bdesc.BindFlags = 0;
bdesc.Usage = D3D11_USAGE_STAGING;
bdesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
bdesc.MiscFlags = 0;
bdesc.StructureByteStride = 0;
bdesc.ByteWidth = 2*4*sizeof(float)*HGRAM_TILES_PER_BLOCK*HGRAM_TILES_PER_BLOCK*maxBlocksNeeded;
ID3D11Buffer *test = NULL;
m_pDevice->CreateBuffer(&bdesc, NULL, &test);
m_pImmediateContext->CopyResource(test, m_DebugRender.tileResultBuff);
m_pImmediateContext->Map(test, 0, D3D11_MAP_READ, 0, &mapped);
m_pImmediateContext->Unmap(test, 0);
SAFE_RELEASE(test);
*/
return true;
}