Skip to content

Instantly share code, notes, and snippets.

@betsch85
Forked from d7samurai/.readme.md
Created March 12, 2025 06:00
Show Gist options
  • Select an option

  • Save betsch85/d2899696cc0e3c13e32b43a22e8ffea9 to your computer and use it in GitHub Desktop.

Select an option

Save betsch85/d2899696cc0e3c13e32b43a22e8ffea9 to your computer and use it in GitHub Desktop.

Revisions

  1. @d7samurai d7samurai revised this gist Oct 13, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .readme.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Minimal D3D11 pt3
    # Minimal D3D11 part 3
    An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4), adding shadowmapping and incorporating various improvements and alternative approaches to the rendering setup, such as manual vertex fetching, samplerless texture lookup, null shader depth map rendering and procedurally generated texture and instance data.

    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering reference implementation, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft, only ~190 LOC. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)
  2. @d7samurai d7samurai revised this gist Mar 22, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .readme.md
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,4 @@ An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5

    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering reference implementation, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft, only ~190 LOC. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)
    [![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)](https://gist.github.com/d7samurai/abab8a580d0298cb2f34a44eec41d39d)
  3. @d7samurai d7samurai revised this gist Jul 14, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion code.cpp
    Original file line number Diff line number Diff line change
    @@ -81,7 +81,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
    swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(&framebufferTexture));

    D3D11_RENDER_TARGET_VIEW_DESC framebufferDesc = {};
    framebufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; // ... so do this to get _SRGB swapchain
    framebufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; // ... so do this to get _SRGB swapchain (rendertarget view)
    framebufferDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;

    ID3D11RenderTargetView* framebufferRTV;
  4. @d7samurai d7samurai revised this gist Jan 29, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion code.cpp
    Original file line number Diff line number Diff line change
    @@ -235,7 +235,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine

    device->CreatePixelShader(framebufferPSBlob->GetBufferPointer(), framebufferPSBlob->GetBufferSize(), nullptr, &framebufferPS);

    /////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////

    ID3DBlob* shadowmapVSBlob;

  5. @d7samurai d7samurai revised this gist Jan 25, 2023. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions .readme.md
    Original file line number Diff line number Diff line change
    @@ -4,5 +4,3 @@ An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5
    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering reference implementation, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft, only ~190 LOC. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)

    https://user-images.githubusercontent.com/5618797/214469662-81007dd2-2bc8-4401-a919-48c10b6b502d.mp4
  6. @d7samurai d7samurai revised this gist Jan 25, 2023. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions .readme.md
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,6 @@ An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5

    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering reference implementation, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft, only ~190 LOC. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)

    https://user-images.githubusercontent.com/5618797/214469662-81007dd2-2bc8-4401-a919-48c10b6b502d.mp4

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)

    <!---![minimald3d11pt3b](https://user-images.githubusercontent.com/5618797/197341943-a58949f0-caf9-458e-b9dd-3e2b2628f666.png)--->
    https://user-images.githubusercontent.com/5618797/214469662-81007dd2-2bc8-4401-a919-48c10b6b502d.mp4
  7. @d7samurai d7samurai revised this gist Jan 25, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions .readme.md
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@ An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5

    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering reference implementation, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft, only ~190 LOC. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)

    https://user-images.githubusercontent.com/5618797/214469662-81007dd2-2bc8-4401-a919-48c10b6b502d.mp4

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)

    <!---![minimald3d11pt3b](https://user-images.githubusercontent.com/5618797/197341943-a58949f0-caf9-458e-b9dd-3e2b2628f666.png)--->
  8. @d7samurai d7samurai renamed this gist Dec 23, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  9. @d7samurai d7samurai revised this gist Dec 19, 2022. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions shaders.hlsl
    Original file line number Diff line number Diff line change
    @@ -3,11 +3,11 @@ cbuffer constants : register(b0)
    {
    row_major float4x4 cameraprojection;
    row_major float4x4 lightprojection;
    float3 lightrotation;
    float3 modelrotation;
    float4 modeltranslation;

    float2 shadowmapsize;
    float3 lightrotation;
    float3 modelrotation;
    float4 modeltranslation;
    float2 shadowmapsize;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////////
  10. @d7samurai d7samurai revised this gist Dec 19, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion shaders.hlsl
    Original file line number Diff line number Diff line change
    @@ -75,7 +75,7 @@ output framebuffer_vs(uint vertexid : SV_VERTEXID, uint instanceid : SV_INSTANCE

    float4 framebuffer_ps(output myinput) : SV_TARGET
    {
    float3 color = myinput.color.rgb * ((uint(myinput.texcoord.x * 2) ^ uint(myinput.texcoord.y * 2)) & 1 ? 0.25f : 1.0f);
    float3 color = myinput.color.rgb * ((uint(myinput.texcoord.x * 2) ^ uint(myinput.texcoord.y * 2)) & 1 ? 0.25f : 1.0f); // procedural checkerboard pattern
    float light = myinput.color.a;

    if (light > 0.0f && shadowmap[myinput.lightpos.xy] < myinput.lightpos.z) light *= 0.2;
  11. @d7samurai d7samurai revised this gist Dec 19, 2022. 1 changed file with 1 addition and 4 deletions.
    5 changes: 1 addition & 4 deletions shaders.hlsl
    Original file line number Diff line number Diff line change
    @@ -78,10 +78,7 @@ float4 framebuffer_ps(output myinput) : SV_TARGET
    float3 color = myinput.color.rgb * ((uint(myinput.texcoord.x * 2) ^ uint(myinput.texcoord.y * 2)) & 1 ? 0.25f : 1.0f);
    float light = myinput.color.a;

    if (light > 0.0f && shadowmap[myinput.lightpos.xy] < myinput.lightpos.z)
    {
    light *= 0.2;
    }
    if (light > 0.0f && shadowmap[myinput.lightpos.xy] < myinput.lightpos.z) light *= 0.2;

    return float4(color * (light * 0.8f + 0.2f), 1);
    }
  12. @d7samurai d7samurai revised this gist Dec 19, 2022. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions shaders.hlsl
    Original file line number Diff line number Diff line change
    @@ -20,10 +20,10 @@ struct input

    struct output
    {
    float4 position : SV_POSITION;
    float4 lightpos : LPS;
    float2 texcoord : TEX;
    nointerpolation float4 color : COL;
    float4 position : SV_POSITION;
    float4 lightpos : LPS;
    float2 texcoord : TEX;
    nointerpolation float4 color : COL;
    };

    ///////////////////////////////////////////////////////////////////////////////////////////////////
  13. @d7samurai d7samurai revised this gist Dec 19, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion shaders.hlsl
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ struct output
    float4 position : SV_POSITION;
    float4 lightpos : LPS;
    float2 texcoord : TEX;
    float4 color : COL;
    nointerpolation float4 color : COL;
    };

    ///////////////////////////////////////////////////////////////////////////////////////////////////
  14. @d7samurai d7samurai revised this gist Dec 19, 2022. 1 changed file with 3 additions and 5 deletions.
    8 changes: 3 additions & 5 deletions code.cpp
    Original file line number Diff line number Diff line change
    @@ -17,13 +17,11 @@

    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
    {
    WNDCLASSEXA wndClassEx = { sizeof(wndClassEx) };
    wndClassEx.lpfnWndProc = DefWindowProcA;
    wndClassEx.lpszClassName = TITLE;
    WNDCLASSA wndClass = { 0, DefWindowProcA, 0, 0, 0, 0, 0, 0, 0, TITLE };

    RegisterClassExA(&wndClassEx);
    RegisterClassA(&wndClass);

    HWND window = CreateWindowExA(0, TITLE, TITLE, WS_POPUP | WS_MAXIMIZE | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, nullptr, nullptr, nullptr, nullptr);
    HWND window = CreateWindowExA(0, TITLE, TITLE, WS_POPUP | WS_MAXIMIZE | WS_VISIBLE, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);

    ///////////////////////////////////////////////////////////////////////////////////////////////

  15. @d7samurai d7samurai revised this gist Dec 15, 2022. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions shaders.hlsl
    Original file line number Diff line number Diff line change
    @@ -14,8 +14,8 @@ cbuffer constants : register(b0)

    struct input
    {
    float3 position : POS;
    float2 texcoord : TEX;
    float3 position;
    float2 texcoord;
    };

    struct output
  16. @d7samurai d7samurai revised this gist Dec 13, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion code.cpp
    Original file line number Diff line number Diff line change
    @@ -173,7 +173,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
    vertexBufferDesc.Usage = D3D11_USAGE_IMMUTABLE;
    vertexBufferDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE; // using regular shader resource as vertex buffer for manual vertex fetch
    vertexBufferDesc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
    vertexBufferDesc.StructureByteStride = 5 * 4; // 5 floats per vertex (float3 position, float2 texcoord)
    vertexBufferDesc.StructureByteStride = 5 * sizeof(float); // 5 floats per vertex (float3 position, float2 texcoord)

    D3D11_SUBRESOURCE_DATA vertexBufferData = { vertexData };

  17. @d7samurai d7samurai revised this gist Dec 13, 2022. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions code.cpp
    Original file line number Diff line number Diff line change
    @@ -166,7 +166,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine

    ///////////////////////////////////////////////////////////////////////////////////////////////

    float vertexData[] = { -1, 1, -1, 0, 0, 1, 1, -1, 9.5f, 0, -0.58f, 0.58f, -1, 2, 2, 0.58f, 0.58f, -1, 7.5f, 2, -0.58f, 0.58f, -1, 0, 0, 0.58f, 0.58f, -1, 0, 0, -0.58f, 0.58f, -0.58f, 0, 0, 0.58f, 0.58f, -0.58f, 0, 0 }; // float3 position, float2 texcoord, ...
    float vertexData[] = { -1, 1, -1, 0, 0, 1, 1, -1, 9.5f, 0, -0.58f, 0.58f, -1, 2, 2, 0.58f, 0.58f, -1, 7.5f, 2, -0.58f, 0.58f, -1, 0, 0, 0.58f, 0.58f, -1, 0, 0, -0.58f, 0.58f, -0.58f, 0, 0, 0.58f, 0.58f, -0.58f, 0, 0 }; // pos.x, pos.y, pos.z, tex.u, tex.v, ...

    D3D11_BUFFER_DESC vertexBufferDesc = {};
    vertexBufferDesc.ByteWidth = sizeof(vertexData);
    @@ -184,7 +184,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
    D3D11_SHADER_RESOURCE_VIEW_DESC vertexBufferSRVdesc = {};
    vertexBufferSRVdesc.Format = DXGI_FORMAT_UNKNOWN;
    vertexBufferSRVdesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
    vertexBufferSRVdesc.Buffer.NumElements = sizeof(vertexData) / vertexBufferDesc.StructureByteStride;
    vertexBufferSRVdesc.Buffer.NumElements = vertexBufferDesc.ByteWidth / vertexBufferDesc.StructureByteStride;

    ID3D11ShaderResourceView* vertexBufferSRV;

  18. @d7samurai d7samurai revised this gist Nov 16, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .minimal d3d11 pt3.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # Minimal D3D11 pt3
    An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4), adding shadowmapping and incorporating various improvements and alternative approaches to the rendering setup, such as manual vertex fetching, samplerless texture lookup, null shader depth map rendering and procedurally generated texture and instance data.

    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering implementation for reference, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft, only ~190 LOC. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)
    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering reference implementation, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft, only ~190 LOC. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)

  19. @d7samurai d7samurai revised this gist Nov 16, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .minimal d3d11 pt3.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # Minimal D3D11 pt3
    An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4), adding shadowmapping and incorporating various improvements and alternative approaches to the rendering setup, such as manual vertex fetching, samplerless texture lookup, null shader depth map rendering and procedurally generated texture and instance data.

    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering implementation _for reference_, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft, only ~190 LOC. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)
    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering implementation for reference, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft, only ~190 LOC. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)

  20. @d7samurai d7samurai revised this gist Oct 24, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .minimal d3d11 pt3.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # Minimal D3D11 pt3
    An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4), adding shadowmapping and incorporating various improvements and alternative approaches to the rendering setup, such as manual vertex fetching, samplerless texture lookup, null shader depth map rendering and procedurally generated texture and instance data.

    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering implementation _for reference_, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft. ~190 LOC. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)
    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering implementation _for reference_, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft, only ~190 LOC. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)

  21. @d7samurai d7samurai revised this gist Oct 24, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .minimal d3d11 pt3.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # Minimal D3D11 pt3
    An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4), adding shadowmapping and incorporating various improvements and alternative approaches to the rendering setup, such as manual vertex fetching, samplerless texture lookup, null shader depth map rendering and procedurally generated texture and instance data.

    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering implementation _for reference_, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)
    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering implementation _for reference_, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft. ~190 LOC. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)

  22. @d7samurai d7samurai revised this gist Oct 24, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .minimal d3d11 pt3.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # Minimal D3D11 pt3
    An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4), adding shadowmapping and incorporating various improvements and alternative approaches to the rendering setup, such as manual vertex fetching, samplerless texture lookup, null shader depth map rendering and procedurally generated texture and instance data.

    As before, this is intended to be an an "API familiarizer" - an uncluttered Direct3D 11 setup & basic rendering implementation _for reference_, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)
    As before, this is intended to be an an "API familiarizer" - an **uncluttered** Direct3D 11 setup & basic rendering implementation _for reference_, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)

  23. @d7samurai d7samurai revised this gist Oct 24, 2022. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion .minimal d3d11 pt3.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    # Minimal D3D11 pt3
    An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4), adding shadowmapping and incorporating various improvements and alternative approaches to the rendering setup, such as manual vertex fetching, samplerless texture lookup, null shader depth map rendering and procedurally generated texture and instance data. As before, this is intended to be an an "API familiarizer" - an uncluttered Direct3D 11 setup & basic rendering implementation _for reference_, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)
    An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4), adding shadowmapping and incorporating various improvements and alternative approaches to the rendering setup, such as manual vertex fetching, samplerless texture lookup, null shader depth map rendering and procedurally generated texture and instance data.

    As before, this is intended to be an an "API familiarizer" - an uncluttered Direct3D 11 setup & basic rendering implementation _for reference_, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)

  24. @d7samurai d7samurai revised this gist Oct 24, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .minimal d3d11 pt3.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    # Minimal D3D11 pt3
    An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4), adding shadowmapping and incorporating various improvements and alternative approaches to the rendering setup, such as manual vertex fetching, samplerless texture lookup, null shader depth map rendering and procedurally generated texture and instance data. As before, this is intended to be an uncluttered Direct3D 11 setup & basic rendering primer / API familiarizer, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)
    An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4), adding shadowmapping and incorporating various improvements and alternative approaches to the rendering setup, such as manual vertex fetching, samplerless texture lookup, null shader depth map rendering and procedurally generated texture and instance data. As before, this is intended to be an an "API familiarizer" - an uncluttered Direct3D 11 setup & basic rendering implementation _for reference_, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)

  25. @d7samurai d7samurai revised this gist Oct 24, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion code.cpp
    Original file line number Diff line number Diff line change
    @@ -155,7 +155,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
    };

    D3D11_BUFFER_DESC constantBufferDesc = {};
    constantBufferDesc.ByteWidth = sizeof(Constants) + 0xf & 0xfffffff0; // ensure constant buffer size is multiple of 16
    constantBufferDesc.ByteWidth = sizeof(Constants) + 0xf & 0xfffffff0; // ensure constant buffer size is multiple of 16 bytes
    constantBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    constantBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    constantBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
  26. @d7samurai d7samurai revised this gist Oct 24, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion code.cpp
    Original file line number Diff line number Diff line change
    @@ -155,7 +155,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
    };

    D3D11_BUFFER_DESC constantBufferDesc = {};
    constantBufferDesc.ByteWidth = sizeof(Constants) + 0xf & 0xfffffff0; // round constant buffer size up to 16 byte boundary
    constantBufferDesc.ByteWidth = sizeof(Constants) + 0xf & 0xfffffff0; // ensure constant buffer size is multiple of 16
    constantBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
    constantBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
    constantBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
  27. @d7samurai d7samurai revised this gist Oct 24, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion code.cpp
    Original file line number Diff line number Diff line change
    @@ -94,7 +94,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine

    D3D11_TEXTURE2D_DESC framebufferDepthDesc;

    framebufferTexture->GetDesc(&framebufferDepthDesc); // copy framebuffer properties
    framebufferTexture->GetDesc(&framebufferDepthDesc); // copy from framebuffer properties

    framebufferDepthDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
    framebufferDepthDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
  28. @d7samurai d7samurai revised this gist Oct 23, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .minimal d3d11 pt3.md
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,4 @@ An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)

    // ![minimald3d11pt3b](https://user-images.githubusercontent.com/5618797/197341943-a58949f0-caf9-458e-b9dd-3e2b2628f666.png)
    <!---![minimald3d11pt3b](https://user-images.githubusercontent.com/5618797/197341943-a58949f0-caf9-458e-b9dd-3e2b2628f666.png)--->
  29. @d7samurai d7samurai revised this gist Oct 23, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .minimal d3d11 pt3.md
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,4 @@ An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)

    ![minimald3d11pt3b](https://user-images.githubusercontent.com/5618797/197341943-a58949f0-caf9-458e-b9dd-3e2b2628f666.png)
    // ![minimald3d11pt3b](https://user-images.githubusercontent.com/5618797/197341943-a58949f0-caf9-458e-b9dd-3e2b2628f666.png)
  30. @d7samurai d7samurai revised this gist Oct 23, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .minimal d3d11 pt3.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    # Minimal D3D11 pt3
    An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4), adding shadowmapping and incorporating various improvements and alternative approaches to the rendering setup, such as manual vertex fetching, samplerless texture lookup, null shader depth map rendering and procedurally generated texture and instance data. As before, this is intended to be an uncluttered Direct3D 11 setup & basic rendering primer / API familiarizer in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)
    An elaboration on [Minimal D3D11 pt2](https://gist.github.com/d7samurai/aee35fd5d132c51e8b0a78699cbaa1e4), adding shadowmapping and incorporating various improvements and alternative approaches to the rendering setup, such as manual vertex fetching, samplerless texture lookup, null shader depth map rendering and procedurally generated texture and instance data. As before, this is intended to be an uncluttered Direct3D 11 setup & basic rendering primer / API familiarizer, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft. [View on YouTube](https://youtu.be/Oj_umRjZ7NU)

    ![minimald3d11pt3](https://user-images.githubusercontent.com/5618797/197362544-685b5823-3637-4906-ae1d-929eb0f7e351.png)