fixed the D3D11 back-end sometimes colorizing mip level 0 with r_gpuMipGen 1 and r_colorMipLevels 0

it happened because the color channels for blendColor weren't initialized,
that memory could have at least one channel initialized as a NaN value and
throwing a NaN in the shader logic would break it
This commit is contained in:
myT 2020-04-16 05:24:11 +02:00
parent a5e28eb08f
commit a59875200c

View file

@ -2152,13 +2152,13 @@ static void GAL_CreateTextureEx(image_t* image, int mipCount, int mipOffset, int
LinearToGammaCSData dataL2G; LinearToGammaCSData dataL2G;
dataL2G.intensity = r_intensity->value; dataL2G.intensity = r_intensity->value;
dataL2G.invGamma = 1.0f / r_mipGenGamma->value; dataL2G.invGamma = 1.0f / r_mipGenGamma->value;
dataL2G.blendColor[3] = 0.0f;
// copy to destination mip 0 now if needed // copy to destination mip 0 now if needed
if(mipOffset == 0) if(mipOffset == 0)
{ {
readIndex = 0; readIndex = 0;
writeIndex = 2; writeIndex = 2;
memcpy(dataL2G.blendColor, r_mipBlendColors[0], sizeof(dataL2G.blendColor));
ResetShaderData(d3d.mipLinearToGammaConstBuffer, &dataL2G, sizeof(dataL2G)); ResetShaderData(d3d.mipLinearToGammaConstBuffer, &dataL2G, sizeof(dataL2G));
d3ds.context->CSSetShader(d3d.mipLinearToGammaComputeShader, NULL, 0); d3ds.context->CSSetShader(d3d.mipLinearToGammaComputeShader, NULL, 0);
d3ds.context->CSSetConstantBuffers(0, 1, &bufferNull); d3ds.context->CSSetConstantBuffers(0, 1, &bufferNull);