Skip to content

Commit 33e5ef3

Browse files
author
Floyd Huizinga
committed
cleanup and warning fixes
1 parent b475ef6 commit 33e5ef3

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/Cpp/1-getting-started/1-3-2-Texturing/TexturingApplication.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,6 @@ void TexturingApplication::Update()
405405
void TexturingApplication::Render()
406406
{
407407
float clearColor[] = { 0.1f, 0.1f, 0.1f, 1.0f };
408-
constexpr uint32_t vertexOffset = 0;
409408

410409
ID3D11RenderTargetView* nullTarget = nullptr;
411410

@@ -419,13 +418,13 @@ void TexturingApplication::Render()
419418

420419
D3D11_BUFFER_DESC description = {};
421420
_triangleVertices->GetDesc(&description);
422-
UINT stride = sizeof(VertexPositionColorUv);
421+
UINT stride = static_cast<UINT>(_shaderCollection.GetLayoutByteSize(VertexType::PositionColorUv));
423422
_deviceContext->IASetVertexBuffers(
424423
0,
425424
1,
426425
_triangleVertices.GetAddressOf(),
427426
&stride,
428-
&vertexOffset);
427+
nullptr);
429428

430429
_shaderCollection.ApplyToContext(_deviceContext.Get());
431430

src/Cpp/1-getting-started/1-3-3-SettingUp3DRendering/Setting3DApplication.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ void Setting3DApplication::Update()
483483
void Setting3DApplication::Render()
484484
{
485485
float clearColor[] = { 0.1f, 0.1f, 0.1f, 1.0f };
486-
constexpr uint32_t vertexOffset = 0;
487486

488487
ID3D11RenderTargetView* nullTarget = nullptr;
489488

@@ -497,13 +496,13 @@ void Setting3DApplication::Render()
497496

498497
D3D11_BUFFER_DESC description = {};
499498
_triangleVertices->GetDesc(&description);
500-
UINT stride = sizeof(VertexPositionColorUv);
499+
UINT stride = static_cast<UINT>(_shaderCollection.GetLayoutByteSize(VertexType::PositionColorUv));
501500
_deviceContext->IASetVertexBuffers(
502501
0,
503502
1,
504503
_triangleVertices.GetAddressOf(),
505504
&stride,
506-
&vertexOffset);
505+
nullptr);
507506

508507
_shaderCollection.ApplyToContext(_deviceContext.Get());
509508

src/Cpp/1-getting-started/1-3-4-3DRendering/3DRenderingApplication.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ void Rendering3DApplication::Update()
401401
void Rendering3DApplication::Render()
402402
{
403403
float clearColor[] = { 0.1f, 0.1f, 0.1f, 1.0f };
404-
constexpr uint32_t vertexOffset = 0;
405404

406405
ID3D11RenderTargetView* nullRTV = nullptr;
407406

@@ -415,13 +414,13 @@ void Rendering3DApplication::Render()
415414

416415
_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY::D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
417416

418-
UINT stride = sizeof(VertexPositionColorUv);
417+
UINT stride = static_cast<UINT>(_shaderCollection.GetLayoutByteSize(VertexType::PositionColorUv));
419418
_deviceContext->IASetVertexBuffers(
420419
0,
421420
1,
422421
_cubeVertices.GetAddressOf(),
423422
&stride,
424-
&vertexOffset);
423+
nullptr);
425424

426425
_deviceContext->IASetIndexBuffer(
427426
_cubeIndices.Get(),

0 commit comments

Comments
 (0)