warnings cleanup

cleanup and some warning fixes
This commit is contained in:
marauder2k7 2024-03-14 08:28:11 +00:00
parent 9dc5ae833b
commit e6c653c441
8 changed files with 55 additions and 42 deletions

View file

@ -469,6 +469,12 @@ void GFXD3D11ShaderConstBuffer::addBuffer(U32 bufBindingPoint, GFXShaderStage sh
} }
} }
// no shaderstage defined? cannot be!!!
if (shaderStageID == -1)
{
AssertFatal(false, "DX Const buffer requires a shaderStage flag.");
}
const BufferKey bufKey(bufBindingPoint, shaderStageID); const BufferKey bufKey(bufBindingPoint, shaderStageID);
// doesnt matter if its already added. // doesnt matter if its already added.
U8* buf = new U8[size]; U8* buf = new U8[size];
@ -572,8 +578,8 @@ void GFXD3D11ShaderConstBuffer::activate( GFXD3D11ShaderConstBuffer *prevShaderB
D3D11DEVICECONTEXT->GSSetConstantBuffers(bufStartSlot, numBufs, psBuffers); D3D11DEVICECONTEXT->GSSetConstantBuffers(bufStartSlot, numBufs, psBuffers);
} }
mWasLost = false; mWasLost = false;
} }
void GFXD3D11ShaderConstBuffer::onShaderReload( GFXD3D11Shader *shader ) void GFXD3D11ShaderConstBuffer::onShaderReload( GFXD3D11Shader *shader )
@ -1091,6 +1097,8 @@ GFXShaderConstType GFXD3D11Shader::convertConstType(const D3D11_SHADER_TYPE_DESC
} }
} }
return GFXSCT_Uknown;
} }
void GFXD3D11Shader::_buildShaderConstantHandles() void GFXD3D11Shader::_buildShaderConstantHandles()

View file

@ -34,6 +34,9 @@
#define STBIWDEF static inline #define STBIWDEF static inline
#endif #endif
#pragma warning( push )
#pragma warning( disable : 4505 ) // unreferenced function removed.
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_STATIC #define STB_IMAGE_STATIC
#include "stb_image.h" #include "stb_image.h"
@ -42,6 +45,8 @@
#define STB_IMAGE_WRITE_STATIC #define STB_IMAGE_WRITE_STATIC
#include "stb_image_write.h" #include "stb_image_write.h"
#pragma warning(pop)
static bool sReadSTB(const Torque::Path& path, GBitmap* bitmap); static bool sReadSTB(const Torque::Path& path, GBitmap* bitmap);
static bool sReadStreamSTB(Stream& stream, GBitmap* bitmap, U32 len); static bool sReadStreamSTB(Stream& stream, GBitmap* bitmap, U32 len);
@ -399,8 +404,6 @@ bool sWriteSTB(const Torque::Path& path, GBitmap* bitmap, U32 compressionLevel)
String ext = path.getExtension(); String ext = path.getExtension();
U32 stride = width * bytes;
// we always have at least 1 // we always have at least 1
U32 comp = 1; U32 comp = 1;
@ -554,7 +557,6 @@ void DeferredPNGWriter::append(GBitmap* bitmap, U32 rows)
mData->channels = bitmap->getBytesPerPixel(); mData->channels = bitmap->getBytesPerPixel();
} }
const U32 height = getMin(bitmap->getHeight(), rows);
const dsize_t dataChuckSize = bitmap->getByteSize(); const dsize_t dataChuckSize = bitmap->getByteSize();
const U8* pSrcData = bitmap->getBits(); const U8* pSrcData = bitmap->getBits();

View file

@ -312,6 +312,7 @@ enum GFXMatrixType
enum GFXShaderConstType enum GFXShaderConstType
{ {
GFXSCT_Uknown,
/// GFX"S"hader"C"onstant"T"ype /// GFX"S"hader"C"onstant"T"ype
GFXSCT_ConstBuffer, GFXSCT_ConstBuffer,
// Scalar // Scalar

View file

@ -79,14 +79,14 @@ enum GFXShaderStage
struct GFXShaderConstDesc struct GFXShaderConstDesc
{ {
public: public:
String name; String name = String::EmptyString;
GFXShaderConstType constType; GFXShaderConstType constType = GFXSCT_Uknown;
U32 arraySize = 0; // > 1 means it is an array! U32 arraySize = 0; // > 1 means it is an array!
S32 bindPoint = -1; // bind point used for ubo/cb S32 bindPoint = -1; // bind point used for ubo/cb
S32 samplerReg = -1; // sampler register. S32 samplerReg = -1; // sampler register.
U32 offset = 0; // offset for vars U32 offset = 0; // offset for vars
U32 size = 0; // size of buffer/type U32 size = 0; // size of buffer/type
GFXShaderStage shaderStage; // only used dx side. GFXShaderStage shaderStage = VERTEX_SHADER; // only used dx side.not wasting a bit for an unknown?
}; };
/// This is an opaque handle used by GFXShaderConstBuffer clients to set individual shader constants. /// This is an opaque handle used by GFXShaderConstBuffer clients to set individual shader constants.

View file

@ -868,10 +868,12 @@ GFXShaderConstType GFXGLShader::convertConstType(GLenum constType)
return GFXSCT_SamplerTextureArray; return GFXSCT_SamplerTextureArray;
break; break;
default: default:
AssertFatal(false, "GFXGLShader::initConstantDescs - unrecognized uniform type"); AssertFatal(false, "Unknown shader constant class enum, maybe you could add it?");
// If we don't recognize the constant don't add its description. // If we don't recognize the constant don't add its description.
break; break;
} }
return GFXSCT_Uknown;
} }
void GFXGLShader::initHandles() void GFXGLShader::initHandles()

View file

@ -598,7 +598,7 @@ bool GuiShaderEditor::onMouseWheelUp(const GuiEvent& event)
if (!mActive || !mAwake || !mVisible) if (!mActive || !mAwake || !mVisible)
return Parent::onMouseWheelUp(event); return Parent::onMouseWheelUp(event);
mZoomScale *= 1.1; mZoomScale *= 1.1f;
return true; return true;
} }
@ -608,7 +608,7 @@ bool GuiShaderEditor::onMouseWheelDown(const GuiEvent& event)
if (!mActive || !mAwake || !mVisible) if (!mActive || !mAwake || !mVisible)
return Parent::onMouseWheelDown(event); return Parent::onMouseWheelDown(event);
mZoomScale *= 0.9; mZoomScale *= 0.9f;
return true; return true;
} }

View file

@ -71,7 +71,7 @@ struct SceneBinRange
inline bool isGlobal() const inline bool isGlobal() const
{ {
return minCoord[0] == 0 && return minCoord[0] == 0 &&
minCoord[0] == 0 && minCoord[1] == 0 &&
maxCoord[0] == 0xFFFF && maxCoord[0] == 0xFFFF &&
maxCoord[1] == 0xFFFF; maxCoord[1] == 0xFFFF;
} }

View file

@ -122,13 +122,13 @@ void DebugVizHLSL::processPix(Vector<ShaderComponent*>& componentList,
if (fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || fd.features[MFT_VertLit]) if (fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || fd.features[MFT_VertLit])
return; return;
MultiLine* meta = new MultiLine; MultiLine* newMeta = new MultiLine;
// Now the wsPosition and wsView. // Now the wsPosition and wsView.
Var* worldToTangent = getInWorldToTangent(componentList); Var* worldToTangent = getInWorldToTangent(componentList);
Var* wsNormal = getInWorldNormal(componentList); Var* wsNormal = getInWorldNormal(componentList);
Var* wsPosition = getInWsPosition(componentList); Var* wsPosition = getInWsPosition(componentList);
Var* wsView = getWsView(wsPosition, meta); Var* wsView = getWsView(wsPosition, newMeta);
//Reflection Probe WIP //Reflection Probe WIP
U32 MAX_FORWARD_PROBES = 4; U32 MAX_FORWARD_PROBES = 4;
@ -153,32 +153,32 @@ void DebugVizHLSL::processPix(Vector<ShaderComponent*>& componentList,
Var* showAttenVar = new Var("showAttenVar", "int"); Var* showAttenVar = new Var("showAttenVar", "int");
char buf[64]; char buf[64];
dSprintf(buf, sizeof(buf), " @ = %s;\r\n", showAtten); dSprintf(buf, sizeof(buf), " @ = %s;\r\n", showAtten);
meta->addStatement(new GenOp(buf, new DecOp(showAttenVar))); newMeta->addStatement(new GenOp(buf, new DecOp(showAttenVar)));
Var* showContribVar = new Var("showContribVar", "int"); Var* showContribVar = new Var("showContribVar", "int");
dSprintf(buf, sizeof(buf), " @ = %s;\r\n", showContrib); dSprintf(buf, sizeof(buf), " @ = %s;\r\n", showContrib);
meta->addStatement(new GenOp(buf, new DecOp(showContribVar))); newMeta->addStatement(new GenOp(buf, new DecOp(showContribVar)));
Var* showSpecVar = new Var("showSpecVar", "int"); Var* showSpecVar = new Var("showSpecVar", "int");
dSprintf(buf, sizeof(buf), " @ = %s;\r\n", showSpec); dSprintf(buf, sizeof(buf), " @ = %s;\r\n", showSpec);
meta->addStatement(new GenOp(buf, new DecOp(showSpecVar))); newMeta->addStatement(new GenOp(buf, new DecOp(showSpecVar)));
Var* showDiffVar = new Var("showDiffVar", "int"); Var* showDiffVar = new Var("showDiffVar", "int");
dSprintf(buf, sizeof(buf), " @ = %s;\r\n", showDiff); dSprintf(buf, sizeof(buf), " @ = %s;\r\n", showDiff);
meta->addStatement(new GenOp(buf, new DecOp(showDiffVar))); newMeta->addStatement(new GenOp(buf, new DecOp(showDiffVar)));
String computeForwardProbes = String(" @ = debugVizForwardProbes(@,@,@,@,@,@,@,@,\r\n\t\t"); String computeForwardProbes = String(" @ = debugVizForwardProbes(@,@,@,@,@,@,@,@,\r\n\t\t");
computeForwardProbes += String("@,TORQUE_SAMPLER2D_MAKEARG(@),\r\n\t\t"); computeForwardProbes += String("@,TORQUE_SAMPLER2D_MAKEARG(@),\r\n\t\t");
computeForwardProbes += String("TORQUE_SAMPLERCUBEARRAY_MAKEARG(@),TORQUE_SAMPLERCUBEARRAY_MAKEARG(@), @, @, @, @).rgb; \r\n"); computeForwardProbes += String("TORQUE_SAMPLERCUBEARRAY_MAKEARG(@),TORQUE_SAMPLERCUBEARRAY_MAKEARG(@), @, @, @, @).rgb; \r\n");
meta->addStatement(new GenOp(computeForwardProbes.c_str(), ibl, surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refScaleArray, inRefPosArray, newMeta->addStatement(new GenOp(computeForwardProbes.c_str(), ibl, surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refScaleArray, inRefPosArray,
skylightCubemapIdx, BRDFTexture, skylightCubemapIdx, BRDFTexture,
irradianceCubemapAR, specularCubemapAR, irradianceCubemapAR, specularCubemapAR,
showAttenVar, showContribVar, showSpecVar, showDiffVar)); showAttenVar, showContribVar, showSpecVar, showDiffVar));
meta->addStatement(new GenOp(" @.rgb = @.rgb;\r\n", color, ibl)); newMeta->addStatement(new GenOp(" @.rgb = @.rgb;\r\n", color, ibl));
output = meta; output = newMeta;
return; return;
} }
} }