Skip to content

Commit c253e17

Browse files
committed
Fix type conversion warnings
1 parent a055364 commit c253e17

34 files changed

+180
-116
lines changed

src/Cpp/1-getting-started/1-1-2-HelloD3D11-Raw/Main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ int main()
178178
D3D11_VIEWPORT viewport = {};
179179
viewport.TopLeftX = 0;
180180
viewport.TopLeftY = 0;
181-
viewport.Width = g_Width;
182-
viewport.Height = g_Height;
181+
viewport.Width = static_cast<float>(g_Width);
182+
viewport.Height = static_cast<float>(g_Height);
183183
viewport.MinDepth = 0.0f;
184184
viewport.MaxDepth = 1.0f;
185185

src/Cpp/1-getting-started/1-1-2-HelloD3D11/HelloD3D11Application.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ void HelloD3D11Application::Render()
164164
D3D11_VIEWPORT viewport = {};
165165
viewport.TopLeftX = 0;
166166
viewport.TopLeftY = 0;
167-
viewport.Width = GetWindowWidth();
168-
viewport.Height = GetWindowHeight();
167+
viewport.Width = static_cast<float>(GetWindowWidth());
168+
viewport.Height = static_cast<float>(GetWindowHeight());
169169
viewport.MinDepth = 0.0f;
170170
viewport.MaxDepth = 1.0f;
171171

src/Cpp/1-getting-started/1-1-3-HelloTriangle-Refactored/HelloTriangleApplication.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ bool HelloTriangleApplication::Load()
121121
return false;
122122
}
123123

124-
_pipeline->SetViewport(0.0f, 0.0f, GetWindowWidth(), GetWindowHeight());
124+
_pipeline->SetViewport(
125+
0.0f,
126+
0.0f,
127+
static_cast<float>(GetWindowWidth()),
128+
static_cast<float>(GetWindowHeight()));
125129

126130
constexpr VertexPositionColor vertices[] =
127131
{

src/Cpp/1-getting-started/1-1-3-HelloTriangle-Refactored/PipelineFactory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bool PipelineFactory::CreatePipeline(
5656
return false;
5757
}
5858
pipeline->_primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY::D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
59-
pipeline->_vertexSize = GetLayoutByteSize(settings.VertexType);
59+
pipeline->_vertexSize = static_cast<uint32_t>(GetLayoutByteSize(settings.VertexType));
6060
return true;
6161
}
6262

@@ -147,7 +147,7 @@ bool PipelineFactory::CreateInputLayout(
147147
const std::vector<D3D11_INPUT_ELEMENT_DESC> inputLayoutDesc = _layoutMap[layoutInfo];
148148
if (FAILED(_device->CreateInputLayout(
149149
inputLayoutDesc.data(),
150-
inputLayoutDesc.size(),
150+
static_cast<uint32_t>(inputLayoutDesc.size()),
151151
vertexBlob->GetBufferPointer(),
152152
vertexBlob->GetBufferSize(),
153153
&inputLayout)))

src/Cpp/1-getting-started/1-1-3-HelloTriangle/HelloTriangleApplication.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ void HelloTriangleApplication::Render()
323323
D3D11_VIEWPORT viewport = {};
324324
viewport.TopLeftX = 0;
325325
viewport.TopLeftY = 0;
326-
viewport.Width = GetWindowWidth();
327-
viewport.Height = GetWindowHeight();
326+
viewport.Width = static_cast<float>(GetWindowWidth());
327+
viewport.Height = static_cast<float>(GetWindowHeight());
328328
viewport.MinDepth = 0.0f;
329329
viewport.MaxDepth = 1.0f;
330330

src/Cpp/1-getting-started/1-2-2-DebugLayer/DebugLayerApplication.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ bool DebugLayerApplication::Load()
133133
return false;
134134
}
135135

136-
_pipeline->SetViewport(0.0f, 0.0f, GetWindowWidth(), GetWindowHeight());
136+
_pipeline->SetViewport(
137+
0.0f,
138+
0.0f,
139+
static_cast<float>(GetWindowWidth()),
140+
static_cast<float>(GetWindowHeight()));
137141

138142
constexpr VertexPositionColor vertices[] =
139143
{

src/Cpp/1-getting-started/1-2-2-DebugLayer/PipelineFactory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bool PipelineFactory::CreatePipeline(
5656
return false;
5757
}
5858
pipeline->_primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY::D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
59-
pipeline->_vertexSize = GetLayoutByteSize(settings.VertexType);
59+
pipeline->_vertexSize = static_cast<uint32_t>(GetLayoutByteSize(settings.VertexType));
6060
return true;
6161
}
6262

@@ -147,7 +147,7 @@ bool PipelineFactory::CreateInputLayout(
147147
const std::vector<D3D11_INPUT_ELEMENT_DESC> inputLayoutDesc = _layoutMap[layoutInfo];
148148
if (FAILED(_device->CreateInputLayout(
149149
inputLayoutDesc.data(),
150-
inputLayoutDesc.size(),
150+
static_cast<uint32_t>(inputLayoutDesc.size()),
151151
vertexBlob->GetBufferPointer(),
152152
vertexBlob->GetBufferSize(),
153153
&inputLayout)))

src/Cpp/1-getting-started/1-2-3-NamingThings/NamingThingsApplication.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ bool NamingThingsApplication::Load()
144144
return false;
145145
}
146146

147-
_pipeline->SetViewport(0.0f, 0.0f, GetWindowWidth(), GetWindowHeight());
147+
_pipeline->SetViewport(
148+
0.0f,
149+
0.0f,
150+
static_cast<float>(GetWindowWidth()),
151+
static_cast<float>(GetWindowHeight()));
148152

149153
constexpr VertexPositionColor vertices[] =
150154
{

src/Cpp/1-getting-started/1-2-3-NamingThings/PipelineFactory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bool PipelineFactory::CreatePipeline(
5656
return false;
5757
}
5858
pipeline->_primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY::D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
59-
pipeline->_vertexSize = GetLayoutByteSize(settings.VertexType);
59+
pipeline->_vertexSize = static_cast<uint32_t>(GetLayoutByteSize(settings.VertexType));
6060
return true;
6161
}
6262

@@ -147,7 +147,7 @@ bool PipelineFactory::CreateInputLayout(
147147
const std::vector<D3D11_INPUT_ELEMENT_DESC> inputLayoutDesc = _layoutMap[layoutInfo];
148148
if (FAILED(_device->CreateInputLayout(
149149
inputLayoutDesc.data(),
150-
inputLayoutDesc.size(),
150+
static_cast<uint32_t>(inputLayoutDesc.size()),
151151
vertexBlob->GetBufferPointer(),
152152
vertexBlob->GetBufferSize(),
153153
&inputLayout)))

src/Cpp/1-getting-started/1-3-1-ImageLibrary/ImageLibraryApplication.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,11 @@ bool ImageLibraryApplication::Load()
146146
return false;
147147
}
148148

149-
_pipeline->SetViewport(0.0f, 0.0f, GetWindowWidth(), GetWindowHeight());
149+
_pipeline->SetViewport(
150+
0.0f,
151+
0.0f,
152+
static_cast<float>(GetWindowWidth()),
153+
static_cast<float>(GetWindowHeight()));
150154

151155
constexpr VertexPositionColorUv vertices[] =
152156
{

0 commit comments

Comments
 (0)