moved more things to bindless
This commit is contained in:
@@ -19,27 +19,6 @@
|
||||
#define TEXSLOT_BVH_PRIMITIVES 5
|
||||
#define TEXSLOT_BVH_NODES 6
|
||||
|
||||
#define SBSLOT_ENTITYARRAY 7
|
||||
#define SBSLOT_MATRIXARRAY 8
|
||||
|
||||
#define TEXSLOT_SHADOWARRAY_2D 12
|
||||
#define TEXSLOT_SHADOWARRAY_CUBE 13
|
||||
#define TEXSLOT_SHADOWARRAY_TRANSPARENT_2D 14
|
||||
#define TEXSLOT_SHADOWARRAY_TRANSPARENT_CUBE 15
|
||||
|
||||
#define TEXSLOT_SKYVIEWLUT 16
|
||||
#define TEXSLOT_TRANSMITTANCELUT 17
|
||||
#define TEXSLOT_MULTISCATTERINGLUT 18
|
||||
#define TEXSLOT_SKYLUMINANCELUT 19
|
||||
|
||||
#define TEXSLOT_SHEENLUT 20
|
||||
#define TEXSLOT_BLUENOISE 21
|
||||
#define TEXSLOT_RANDOM64X64 22
|
||||
|
||||
#define TEXSLOT_VOXELGI 23
|
||||
|
||||
#define TEXSLOT_FONTATLAS 29
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -82,12 +61,6 @@
|
||||
|
||||
#define TEXSLOT_COUNT 64
|
||||
|
||||
// Skinning:
|
||||
#define SKINNINGSLOT_IN_VERTEX_POS TEXSLOT_ONDEMAND0
|
||||
#define SKINNINGSLOT_IN_VERTEX_TAN TEXSLOT_ONDEMAND1
|
||||
#define SKINNINGSLOT_IN_VERTEX_BON TEXSLOT_ONDEMAND2
|
||||
#define SKINNINGSLOT_IN_BONEBUFFER TEXSLOT_ONDEMAND3
|
||||
|
||||
// RenderPath texture mappings:
|
||||
#define TEXSLOT_RENDERPATH_ENTITYTILES TEXSLOT_ONDEMAND13
|
||||
#define TEXSLOT_RENDERPATH_REFLECTION TEXSLOT_ONDEMAND14
|
||||
@@ -98,10 +71,5 @@
|
||||
#define TEXSLOT_RENDERPATH_RTSHADOW TEXSLOT_ONDEMAND19
|
||||
#define TEXSLOT_RENDERPATH_SURFELGI TEXSLOT_ONDEMAND20
|
||||
|
||||
// wiImage:
|
||||
#define TEXSLOT_IMAGE_BASE TEXSLOT_ONDEMAND0
|
||||
#define TEXSLOT_IMAGE_MASK TEXSLOT_ONDEMAND1
|
||||
#define TEXSLOT_IMAGE_BACKGROUND TEXSLOT_ONDEMAND2
|
||||
|
||||
|
||||
#endif // WI_RESOURCE_MAPPING_H
|
||||
|
||||
@@ -812,6 +812,26 @@ struct FrameCB
|
||||
int ObjectShaderSamplerIndex;
|
||||
float BlueNoisePhase;
|
||||
|
||||
int texture_random64x64_index;
|
||||
int texture_bluenoise_index;
|
||||
int texture_sheenlut_index;
|
||||
int texture_skyviewlut_index;
|
||||
|
||||
int texture_transmittancelut_index;
|
||||
int texture_multiscatteringlut_index;
|
||||
int texture_skyluminancelut_index;
|
||||
int texture_shadowarray_2d_index;
|
||||
|
||||
int texture_shadowarray_cube_index;
|
||||
int texture_shadowarray_transparent_2d_index;
|
||||
int texture_shadowarray_transparent_cube_index;
|
||||
int texture_voxelgi_index;
|
||||
|
||||
int buffer_entityarray_index;
|
||||
int buffer_entitymatrixarray_index;
|
||||
int padding1;
|
||||
int padding2;
|
||||
|
||||
AtmosphereParameters Atmosphere;
|
||||
VolumetricCloudParameters VolumetricClouds;
|
||||
|
||||
@@ -970,5 +990,16 @@ CBUFFER(PaintRadiusCB, CBSLOT_RENDERER_MISC)
|
||||
uint2 pad;
|
||||
};
|
||||
|
||||
struct SkinningPushConstants
|
||||
{
|
||||
int bonebuffer_index;
|
||||
int vb_pos_nor_wind;
|
||||
int vb_tan;
|
||||
int vb_bon;
|
||||
|
||||
int so_pos_nor_wind;
|
||||
int so_tan;
|
||||
};
|
||||
|
||||
|
||||
#endif // WI_SHADERINTEROP_RENDERER_H
|
||||
|
||||
@@ -31,7 +31,7 @@ void main(uint3 DTid : SV_DispatchThreadID, uint Gid : SV_GroupIndex)
|
||||
// simulate:
|
||||
for (uint i = 0; i < g_xFrame.ForceFieldArrayCount; ++i)
|
||||
{
|
||||
ShaderEntity forceField = EntityArray[g_xFrame.ForceFieldArrayOffset + i];
|
||||
ShaderEntity forceField = load_entity(g_xFrame.ForceFieldArrayOffset + i);
|
||||
|
||||
[branch]
|
||||
if (forceField.layerMask & xEmitterLayerMask)
|
||||
|
||||
@@ -14,7 +14,7 @@ PSIn main(uint vID : SV_VERTEXID)
|
||||
Out.pos = float4(CreateCube(vID) * 2 - 1, 1);
|
||||
|
||||
uint forceFieldID = g_xFrame.ForceFieldArrayOffset + (uint)g_xColor.w;
|
||||
ShaderEntity forceField = EntityArray[forceFieldID];
|
||||
ShaderEntity forceField = load_entity(forceFieldID);
|
||||
|
||||
Out.pos.xyz *= forceField.GetConeAngleCos(); // range...
|
||||
Out.pos.xyz += forceField.position;
|
||||
|
||||
@@ -16,7 +16,7 @@ PSIn main(uint vID : SV_VERTEXID)
|
||||
|
||||
|
||||
uint forceFieldID = g_xFrame.ForceFieldArrayOffset + (uint)g_xColor.w;
|
||||
ShaderEntity forceField = EntityArray[forceFieldID];
|
||||
ShaderEntity forceField = load_entity(forceFieldID);
|
||||
|
||||
Out.pos.xyz *= forceField.GetConeAngleCos(); // range...
|
||||
Out.pos.xyz += forceField.position;
|
||||
|
||||
@@ -10,7 +10,7 @@ struct PSIn
|
||||
float4 main(PSIn input) : SV_TARGET
|
||||
{
|
||||
uint forceFieldID = g_xFrame.ForceFieldArrayOffset + (uint)g_xColor.w;
|
||||
ShaderEntity forceField = EntityArray[forceFieldID];
|
||||
ShaderEntity forceField = load_entity(forceFieldID);
|
||||
|
||||
float4 color = forceField.GetEnergy() < 0 ? float4(0, 0, 1, 1) : float4(1, 0, 0, 1);
|
||||
|
||||
|
||||
@@ -8,10 +8,12 @@ ByteAddressBuffer bindless_buffers[] : register(space2);
|
||||
SamplerState bindless_samplers[] : register(space3);
|
||||
Buffer<uint> bindless_ib[] : register(space4);
|
||||
|
||||
Texture2DArray<float4> bindless_textures2DArray[] : register(space5);
|
||||
TextureCube<float4> bindless_cubemaps[] : register(space5);
|
||||
TextureCubeArray<float4> bindless_cubearrays[] : register(space6);
|
||||
Texture3D<float4> bindless_textures3D[] : register(space7);
|
||||
RWTexture2D<float4> bindless_rwtextures[] : register(space8);
|
||||
RWByteAddressBuffer bindless_rwbuffers[] : register(space9);
|
||||
|
||||
ShaderMeshInstance load_instance(uint instanceIndex)
|
||||
{
|
||||
@@ -29,29 +31,37 @@ ShaderMaterial load_material(uint materialIndex)
|
||||
{
|
||||
return bindless_buffers[g_xFrame.scene.materialbuffer].Load<ShaderMaterial>(materialIndex * sizeof(ShaderMaterial));
|
||||
}
|
||||
ShaderEntity load_entity(uint entityIndex)
|
||||
{
|
||||
return bindless_buffers[g_xFrame.buffer_entityarray_index].Load<ShaderEntity>(entityIndex * sizeof(ShaderEntity));
|
||||
}
|
||||
float4x4 load_entitymatrix(uint matrixIndex)
|
||||
{
|
||||
return transpose(bindless_buffers[g_xFrame.buffer_entitymatrixarray_index].Load<float4x4>(matrixIndex * sizeof(float4x4)));
|
||||
}
|
||||
|
||||
#define texture_globalenvmap bindless_cubemaps[g_xFrame.scene.globalenvmap]
|
||||
#define texture_envmaparray bindless_cubearrays[g_xFrame.scene.envmaparray]
|
||||
|
||||
#define texture_random64x64 bindless_textures[g_xFrame.texture_random64x64_index]
|
||||
#define texture_bluenoise bindless_textures[g_xFrame.texture_bluenoise_index]
|
||||
#define texture_sheenlut bindless_textures[g_xFrame.texture_sheenlut_index]
|
||||
#define texture_skyviewlut bindless_textures[g_xFrame.texture_skyviewlut_index]
|
||||
#define texture_transmittancelut bindless_textures[g_xFrame.texture_transmittancelut_index]
|
||||
#define texture_multiscatteringlut bindless_textures[g_xFrame.texture_multiscatteringlut_index]
|
||||
#define texture_skyluminancelut bindless_textures[g_xFrame.texture_skyluminancelut_index]
|
||||
#define texture_shadowarray_2d bindless_textures2DArray[g_xFrame.texture_shadowarray_2d_index]
|
||||
#define texture_shadowarray_cube bindless_cubearrays[g_xFrame.texture_shadowarray_cube_index]
|
||||
#define texture_shadowarray_transparent_2d bindless_textures2DArray[g_xFrame.texture_shadowarray_transparent_2d_index]
|
||||
#define texture_shadowarray_transparent_cube bindless_cubearrays[g_xFrame.texture_shadowarray_transparent_cube_index]
|
||||
#define texture_voxelgi bindless_textures3D[g_xFrame.texture_voxelgi_index]
|
||||
|
||||
TEXTURE2D(texture_depth, float, TEXSLOT_DEPTH);
|
||||
TEXTURE2D(texture_lineardepth, float, TEXSLOT_LINEARDEPTH);
|
||||
TEXTURE2D(texture_gbuffer0, uint2, TEXSLOT_GBUFFER0);
|
||||
TEXTURE2D(texture_gbuffer1, float2, TEXSLOT_GBUFFER1);
|
||||
TEXTURE2D(texture_skyviewlut, float4, TEXSLOT_SKYVIEWLUT);
|
||||
TEXTURE2D(texture_transmittancelut, float4, TEXSLOT_TRANSMITTANCELUT);
|
||||
TEXTURE2D(texture_multiscatteringlut, float4, TEXSLOT_MULTISCATTERINGLUT);
|
||||
TEXTURE2D(texture_skyluminancelut, float4, TEXSLOT_SKYLUMINANCELUT);
|
||||
TEXTURE2DARRAY(texture_shadowarray_2d, float, TEXSLOT_SHADOWARRAY_2D);
|
||||
TEXTURECUBEARRAY(texture_shadowarray_cube, float, TEXSLOT_SHADOWARRAY_CUBE);
|
||||
TEXTURE2DARRAY(texture_shadowarray_transparent_2d, float4, TEXSLOT_SHADOWARRAY_TRANSPARENT_2D);
|
||||
TEXTURECUBEARRAY(texture_shadowarray_transparent_cube, float4, TEXSLOT_SHADOWARRAY_TRANSPARENT_CUBE);
|
||||
TEXTURE3D(texture_voxelgi, float4, TEXSLOT_VOXELGI);
|
||||
TEXTURE2D(texture_sheenlut, float, TEXSLOT_SHEENLUT);
|
||||
TEXTURE2D(texture_bluenoise, float4, TEXSLOT_BLUENOISE);
|
||||
TEXTURE2D(texture_random64x64, float4, TEXSLOT_RANDOM64X64);
|
||||
STRUCTUREDBUFFER(EntityArray, ShaderEntity, SBSLOT_ENTITYARRAY);
|
||||
STRUCTUREDBUFFER(MatrixArray, float4x4, SBSLOT_MATRIXARRAY);
|
||||
|
||||
// These are static samplers, don't need to be bound:
|
||||
SAMPLERSTATE( sampler_linear_clamp, SSLOT_LINEAR_CLAMP );
|
||||
SAMPLERSTATE( sampler_linear_wrap, SSLOT_LINEAR_WRAP );
|
||||
SAMPLERSTATE( sampler_linear_mirror, SSLOT_LINEAR_MIRROR );
|
||||
|
||||
@@ -116,7 +116,7 @@ void main(uint3 DTid : SV_DispatchThreadID, uint3 Gid : SV_GroupID, uint groupIn
|
||||
float3 force = 0;
|
||||
for (uint i = 0; i < g_xFrame.ForceFieldArrayCount; ++i)
|
||||
{
|
||||
ShaderEntity forceField = EntityArray[g_xFrame.ForceFieldArrayOffset + i];
|
||||
ShaderEntity forceField = load_entity(g_xFrame.ForceFieldArrayOffset + i);
|
||||
|
||||
[branch]
|
||||
if (forceField.layerMask & xHairLayerMask)
|
||||
|
||||
@@ -212,7 +212,7 @@ void main(uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid :
|
||||
// Each thread will cull one entity until all entities have been culled:
|
||||
for (i = groupIndex; i < entityCount; i += TILED_CULLING_THREADSIZE * TILED_CULLING_THREADSIZE)
|
||||
{
|
||||
ShaderEntity entity = EntityArray[i];
|
||||
ShaderEntity entity = load_entity(i);
|
||||
|
||||
if (entity.GetFlags() & ENTITY_FLAG_LIGHT_STATIC)
|
||||
{
|
||||
@@ -287,7 +287,7 @@ void main(uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid :
|
||||
|
||||
// frustum AABB in world space transformed into the space of the probe/decal OBB:
|
||||
AABB b = GroupAABB_WS;
|
||||
AABBtransform(b, MatrixArray[entity.GetMatrixIndex()]);
|
||||
AABBtransform(b, load_entitymatrix(entity.GetMatrixIndex()));
|
||||
|
||||
if (IntersectAABB(a, b))
|
||||
{
|
||||
|
||||
@@ -50,18 +50,18 @@ inline float3 shadowCascade(in ShaderEntity light, in float3 shadowPos, in float
|
||||
float3 shadow = 0;
|
||||
#ifndef DISABLE_SOFT_SHADOWMAP
|
||||
// sample along a rectangle pattern around center:
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(-1, -1) * g_xFrame.ShadowKernel2D, slice), realDistance);
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(-1, 0) * g_xFrame.ShadowKernel2D, slice), realDistance);
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(-1, 1) * g_xFrame.ShadowKernel2D, slice), realDistance);
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(0, -1) * g_xFrame.ShadowKernel2D, slice), realDistance);
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV, slice), realDistance);
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(0, 1) * g_xFrame.ShadowKernel2D, slice), realDistance);
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(1, -1) * g_xFrame.ShadowKernel2D, slice), realDistance);
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(1, 0) * g_xFrame.ShadowKernel2D, slice), realDistance);
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(1, 1) * g_xFrame.ShadowKernel2D, slice), realDistance);
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(-1, -1) * g_xFrame.ShadowKernel2D, slice), realDistance).r;
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(-1, 0) * g_xFrame.ShadowKernel2D, slice), realDistance).r;
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(-1, 1) * g_xFrame.ShadowKernel2D, slice), realDistance).r;
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(0, -1) * g_xFrame.ShadowKernel2D, slice), realDistance).r;
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV, slice), realDistance).r;
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(0, 1) * g_xFrame.ShadowKernel2D, slice), realDistance).r;
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(1, -1) * g_xFrame.ShadowKernel2D, slice), realDistance).r;
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(1, 0) * g_xFrame.ShadowKernel2D, slice), realDistance).r;
|
||||
shadow.x += texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV + float2(1, 1) * g_xFrame.ShadowKernel2D, slice), realDistance).r;
|
||||
shadow = shadow.xxx / 9.0;
|
||||
#else
|
||||
shadow = texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV, slice), realDistance);
|
||||
shadow = texture_shadowarray_2d.SampleCmpLevelZero(sampler_cmp_depth, float3(shadowUV, slice), realDistance).r;
|
||||
#endif // DISABLE_SOFT_SHADOWMAP
|
||||
|
||||
#ifndef DISABLE_TRANSPARENT_SHADOWMAP
|
||||
@@ -89,15 +89,15 @@ inline float3 shadowCube(in ShaderEntity light, in float3 L, in float3 Lunnormal
|
||||
#ifndef DISABLE_SOFT_SHADOWMAP
|
||||
// sample along a cube pattern around center:
|
||||
L = -L;
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(-1, -1, -1) * g_xFrame.ShadowKernelCube, slice), remappedDistance);
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(1, -1, -1) * g_xFrame.ShadowKernelCube, slice), remappedDistance);
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(-1, 1, -1) * g_xFrame.ShadowKernelCube, slice), remappedDistance);
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(1, 1, -1) * g_xFrame.ShadowKernelCube, slice), remappedDistance);
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(-1, -1, -1) * g_xFrame.ShadowKernelCube, slice), remappedDistance).r;
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(1, -1, -1) * g_xFrame.ShadowKernelCube, slice), remappedDistance).r;
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(-1, 1, -1) * g_xFrame.ShadowKernelCube, slice), remappedDistance).r;
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(1, 1, -1) * g_xFrame.ShadowKernelCube, slice), remappedDistance).r;
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L, slice), remappedDistance).r;
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(-1, -1, 1) * g_xFrame.ShadowKernelCube, slice), remappedDistance);
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(1, -1, 1) * g_xFrame.ShadowKernelCube, slice), remappedDistance);
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(-1, 1, 1) * g_xFrame.ShadowKernelCube, slice), remappedDistance);
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(1, 1, 1) * g_xFrame.ShadowKernelCube, slice), remappedDistance);
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(-1, -1, 1) * g_xFrame.ShadowKernelCube, slice), remappedDistance).r;
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(1, -1, 1) * g_xFrame.ShadowKernelCube, slice), remappedDistance).r;
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(-1, 1, 1) * g_xFrame.ShadowKernelCube, slice), remappedDistance).r;
|
||||
shadow += texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(L + float3(1, 1, 1) * g_xFrame.ShadowKernelCube, slice), remappedDistance).r;
|
||||
shadow /= 9.0;
|
||||
#else
|
||||
shadow = texture_shadowarray_cube.SampleCmpLevelZero(sampler_cmp_depth, float4(-Lunnormalized, slice), remappedDistance).r;
|
||||
@@ -145,7 +145,7 @@ inline void DirectionalLight(in ShaderEntity light, in Surface surface, inout Li
|
||||
for (uint cascade = 0; cascade < g_xFrame.ShadowCascadeCount; ++cascade)
|
||||
{
|
||||
// Project into shadow map space (no need to divide by .w because ortho projection!):
|
||||
float3 ShPos = mul(MatrixArray[light.GetMatrixIndex() + cascade], float4(surface.P, 1)).xyz;
|
||||
float3 ShPos = mul(load_entitymatrix(light.GetMatrixIndex() + cascade), float4(surface.P, 1)).xyz;
|
||||
float3 ShTex = ShPos * float3(0.5, -0.5, 0.5) + 0.5;
|
||||
|
||||
// Determine if pixel is inside current cascade bounds and compute shadow if it is:
|
||||
@@ -162,7 +162,7 @@ inline void DirectionalLight(in ShaderEntity light, in Surface surface, inout Li
|
||||
{
|
||||
// Project into next shadow cascade (no need to divide by .w because ortho projection!):
|
||||
cascade += 1;
|
||||
ShPos = mul(MatrixArray[light.GetMatrixIndex() + cascade], float4(surface.P, 1)).xyz;
|
||||
ShPos = mul(load_entitymatrix(light.GetMatrixIndex() + cascade), float4(surface.P, 1)).xyz;
|
||||
ShTex = ShPos * float3(0.5, -0.5, 0.5) + 0.5;
|
||||
const float3 shadow_fallback = shadowCascade(light, ShPos, ShTex.xy, cascade);
|
||||
|
||||
@@ -282,7 +282,7 @@ inline void SpotLight(in ShaderEntity light, in Surface surface, inout Lighting
|
||||
if ((g_xFrame.Options & OPTION_BIT_RAYTRACED_SHADOWS) == 0)
|
||||
#endif // SHADOW_MASK_ENABLED
|
||||
{
|
||||
float4 ShPos = mul(MatrixArray[light.GetMatrixIndex() + 0], float4(surface.P, 1));
|
||||
float4 ShPos = mul(load_entitymatrix(light.GetMatrixIndex() + 0), float4(surface.P, 1));
|
||||
ShPos.xyz /= ShPos.w;
|
||||
float2 ShTex = ShPos.xy * float2(0.5, -0.5) + 0.5;
|
||||
[branch]
|
||||
|
||||
@@ -452,11 +452,11 @@ inline void ForwardLighting(inout Surface surface, inout Lighting lighting)
|
||||
[branch]
|
||||
if (decalAccumulation.a < 1)
|
||||
{
|
||||
ShaderEntity decal = EntityArray[g_xFrame.DecalArrayOffset + entity_index];
|
||||
ShaderEntity decal = load_entity(g_xFrame.DecalArrayOffset + entity_index);
|
||||
if ((decal.layerMask & surface.layerMask) == 0)
|
||||
continue;
|
||||
|
||||
float4x4 decalProjection = MatrixArray[decal.GetMatrixIndex()];
|
||||
float4x4 decalProjection = load_entitymatrix(decal.GetMatrixIndex());
|
||||
int decalTexture = asint(decalProjection[3][0]);
|
||||
int decalNormal = asint(decalProjection[3][1]);
|
||||
decalProjection[3] = float4(0, 0, 0, 1);
|
||||
@@ -527,11 +527,11 @@ inline void ForwardLighting(inout Surface surface, inout Lighting lighting)
|
||||
[branch]
|
||||
if (envmapAccumulation.a < 1)
|
||||
{
|
||||
ShaderEntity probe = EntityArray[g_xFrame.EnvProbeArrayOffset + entity_index];
|
||||
ShaderEntity probe = load_entity(g_xFrame.EnvProbeArrayOffset + entity_index);
|
||||
if ((probe.layerMask & surface.layerMask) == 0)
|
||||
continue;
|
||||
|
||||
const float4x4 probeProjection = MatrixArray[probe.GetMatrixIndex()];
|
||||
const float4x4 probeProjection = load_entitymatrix(probe.GetMatrixIndex());
|
||||
const float3 clipSpacePos = mul(probeProjection, float4(surface.P, 1)).xyz;
|
||||
const float3 uvw = clipSpacePos.xyz * float3(0.5, -0.5, 0.5) + 0.5;
|
||||
[branch]
|
||||
@@ -595,7 +595,7 @@ inline void ForwardLighting(inout Surface surface, inout Lighting lighting)
|
||||
const uint entity_index = bucket * 32 + bucket_bit_index;
|
||||
bucket_bits ^= 1u << bucket_bit_index;
|
||||
|
||||
ShaderEntity light = EntityArray[g_xFrame.LightArrayOffset + entity_index];
|
||||
ShaderEntity light = load_entity(g_xFrame.LightArrayOffset + entity_index);
|
||||
if ((light.layerMask & surface.layerMask) == 0)
|
||||
continue;
|
||||
|
||||
@@ -667,11 +667,11 @@ inline void TiledLighting(inout Surface surface, inout Lighting lighting)
|
||||
[branch]
|
||||
if (entity_index >= first_item && entity_index <= last_item && decalAccumulation.a < 1)
|
||||
{
|
||||
ShaderEntity decal = EntityArray[entity_index];
|
||||
ShaderEntity decal = load_entity(entity_index);
|
||||
if ((decal.layerMask & surface.layerMask) == 0)
|
||||
continue;
|
||||
|
||||
float4x4 decalProjection = MatrixArray[decal.GetMatrixIndex()];
|
||||
float4x4 decalProjection = load_entitymatrix(decal.GetMatrixIndex());
|
||||
int decalTexture = asint(decalProjection[3][0]);
|
||||
int decalNormal = asint(decalProjection[3][1]);
|
||||
decalProjection[3] = float4(0, 0, 0, 1);
|
||||
@@ -755,11 +755,11 @@ inline void TiledLighting(inout Surface surface, inout Lighting lighting)
|
||||
[branch]
|
||||
if (entity_index >= first_item && entity_index <= last_item && envmapAccumulation.a < 1)
|
||||
{
|
||||
ShaderEntity probe = EntityArray[entity_index];
|
||||
ShaderEntity probe = load_entity(entity_index);
|
||||
if ((probe.layerMask & surface.layerMask) == 0)
|
||||
continue;
|
||||
|
||||
const float4x4 probeProjection = MatrixArray[probe.GetMatrixIndex()];
|
||||
const float4x4 probeProjection = load_entitymatrix(probe.GetMatrixIndex());
|
||||
const float3 clipSpacePos = mul(probeProjection, float4(surface.P, 1)).xyz;
|
||||
const float3 uvw = clipSpacePos.xyz * float3(0.5, -0.5, 0.5) + 0.5;
|
||||
[branch]
|
||||
@@ -841,7 +841,7 @@ inline void TiledLighting(inout Surface surface, inout Lighting lighting)
|
||||
[branch]
|
||||
if (entity_index >= first_item && entity_index <= last_item)
|
||||
{
|
||||
ShaderEntity light = EntityArray[entity_index];
|
||||
ShaderEntity light = load_entity(entity_index);
|
||||
if ((light.layerMask & surface.layerMask) == 0)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ void main(PSInput input)
|
||||
const uint entity_index = bucket * 32 + bucket_bit_index;
|
||||
bucket_bits ^= 1u << bucket_bit_index;
|
||||
|
||||
ShaderEntity light = EntityArray[g_xFrame.LightArrayOffset + entity_index];
|
||||
ShaderEntity light = load_entity(g_xFrame.LightArrayOffset + entity_index);
|
||||
|
||||
if (light.GetFlags() & ENTITY_FLAG_LIGHT_STATIC)
|
||||
{
|
||||
@@ -214,7 +214,7 @@ void main(PSInput input)
|
||||
if (light.IsCastingShadow() >= 0)
|
||||
{
|
||||
const uint cascade = g_xFrame.ShadowCascadeCount - 1; // biggest cascade (coarsest resolution) will be used to voxelize
|
||||
float3 ShPos = mul(MatrixArray[light.GetMatrixIndex() + cascade], float4(P, 1)).xyz; // ortho matrix, no divide by .w
|
||||
float3 ShPos = mul(load_entitymatrix(light.GetMatrixIndex() + cascade), float4(P, 1)).xyz; // ortho matrix, no divide by .w
|
||||
float3 ShTex = ShPos.xyz * float3(0.5f, -0.5f, 0.5f) + 0.5f;
|
||||
|
||||
[branch] if ((saturate(ShTex.x) == ShTex.x) && (saturate(ShTex.y) == ShTex.y) && (saturate(ShTex.z) == ShTex.z))
|
||||
@@ -291,7 +291,7 @@ void main(PSInput input)
|
||||
[branch]
|
||||
if (light.IsCastingShadow() >= 0)
|
||||
{
|
||||
float4 ShPos = mul(MatrixArray[light.GetMatrixIndex() + 0], float4(P, 1));
|
||||
float4 ShPos = mul(load_entitymatrix(light.GetMatrixIndex() + 0), float4(P, 1));
|
||||
ShPos.xyz /= ShPos.w;
|
||||
float2 ShTex = ShPos.xy * float2(0.5f, -0.5f) + float2(0.5f, 0.5f);
|
||||
[branch]
|
||||
|
||||
@@ -124,7 +124,7 @@ void main(uint3 DTid : SV_DispatchThreadID, uint groupIndex : SV_GroupIndex)
|
||||
[loop]
|
||||
for (uint iterator = 0; iterator < g_xFrame.LightArrayCount; iterator++)
|
||||
{
|
||||
ShaderEntity light = EntityArray[g_xFrame.LightArrayOffset + iterator];
|
||||
ShaderEntity light = load_entity(g_xFrame.LightArrayOffset + iterator);
|
||||
|
||||
Lighting lighting;
|
||||
lighting.create(0, 0, 0, 0);
|
||||
|
||||
@@ -36,7 +36,7 @@ float4 main(Input input) : SV_TARGET
|
||||
[loop]
|
||||
for (uint iterator = 0; iterator < g_xFrame.LightArrayCount; iterator++)
|
||||
{
|
||||
ShaderEntity light = EntityArray[g_xFrame.LightArrayOffset + iterator];
|
||||
ShaderEntity light = load_entity(g_xFrame.LightArrayOffset + iterator);
|
||||
|
||||
Lighting lighting;
|
||||
lighting.create(0, 0, 0, 0);
|
||||
|
||||
@@ -136,7 +136,7 @@ void RTReflection_ClosestHit(inout RayPayload payload, in BuiltInTriangleInterse
|
||||
[loop]
|
||||
for (uint iterator = 0; iterator < g_xFrame.LightArrayCount; iterator++)
|
||||
{
|
||||
ShaderEntity light = EntityArray[g_xFrame.LightArrayOffset + iterator];
|
||||
ShaderEntity light = load_entity(g_xFrame.LightArrayOffset + iterator);
|
||||
if ((light.layerMask & surface.material.layerMask) == 0)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ void main(uint3 DTid : SV_DispatchThreadID, uint3 Gid : SV_GroupID, uint3 GTid :
|
||||
if (shadow_index >= MAX_RTSHADOWS)
|
||||
break;
|
||||
|
||||
ShaderEntity light = EntityArray[entity_index];
|
||||
ShaderEntity light = load_entity(entity_index);
|
||||
|
||||
if (!light.IsCastingShadow())
|
||||
{
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
#include "ResourceMapping.h"
|
||||
#include "ShaderInterop_Renderer.h"
|
||||
#include "globals.hlsli"
|
||||
|
||||
STRUCTUREDBUFFER(boneBuffer, ShaderTransform, SKINNINGSLOT_IN_BONEBUFFER);
|
||||
PUSHCONSTANT(push, SkinningPushConstants);
|
||||
|
||||
RAWBUFFER(vertexBuffer_POS, SKINNINGSLOT_IN_VERTEX_POS);
|
||||
RAWBUFFER(vertexBuffer_TAN, SKINNINGSLOT_IN_VERTEX_TAN);
|
||||
RAWBUFFER(vertexBuffer_BON, SKINNINGSLOT_IN_VERTEX_BON);
|
||||
|
||||
RWRAWBUFFER(streamoutBuffer_POS, 0);
|
||||
RWRAWBUFFER(streamoutBuffer_TAN, 1);
|
||||
|
||||
|
||||
inline void Skinning(inout float3 pos, inout float3 nor, inout float3 tan, in float4 inBon, in float4 inWei)
|
||||
inline void Skinning(inout float3 pos, inout float3 nor, inout float3 tan, in uint4 inBon, in float4 inWei)
|
||||
{
|
||||
if (any(inWei))
|
||||
{
|
||||
@@ -25,7 +16,7 @@ inline void Skinning(inout float3 pos, inout float3 nor, inout float3 tan, in fl
|
||||
[loop]
|
||||
for (uint i = 0; ((i < 4) && (weisum < 1.0f)); ++i)
|
||||
{
|
||||
float4x4 m = boneBuffer[(uint)inBon[i]].GetMatrix();
|
||||
float4x4 m = bindless_buffers[push.bonebuffer_index].Load<ShaderTransform>(inBon[i] * sizeof(ShaderTransform)).GetMatrix();
|
||||
|
||||
p += mul(m, float4(pos.xyz, 1)) * inWei[i];
|
||||
n += mul((float3x3)m, nor.xyz) * inWei[i];
|
||||
@@ -49,9 +40,9 @@ void main(uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID)
|
||||
const uint fetchAddress_BON = DTid.x * sizeof(uint4);
|
||||
|
||||
// Manual type-conversion for pos:
|
||||
uint4 pos_nor_u = vertexBuffer_POS.Load4(fetchAddress_POS_NOR);
|
||||
uint4 pos_nor_u = bindless_buffers[push.vb_pos_nor_wind].Load4(fetchAddress_POS_NOR);
|
||||
float3 pos = asfloat(pos_nor_u.xyz);
|
||||
uint vtan = vertexBuffer_TAN.Load(fetchAddress_TAN);
|
||||
uint vtan = bindless_buffers[push.vb_tan].Load(fetchAddress_TAN);
|
||||
|
||||
// Manual type-conversion for normal:
|
||||
float4 nor = 0;
|
||||
@@ -72,14 +63,14 @@ void main(uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID)
|
||||
}
|
||||
|
||||
// Manual type-conversion for bone props:
|
||||
uint4 ind_wei_u = vertexBuffer_BON.Load4(fetchAddress_BON);
|
||||
uint4 ind_wei_u = bindless_buffers[push.vb_bon].Load4(fetchAddress_BON);
|
||||
float4 ind = 0;
|
||||
float4 wei = 0;
|
||||
{
|
||||
ind.x = (float)((ind_wei_u.x >> 0) & 0x0000FFFF);
|
||||
ind.y = (float)((ind_wei_u.x >> 16) & 0x0000FFFF);
|
||||
ind.z = (float)((ind_wei_u.y >> 0) & 0x0000FFFF);
|
||||
ind.w = (float)((ind_wei_u.y >> 16) & 0x0000FFFF);
|
||||
ind.x = (ind_wei_u.x >> 0) & 0x0000FFFF;
|
||||
ind.y = (ind_wei_u.x >> 16) & 0x0000FFFF;
|
||||
ind.z = (ind_wei_u.y >> 0) & 0x0000FFFF;
|
||||
ind.w = (ind_wei_u.y >> 16) & 0x0000FFFF;
|
||||
|
||||
wei.x = (float)((ind_wei_u.z >> 0) & 0x0000FFFF) / 65535.0f;
|
||||
wei.y = (float)((ind_wei_u.z >> 16) & 0x0000FFFF) / 65535.0f;
|
||||
@@ -96,7 +87,7 @@ void main(uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID)
|
||||
// Manual type-conversion for pos:
|
||||
pos_nor_u.xyz = asuint(pos.xyz);
|
||||
|
||||
|
||||
|
||||
// Manual type-conversion for normal:
|
||||
pos_nor_u.w = 0;
|
||||
{
|
||||
@@ -116,6 +107,6 @@ void main(uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID)
|
||||
}
|
||||
|
||||
// Store data:
|
||||
streamoutBuffer_POS.Store4(fetchAddress_POS_NOR, pos_nor_u);
|
||||
streamoutBuffer_TAN.Store(fetchAddress_TAN, vtan);
|
||||
bindless_rwbuffers[push.so_pos_nor_wind].Store4(fetchAddress_POS_NOR, pos_nor_u);
|
||||
bindless_rwbuffers[push.so_tan].Store(fetchAddress_TAN, vtan);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ void main(uint3 DTid : SV_DispatchThreadID)
|
||||
[loop]
|
||||
for (uint iterator = 0; iterator < g_xFrame.LightArrayCount; iterator++)
|
||||
{
|
||||
ShaderEntity light = EntityArray[g_xFrame.LightArrayOffset + iterator];
|
||||
ShaderEntity light = load_entity(g_xFrame.LightArrayOffset + iterator);
|
||||
|
||||
Lighting lighting;
|
||||
lighting.create(0, 0, 0, 0);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
float4 main(VertexToPixel input) : SV_TARGET
|
||||
{
|
||||
ShaderEntity light = EntityArray[g_xFrame.LightArrayOffset + (uint)g_xColor.x];
|
||||
ShaderEntity light = load_entity(g_xFrame.LightArrayOffset + (uint)g_xColor.x);
|
||||
|
||||
if (!light.IsCastingShadow())
|
||||
{
|
||||
@@ -41,7 +41,7 @@ float4 main(VertexToPixel input) : SV_TARGET
|
||||
|
||||
for (uint cascade = 0; cascade < g_xFrame.ShadowCascadeCount; ++cascade)
|
||||
{
|
||||
float3 ShPos = mul(MatrixArray[light.GetMatrixIndex() + cascade], float4(P, 1)).xyz; // ortho matrix, no divide by .w
|
||||
float3 ShPos = mul(load_entitymatrix(light.GetMatrixIndex() + cascade), float4(P, 1)).xyz; // ortho matrix, no divide by .w
|
||||
float3 ShTex = ShPos.xyz * float3(0.5f, -0.5f, 0.5f) + 0.5f;
|
||||
|
||||
[branch]if (is_saturated(ShTex))
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
float4 main(VertexToPixel input) : SV_TARGET
|
||||
{
|
||||
ShaderEntity light = EntityArray[g_xFrame.LightArrayOffset + (uint)g_xColor.x];
|
||||
ShaderEntity light = load_entity(g_xFrame.LightArrayOffset + (uint)g_xColor.x);
|
||||
|
||||
float2 ScreenCoord = input.pos2D.xy / input.pos2D.w * float2(0.5f, -0.5f) + 0.5f;
|
||||
float depth = max(input.pos.z, texture_depth.SampleLevel(sampler_point_clamp, ScreenCoord, 2));
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
float4 main(VertexToPixel input) : SV_TARGET
|
||||
{
|
||||
ShaderEntity light = EntityArray[g_xFrame.LightArrayOffset + (uint)g_xColor.x];
|
||||
ShaderEntity light = load_entity(g_xFrame.LightArrayOffset + (uint)g_xColor.x);
|
||||
|
||||
float2 ScreenCoord = input.pos2D.xy / input.pos2D.w * float2(0.5f, -0.5f) + 0.5f;
|
||||
float depth = max(input.pos.z, texture_depth.SampleLevel(sampler_point_clamp, ScreenCoord, 2));
|
||||
@@ -48,7 +48,7 @@ float4 main(VertexToPixel input) : SV_TARGET
|
||||
[branch]
|
||||
if (light.IsCastingShadow())
|
||||
{
|
||||
float4 ShPos = mul(MatrixArray[light.GetMatrixIndex() + 0], float4(P, 1));
|
||||
float4 ShPos = mul(load_entitymatrix(light.GetMatrixIndex() + 0), float4(P, 1));
|
||||
ShPos.xyz /= ShPos.w;
|
||||
float2 ShTex = ShPos.xy * float2(0.5f, -0.5f) + float2(0.5f, 0.5f);
|
||||
[branch]
|
||||
|
||||
+25
-54
@@ -1801,14 +1801,14 @@ void LoadBuffers()
|
||||
|
||||
bd.Size = sizeof(ShaderEntity) * SHADER_ENTITY_COUNT;
|
||||
bd.BindFlags = BIND_SHADER_RESOURCE;
|
||||
bd.MiscFlags = RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
bd.MiscFlags = RESOURCE_MISC_BUFFER_RAW;
|
||||
bd.Stride = sizeof(ShaderEntity);
|
||||
device->CreateBuffer(&bd, nullptr, &resourceBuffers[RBTYPE_ENTITYARRAY]);
|
||||
device->SetName(&resourceBuffers[RBTYPE_ENTITYARRAY], "EntityArray");
|
||||
|
||||
bd.Size = sizeof(XMMATRIX) * MATRIXARRAY_COUNT;
|
||||
bd.BindFlags = BIND_SHADER_RESOURCE;
|
||||
bd.MiscFlags = RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
bd.MiscFlags = RESOURCE_MISC_BUFFER_RAW;
|
||||
bd.Stride = sizeof(XMMATRIX);
|
||||
device->CreateBuffer(&bd, nullptr, &resourceBuffers[RBTYPE_MATRIXARRAY]);
|
||||
device->SetName(&resourceBuffers[RBTYPE_MATRIXARRAY], "MatrixArray");
|
||||
@@ -3231,6 +3231,21 @@ void UpdatePerFrameData(
|
||||
frameCB.VolumetricClouds = vis.scene->weather.volumetricCloudParameters;
|
||||
frameCB.scene = vis.scene->shaderscene;
|
||||
|
||||
frameCB.texture_random64x64_index = device->GetDescriptorIndex(wiTextureHelper::getRandom64x64(), SRV);
|
||||
frameCB.texture_bluenoise_index = device->GetDescriptorIndex(wiTextureHelper::getBlueNoise(), SRV);
|
||||
frameCB.texture_sheenlut_index = device->GetDescriptorIndex(&textures[TEXTYPE_2D_SHEENLUT], SRV);
|
||||
frameCB.texture_skyviewlut_index = device->GetDescriptorIndex(&textures[TEXTYPE_2D_SKYATMOSPHERE_SKYVIEWLUT], SRV);
|
||||
frameCB.texture_transmittancelut_index = device->GetDescriptorIndex(&textures[TEXTYPE_2D_SKYATMOSPHERE_TRANSMITTANCELUT], SRV);
|
||||
frameCB.texture_multiscatteringlut_index = device->GetDescriptorIndex(&textures[TEXTYPE_2D_SKYATMOSPHERE_MULTISCATTEREDLUMINANCELUT], SRV);
|
||||
frameCB.texture_skyluminancelut_index = device->GetDescriptorIndex(&textures[TEXTYPE_2D_SKYATMOSPHERE_SKYLUMINANCELUT], SRV);
|
||||
frameCB.texture_shadowarray_2d_index = device->GetDescriptorIndex(&shadowMapArray_2D, SRV);
|
||||
frameCB.texture_shadowarray_cube_index = device->GetDescriptorIndex(&shadowMapArray_Cube, SRV);
|
||||
frameCB.texture_shadowarray_transparent_2d_index = device->GetDescriptorIndex(&shadowMapArray_Transparent_2D, SRV);
|
||||
frameCB.texture_shadowarray_transparent_cube_index = device->GetDescriptorIndex(&shadowMapArray_Transparent_Cube, SRV);
|
||||
frameCB.texture_voxelgi_index = device->GetDescriptorIndex(GetVoxelRadianceSecondaryBounceEnabled() ? &textures[TEXTYPE_3D_VOXELRADIANCE_HELPER] : &textures[TEXTYPE_3D_VOXELRADIANCE], SRV);
|
||||
frameCB.buffer_entityarray_index = device->GetDescriptorIndex(&resourceBuffers[RBTYPE_ENTITYARRAY], SRV);
|
||||
frameCB.buffer_entitymatrixarray_index = device->GetDescriptorIndex(&resourceBuffers[RBTYPE_MATRIXARRAY], SRV);
|
||||
|
||||
|
||||
// Create volumetric cloud static resources if needed:
|
||||
if (scene.weather.IsVolumetricClouds() && !texture_shapeNoise.IsValid())
|
||||
@@ -3712,20 +3727,14 @@ void UpdateRenderData(
|
||||
|
||||
device->BindComputeShader(&shaders[CSTYPE_SKINNING], cmd);
|
||||
|
||||
// Do the skinning
|
||||
const GPUResource* vbs[] = {
|
||||
&mesh.vertexBuffer_POS,
|
||||
&mesh.vertexBuffer_TAN,
|
||||
&mesh.vertexBuffer_BON,
|
||||
&armature.boneBuffer,
|
||||
};
|
||||
const GPUResource* uavs[] = {
|
||||
&mesh.streamoutBuffer_POS,
|
||||
&mesh.streamoutBuffer_TAN,
|
||||
};
|
||||
|
||||
device->BindResources(vbs, SKINNINGSLOT_IN_VERTEX_POS, arraysize(vbs), cmd);
|
||||
device->BindUAVs(uavs, 0, arraysize(uavs), cmd);
|
||||
SkinningPushConstants push;
|
||||
push.bonebuffer_index = device->GetDescriptorIndex(&armature.boneBuffer, SRV);
|
||||
push.vb_pos_nor_wind = device->GetDescriptorIndex(&mesh.vertexBuffer_POS, SRV);
|
||||
push.vb_tan = device->GetDescriptorIndex(&mesh.vertexBuffer_TAN, SRV);
|
||||
push.vb_bon = device->GetDescriptorIndex(&mesh.vertexBuffer_BON, SRV);
|
||||
push.so_pos_nor_wind = device->GetDescriptorIndex(&mesh.streamoutBuffer_POS, UAV);
|
||||
push.so_tan = device->GetDescriptorIndex(&mesh.streamoutBuffer_TAN, UAV);
|
||||
device->PushConstants(&push, sizeof(push), cmd);
|
||||
|
||||
device->Dispatch(((uint32_t)mesh.vertex_positions.size() + 63) / 64, 1, 1, cmd);
|
||||
|
||||
@@ -5781,8 +5790,6 @@ void DrawDebugWorld(
|
||||
|
||||
device->BindPipelineState(&PSO_debug[DEBUGRENDERING_VOXEL], cmd);
|
||||
|
||||
device->BindResource(GetVoxelRadianceSecondaryBounceEnabled() ? &textures[TEXTYPE_3D_VOXELRADIANCE_HELPER] : &textures[TEXTYPE_3D_VOXELRADIANCE], TEXSLOT_VOXELGI, cmd);
|
||||
|
||||
|
||||
MiscCB sb;
|
||||
XMStoreFloat4x4(&sb.g_xTransform, XMMatrixTranslationFromVector(XMLoadFloat3(&voxelSceneData.center)) * camera.GetViewProjection());
|
||||
@@ -6253,7 +6260,6 @@ void RefreshEnvProbes(const Visibility& vis, CommandList cmd)
|
||||
{
|
||||
// Refresh atmospheric textures, since each probe has different positions
|
||||
RefreshAtmosphericScatteringTextures(cmd);
|
||||
device->BindResource(&textures[TEXTYPE_2D_SKYATMOSPHERE_SKYLUMINANCELUT], TEXSLOT_SKYLUMINANCELUT, cmd);
|
||||
}
|
||||
|
||||
device->RenderPassBegin(&vis.scene->renderpasses_envmap[probe.textureIndex], cmd);
|
||||
@@ -7345,39 +7351,6 @@ void RefreshLightmaps(const Scene& scene, CommandList cmd)
|
||||
void BindCommonResources(CommandList cmd)
|
||||
{
|
||||
device->BindConstantBuffer(&constantBuffers[CBTYPE_FRAME], CBSLOT_RENDERER_FRAME, cmd);
|
||||
|
||||
device->BindSampler(&samplers[SSLOT_OBJECTSHADER], SSLOT_OBJECTSHADER, cmd);
|
||||
|
||||
device->BindResource(wiTextureHelper::getRandom64x64(), TEXSLOT_RANDOM64X64, cmd);
|
||||
device->BindResource(wiTextureHelper::getBlueNoise(), TEXSLOT_BLUENOISE, cmd);
|
||||
|
||||
device->BindResource(&textures[TEXTYPE_2D_SHEENLUT], TEXSLOT_SHEENLUT, cmd);
|
||||
|
||||
// Bind the GPU entity array for all shaders that need it here:
|
||||
GPUResource* resources[] = {
|
||||
&resourceBuffers[RBTYPE_ENTITYARRAY],
|
||||
&resourceBuffers[RBTYPE_MATRIXARRAY],
|
||||
};
|
||||
device->BindResources(resources, SBSLOT_ENTITYARRAY, arraysize(resources), cmd);
|
||||
device->BindResources(resources, SBSLOT_ENTITYARRAY, arraysize(resources), cmd);
|
||||
device->BindResources(resources, SBSLOT_ENTITYARRAY, arraysize(resources), cmd);
|
||||
|
||||
device->BindResource(&shadowMapArray_2D, TEXSLOT_SHADOWARRAY_2D, cmd);
|
||||
device->BindResource(&shadowMapArray_Cube, TEXSLOT_SHADOWARRAY_CUBE, cmd);
|
||||
if (GetTransparentShadowsEnabled())
|
||||
{
|
||||
device->BindResource(&shadowMapArray_Transparent_2D, TEXSLOT_SHADOWARRAY_TRANSPARENT_2D, cmd);
|
||||
device->BindResource(&shadowMapArray_Transparent_Cube, TEXSLOT_SHADOWARRAY_TRANSPARENT_CUBE, cmd);
|
||||
}
|
||||
|
||||
// Bind the atmospheric textures, as lighting and sky needs them
|
||||
device->BindResource(&textures[TEXTYPE_2D_SKYATMOSPHERE_SKYVIEWLUT], TEXSLOT_SKYVIEWLUT, cmd);
|
||||
device->BindResource(&textures[TEXTYPE_2D_SKYATMOSPHERE_TRANSMITTANCELUT], TEXSLOT_TRANSMITTANCELUT, cmd);
|
||||
device->BindResource(&textures[TEXTYPE_2D_SKYATMOSPHERE_MULTISCATTEREDLUMINANCELUT], TEXSLOT_MULTISCATTERINGLUT, cmd);
|
||||
device->BindResource(&textures[TEXTYPE_2D_SKYATMOSPHERE_SKYLUMINANCELUT], TEXSLOT_SKYLUMINANCELUT, cmd);
|
||||
|
||||
device->BindResource(GetVoxelRadianceSecondaryBounceEnabled() ? &textures[TEXTYPE_3D_VOXELRADIANCE_HELPER] : &textures[TEXTYPE_3D_VOXELRADIANCE], TEXSLOT_VOXELGI, cmd);
|
||||
|
||||
}
|
||||
|
||||
void UpdateCameraCB(
|
||||
@@ -11118,8 +11091,6 @@ void Postprocess_VolumetricClouds(
|
||||
device->BindResource(&texture_detailNoise, TEXSLOT_ONDEMAND2, cmd);
|
||||
device->BindResource(&texture_curlNoise, TEXSLOT_ONDEMAND3, cmd);
|
||||
device->BindResource(&texture_weatherMap, TEXSLOT_ONDEMAND4, cmd);
|
||||
device->BindResource(&textures[TEXTYPE_2D_SKYATMOSPHERE_TRANSMITTANCELUT], TEXSLOT_TRANSMITTANCELUT, cmd);
|
||||
device->BindResource(&textures[TEXTYPE_2D_SKYATMOSPHERE_SKYLUMINANCELUT], TEXSLOT_SKYLUMINANCELUT, cmd);
|
||||
|
||||
const GPUResource* uavs[] = {
|
||||
&res.texture_cloudRender,
|
||||
|
||||
@@ -1233,7 +1233,7 @@ namespace wiScene
|
||||
GPUBufferDesc bd;
|
||||
bd.Size = sizeof(ShaderTransform) * (uint32_t)boneCollection.size();
|
||||
bd.BindFlags = BIND_SHADER_RESOURCE;
|
||||
bd.MiscFlags = RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
bd.MiscFlags = RESOURCE_MISC_BUFFER_RAW;
|
||||
bd.Stride = sizeof(ShaderTransform);
|
||||
|
||||
device->CreateBuffer(&bd, nullptr, &boneBuffer);
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wiVersion
|
||||
// minor features, major updates, breaking compatibility changes
|
||||
const int minor = 57;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 9;
|
||||
const int revision = 10;
|
||||
|
||||
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user