2020-06-18 02:19:34 +00:00
|
|
|
/*
|
|
|
|
===========================================================================
|
2024-01-13 21:40:13 +00:00
|
|
|
Copyright (C) 2024 Gian 'myT' Schellenbaum
|
2020-06-18 02:19:34 +00:00
|
|
|
|
|
|
|
This file is part of Challenge Quake 3 (CNQ3).
|
|
|
|
|
|
|
|
Challenge Quake 3 is free software; you can redistribute it
|
|
|
|
and/or modify it under the terms of the GNU General Public License as
|
|
|
|
published by the Free Software Foundation; either version 2 of the License,
|
|
|
|
or (at your option) any later version.
|
|
|
|
|
|
|
|
Challenge Quake 3 is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
===========================================================================
|
|
|
|
*/
|
2024-07-02 00:06:15 +00:00
|
|
|
// volumetric lighting particles: clear all froxel tiles and global counters
|
2020-06-18 02:19:34 +00:00
|
|
|
|
|
|
|
|
2024-01-13 21:40:13 +00:00
|
|
|
#include "common.hlsli"
|
2024-07-02 00:06:15 +00:00
|
|
|
#include "vl_common.h.hlsli"
|
|
|
|
#include "scene_view.h.hlsli"
|
2020-06-18 02:19:34 +00:00
|
|
|
|
|
|
|
|
2024-03-29 03:19:27 +00:00
|
|
|
cbuffer RootConstants
|
2020-06-18 02:19:34 +00:00
|
|
|
{
|
2024-07-02 00:06:15 +00:00
|
|
|
uint counterBufferIndex;
|
2024-03-29 03:19:27 +00:00
|
|
|
uint tileBufferIndex;
|
2024-07-02 00:06:15 +00:00
|
|
|
uint tileCount;
|
2024-03-29 03:19:27 +00:00
|
|
|
}
|
|
|
|
|
2024-07-02 00:06:15 +00:00
|
|
|
[numthreads(64, 1, 1)]
|
2024-03-29 03:19:27 +00:00
|
|
|
void cs(uint3 id : SV_DispatchThreadID)
|
|
|
|
{
|
2024-07-02 00:06:15 +00:00
|
|
|
if(id.x >= tileCount)
|
2022-12-28 19:49:18 +00:00
|
|
|
{
|
2024-03-29 03:19:27 +00:00
|
|
|
return;
|
2022-12-28 19:49:18 +00:00
|
|
|
}
|
|
|
|
|
2024-07-02 00:06:15 +00:00
|
|
|
RWStructuredBuffer<Tile> tileBuffer= ResourceDescriptorHeap[tileBufferIndex];
|
|
|
|
if(id.x == 0)
|
2024-03-29 03:19:27 +00:00
|
|
|
{
|
2024-07-02 00:06:15 +00:00
|
|
|
RWStructuredBuffer<Counters> counterBuffer = ResourceDescriptorHeap[counterBufferIndex];
|
|
|
|
Counters counters;
|
|
|
|
counters.particleCount = 0;
|
|
|
|
counters.tileCount = 0;
|
|
|
|
counterBuffer[0] = counters;
|
2024-03-29 03:19:27 +00:00
|
|
|
}
|
2024-07-02 00:06:15 +00:00
|
|
|
Tile tile;
|
|
|
|
tile.firstParticle = 0;
|
|
|
|
tile.particleCount = 0;
|
|
|
|
tile.particleIndex = 0;
|
|
|
|
tile.pad0 = 0;
|
|
|
|
tileBuffer[id.x] = tile;
|
2020-06-18 02:19:34 +00:00
|
|
|
}
|