Skip to content

Commit 33a515f

Browse files
committed
Fix lint warnings
1 parent 98f75f0 commit 33a515f

File tree

6 files changed

+10
-12
lines changed

6 files changed

+10
-12
lines changed

axmol/3d/Bundle3D.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,9 +894,10 @@ bool Bundle3D::loadMaterialsBinary(MaterialDatas& materialdatas)
894894
{
895895
if (!seekToFirstType(BUNDLE_TYPE_MATERIAL))
896896
return false;
897-
unsigned int materialnum = 1;
897+
898898
try
899899
{
900+
unsigned int materialnum = 1;
900901
_binaryReader.read_blob(materialnum);
901902
for (unsigned int i = 0; i < materialnum; ++i)
902903
{

axmol/physics/PhysicsJoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Optional
4343

4444
public:
4545
Optional() {}
46-
Optional(T d) : _isSet(true), _data(d) {}
46+
explicit Optional(T d) : _isSet(true), _data(d) {}
4747
Optional(const Optional& t) : _isSet(t._isSet), _data(t._data) {}
4848

4949
// bool isNull() const { return !_isSet; }

axmol/rhi/d3d/DepthStencilStateD3D.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static D3D11_DEPTH_STENCILOP_DESC make_op_desc(const StencilDescriptor& s)
6565

6666
void DepthStencilStateImpl::update(const DepthStencilDescriptor& desc)
6767
{
68-
if (_state && memcmp(&desc, &_dsDesc, sizeof(desc) == 0))
68+
if (_state && memcmp(&desc, &_dsDesc, sizeof(desc)) == 0)
6969
{
7070
return;
7171
}
@@ -115,7 +115,6 @@ void DepthStencilStateImpl::reset(ID3D11DeviceContext* ctx)
115115

116116
dsDesc.StencilEnable = FALSE;
117117

118-
ID3D11DepthStencilState* pDSStateDisable = nullptr;
119118
_device->CreateDepthStencilState(&dsDesc, _disableState.GetAddressOf());
120119
}
121120

axmol/rhi/d3d/RenderPipelineD3D.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static UINT toD3DColorWriteMask(ColorWriteMask mask)
144144
return result;
145145
}
146146

147-
static uint64_t hashBlendDesc(const BlendDescriptor& bd)
147+
static uint32_t hashBlendDesc(const BlendDescriptor& bd)
148148
{
149149
struct PODBlend
150150
{
@@ -157,7 +157,7 @@ static uint64_t hashBlendDesc(const BlendDescriptor& bd)
157157
uint8_t destinationRGBBlendFactor;
158158
uint8_t sourceAlphaBlendFactor;
159159
uint8_t destinationAlphaBlendFactor;
160-
uint8_t pad1[4];
160+
uint32_t pad1;
161161
} pod{static_cast<uint32_t>(bd.writeMask),
162162
static_cast<uint8_t>(bd.blendEnabled),
163163
static_cast<uint8_t>(bd.rgbBlendOperation),
@@ -167,16 +167,16 @@ static uint64_t hashBlendDesc(const BlendDescriptor& bd)
167167
static_cast<uint8_t>(bd.destinationRGBBlendFactor),
168168
static_cast<uint8_t>(bd.sourceAlphaBlendFactor),
169169
static_cast<uint8_t>(bd.destinationAlphaBlendFactor),
170-
{0, 0, 0, 0}};
170+
0};
171171

172-
return XXH64(&pod, sizeof(pod), 0);
172+
return XXH32(&pod, sizeof(pod), 0);
173173
}
174174

175175
void RenderPipelineImpl::update(const RenderTarget*, const PipelineDescriptor& desc)
176176
{
177177
ComPtr<ID3D11BlendState> blendState;
178178

179-
uint64_t key = hashBlendDesc(desc.blendDescriptor);
179+
auto key = hashBlendDesc(desc.blendDescriptor);
180180
auto it = _blendCache.find(key);
181181

182182
if (it != _blendCache.end())

axmol/rhi/d3d/RenderPipelineD3D.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ class RenderPipelineImpl : public RenderPipeline
1717
ID3D11Device* _device = nullptr;
1818
ID3D11DeviceContext* _context = nullptr;
1919

20-
tsl::robin_map<uint64_t, ComPtr<ID3D11BlendState>> _blendCache;
20+
tsl::robin_map<uint32_t, ComPtr<ID3D11BlendState>> _blendCache;
2121
};
2222
} // namespace ax::rhi::d3d

axmol/rhi/d3d/TextureD3D.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,6 @@ void TextureImpl::updateFaceData(TextureCubeFace side, void* data, int index)
418418
//-------------------------------------------------------------------
419419
// 2. compute RowPitch / SlicePitch
420420
//-------------------------------------------------------------------
421-
const uint32_t pixelSize = PixelFormatUtils::getBitsPerPixel(_textureRes._descriptor.textureFormat) / 8;
422-
const uint32_t rowPitchVerified = _textureRes._descriptor.width * pixelSize;
423421
const uint32_t rowPitch =
424422
PixelFormatUtils::computeRowPitch(_textureFormat, static_cast<uint32_t>(_textureRes._descriptor.width));
425423
const uint32_t slicePitch = _textureRes._descriptor.height * rowPitch;

0 commit comments

Comments
 (0)