mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Cleanup.
This commit is contained in:
@@ -223,8 +223,8 @@ static const uint16_t s_planeIndices[] =
|
||||
static bool s_flipV = false;
|
||||
static float s_texelHalf = 0.0f;
|
||||
|
||||
static bgfx::UniformHandle u_texColor;
|
||||
static bgfx::UniformHandle u_shadowMap[ShadowMapRenderTargets::Count];
|
||||
static bgfx::UniformHandle s_texColor;
|
||||
static bgfx::UniformHandle s_shadowMap[ShadowMapRenderTargets::Count];
|
||||
static bgfx::FrameBufferHandle s_rtShadowMap[ShadowMapRenderTargets::Count];
|
||||
static bgfx::FrameBufferHandle s_rtBlur;
|
||||
|
||||
@@ -1012,12 +1012,12 @@ struct Mesh
|
||||
// Set textures.
|
||||
if (bgfx::invalidHandle != _texture.idx)
|
||||
{
|
||||
bgfx::setTexture(0, u_texColor, _texture);
|
||||
bgfx::setTexture(0, s_texColor, _texture);
|
||||
}
|
||||
|
||||
for (uint8_t ii = 0; ii < ShadowMapRenderTargets::Count; ++ii)
|
||||
{
|
||||
bgfx::setTexture(4 + ii, u_shadowMap[ii], s_rtShadowMap[ii]);
|
||||
bgfx::setTexture(4 + ii, s_shadowMap[ii], s_rtShadowMap[ii]);
|
||||
}
|
||||
|
||||
// Apply render state.
|
||||
@@ -1351,11 +1351,11 @@ int _main_(int _argc, char** _argv)
|
||||
|
||||
// Uniforms.
|
||||
s_uniforms.init();
|
||||
u_texColor = bgfx::createUniform("u_texColor", bgfx::UniformType::Int1);
|
||||
u_shadowMap[0] = bgfx::createUniform("u_shadowMap0", bgfx::UniformType::Int1);
|
||||
u_shadowMap[1] = bgfx::createUniform("u_shadowMap1", bgfx::UniformType::Int1);
|
||||
u_shadowMap[2] = bgfx::createUniform("u_shadowMap2", bgfx::UniformType::Int1);
|
||||
u_shadowMap[3] = bgfx::createUniform("u_shadowMap3", bgfx::UniformType::Int1);
|
||||
s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Int1);
|
||||
s_shadowMap[0] = bgfx::createUniform("s_shadowMap0", bgfx::UniformType::Int1);
|
||||
s_shadowMap[1] = bgfx::createUniform("s_shadowMap1", bgfx::UniformType::Int1);
|
||||
s_shadowMap[2] = bgfx::createUniform("s_shadowMap2", bgfx::UniformType::Int1);
|
||||
s_shadowMap[3] = bgfx::createUniform("s_shadowMap3", bgfx::UniformType::Int1);
|
||||
|
||||
// Programs.
|
||||
s_programs.init();
|
||||
@@ -2814,12 +2814,12 @@ int _main_(int _argc, char** _argv)
|
||||
if (bVsmOrEsm
|
||||
&& currentSmSettings->m_doBlur)
|
||||
{
|
||||
bgfx::setTexture(4, u_shadowMap[0], s_rtShadowMap[0]);
|
||||
bgfx::setTexture(4, s_shadowMap[0], s_rtShadowMap[0]);
|
||||
bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
|
||||
screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV);
|
||||
bgfx::submit(RENDERVIEW_VBLUR_0_ID, s_programs.m_vBlur[depthType]);
|
||||
|
||||
bgfx::setTexture(4, u_shadowMap[0], s_rtBlur);
|
||||
bgfx::setTexture(4, s_shadowMap[0], s_rtBlur);
|
||||
bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
|
||||
screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV);
|
||||
bgfx::submit(RENDERVIEW_HBLUR_0_ID, s_programs.m_hBlur[depthType]);
|
||||
@@ -2830,12 +2830,12 @@ int _main_(int _argc, char** _argv)
|
||||
{
|
||||
const uint8_t viewId = RENDERVIEW_VBLUR_0_ID + jj;
|
||||
|
||||
bgfx::setTexture(4, u_shadowMap[0], s_rtShadowMap[ii]);
|
||||
bgfx::setTexture(4, s_shadowMap[0], s_rtShadowMap[ii]);
|
||||
bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
|
||||
screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV);
|
||||
bgfx::submit(viewId, s_programs.m_vBlur[depthType]);
|
||||
|
||||
bgfx::setTexture(4, u_shadowMap[0], s_rtBlur);
|
||||
bgfx::setTexture(4, s_shadowMap[0], s_rtBlur);
|
||||
bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
|
||||
screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV);
|
||||
bgfx::submit(viewId+1, s_programs.m_hBlur[depthType]);
|
||||
@@ -3065,7 +3065,7 @@ int _main_(int _argc, char** _argv)
|
||||
// Draw depth rect.
|
||||
if (settings.m_drawDepthBuffer)
|
||||
{
|
||||
bgfx::setTexture(4, u_shadowMap[0], s_rtShadowMap[0]);
|
||||
bgfx::setTexture(4, s_shadowMap[0], s_rtShadowMap[0]);
|
||||
bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
|
||||
screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV);
|
||||
bgfx::submit(RENDERVIEW_DRAWDEPTH_0_ID, s_programs.m_drawDepth[depthType]);
|
||||
@@ -3074,7 +3074,7 @@ int _main_(int _argc, char** _argv)
|
||||
{
|
||||
for (uint8_t ii = 1; ii < settings.m_numSplits; ++ii)
|
||||
{
|
||||
bgfx::setTexture(4, u_shadowMap[0], s_rtShadowMap[ii]);
|
||||
bgfx::setTexture(4, s_shadowMap[0], s_rtShadowMap[ii]);
|
||||
bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
|
||||
screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV);
|
||||
bgfx::submit(RENDERVIEW_DRAWDEPTH_0_ID+ii, s_programs.m_drawDepth[depthType]);
|
||||
@@ -3147,11 +3147,11 @@ int _main_(int _argc, char** _argv)
|
||||
|
||||
s_programs.destroy();
|
||||
|
||||
bgfx::destroyUniform(u_texColor);
|
||||
bgfx::destroyUniform(u_shadowMap[3]);
|
||||
bgfx::destroyUniform(u_shadowMap[2]);
|
||||
bgfx::destroyUniform(u_shadowMap[1]);
|
||||
bgfx::destroyUniform(u_shadowMap[0]);
|
||||
bgfx::destroyUniform(s_texColor);
|
||||
bgfx::destroyUniform(s_shadowMap[3]);
|
||||
bgfx::destroyUniform(s_shadowMap[2]);
|
||||
bgfx::destroyUniform(s_shadowMap[1]);
|
||||
bgfx::destroyUniform(s_shadowMap[0]);
|
||||
|
||||
s_uniforms.destroy();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user