Skip to content

Commit

Permalink
Workaround flickering dlight texture.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcy committed Feb 15, 2016
1 parent 1a3a6dd commit 407e254
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions code/renderer_bgfx/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ DynamicLightManager::DynamicLightManager() : nLights_(0)
while (textureSize_ < sr)
textureSize_ *= 2;

// FIXME: workaround d3d11 flickering texture if smaller than 64x64 and not updated every frame
textureSize_ = std::max(64, textureSize_);

// Clamp and filter are just for debug drawing. Sampling uses texel fetch.
texture_ = bgfx::createTexture2D(textureSize_, textureSize_, 1, bgfx::TextureFormat::RGBA32F, BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT);
}
Expand Down
2 changes: 1 addition & 1 deletion code/renderer_bgfx/Main.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class DynamicLightManager
/// @param ignore Write 0 to the uniform number of lights.
void update(int frameNo, Uniforms *uniforms, bool ignore);

static const size_t maxLights = MAX_DLIGHTS;
static const size_t maxLights = 256;

private:
DynamicLight lights_[BGFX_NUM_BUFFER_FRAMES][maxLights];
Expand Down
1 change: 0 additions & 1 deletion shaders/SharedDefines.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#define GEN_TEXCOORD 2

#define MAX_DEFORMS 3
#define MAX_DLIGHTS 256

#define TCGEN_NONE 0
#define TCGEN_ENVIRONMENT_MAPPED 1
Expand Down

0 comments on commit 407e254

Please sign in to comment.