Merge pull request #659 from w23/comparender
Stuff done during streams E333-E337 - [x] Engine/rendering support for reproducible rendering and testing: - [x] `screenshot filename.png` - [x] `wait NUM` - [x] ~~`imagecompare`~~ -> moved to [HLRTest](https://rtxash.omgwtf.ru/Half-Life-RTX/HLRTest) repo - [x] ~~example rendertest script~~ -> moved to HLRTest repo - [x] how to organize saves, rendertest.script, golden images? -> I KNOW HOW -> HLRTest repo - [ ] how to run these in CI? -- we just don't know - [x] Consolidate all bindings to shader tops - [x] fixup per-model material mapping, fix #669
This commit is contained in:
commit
e9dc10a503
|
@ -192,7 +192,12 @@ void CL_ScreenShot_f( void )
|
|||
int i;
|
||||
string checkname;
|
||||
|
||||
if( CL_IsDevOverviewMode() == 1 )
|
||||
if ( Cmd_Argc() > 1)
|
||||
{
|
||||
Q_strncpy( cls.shotname, Cmd_Argv( 1 ), sizeof( cls.shotname ));
|
||||
cls.scrshot_action = scrshot_normal; // build new frame for screenshot
|
||||
}
|
||||
else if( CL_IsDevOverviewMode() == 1 )
|
||||
{
|
||||
// special case for write overview image and script file
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname );
|
||||
|
|
|
@ -29,7 +29,7 @@ typedef struct
|
|||
int maxsize;
|
||||
} cmdbuf_t;
|
||||
|
||||
qboolean cmd_wait;
|
||||
int cmd_wait;
|
||||
cmdbuf_t cmd_text, filteredcmd_text;
|
||||
byte cmd_text_buf[MAX_CMD_BUFFER];
|
||||
byte filteredcmd_text_buf[MAX_CMD_BUFFER];
|
||||
|
@ -185,6 +185,14 @@ void Cbuf_ExecuteCommandsFromBuffer( cmdbuf_t *buf, qboolean isPrivileged, int c
|
|||
|
||||
while( buf->cursize )
|
||||
{
|
||||
if( cmd_wait > 0 )
|
||||
{
|
||||
// skip out while text still remains in buffer,
|
||||
// leaving it for next frame
|
||||
cmd_wait--;
|
||||
break;
|
||||
}
|
||||
|
||||
// limit amount of commands that can be issued
|
||||
if( cmdsToExecute >= 0 )
|
||||
{
|
||||
|
@ -249,14 +257,6 @@ void Cbuf_ExecuteCommandsFromBuffer( cmdbuf_t *buf, qboolean isPrivileged, int c
|
|||
|
||||
// execute the command line
|
||||
Cmd_ExecuteStringWithPrivilegeCheck( line, isPrivileged );
|
||||
|
||||
if( cmd_wait )
|
||||
{
|
||||
// skip out while text still remains in buffer,
|
||||
// leaving it for next frame
|
||||
cmd_wait = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,13 @@ bind g "cmd use rocket ; +attack ; wait ; -attack ; cmd use blaster"
|
|||
*/
|
||||
void Cmd_Wait_f( void )
|
||||
{
|
||||
cmd_wait = true;
|
||||
if ( Cmd_Argc() > 1 )
|
||||
{
|
||||
const char *arg = Cmd_Argv( 1 );
|
||||
cmd_wait = atoi( arg );
|
||||
}
|
||||
|
||||
cmd_wait = Q_max( cmd_wait, 1 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -897,3 +897,27 @@ This is then dumped into a file.
|
|||
Then there's a piece of software that analyzes these dumps. It can check for a few basic metrics (e.g. frame percentiles,
|
||||
amount and count of memory allocations, etc.) and compare them against known bounds. Going way too fast or too slow is a failure.
|
||||
The same software could do more analysis, e.g. producing graphs and statistics for all other metrics.
|
||||
|
||||
# 2023-11-20 E333
|
||||
## Comparing rendering results
|
||||
1. Make a script that loads save files, and takes screenshots. The result is a bunch of screenshots.
|
||||
2. Make a tiny program comparing these screenshots with golden ones.
|
||||
3. Make initial set of golden screenshots.
|
||||
4. Make a representative set of places to take screenshots of.
|
||||
5. Make a script taking screenshots, comparing results and presenting that as a build artifact.
|
||||
5. (draw the rest of the fucking owl) Integrate this into CI.
|
||||
|
||||
Observations:
|
||||
- Need to fix window/screen resolution (doesn't work with tiling managers that well)
|
||||
- There's still some console garbage on screen
|
||||
- Making random_seed constant is not enough. There are still some per-pixel differences. Not sure why. Timing dependent, getting a different frame?
|
||||
|
||||
# 2023-11-21 E334
|
||||
## Reproducible rendering
|
||||
### More observations
|
||||
- PNG is super slow to write. 300-700ms. Copying screenshots from vulkan is ~30ms.
|
||||
- There are still lots of small pixel differences even for basecolor/normal and other similar light-independent things.
|
||||
It would seem that there's inherent timing instabilites -- we can't guarantee the same game state even for the
|
||||
first frame (verify that?).
|
||||
- Image comparison is slow. ~~4.7s for all images.~~
|
||||
After optimization: 1.3s for everything. Built using `-O3 -march=native`. Saves into tga. Was > 16s.
|
||||
|
|
|
@ -1,3 +1,50 @@
|
|||
# 2023-11-27 E337
|
||||
- [x] make rendetest.py the central script
|
||||
- [x] parallelize/make gifs
|
||||
- [x] diff/convert in parallel
|
||||
- [-] backside transparency
|
||||
- [x] added to rendertest
|
||||
- [ ] consider passing a special flag for single-sided blended surfaces (i.e. brush surfaces)
|
||||
- [x] fix per-entity material mapping, #669
|
||||
- [x] add to rendertest
|
||||
- [ ] html report
|
||||
|
||||
# 2023-11-24 E336
|
||||
- reproducible rendering:
|
||||
- [x] make sure it's reproducible -- given carefully spaced `wait N`s and `playersonly` it gets pretty reproducible
|
||||
- [x] difference heatmap
|
||||
- [x] contemplate infrastructure: scripts, repo, etc.
|
||||
|
||||
# 2023-11-23 E335
|
||||
- [x] spec for profiler dumper
|
||||
- reproducible rendering:
|
||||
- [ ] write fixed resolution internal images -- only need this because i'm stupid and using tiling window manager
|
||||
- [ ] how to synchronize with frames
|
||||
- [ ] how to extract vk images
|
||||
- [ ] how to blit/copy various image pixel formats
|
||||
- [ ] what file format to choose for non-rgba8 formats? do we even need them?
|
||||
- [x] script for running and comparing results
|
||||
- [-] extras:
|
||||
- [x] difference gif
|
||||
- [ ] difference summary table
|
||||
- [ ] summary html
|
||||
- [x] consolidate all binding in shaders
|
||||
|
||||
# 2023-11-21 E334
|
||||
- [ ] reproducible rendering
|
||||
- [ ] dump all components
|
||||
- [x] script
|
||||
- [-] ~~try also dumping in native code~~ -- no need, it's fast enough
|
||||
- [x] command for random seed fixation
|
||||
|
||||
# 2023-11-20 E333
|
||||
- [ ] contemplate testing rendered images
|
||||
- [x] try making a rendertest script: load multiple save, make multiple screenshots
|
||||
- [x] compare screenshots
|
||||
- [ ] Other infrastructure:
|
||||
- tracking golden states
|
||||
- testing script
|
||||
|
||||
# 2023-11-17 E332
|
||||
- [-] backside emissive water polygons:
|
||||
- adding them makes things worse in other parts of the level
|
||||
|
|
|
@ -1,12 +1,22 @@
|
|||
#version 460 core
|
||||
#extension GL_EXT_nonuniform_qualifier : enable
|
||||
#extension GL_GOOGLE_include_directive : require
|
||||
#extension GL_EXT_shader_16bit_storage : require
|
||||
|
||||
#define GLSL
|
||||
#include "ray_interop.h"
|
||||
#undef GLSL
|
||||
|
||||
layout (set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
|
||||
layout(set = 0, binding = 30, std430) readonly buffer ModelHeaders { ModelHeader a[]; } model_headers;
|
||||
layout(set = 0, binding = 31, std430) readonly buffer Kusochki { Kusok a[]; } kusochki;
|
||||
layout(set = 0, binding = 32, std430) readonly buffer Indices { uint16_t a[]; } indices;
|
||||
layout(set = 0, binding = 33, std430) readonly buffer Vertices { Vertex a[]; } vertices;
|
||||
|
||||
#include "ray_common.glsl"
|
||||
#include "ray_kusochki.glsl"
|
||||
|
||||
layout (set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
|
||||
layout (push_constant) uniform PC_ {
|
||||
PushConstants push_constants;
|
||||
};
|
||||
|
|
|
@ -1,12 +1,22 @@
|
|||
#version 460 core
|
||||
#extension GL_EXT_nonuniform_qualifier : enable
|
||||
#extension GL_GOOGLE_include_directive : require
|
||||
#extension GL_EXT_shader_16bit_storage : require
|
||||
|
||||
#define GLSL
|
||||
#include "ray_interop.h"
|
||||
#undef GLSL
|
||||
|
||||
layout (set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
|
||||
layout(set = 0, binding = 30, std430) readonly buffer ModelHeaders { ModelHeader a[]; } model_headers;
|
||||
layout(set = 0, binding = 31, std430) readonly buffer Kusochki { Kusok a[]; } kusochki;
|
||||
layout(set = 0, binding = 32, std430) readonly buffer Indices { uint16_t a[]; } indices;
|
||||
layout(set = 0, binding = 33, std430) readonly buffer Vertices { Vertex a[]; } vertices;
|
||||
|
||||
#include "ray_common.glsl"
|
||||
#include "ray_kusochki.glsl"
|
||||
|
||||
layout (set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
|
||||
hitAttributeEXT vec2 bary;
|
||||
|
||||
void main() {
|
||||
|
|
|
@ -1,43 +1,48 @@
|
|||
#version 460 core
|
||||
#extension GL_GOOGLE_include_directive : require
|
||||
#extension GL_EXT_nonuniform_qualifier : enable
|
||||
#extension GL_EXT_shader_16bit_storage : require
|
||||
#extension GL_EXT_ray_query: require
|
||||
|
||||
#define GLSL
|
||||
#include "ray_interop.h"
|
||||
#undef GLSL
|
||||
|
||||
#define RAY_BOUNCE
|
||||
#define RAY_QUERY
|
||||
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
|
||||
|
||||
layout(set=0, binding=1) uniform accelerationStructureEXT tlas;
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureEXT tlas;
|
||||
|
||||
#define RAY_LIGHT_DIRECT_INPUTS(X) \
|
||||
X(10, position_t, rgba32f) \
|
||||
X(11, normals_gs, rgba16f) \
|
||||
X(12, material_rmxx, rgba8) \
|
||||
X(13, base_color_a, rgba8)
|
||||
#define X(index, name, format) layout(set=0,binding=index,format) uniform readonly image2D name;
|
||||
RAY_LIGHT_DIRECT_INPUTS(X)
|
||||
#undef X
|
||||
layout(set = 0, binding = 2) uniform UBO { UniformBuffer ubo; } ubo;
|
||||
layout(set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
layout(set = 0, binding = 7) uniform samplerCube skybox;
|
||||
|
||||
layout(set=0, binding=20, rgba16f) uniform writeonly image2D out_indirect_diffuse;
|
||||
layout(set=0, binding=21, rgba16f) uniform writeonly image2D out_indirect_specular;
|
||||
layout (set = 0, binding = 8) readonly buffer SBOLights { LightsMetadata m; } lights;
|
||||
layout (set = 0, binding = 9, align = 1) readonly buffer UBOLightClusters {
|
||||
LightCluster clusters_[MAX_LIGHT_CLUSTERS];
|
||||
} light_grid;
|
||||
|
||||
layout(set = 0, binding = 10, rgba32f) uniform readonly image2D position_t;
|
||||
layout(set = 0, binding = 11, rgba16f) uniform readonly image2D normals_gs;
|
||||
layout(set = 0, binding = 12, rgba8) uniform readonly image2D material_rmxx;
|
||||
layout(set = 0, binding = 13, rgba8) uniform readonly image2D base_color_a;
|
||||
|
||||
layout(set = 0, binding = 20, rgba16f) uniform writeonly image2D out_indirect_diffuse;
|
||||
layout(set = 0, binding = 21, rgba16f) uniform writeonly image2D out_indirect_specular;
|
||||
|
||||
layout(set = 0, binding = 30, std430) readonly buffer ModelHeaders { ModelHeader a[]; } model_headers;
|
||||
layout(set = 0, binding = 31, std430) readonly buffer Kusochki { Kusok a[]; } kusochki;
|
||||
layout(set = 0, binding = 32, std430) readonly buffer Indices { uint16_t a[]; } indices;
|
||||
layout(set = 0, binding = 33, std430) readonly buffer Vertices { Vertex a[]; } vertices;
|
||||
|
||||
#include "ray_primary_common.glsl"
|
||||
#include "ray_primary_hit.glsl"
|
||||
//#include "brdf.h" // already in light.glsl below
|
||||
#include "noise.glsl"
|
||||
|
||||
#define TEXTURES_INCLUDED_ALREADY_FIXME
|
||||
#define LIGHT_POLYGON 1
|
||||
#define LIGHT_POINT 1
|
||||
#undef SHADER_OFFSET_HIT_SHADOW_BASE
|
||||
#define SHADER_OFFSET_HIT_SHADOW_BASE 0
|
||||
#undef SHADER_OFFSET_MISS_SHADOW
|
||||
#define SHADER_OFFSET_MISS_SHADOW 0
|
||||
#undef PAYLOAD_LOCATION_SHADOW
|
||||
#define PAYLOAD_LOCATION_SHADOW 0
|
||||
|
||||
#define BINDING_LIGHTS 19
|
||||
#define BINDING_LIGHT_CLUSTERS 18
|
||||
#include "light.glsl"
|
||||
|
||||
#include "trace_simple_blending.glsl"
|
||||
|
@ -48,7 +53,6 @@ void readNormals(ivec2 uv, out vec3 geometry_normal, out vec3 shading_normal) {
|
|||
shading_normal = normalDecode(n.zw);
|
||||
}
|
||||
|
||||
|
||||
bool getHit(vec3 origin, vec3 direction, inout RayPayloadPrimary payload) {
|
||||
rayQueryEXT rq;
|
||||
const uint flags = 0
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#version 460
|
||||
|
||||
#include "noise.glsl"
|
||||
#include "utils.glsl"
|
||||
#include "color_spaces.glsl"
|
||||
|
||||
|
@ -230,6 +229,11 @@ void main() {
|
|||
|
||||
vec3 colour = vec3(0.);
|
||||
{
|
||||
vec3 diffuse = c.direct_diffuse + c.indirect_diffuse;
|
||||
vec3 specular = c.direct_specular + c.indirect_specular;
|
||||
|
||||
//#define DISABLE_TEMPORAL_DENOISER
|
||||
#ifndef DISABLE_TEMPORAL_DENOISER
|
||||
// TODO: need to extract reprojecting from this shader because reprojected stuff need svgf denoising pass after it
|
||||
const vec3 origin = (ubo.ubo.inv_view * vec4(0., 0., 0., 1.)).xyz;
|
||||
const vec3 position = imageLoad(position_t, pix).xyz;
|
||||
|
@ -243,8 +247,6 @@ void main() {
|
|||
const float depth_treshold = 0.01 * clip_space.w;
|
||||
|
||||
float better_depth_offset = depth_treshold;
|
||||
vec3 diffuse = c.direct_diffuse + c.indirect_diffuse;
|
||||
vec3 specular = c.direct_specular + c.indirect_specular;
|
||||
vec3 history_diffuse = diffuse;
|
||||
vec3 history_specular = specular;
|
||||
const int TEMPORAL_KERNEL = 1; // lifekilled says it should be fixed
|
||||
|
@ -273,6 +275,7 @@ void main() {
|
|||
|
||||
imageStore(out_temporal_diffuse, pix, vec4(diffuse, depth));
|
||||
imageStore(out_temporal_specular, pix, vec4(specular, 0./*unused*/));
|
||||
#endif // ifndef DISABLE_TEMPORAL_DENOISER
|
||||
colour = diffuse + specular;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
#extension GL_EXT_control_flow_attributes : require
|
||||
layout (set = 0, binding = BINDING_LIGHTS) readonly buffer SBOLights { LightsMetadata m; } lights;
|
||||
layout (set = 0, binding = BINDING_LIGHT_CLUSTERS, align = 1) readonly buffer UBOLightClusters {
|
||||
//ivec3 grid_min, grid_size;
|
||||
//uint8_t clusters_data[MAX_LIGHT_CLUSTERS * LIGHT_CLUSTER_SIZE + HACK_OFFSET];
|
||||
LightCluster clusters_[MAX_LIGHT_CLUSTERS];
|
||||
} light_grid;
|
||||
|
||||
const float color_culling_threshold = 0;//600./color_factor;
|
||||
const float shadow_offset_fudge = .1;
|
||||
|
||||
#ifdef RAY_QUERY
|
||||
// TODO sync with native code
|
||||
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
|
||||
#endif
|
||||
|
||||
#include "brdf.h"
|
||||
#include "light_common.glsl"
|
||||
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
|
||||
#include "ray_kusochki.glsl"
|
||||
|
||||
#ifndef TEXTURES_INCLUDED_ALREADY_FIXME
|
||||
layout(set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
#endif
|
||||
|
||||
#ifdef RAY_TRACE2
|
||||
#include "ray_shadow_interface.glsl"
|
||||
layout(location = PAYLOAD_LOCATION_SHADOW) rayPayloadEXT RayPayloadShadow payload_shadow;
|
||||
|
|
|
@ -1,17 +1,26 @@
|
|||
#version 460 core
|
||||
#extension GL_EXT_nonuniform_qualifier : enable
|
||||
#extension GL_GOOGLE_include_directive : require
|
||||
#extension GL_EXT_shader_16bit_storage : require
|
||||
#extension GL_EXT_ray_tracing: require
|
||||
|
||||
#include "ray_primary_common.glsl"
|
||||
#include "ray_kusochki.glsl"
|
||||
|
||||
layout(set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
#define GLSL
|
||||
#include "ray_interop.h"
|
||||
#undef GLSL
|
||||
|
||||
// TODO not really needed here?
|
||||
// It's an artifact of readHitGeometry() computing uv_lods, which we don't really use in this shader
|
||||
// Split readHitGeometry into basic and advanced
|
||||
layout(set = 0, binding = 2) uniform UBO { UniformBuffer ubo; } ubo;
|
||||
layout(set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
|
||||
layout(set = 0, binding = 30, std430) readonly buffer ModelHeaders { ModelHeader a[]; } model_headers;
|
||||
layout(set = 0, binding = 31, std430) readonly buffer Kusochki { Kusok a[]; } kusochki;
|
||||
layout(set = 0, binding = 32, std430) readonly buffer Indices { uint16_t a[]; } indices;
|
||||
layout(set = 0, binding = 33, std430) readonly buffer Vertices { Vertex a[]; } vertices;
|
||||
|
||||
#include "ray_primary_common.glsl"
|
||||
#include "ray_kusochki.glsl"
|
||||
|
||||
hitAttributeEXT vec2 bary;
|
||||
|
||||
|
|
|
@ -47,6 +47,16 @@ LIST_SPECIALIZATION_CONSTANTS(DECLARE_SPECIALIZATION_CONSTANT)
|
|||
|
||||
#endif // not GLSL
|
||||
|
||||
struct Vertex {
|
||||
vec3 pos;
|
||||
vec3 prev_pos;
|
||||
vec3 normal;
|
||||
vec3 tangent;
|
||||
vec2 gl_tc;
|
||||
vec2 _unused_lm_tc;
|
||||
uint color;
|
||||
};
|
||||
|
||||
#define GEOMETRY_BIT_OPAQUE 0x01
|
||||
#define GEOMETRY_BIT_ALPHA_TEST 0x02
|
||||
#define GEOMETRY_BIT_BLEND 0x04
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
#ifndef RAY_KUSOCHKI_GLSL_INCLUDED
|
||||
#define RAY_KUSOCHKI_GLSL_INCLUDED
|
||||
#extension GL_EXT_shader_16bit_storage : require
|
||||
|
||||
#define GLSL
|
||||
#include "ray_interop.h"
|
||||
#undef GLSL
|
||||
|
||||
struct Vertex {
|
||||
vec3 pos;
|
||||
vec3 prev_pos;
|
||||
vec3 normal;
|
||||
vec3 tangent;
|
||||
vec2 gl_tc;
|
||||
vec2 _unused_lm_tc;
|
||||
uint color;
|
||||
};
|
||||
|
||||
layout(std430, binding = 30, set = 0) readonly buffer ModelHeaders { ModelHeader a[]; } model_headers;
|
||||
layout(std430, binding = 31, set = 0) readonly buffer Kusochki { Kusok a[]; } kusochki;
|
||||
layout(std430, binding = 32, set = 0) readonly buffer Indices { uint16_t a[]; } indices;
|
||||
layout(std430, binding = 33, set = 0) readonly buffer Vertices { Vertex a[]; } vertices;
|
||||
|
||||
Kusok getKusok(uint index) { return kusochki.a[index]; }
|
||||
uint16_t getIndex(uint index) { return indices.a[index]; }
|
||||
|
|
|
@ -1,36 +1,8 @@
|
|||
#include "utils.glsl"
|
||||
#include "noise.glsl"
|
||||
|
||||
#define GLSL
|
||||
#include "ray_interop.h"
|
||||
#undef GLSL
|
||||
|
||||
#define RAY_LIGHT_DIRECT_INPUTS(X) \
|
||||
X(10, position_t, rgba32f) \
|
||||
X(11, normals_gs, rgba16f) \
|
||||
X(12, material_rmxx, rgba8) \
|
||||
|
||||
#define X(index, name, format) layout(set=0,binding=index,format) uniform readonly image2D name;
|
||||
RAY_LIGHT_DIRECT_INPUTS(X)
|
||||
#undef X
|
||||
#define X(index, name, format) layout(set=0,binding=index,format) uniform writeonly image2D out_##name;
|
||||
OUTPUTS(X)
|
||||
#undef X
|
||||
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureEXT tlas;
|
||||
layout(set = 0, binding = 2) uniform UBO { UniformBuffer ubo; } ubo;
|
||||
|
||||
#include "ray_kusochki.glsl"
|
||||
|
||||
#undef SHADER_OFFSET_HIT_SHADOW_BASE
|
||||
#define SHADER_OFFSET_HIT_SHADOW_BASE 0
|
||||
#undef SHADER_OFFSET_MISS_SHADOW
|
||||
#define SHADER_OFFSET_MISS_SHADOW 0
|
||||
#undef PAYLOAD_LOCATION_SHADOW
|
||||
#define PAYLOAD_LOCATION_SHADOW 0
|
||||
|
||||
#define BINDING_LIGHTS 7
|
||||
#define BINDING_LIGHT_CLUSTERS 8
|
||||
#include "light.glsl"
|
||||
|
||||
void readNormals(ivec2 uv, out vec3 geometry_normal, out vec3 shading_normal) {
|
||||
|
|
|
@ -1,11 +1,36 @@
|
|||
#version 460 core
|
||||
#extension GL_GOOGLE_include_directive : require
|
||||
#extension GL_EXT_shader_16bit_storage : require
|
||||
#extension GL_EXT_ray_query: require
|
||||
|
||||
#define RAY_QUERY
|
||||
#define GLSL
|
||||
#include "ray_interop.h"
|
||||
#undef GLSL
|
||||
|
||||
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
|
||||
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureEXT tlas;
|
||||
layout(set = 0, binding = 2) uniform UBO { UniformBuffer ubo; } ubo;
|
||||
|
||||
layout(set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
|
||||
layout (set = 0, binding = 7) readonly buffer SBOLights { LightsMetadata m; } lights;
|
||||
layout (set = 0, binding = 8, align = 1) readonly buffer UBOLightClusters {
|
||||
LightCluster clusters_[MAX_LIGHT_CLUSTERS];
|
||||
} light_grid;
|
||||
|
||||
layout(set = 0, binding = 10, rgba32f) uniform readonly image2D position_t;
|
||||
layout(set = 0, binding = 11, rgba16f) uniform readonly image2D normals_gs;
|
||||
layout(set = 0, binding = 12, rgba8) uniform readonly image2D material_rmxx;
|
||||
|
||||
layout(set = 0, binding = 20, rgba16f) uniform writeonly image2D out_light_point_diffuse;
|
||||
layout(set = 0, binding = 21, rgba16f) uniform writeonly image2D out_light_point_specular;
|
||||
|
||||
layout(set = 0, binding = 30, std430) readonly buffer ModelHeaders { ModelHeader a[]; } model_headers;
|
||||
layout(set = 0, binding = 31, std430) readonly buffer Kusochki { Kusok a[]; } kusochki;
|
||||
layout(set = 0, binding = 32, std430) readonly buffer Indices { uint16_t a[]; } indices;
|
||||
layout(set = 0, binding = 33, std430) readonly buffer Vertices { Vertex a[]; } vertices;
|
||||
|
||||
#define RAY_QUERY
|
||||
#define LIGHT_POINT 1
|
||||
#define OUTPUTS(X) \
|
||||
X(20, light_point_diffuse, rgba16f) \
|
||||
X(21, light_point_specular, rgba16f)
|
||||
#include "ray_light_direct.glsl"
|
||||
|
|
|
@ -1,11 +1,36 @@
|
|||
#version 460 core
|
||||
#extension GL_GOOGLE_include_directive : require
|
||||
#extension GL_EXT_shader_16bit_storage : require
|
||||
#extension GL_EXT_ray_query: require
|
||||
|
||||
#define RAY_QUERY
|
||||
#define GLSL
|
||||
#include "ray_interop.h"
|
||||
#undef GLSL
|
||||
|
||||
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
|
||||
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureEXT tlas;
|
||||
layout(set = 0, binding = 2) uniform UBO { UniformBuffer ubo; } ubo;
|
||||
|
||||
layout(set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
|
||||
layout (set = 0, binding = 7) readonly buffer SBOLights { LightsMetadata m; } lights;
|
||||
layout (set = 0, binding = 8, align = 1) readonly buffer UBOLightClusters {
|
||||
LightCluster clusters_[MAX_LIGHT_CLUSTERS];
|
||||
} light_grid;
|
||||
|
||||
layout(set = 0, binding = 10, rgba32f) uniform readonly image2D position_t;
|
||||
layout(set = 0, binding = 11, rgba16f) uniform readonly image2D normals_gs;
|
||||
layout(set = 0, binding = 12, rgba8) uniform readonly image2D material_rmxx;
|
||||
|
||||
layout(set = 0, binding = 20, rgba16f) uniform writeonly image2D out_light_poly_diffuse;
|
||||
layout(set = 0, binding = 21, rgba16f) uniform writeonly image2D out_light_poly_specular;
|
||||
|
||||
layout(set = 0, binding = 30, std430) readonly buffer ModelHeaders { ModelHeader a[]; } model_headers;
|
||||
layout(set = 0, binding = 31, std430) readonly buffer Kusochki { Kusok a[]; } kusochki;
|
||||
layout(set = 0, binding = 32, std430) readonly buffer Indices { uint16_t a[]; } indices;
|
||||
layout(set = 0, binding = 33, std430) readonly buffer Vertices { Vertex a[]; } vertices;
|
||||
|
||||
#define RAY_QUERY
|
||||
#define LIGHT_POLYGON 1
|
||||
#define OUTPUTS(X) \
|
||||
X(20, light_poly_diffuse, rgba16f) \
|
||||
X(21, light_poly_specular, rgba16f)
|
||||
#include "ray_light_direct.glsl"
|
||||
|
|
|
@ -1,28 +1,36 @@
|
|||
#version 460 core
|
||||
#extension GL_GOOGLE_include_directive : require
|
||||
#extension GL_EXT_nonuniform_qualifier : enable
|
||||
#extension GL_EXT_shader_16bit_storage : require
|
||||
#extension GL_EXT_ray_query: require
|
||||
|
||||
#define GLSL
|
||||
#include "ray_interop.h"
|
||||
#undef GLSL
|
||||
|
||||
#define RAY_QUERY
|
||||
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
|
||||
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureEXT tlas;
|
||||
|
||||
layout(set = 0, binding = 2) uniform UBO { UniformBuffer ubo; } ubo;
|
||||
layout(set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
layout(set = 0, binding = 7) uniform samplerCube skybox;
|
||||
|
||||
layout(set = 0, binding = 10, rgba8) uniform writeonly image2D out_base_color_a;
|
||||
layout(set = 0, binding = 11, rgba32f) uniform writeonly image2D out_position_t;
|
||||
layout(set = 0, binding = 12, rgba16f) uniform writeonly image2D out_normals_gs;
|
||||
layout(set = 0, binding = 13, rgba8) uniform writeonly image2D out_material_rmxx;
|
||||
layout(set = 0, binding = 14, rgba16f) uniform writeonly image2D out_emissive;
|
||||
layout(set = 0, binding = 15, rgba32f) uniform writeonly image2D out_geometry_prev_position;
|
||||
|
||||
layout(set = 0, binding = 30, std430) readonly buffer ModelHeaders { ModelHeader a[]; } model_headers;
|
||||
layout(set = 0, binding = 31, std430) readonly buffer Kusochki { Kusok a[]; } kusochki;
|
||||
layout(set = 0, binding = 32, std430) readonly buffer Indices { uint16_t a[]; } indices;
|
||||
layout(set = 0, binding = 33, std430) readonly buffer Vertices { Vertex a[]; } vertices;
|
||||
|
||||
#include "ray_primary_common.glsl"
|
||||
#include "ray_primary_hit.glsl"
|
||||
//#include "noise.glsl"
|
||||
|
||||
#define RAY_PRIMARY_OUTPUTS(X) \
|
||||
X(10, base_color_a, rgba8) \
|
||||
X(11, position_t, rgba32f) \
|
||||
X(12, normals_gs, rgba16f) \
|
||||
X(13, material_rmxx, rgba8) \
|
||||
X(14, emissive, rgba16f) \
|
||||
X(15, geometry_prev_position, rgba32f) \
|
||||
|
||||
#define X(index, name, format) layout(set=0,binding=index,format) uniform writeonly image2D out_##name;
|
||||
RAY_PRIMARY_OUTPUTS(X)
|
||||
#undef X
|
||||
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureEXT tlas;
|
||||
|
||||
#include "trace_simple_blending.glsl"
|
||||
|
||||
|
|
|
@ -1,20 +1,31 @@
|
|||
#version 460 core
|
||||
#extension GL_GOOGLE_include_directive : require
|
||||
#extension GL_EXT_nonuniform_qualifier : enable
|
||||
#extension GL_EXT_shader_16bit_storage : require
|
||||
#extension GL_EXT_ray_tracing: require
|
||||
|
||||
#include "utils.glsl"
|
||||
#include "ray_primary_common.glsl"
|
||||
#include "ray_kusochki.glsl"
|
||||
#include "color_spaces.glsl"
|
||||
#define GLSL
|
||||
#include "ray_interop.h"
|
||||
#undef GLSL
|
||||
|
||||
layout(set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
layout(set = 0, binding = 2) uniform UBO { UniformBuffer ubo; } ubo;
|
||||
layout(set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
layout(set = 0, binding = 7) uniform samplerCube skybox;
|
||||
|
||||
layout(set = 0, binding = 30, std430) readonly buffer ModelHeaders { ModelHeader a[]; } model_headers;
|
||||
layout(set = 0, binding = 31, std430) readonly buffer Kusochki { Kusok a[]; } kusochki;
|
||||
layout(set = 0, binding = 32, std430) readonly buffer Indices { uint16_t a[]; } indices;
|
||||
layout(set = 0, binding = 33, std430) readonly buffer Vertices { Vertex a[]; } vertices;
|
||||
|
||||
#include "ray_primary_common.glsl"
|
||||
|
||||
layout(location = PAYLOAD_LOCATION_PRIMARY) rayPayloadInEXT RayPayloadPrimary payload;
|
||||
hitAttributeEXT vec2 bary;
|
||||
|
||||
#include "utils.glsl"
|
||||
#include "ray_kusochki.glsl"
|
||||
#include "color_spaces.glsl"
|
||||
|
||||
#include "rt_geometry.glsl"
|
||||
|
||||
vec4 sampleTexture(uint tex_index, vec2 uv, vec4 uv_lods) {
|
||||
|
|
|
@ -4,21 +4,16 @@
|
|||
|
||||
#include "ray_primary_common.glsl"
|
||||
|
||||
#define RAY_PRIMARY_OUTPUTS(X) \
|
||||
X(10, base_color_a, rgba8) \
|
||||
X(11, position_t, rgba32f) \
|
||||
X(12, normals_gs, rgba16f) \
|
||||
X(13, material_rmxx, rgba8) \
|
||||
X(14, emissive, rgba16f) \
|
||||
X(15, geometry_prev_position, rgba32f) \
|
||||
|
||||
#define X(index, name, format) layout(set=0,binding=index,format) uniform writeonly image2D out_##name;
|
||||
RAY_PRIMARY_OUTPUTS(X)
|
||||
#undef X
|
||||
|
||||
layout(set = 0, binding = 1) uniform accelerationStructureEXT tlas;
|
||||
layout(set = 0, binding = 2) uniform UBO { UniformBuffer ubo; } ubo;
|
||||
|
||||
layout(set = 0, binding = 10, rgba8) uniform writeonly image2D out_base_color_a;
|
||||
layout(set = 0, binding = 11, rgba32f) uniform writeonly image2D out_position_t;
|
||||
layout(set = 0, binding = 12, rgba16f) uniform writeonly image2D out_normals_gs;
|
||||
layout(set = 0, binding = 13, rgba8) uniform writeonly image2D out_material_rmxx;
|
||||
layout(set = 0, binding = 14, rgba16f) uniform writeonly image2D out_emissive;
|
||||
layout(set = 0, binding = 15, rgba32f) uniform writeonly image2D out_geometry_prev_position;
|
||||
|
||||
layout(location = PAYLOAD_LOCATION_PRIMARY) rayPayloadEXT RayPayloadPrimary payload;
|
||||
|
||||
void main() {
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
|
||||
#include "noise.glsl" // for DEBUG_DISPLAY_SURFHASH
|
||||
|
||||
layout(set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES];
|
||||
layout(set = 0, binding = 2) uniform UBO { UniformBuffer ubo; } ubo;
|
||||
layout(set = 0, binding = 7) uniform samplerCube skybox;
|
||||
|
||||
vec4 sampleTexture(uint tex_index, vec2 uv, vec4 uv_lods) {
|
||||
#ifndef RAY_BOUNCE
|
||||
return textureGrad(textures[nonuniformEXT(tex_index)], uv, uv_lods.xy, uv_lods.zw);
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
#version 460 core
|
||||
#extension GL_EXT_ray_tracing: require
|
||||
#extension GL_EXT_shader_16bit_storage : require
|
||||
|
||||
#define GLSL
|
||||
#include "ray_interop.h"
|
||||
#undef GLSL
|
||||
|
||||
layout(set = 0, binding = 30, std430) readonly buffer ModelHeaders { ModelHeader a[]; } model_headers;
|
||||
layout(set = 0, binding = 31, std430) readonly buffer Kusochki { Kusok a[]; } kusochki;
|
||||
layout(set = 0, binding = 32, std430) readonly buffer Indices { uint16_t a[]; } indices;
|
||||
layout(set = 0, binding = 33, std430) readonly buffer Vertices { Vertex a[]; } vertices;
|
||||
|
||||
#include "ray_kusochki.glsl"
|
||||
#include "ray_common.glsl"
|
||||
|
|
|
@ -1302,6 +1302,8 @@ static qboolean fillBrushSurfaces(fill_geometries_args_t args) {
|
|||
int index_offset = args.base_index_offset;
|
||||
|
||||
const xvk_mapent_func_any_t *const entity_patch = getModelFuncAnyPatch(args.mod);
|
||||
if (entity_patch)
|
||||
DEBUG("Found entity_patch(matmap_count=%d) for model \"%s\"", entity_patch->matmap_count, args.mod->name);
|
||||
connectVertices(args.mod, entity_patch ? entity_patch->smooth_entire_model : false);
|
||||
|
||||
// Load sorted by gl_texturenum
|
||||
|
@ -1381,7 +1383,9 @@ static qboolean fillBrushSurfaces(fill_geometries_args_t args) {
|
|||
if (!material_assigned && entity_patch) {
|
||||
for (int i = 0; i < entity_patch->matmap_count; ++i) {
|
||||
if (entity_patch->matmap[i].from_tex == orig_tex_id) {
|
||||
model_geometry->material = R_VkMaterialGetForTexture(entity_patch->matmap[i].to_mat.index);
|
||||
model_geometry->material = R_VkMaterialGetForRef(entity_patch->matmap[i].to_mat);
|
||||
DEBUG(" Assigning entity_patch/material[%d] for surf=%d to mat ref=%d",
|
||||
i, surface_index, entity_patch->matmap[i].to_mat.index);
|
||||
material_assigned = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -502,7 +502,7 @@ static qboolean canBlitFromSwapchainToFormat( VkFormat dest_format ) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static rgbdata_t *XVK_ReadPixels( void ) {
|
||||
static rgbdata_t *R_VkReadPixels( void ) {
|
||||
const VkFormat dest_format = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
r_vk_image_t dest_image;
|
||||
const VkImage frame_image = g_frame.current.framebuffer.image;
|
||||
|
@ -706,7 +706,7 @@ qboolean VID_ScreenShot( const char *filename, int shot_type )
|
|||
qboolean result;
|
||||
|
||||
// get screen frame
|
||||
rgbdata_t *r_shot = XVK_ReadPixels();
|
||||
rgbdata_t *r_shot = R_VkReadPixels();
|
||||
if (!r_shot)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
// TODO settings/realtime modifiable/adaptive
|
||||
#if 1
|
||||
#define FRAME_WIDTH 1280
|
||||
#define FRAME_HEIGHT 720
|
||||
#define FRAME_HEIGHT 800
|
||||
#elif 0
|
||||
#define FRAME_WIDTH 2560
|
||||
#define FRAME_HEIGHT 1440
|
||||
|
@ -93,6 +93,8 @@ static struct {
|
|||
struct {
|
||||
cvar_t *rt_debug_display_only;
|
||||
uint32_t rt_debug_display_only_value;
|
||||
|
||||
cvar_t *rt_debug_fixed_random_seed;
|
||||
} debug;
|
||||
} g_rtx = {0};
|
||||
|
||||
|
@ -163,6 +165,7 @@ static void parseDebugDisplayValue( void ) {
|
|||
X(EMISSIVE) \
|
||||
X(NSHADE) \
|
||||
X(NGEOM) \
|
||||
X(LIGHTING) \
|
||||
X(SURFHASH) \
|
||||
X(TRIHASH) \
|
||||
X(DIRECT) \
|
||||
|
@ -189,6 +192,13 @@ LIST_DISPLAYS(X)
|
|||
g_rtx.debug.rt_debug_display_only_value = DEBUG_DISPLAY_DISABLED;
|
||||
}
|
||||
|
||||
static uint32_t getRandomSeed( void ) {
|
||||
if (g_rtx.debug.rt_debug_fixed_random_seed->string[0])
|
||||
return (uint32_t)g_rtx.debug.rt_debug_fixed_random_seed->value;
|
||||
|
||||
return (uint32_t)gEngine.COM_RandomLong(0, INT32_MAX);
|
||||
}
|
||||
|
||||
static void prepareUniformBuffer( const vk_ray_frame_render_args_t *args, int frame_index, uint32_t frame_counter, float fov_angle_y ) {
|
||||
struct UniformBuffer *ubo = (struct UniformBuffer*)((char*)g_rtx.uniform_buffer.mapped + frame_index * g_rtx.uniform_unit_size);
|
||||
|
||||
|
@ -208,7 +218,6 @@ static void prepareUniformBuffer( const vk_ray_frame_render_args_t *args, int fr
|
|||
Matrix4x4_Copy(g_rtx.prev_inv_proj, proj_inv);
|
||||
|
||||
ubo->ray_cone_width = atanf((2.0f*tanf(DEG2RAD(fov_angle_y) * 0.5f)) / (float)FRAME_HEIGHT);
|
||||
ubo->random_seed = (uint32_t)gEngine.COM_RandomLong(0, INT32_MAX);
|
||||
ubo->frame_counter = frame_counter;
|
||||
|
||||
parseDebugDisplayValue();
|
||||
|
@ -217,6 +226,8 @@ static void prepareUniformBuffer( const vk_ray_frame_render_args_t *args, int fr
|
|||
} else {
|
||||
ubo->debug_display_only = r_lightmap->value != 0 ? DEBUG_DISPLAY_LIGHTING : DEBUG_DISPLAY_DISABLED;
|
||||
}
|
||||
|
||||
ubo->random_seed = getRandomSeed();
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
@ -713,6 +724,9 @@ qboolean VK_RayInit( void )
|
|||
"Display only the specified channel (" LIST_DISPLAYS(X) "etc)");
|
||||
#undef X
|
||||
|
||||
g_rtx.debug.rt_debug_fixed_random_seed = gEngine.Cvar_Get("rt_debug_fixed_random_seed", "", FCVAR_GLCONFIG,
|
||||
"Fix random seed value for RT monte carlo sampling. Used for reproducible regression testing");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue