Updated Cg shaders (markdown)
parent
816b11c62b
commit
ea25380a6f
|
@ -1,35 +1 @@
|
|||
## Purpose
|
||||
Cg shaders is a spec from nVidia. It has the great advantage that shaders written in Cg are compatible with both OpenGL and Direct3D. It is also compatible with PlayStation 3 as well. They are also compatible with basic HLSL if some considerations are taken into account. They can even be automatically compiled into [[GLSL shaders]], which makes Cg shaders a true "write once, run everywhere" shader format.
|
||||
We encourage new shaders targeting RetroArch to be written in this format.
|
||||
|
||||
### Example Cg shader
|
||||
void main_vertex
|
||||
(
|
||||
float4 position : POSITION,
|
||||
out float4 oPosition : POSITION,
|
||||
uniform float4x4 modelViewProj,
|
||||
float2 tex : TEXCOORD,
|
||||
out float2 oTex : TEXCOORD
|
||||
)
|
||||
{
|
||||
oPosition = mul(modelViewProj, position);
|
||||
oTex = tex;
|
||||
}
|
||||
|
||||
float4 main_fragment (float2 tex : TEXCOORD, uniform sampler2D s0 : TEXUNIT0) : COLOR
|
||||
{
|
||||
return tex2D(s0, tex);
|
||||
}
|
||||
|
||||
## Specification
|
||||
The Cg shader spec used in RetroArch is documented [here](https://github.com/Themaister/Emulator-Shader-Pack/blob/master/Cg/README). It defines single-pass Cg shaders as well as multi-pass shaders using a custom Cg preset format (.cgp).
|
||||
|
||||
### Example Cg preset
|
||||
shaders = 2
|
||||
shader0 = 4xBR-v3.9.cg
|
||||
scale_type0 = source
|
||||
scale0 = 4.0
|
||||
filter_linear0 = false
|
||||
shader1 = dummy.cg
|
||||
filter_linear1 = true
|
||||
|
||||
This doc is now part of [https://github.com/libretro/docs libretro-docs] and can be viewed here: https://github.com/libretro/docs
|
Loading…
Reference in New Issue