RetroArch/gfx/drivers_shader/slang_reflection.h
Antonio Orefice 2a56a827e8
Add Frametime Uniforms (#17155)
* Initial implementation of CoreAspect uniform

* float -> float_t

* Possibly fix wii_u building

* vulkan: use float instead of float_t;

* slangp: Advertise support of CoreAspect uniform
by defining _RARCH_HAS_COREASPECT_UNIFORM early in the shader source, just after "#extension GL_GOOGLE_cpp_style_line_directive : require"

* CoreAspect + glsl fix: use glUniform1f()

* Add CoreAspectRot uniform.
It reports CoreAspect value or 1/CoreAspect when the content is rotated by 90 or 270 deg.

* Fixed stupid typo

* Just use _HAS_COREASPECT_UNIFORMS to check for CoreAspect uniforms support (was _RARCH_HAS_COREASPECT_UNIFORMS)

* Rename CoreAspect, CoreAspectRot, _HAS_COREASPECT_UNIFORMS to OriginalAspect, OriginlAspectRot, _HAS_ORIGINALASPECT_UNIFORMS

* GLCore: void Pass::build_semantic_float needs glUniform1f.
...how on earth did it worked for UBO !?

* d3d10,11,12, wrong function called by overlook.

* Add test shader, will remove that before PR

* Fix metal rotated aspect reporting

* remove test shader

* Fix C89 Build

* Use OriginalAspectRotated instead of OriginalAspectRot

* Add CoreFPS and FrameTimeDelta Uniforms.
_HAS_ORIGINALASPECT_UNIFORMS is (#)defined and can be used to query for them.

* add test shader

* remote test shader

* Wrong paste.

* gx2: use float

* wrong indentation

* resolved merge conflict

* fix indentation

* Fix comment/Formatting

* Change uniform name from CoreFPS to OriginalFPS

* underliyng references: core_fps -> original_fps
2024-11-12 19:50:59 -08:00

126 lines
3.8 KiB
C

/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2017 - Hans-Kristian Arntzen
*
* RetroArch 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 Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch 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 RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SLANG_REFLECTION_H_
#define SLANG_REFLECTION_H_
/* Textures with built-in meaning. */
enum slang_texture_semantic
{
/* The input texture to the filter chain.
* Canonical name: "Original". */
SLANG_TEXTURE_SEMANTIC_ORIGINAL = 0,
/* The output from pass N - 1 if executing pass N, or ORIGINAL
* if pass #0 is executed.
* Canonical name: "Source".
*/
SLANG_TEXTURE_SEMANTIC_SOURCE = 1,
/* The original inputs with a history back in time.
* Canonical name: "OriginalHistory#", e.g. "OriginalHistory2" <- Two frames back.
* "OriginalHistory0" is an alias for SEMANTIC_ORIGINAL.
* Size name: "OriginalHistorySize#".
*/
SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY = 2,
/* The output from pass #N, where pass #0 is the first pass.
* Canonical name: "PassOutput#", e.g. "PassOutput3".
* Size name: "PassOutputSize#".
*/
SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT = 3,
/* The output from pass #N, one frame ago where pass #0 is the first pass.
* It is not valid to use the pass feedback from a pass which is not offscreen.
* Canonical name: "PassFeedback#", e.g. "PassFeedback2".
*/
SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK = 4,
/* Inputs from static textures, defined by the user.
* There is no canonical name, and the only way to use these semantics are by
* remapping.
*/
SLANG_TEXTURE_SEMANTIC_USER = 5,
SLANG_NUM_TEXTURE_SEMANTICS,
SLANG_INVALID_TEXTURE_SEMANTIC = -1
};
enum slang_semantic
{
/* mat4, MVP */
SLANG_SEMANTIC_MVP = 0,
/* vec4, viewport size of current pass */
SLANG_SEMANTIC_OUTPUT = 1,
/* vec4, viewport size of final pass */
SLANG_SEMANTIC_FINAL_VIEWPORT = 2,
/* uint, frame count with modulo */
SLANG_SEMANTIC_FRAME_COUNT = 3,
/* int, frame direction */
SLANG_SEMANTIC_FRAME_DIRECTION = 4,
/* uint, FrameTimeDelta */
SLANG_SEMANTIC_FRAME_TIME_DELTA = 5,
/* uint, OriginalFPS */
SLANG_SEMANTIC_ORIGINAL_FPS = 6,
/* uint, rotation */
SLANG_SEMANTIC_ROTATION = 7,
/* float, OriginalAspect */
SLANG_SEMANTIC_CORE_ASPECT = 8,
/* float, OriginalAspectRotated */
SLANG_SEMANTIC_CORE_ASPECT_ROT = 9,
/* uint, sub frames per content frame */
SLANG_SEMANTIC_TOTAL_SUBFRAMES = 10,
/* uint, current sub frame */
SLANG_SEMANTIC_CURRENT_SUBFRAME = 11,
SLANG_NUM_BASE_SEMANTICS,
/* float, user defined parameter, arrayed */
SLANG_SEMANTIC_FLOAT_PARAMETER = 12,
SLANG_NUM_SEMANTICS,
SLANG_INVALID_SEMANTIC = -1
};
enum slang_stage
{
SLANG_STAGE_VERTEX_MASK = 1 << 0,
SLANG_STAGE_FRAGMENT_MASK = 1 << 1
};
enum slang_constant_buffer
{
SLANG_CBUFFER_UBO = 0,
SLANG_CBUFFER_PC,
SLANG_CBUFFER_MAX
};
/* Vulkan maximum texture bindings inside shader. D3D11 has hard limit of 16 */
#define SLANG_NUM_BINDINGS 16
struct slang_texture_semantic_map
{
enum slang_texture_semantic semantic;
unsigned index;
};
struct slang_semantic_map
{
enum slang_semantic semantic;
unsigned index;
};
#endif