Explorar el Código

warnings cleanup

cleanup and some warning fixes
marauder2k7 hace 1 año
padre
commit
e6c653c441

+ 9 - 1
Engine/source/gfx/D3D11/gfxD3D11Shader.cpp

@@ -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);
    // doesnt matter if its already added.
    U8* buf = new U8[size];
@@ -572,8 +578,8 @@ void GFXD3D11ShaderConstBuffer::activate( GFXD3D11ShaderConstBuffer *prevShaderB
       D3D11DEVICECONTEXT->GSSetConstantBuffers(bufStartSlot, numBufs, psBuffers);
    }
 
-
    mWasLost = false;
+
 }
 
 void GFXD3D11ShaderConstBuffer::onShaderReload( GFXD3D11Shader *shader )
@@ -1091,6 +1097,8 @@ GFXShaderConstType GFXD3D11Shader::convertConstType(const D3D11_SHADER_TYPE_DESC
       }
    }
 
+   return GFXSCT_Uknown;
+
 }
 
 void GFXD3D11Shader::_buildShaderConstantHandles()

+ 6 - 4
Engine/source/gfx/bitmap/loaders/bitmapSTB.cpp

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

+ 20 - 19
Engine/source/gfx/gfxEnums.h

@@ -64,7 +64,7 @@ enum GFXTexCallbackCode
    GFXResurrect,
 };
 
-enum GFXPrimitiveType 
+enum GFXPrimitiveType
 {
    GFXPT_FIRST = 0,
    GFXPointList = 0,
@@ -75,7 +75,7 @@ enum GFXPrimitiveType
    GFXPT_COUNT
 };
 
-enum GFXBitmapFlip 
+enum GFXBitmapFlip
 {
    GFXBitmapFlip_None = 0,
    GFXBitmapFlip_X    = 1 << 0,
@@ -83,7 +83,7 @@ enum GFXBitmapFlip
    GFXBitmapFlip_XY   = GFXBitmapFlip_X | GFXBitmapFlip_Y
 };
 
-enum GFXTextureAddressMode 
+enum GFXTextureAddressMode
 {
    GFXAddress_FIRST = 0,
    GFXAddressWrap = 0,
@@ -94,7 +94,7 @@ enum GFXTextureAddressMode
    GFXAddress_COUNT
 };
 
-enum GFXTextureFilterType 
+enum GFXTextureFilterType
 {
    GFXTextureFilter_FIRST = 0,
    GFXTextureFilterNone = 0,
@@ -104,7 +104,7 @@ enum GFXTextureFilterType
    GFXTextureFilter_COUNT
 };
 
-enum GFXFillMode 
+enum GFXFillMode
 {
    GFXFill_FIRST = 1,
    GFXFillPoint = 1,
@@ -113,7 +113,7 @@ enum GFXFillMode
    GFXFill_COUNT
 };
 
-enum GFXFormat 
+enum GFXFormat
 {
    // when adding formats make sure to place
    // them in the correct group!
@@ -152,7 +152,7 @@ enum GFXFormat
    GFXFormatR11G11B10,
    GFXFormatD32,
    GFXFormatD24X8,
-   GFXFormatD24S8,   
+   GFXFormatD24S8,
    GFXFormatD24FS8,
 
    // Guaranteed RGBA8 (for apis which really dont like bgr)
@@ -172,7 +172,7 @@ enum GFXFormat
    GFXFormatBC3,  //dxt4/5
    GFXFormatBC4,  //3dc+ / ati1
    GFXFormatBC5,  //3dc / ati2
-   // compressed sRGB formats   
+   // compressed sRGB formats
    GFXFormatBC1_SRGB,
    GFXFormatBC2_SRGB,
    GFXFormatBC3_SRGB,
@@ -191,7 +191,7 @@ enum GFXFormat
 /// Returns the byte size of the pixel for non-compressed formats.
 inline U32 GFXFormat_getByteSize( GFXFormat format )
 {
-   AssertFatal( format < GFXFormat_UNKNOWNSIZE, 
+   AssertFatal( format < GFXFormat_UNKNOWNSIZE,
       "GFXDevice::formatByteSize - Cannot size a compressed format!" );
 
    if ( format < GFXFormat_16BIT )
@@ -205,12 +205,12 @@ inline U32 GFXFormat_getByteSize( GFXFormat format )
    else if ( format < GFXFormat_128BIT )
       return 8;// 64 bit...
 
-   // This should be 128bits... else its a DDS and 
+   // This should be 128bits... else its a DDS and
    // the assert should have gone off above.
    return 16;
 }
 
-enum GFXClearFlags 
+enum GFXClearFlags
 {
    GFXClearTarget = 1 << 0,
    GFXClearZBuffer = 1 << 1,
@@ -218,7 +218,7 @@ enum GFXClearFlags
 };
 
 /// The supported blend modes.
-enum GFXBlend 
+enum GFXBlend
 {
    GFXBlend_FIRST = 0,
    GFXBlendZero = 0, /// (0, 0, 0, 0)
@@ -238,7 +238,7 @@ enum GFXBlend
 /// Constants that name each GFXDevice type. Any new GFXDevice subclass must be
 /// added to this enum. A string representing its name must also be added to
 /// GFXInit::getAdapterNameFromType().
-enum GFXAdapterType 
+enum GFXAdapterType
 {
    OpenGL = 0,
    Direct3D11,
@@ -255,7 +255,7 @@ enum GFXCullMode
    GFXCull_COUNT
 };
 
-enum GFXCmpFunc 
+enum GFXCmpFunc
 {
    GFXCmp_FIRST = 0,
    GFXCmpNever = 0,
@@ -269,7 +269,7 @@ enum GFXCmpFunc
    GFXCmp_COUNT
 };
 
-enum GFXStencilOp 
+enum GFXStencilOp
 {
    GFXStencilOp_FIRST = 0,
    GFXStencilOpKeep = 0,
@@ -283,8 +283,8 @@ enum GFXStencilOp
    GFXStencilOp_COUNT
 };
 
-enum GFXBlendOp 
-{ 
+enum GFXBlendOp
+{
    GFXBlendOp_FIRST = 0,
    GFXBlendOpAdd = 0,
    GFXBlendOpSubtract,
@@ -294,7 +294,7 @@ enum GFXBlendOp
    GFXBlendOp_COUNT
 };
 
-enum GFXMatrixType 
+enum GFXMatrixType
 {
    GFXMatrixWorld = 256,
    GFXMatrixView = 2,
@@ -312,6 +312,7 @@ enum GFXMatrixType
 
 enum GFXShaderConstType
 {
+   GFXSCT_Uknown,
    /// GFX"S"hader"C"onstant"T"ype
    GFXSCT_ConstBuffer,
    // Scalar
@@ -365,7 +366,7 @@ enum GFXDeclType
    /// @see Point2F
    GFXDeclType_Float2,
 
-   /// A three-component F32. 
+   /// A three-component F32.
    /// @see Point3F
    GFXDeclType_Float3,
 

+ 3 - 3
Engine/source/gfx/gfxShader.h

@@ -79,14 +79,14 @@ enum GFXShaderStage
 struct GFXShaderConstDesc
 {
 public:
-   String name;
-   GFXShaderConstType constType;
+   String name = String::EmptyString;
+   GFXShaderConstType constType = GFXSCT_Uknown;
    U32 arraySize = 0;            // > 1 means it is an array!
    S32 bindPoint = -1;           // bind point used for ubo/cb
    S32 samplerReg = -1;          // sampler register.
    U32 offset = 0;               // offset for vars
    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.

+ 3 - 1
Engine/source/gfx/gl/gfxGLShader.cpp

@@ -868,10 +868,12 @@ GFXShaderConstType GFXGLShader::convertConstType(GLenum constType)
       return GFXSCT_SamplerTextureArray;
       break;
    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.
       break;
    }
+
+   return GFXSCT_Uknown;
 }
 
 void GFXGLShader::initHandles()

+ 2 - 2
Engine/source/gui/shaderEditor/guiShaderEditor.cpp

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

+ 3 - 3
Engine/source/scene/sceneQueryUtil.h

@@ -5,7 +5,7 @@
 /// allows it to return the appropriate geometry.
 enum PolyListContext
 {
-   /// A hint that the polyist is intended 
+   /// A hint that the polyist is intended
    /// for collision testing.
    PLC_Collision,
 
@@ -24,7 +24,7 @@ enum PolyListContext
 
    /// A hint that the polyist will be used
    /// to export geometry and would like to have
-   /// texture coords and materials.   
+   /// texture coords and materials.
    PLC_Export
 };
 
@@ -71,7 +71,7 @@ struct SceneBinRange
    inline bool isGlobal() const
    {
       return minCoord[0] == 0 &&
-         minCoord[0] == 0 &&
+         minCoord[1] == 0 &&
          maxCoord[0] == 0xFFFF &&
          maxCoord[1] == 0xFFFF;
    }

+ 9 - 9
Engine/source/shaderGen/HLSL/debugVizFeatureHLSL.cpp

@@ -122,13 +122,13 @@ void DebugVizHLSL::processPix(Vector<ShaderComponent*>& componentList,
       if (fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || fd.features[MFT_VertLit])
          return;
 
-      MultiLine* meta = new MultiLine;
+      MultiLine* newMeta = new MultiLine;
 
       // Now the wsPosition and wsView.
       Var* worldToTangent = getInWorldToTangent(componentList);
       Var* wsNormal = getInWorldNormal(componentList);
       Var* wsPosition = getInWsPosition(componentList);
-      Var* wsView = getWsView(wsPosition, meta);
+      Var* wsView = getWsView(wsPosition, newMeta);
 
       //Reflection Probe WIP
       U32 MAX_FORWARD_PROBES = 4;
@@ -153,32 +153,32 @@ void DebugVizHLSL::processPix(Vector<ShaderComponent*>& componentList,
       Var* showAttenVar = new Var("showAttenVar", "int");
       char buf[64];
       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");
       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");
       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");
       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");
       computeForwardProbes += String("@,TORQUE_SAMPLER2D_MAKEARG(@),\r\n\t\t");
       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,
          irradianceCubemapAR, specularCubemapAR,
          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;
    }
 }