Skip to content

Commit

Permalink
Initial dxc include functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
krupitskas committed Nov 28, 2024
1 parent 9e92fb4 commit 5e0256e
Show file tree
Hide file tree
Showing 26 changed files with 250 additions and 434 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</div>

<p align="center">
<img src="Docs/Images/Raster.png" style="width: 40%; height: 40%">
<img src="Docs/Images/Pathtracing.png" style="width: 40%; height: 40%">
<img src="Docs/Images/Raster.png" style="width: 49%; height: 49%">
<img src="Docs/Images/Pathtracing.png" style="width: 49%; height: 49%">
</p>

## Current research goal idea
Expand Down
210 changes: 0 additions & 210 deletions Shaders/GenerateMipsFast.hlsl

This file was deleted.

56 changes: 1 addition & 55 deletions Shaders/RayGenRT.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//#include "Common.hlsl"
#include "Shared.hlsl"

struct HitInfo
{
Expand Down Expand Up @@ -41,60 +41,6 @@ cbuffer CameraParameters : register(b0)
uint pad;
}

uint JenkinsHash(uint x)
{
x += x << 10;
x ^= x >> 6;
x += x << 3;
x ^= x >> 11;
x += x << 15;
return x;
}

uint InitRNG(uint2 pixel , uint2 resolution , uint frame)
{
const uint rng_state = dot(pixel , uint2(1, resolution.x)) ^ JenkinsHash(frame);
return JenkinsHash(rng_state);
}

float UintToFloat(uint x)
{
return asfloat(0x3f800000 | (x >> 9)) - 1.f;
}

uint Xorshift(inout uint rng_state)
{
rng_state ^= rng_state << 13;
rng_state ^= rng_state >> 17;
rng_state ^= rng_state << 5;
return rng_state;
}

float Rand(inout uint rng_state)
{
return UintToFloat(Xorshift(rng_state));
}

// input : pixel screen space coordinate, frame number, sample number
// return : four random numbers
uint4 Pcg4d(uint4 v)
{
v = v * 1664525u + 1013904223u;

v.x += v.y * v.w;
v.y += v.z * v.x;
v.z += v.x * v.y;
v.w += v.y * v.z;

v = v ^ (v >> 16u);
v.x += v.y * v.w;
v.y += v.z * v.x;
v.z += v.x * v.y;
v.w += v.y * v.z;

return v;
}

// octahedron encoding of normals
float2 octWrap(float2 v)
{
Expand Down
53 changes: 53 additions & 0 deletions Shaders/Shared.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
uint JenkinsHash(uint x)
{
x += x << 10;
x ^= x >> 6;
x += x << 3;
x ^= x >> 11;
x += x << 15;
return x;
}

uint InitRNG(uint2 pixel , uint2 resolution , uint frame)
{
const uint rng_state = dot(pixel , uint2(1, resolution.x)) ^ JenkinsHash(frame);
return JenkinsHash(rng_state);
}

float UintToFloat(uint x)
{
return asfloat(0x3f800000 | (x >> 9)) - 1.f;
}

uint Xorshift(inout uint rng_state)
{
rng_state ^= rng_state << 13;
rng_state ^= rng_state >> 17;
rng_state ^= rng_state << 5;
return rng_state;
}

float Rand(inout uint rng_state)
{
return UintToFloat(Xorshift(rng_state));
}

// input : pixel screen space coordinate, frame number, sample number
// return : four random numbers
uint4 Pcg4d(uint4 v)
{
v = v * 1664525u + 1013904223u;

v.x += v.y * v.w;
v.y += v.z * v.x;
v.z += v.x * v.y;
v.w += v.y * v.z;

v = v ^ (v >> 16u);
v.x += v.y * v.w;
v.y += v.z * v.x;
v.z += v.x * v.y;
v.w += v.y * v.z;

return v;
}
5 changes: 2 additions & 3 deletions Yasno/Graphics/Material.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#pragma once

#include <Renderer/PSO.hpp>
#include <Renderer/GpuResource.hpp>
#include <Graphics/SurfaceMaterial.hpp>
#include <d3dx12.h>
#include <string>

namespace ysn
{
Expand Down
13 changes: 1 addition & 12 deletions Yasno/Graphics/RenderScene.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@

#include <Graphics/Material.hpp>
#include <Graphics/Mesh.hpp>
#include <Graphics/RenderObjectId.hpp>
#include <Yasno/Lights.hpp>
#include <Yasno/CameraController.hpp>
#include <Renderer/GpuResource.hpp>
#include <Renderer/GpuTexture.hpp>
#include <Renderer/GpuBuffer.hpp>
#include <Graphics/ShaderSharedStructs.h>

namespace ysn
{
Expand Down Expand Up @@ -47,16 +46,6 @@ namespace ysn
std::vector<D3D12_SAMPLER_DESC> sampler_descs;
};

// Per instance data for rendering, this can be split into smaller parts
YSN_SHADER_STRUCT RenderInstanceData
{
DirectX::XMMATRIX model_matrix;
int32_t material_id;
int32_t vertices_before;
int32_t indices_before; // offset
int32_t pad;
};

struct RenderScene
{
std::shared_ptr<Camera> camera;
Expand Down
6 changes: 0 additions & 6 deletions Yasno/Graphics/RtxMaterial.cpp

This file was deleted.

Loading

0 comments on commit 5e0256e

Please sign in to comment.