1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418
|
#pragma once
#include "globalincs/pstypes.h"
using SPIRV_FLOAT_MAT_4x4 = matrix4;
using SPIRV_FLOAT_VEC4 = vec4;
#include "shader_structs.h"
namespace graphics {
/**
* @file
*
* This file contains definitions for GPU uniform buffer structs. These structs must respect the std140 layout rules.
* The complete rules for this can be found here: https://www.khronos.org/opengl/wiki/Interface_Block_(GLSL)#Explicit_variable_layout,
* but the TL;DR here is that everything in here must be 16-byte aligned.
*/
struct deferred_global_data {
matrix4 shadow_mv_matrix;
matrix4 shadow_proj_matrix[4];
matrix4 inv_view_matrix;
float veryneardist;
float neardist;
float middist;
float fardist;
float invScreenWidth;
float invScreenHeight;
float nearPlane;
float pad;
};
/**
* @brief Data for one deferred light rendering call
*/
struct deferred_light_data {
vec3d diffuseLightColor;
float coneAngle;
vec3d lightDir;
float coneInnerAngle;
vec3d coneDir;
float dualCone;
vec3d scale;
float lightRadius;
int lightType;
int enable_shadows;
float sourceRadius;
float pad0[1]; // Struct size must be 16-bytes aligned because we use vec3s
};
struct model_light {
vec4 position;
vec3d diffuse_color;
int light_type;
vec3d direction;
float attenuation;
float ml_sourceRadius;
float pad0[3];
};
const size_t MAX_UNIFORM_LIGHTS = 8;
struct model_uniform_data {
matrix4 modelViewMatrix;
matrix4 modelMatrix;
matrix4 viewMatrix;
matrix4 projMatrix;
matrix4 textureMatrix;
matrix4 shadow_mv_matrix;
matrix4 shadow_proj_matrix[4];
matrix4 envMatrix;
vec4 color;
model_light lights[MAX_UNIFORM_LIGHTS];
float outlineWidth;
float fogStart;
float fogScale;
int buffer_matrix_offset;
vec4 clip_equation;
float thruster_scale;
int use_clip_plane;
int n_lights;
float defaultGloss;
vec3d ambientFactor;
int desaturate;
vec3d diffuseFactor;
int blend_alpha;
vec3d emissionFactor;
int alphaGloss;
int gammaSpec;
int envGloss;
int effect_num;
int sBasemapIndex; // moved up here to track alignment
vec4 fogColor;
vec3d base_color;
float anim_timer;
vec3d stripe_color;
float vpwidth;
float vpheight;
int team_glow_enabled;
float znear;
float zfar;
float veryneardist;
float neardist;
float middist;
float fardist;
int sGlowmapIndex;
int sSpecmapIndex;
int sNormalmapIndex;
int sAmbientmapIndex;
int sMiscmapIndex;
float alphaMult;
int flags;
int pad[1];
};
const size_t model_uniform_data_size = sizeof(model_uniform_data);
const float mud_align = model_uniform_data_size / 16.0f;
enum class NanoVGShaderType: int32_t {
FillGradient = 0, FillImage = 1, Simple = 2, Image = 3
};
struct nanovg_draw_data {
float scissorMat[12]; // matrices are actually 3 vec4s
float paintMat[12];
vec4 innerCol;
vec4 outerCol;
vec2d scissorExt;
vec2d scissorScale;
vec2d extent;
float radius;
float feather;
float strokeMult;
float strokeThr;
int texType;
NanoVGShaderType type;
vec2d viewSize;
int texArrayIndex;
float pad3;
};
struct decal_globals {
matrix4 viewMatrix;
matrix4 projMatrix;
matrix4 invViewMatrix;
matrix4 invProjMatrix;
vec3d ambientLight;
float pad0;
vec2d viewportSize;
float pad1[2];
};
struct decal_info {
matrix4 model_matrix;
matrix4 inv_model_matrix;
vec3d decal_direction;
float normal_angle_cutoff;
int diffuse_index;
int glow_index;
int normal_index;
float angle_fade_start;
float alpha_scale;
int diffuse_blend_mode;
int glow_blend_mode;
float pad;
};
struct matrix_uniforms {
matrix4 modelViewMatrix;
matrix4 projMatrix;
};
struct movie_uniforms {
float alpha;
float pad[3];
};
namespace generic_data {
struct passthrough_data {
int noTexturing;
int srgb;
float pad[2];
};
struct tonemapping_data {
float exposure;
int tonemapper;
float x0; //from here on these are for the PPC tonemappers
float y0;
float x1;
float toe_B;
float toe_lnA;
float sh_B;
float sh_lnA;
float sh_offsetX;
float sh_offsetY;
float pad[1];
};
struct smaa_data {
vec2d smaa_rt_metrics;
float pad[2];
};
struct shield_impact_data {
matrix4 shieldModelViewMatrix;
matrix4 shieldProjMatrix;
vec3d hitNormal;
int srgb;
vec4 color;
int shieldMapIndex;
float pad[3];
};
struct rocketui_data {
matrix4 projMatrix;
vec2d offset;
int textured;
int baseMapIndex;
float horizontalSwipeOffset;
float pad[3];
};
struct lightshaft_data {
vec2d sun_pos;
float density;
float weight;
float falloff;
float intensity;
float cp_intensity;
float pad[1];
};
struct fxaa_data {
float rt_w;
float rt_h;
float pad[2];
};
struct fog_data {
vec3d fog_color;
float fog_start;
float fog_density;
float zNear;
float zFar;
float pad[1];
};
struct volumetric_fog_data {
matrix4 p_inv;
matrix4 v_inv;
vec3d cameraPos;
float zNear;
vec3d globalLightDirection;
float zFar;
vec3d globalLightDiffuse;
float stepsize;
vec3d nebPos;
float opacitydistance;
vec3d nebSize;
float alphalimit;
float nebColor[3];
float udfScale;
float emissiveSpreadFactor;
float emissiveIntensity;
float emissiveFalloff;
float henyeyGreensteinCoeff;
float noiseColor[3];
int directionalLightSampleSteps;
float directionalLightStepSize;
float noiseColorScale1;
float noiseColorScale2;
float noiseColorIntensity;
float aspect;
float fov;
float pad[2];
};
struct msaa_data {
int samples;
float fov;
float pad[2];
};
struct blur_data {
float texSize;
int level;
float pad[2];
};
struct bloom_composition_data {
float bloom_intensity;
int levels;
float pad[2];
};
struct effect_data {
float window_width;
float window_height;
float nearZ;
float farZ;
int linear_depth;
int srgb;
int blend_alpha;
float pad[1];
};
struct effect_distort_data {
float window_width;
float window_height;
float use_offset;
float pad[1];
};
struct batched_data {
vec4 color;
float intensity;
float pad[3];
};
struct post_data {
float timer;
float noise_amount;
float saturation;
float brightness;
float contrast;
float film_grain;
float tv_stripes;
float cutoff;
vec3d tint;
float dither;
};
struct irrmap_data {
int face;
};
} // namespace generic_data
} // namespace graphics
|