Skip to content

Commit

Permalink
Default-initialize some pixel shader structs for peace of mind.
Browse files Browse the repository at this point in the history
  • Loading branch information
afritz1 committed Jul 28, 2024
1 parent d9f1ab2 commit 848c7f9
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions OpenTESArena/src/Rendering/SoftwareRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,18 @@ namespace
double widthReal, heightReal;
TextureSamplingType samplingType;

PixelShaderTexture()
{
this->texels = nullptr;
this->width = 0;
this->height = 0;
this->widthMinusOne = 0;
this->heightMinusOne = 0;
this->widthReal = 0.0;
this->heightReal = 0.0;
this->samplingType = static_cast<TextureSamplingType>(-1);
}

void init(const uint8_t *texels, int width, int height, TextureSamplingType samplingType)
{
this->texels = texels;
Expand All @@ -1451,6 +1463,12 @@ namespace
{
const uint32_t *colors;
int count;

PixelShaderPalette()
{
this->colors = nullptr;
this->count = 0;
}
};

struct PixelShaderLighting
Expand All @@ -1461,6 +1479,16 @@ namespace
int lastLightLevel;
int texelsPerLightLevel; // Should be 256 for 8-bit colors.
int lightLevel; // The selected row of shades between light and dark.

PixelShaderLighting()
{
this->lightTableTexels = nullptr;
this->lightLevelCount = 0;
this->lightLevelCountReal = 0.0;
this->lastLightLevel = -1;
this->texelsPerLightLevel = 0;
this->lightLevel = -1;
}
};

struct PixelShaderHorizonMirror
Expand All @@ -1472,13 +1500,29 @@ namespace
int reflectedPixelIndex;
bool isReflectedPixelInFrameBuffer;
uint8_t fallbackSkyColor;

PixelShaderHorizonMirror()
{
this->horizonScreenSpacePointX = 0.0;
this->horizonScreenSpacePointY = 0.0;
this->reflectedPixelIndex = -1;
this->isReflectedPixelInFrameBuffer = false;
this->fallbackSkyColor = 0;
}
};

struct PixelShaderFrameBuffer
{
PixelShaderPalette palette;
double xPercent, yPercent;
int pixelIndex;

PixelShaderFrameBuffer()
{
this->xPercent = 0.0;
this->yPercent = 0.0;
this->pixelIndex = -1;
}
};

double g_ambientPercent;
Expand Down

0 comments on commit 848c7f9

Please sign in to comment.