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);
// 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()

View file

@ -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();

View file

@ -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,

View file

@ -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.

View file

@ -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()