Renamed BGFX_TEXTURE_RT_BUFFER_ONLY to more descriptive BGFX_TEXTURE_RT_WRITE_ONLY.

This commit is contained in:
Branimir Karadžić 2016-01-12 17:11:16 -08:00
parent 96d5da63ab
commit fbace33048
9 changed files with 25 additions and 25 deletions

View File

@ -205,7 +205,7 @@ class HDR : public entry::AppI
m_mesh = meshLoad("meshes/bunny.bin");
m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY);
m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
m_lum[0] = bgfx::createFrameBuffer(128, 128, bgfx::TextureFormat::BGRA8);
@ -308,7 +308,7 @@ class HDR : public entry::AppI
bgfx::destroyFrameBuffer(m_fbh);
m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, ( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT)|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY|( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT) );
m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY|( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT) );
m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
}

View File

@ -1898,7 +1898,7 @@ int _main_(int _argc, char** _argv)
bgfx::TextureHandle fbtextures[] =
{
bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT),
bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY),
bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY),
};
s_stencilFb = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
@ -2092,7 +2092,7 @@ int _main_(int _argc, char** _argv)
bgfx::destroyFrameBuffer(s_stencilFb);
fbtextures[0] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT);
fbtextures[1] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY);
fbtextures[1] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
s_stencilFb = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}

View File

@ -148,7 +148,7 @@ int _main_(int _argc, char** _argv)
bgfx::TextureHandle fbtextures[] =
{
shadowMapTexture,
bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY),
bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY),
};
shadowMapFB = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}

View File

@ -300,7 +300,7 @@
#define BGFX_TEXTURE_RT_MSAA_X16 UINT32_C(0x00005000) //!<
#define BGFX_TEXTURE_RT_MSAA_SHIFT 12 //!<
#define BGFX_TEXTURE_RT_MSAA_MASK UINT32_C(0x00007000) //!<
#define BGFX_TEXTURE_RT_BUFFER_ONLY UINT32_C(0x00008000) //!<
#define BGFX_TEXTURE_RT_WRITE_ONLY UINT32_C(0x00008000) //!<
#define BGFX_TEXTURE_RT_MASK UINT32_C(0x0000f000) //!<
#define BGFX_TEXTURE_COMPARE_LESS UINT32_C(0x00010000) //!<
#define BGFX_TEXTURE_COMPARE_LEQUAL UINT32_C(0x00020000) //!<

View File

@ -4009,7 +4009,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
}
}
const bool bufferOnly = 0 != (m_flags&(BGFX_TEXTURE_RT_BUFFER_ONLY|BGFX_TEXTURE_READ_BACK) );
const bool writeOnly = 0 != (m_flags&(BGFX_TEXTURE_RT_WRITE_ONLY|BGFX_TEXTURE_READ_BACK) );
const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE);
const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK);
const bool srgb = 0 != (m_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb;
@ -4053,7 +4053,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
desc.Format = format;
desc.SampleDesc = msaa;
desc.Usage = kk == 0 || blit ? D3D11_USAGE_DEFAULT : D3D11_USAGE_IMMUTABLE;
desc.BindFlags = bufferOnly ? 0 : D3D11_BIND_SHADER_RESOURCE;
desc.BindFlags = writeOnly ? 0 : D3D11_BIND_SHADER_RESOURCE;
desc.CPUAccessFlags = 0;
if (isDepth( (TextureFormat::Enum)m_textureFormat) )
@ -4126,7 +4126,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
break;
}
if (!bufferOnly)
if (!writeOnly)
{
DX_CHECK(s_renderD3D11->m_device->CreateShaderResourceView(m_ptr, &srvd, &m_srv) );
}

View File

@ -1860,8 +1860,8 @@ data.NumQualityLevels = 0;
if (isValid(frameBuffer.m_depth) )
{
TextureD3D12& texture = m_textures[frameBuffer.m_depth.idx];
const bool bufferOnly = 0 != (texture.m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
if (!bufferOnly)
const bool writeOnly = 0 != (texture.m_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
if (!writeOnly)
{
texture.setState(m_commandList, D3D12_RESOURCE_STATE_DEPTH_READ);
}
@ -3801,7 +3801,7 @@ data.NumQualityLevels = 0;
blockHeight = blockInfo.blockHeight;
}
const bool bufferOnly = 0 != (m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
const bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE);
const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK);
@ -3813,7 +3813,7 @@ data.NumQualityLevels = 0;
, textureHeight
, imageContainer.m_cubeMap ? "x6" : ""
, renderTarget ? 'x' : ' '
, bufferOnly ? 'x' : ' '
, writeOnly ? 'x' : ' '
, computeWrite ? 'x' : ' '
, swizzle ? " (swizzle BGRA8 -> RGBA8)" : ""
);
@ -3969,7 +3969,7 @@ data.NumQualityLevels = 0;
resourceDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
}
if (bufferOnly)
if (writeOnly)
{
resourceDesc.Flags |= D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE;
state &= ~D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;

View File

@ -2431,10 +2431,10 @@ namespace bgfx { namespace d3d9
uint32_t msaaQuality = ( (m_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT);
msaaQuality = bx::uint32_satsub(msaaQuality, 1);
bool bufferOnly = 0 != (m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
if (0 != msaaQuality
|| bufferOnly)
|| writeOnly)
{
const Msaa& msaa = s_msaa[msaaQuality];
@ -2465,7 +2465,7 @@ namespace bgfx { namespace d3d9
) );
}
if (bufferOnly)
if (writeOnly)
{
// This is render buffer, there is no sampling, no need
// to create texture.
@ -2841,7 +2841,7 @@ namespace bgfx { namespace d3d9
, 0 != (m_flags&BGFX_TEXTURE_RT_MASK) ? " (render target)" : ""
);
if (0 != (_flags&BGFX_TEXTURE_RT_BUFFER_ONLY) )
if (0 != (_flags&BGFX_TEXTURE_RT_WRITE_ONLY) )
{
return;
}

View File

@ -3948,10 +3948,10 @@ namespace bgfx { namespace gl
m_requestedFormat =
m_textureFormat = uint8_t(_format);
const bool bufferOnly = 0 != (m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
const bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE );
if (!bufferOnly)
if (!writeOnly)
{
GL_CHECK(glGenTextures(1, &m_id) );
BX_CHECK(0 != m_id, "Failed to generate texture id.");
@ -4025,7 +4025,7 @@ namespace bgfx { namespace gl
msaaQuality = bx::uint32_min(s_renderGL->m_maxMsaa, msaaQuality == 0 ? 0 : 1<<msaaQuality);
if (0 != msaaQuality
|| bufferOnly)
|| writeOnly)
{
GL_CHECK(glGenRenderbuffers(1, &m_rbo) );
BX_CHECK(0 != m_rbo, "Failed to generate renderbuffer id.");
@ -4051,7 +4051,7 @@ namespace bgfx { namespace gl
GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, 0) );
if (bufferOnly)
if (writeOnly)
{
// This is render buffer, there is no sampling, no need
// to create texture.

View File

@ -1887,7 +1887,7 @@ namespace bgfx { namespace mtl
, 0 != (_flags&BGFX_TEXTURE_RT_MASK) ? " (render target)" : ""
);
const bool bufferOnly = 0 != (_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
const bool writeOnly = 0 != (_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
// const bool computeWrite = 0 != (_flags&BGFX_TEXTURE_COMPUTE_WRITE);
// const bool renderTarget = 0 != (_flags&BGFX_TEXTURE_RT_MASK);
const bool srgb = 0 != (_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb;
@ -1919,11 +1919,11 @@ namespace bgfx { namespace mtl
desc.resourceOptions = MTLResourceStorageModePrivate;
desc.cpuCacheMode = MTLCPUCacheModeDefaultCache;
desc.storageMode = (MTLStorageMode)(bufferOnly
desc.storageMode = (MTLStorageMode)(writeOnly
? 2 /*MTLStorageModePrivate*/
: 1 /*MTLStorageModeManaged*/
);
desc.usage = bufferOnly
desc.usage = writeOnly
? MTLTextureUsageShaderWrite
: MTLTextureUsageShaderRead
;