Files
cocos4/editor/assets/effects/pipeline/post-process.effect
T
hyde zhou 8c612a3bbb [pipeline] add native pipeline ubo uploading (#14061)
* merge v3.7.0-pipeline

* pass done

* fix const reference return type

* add uniform block buiding

* fix const cast

* fix const

* fix mtl const

* integrating native program library

* native pipeline workflow updated

* adding ubo binding

* Solve the problem of the version attribute of pass (#87)

* ubo upload added

* adding camera ubo

* add constant name

* update uniform buffer

* adding execution resources

* per pass ubo added

* fix bugs

* ubo added

* fix render pass bug

* bind set added

* adding ubo uploading

* shader binding overwrite added

* shader binding overwrite added

* add missing header

* draw updated

* ubo updated

* fix main light ubo

* pass ubo added

* lint

* fix custom pipeline window resize issue. (#88)

* fix lint

* fix assert

* remove texture1d

* fix constantMacros

* lint

* fixed: native custom pipeline graphics pipeline state leak. (#89)

* lint

* skybox added

* skip subpass input binding rewrite (#90)

* per pass descriptor set modified

* adding blit

* fix material

* fix fg get usage (#91)

* fix barrier fetch

* fix ios bug

* fix barrier

* support cc builtin overwrite

* try fix shadowMap

* refactor resources

* update blit

* add render graph binding

* fix shader bugs

* fix blit

* fix bugs

* remove unnessary barriers

* fix init

* fix addCameraQuad

* fix raster view order

---------

Co-authored-by: GengineJS <476393671@qq.com>
Co-authored-by: Zach Lee <bluesky013@126.com>
Co-authored-by: Zeqiang Li <zeqiang-li@outlook.com>
2023-02-01 17:46:34 +08:00

84 lines
2.3 KiB
Plaintext

// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
CCEffect %{
techniques:
- passes:
- vert: post-process-vs
frag: post-process-fs
pass: post-process
depthStencilState:
depthTest: false
depthWrite: false
rasterizerState:
cullMode: none
blendState:
targets:
- blend: true
blendSrc: src_alpha
blendDst: one_minus_src_alpha
blendSrcAlpha: src_alpha
blendDstAlpha: one_minus_src_alpha
}%
CCProgram post-process-vs %{
precision highp float;
#include <legacy/decode-standard>
#include <builtin/uniforms/cc-global>
#include <common/common-define>
out vec2 v_uv;
void main () {
StandardVertInput In;
CCDecode(In);
CC_HANDLE_GET_CLIP_FLIP(In.position.xy);
gl_Position = In.position;
gl_Position.y = gl_Position.y;
v_uv = a_texCoord;
}
}%
CCProgram post-process-fs %{
precision highp float;
#include <builtin/uniforms/cc-global>
#include <post-process/anti-aliasing>
in vec2 v_uv;
#pragma rate outputResultMap pass
layout(binding = 0) uniform sampler2D outputResultMap;
layout(location = 0) out vec4 fragColor;
void texcoords(vec2 fragCoord, vec2 resolution,
out vec2 v_rgbNW, out vec2 v_rgbNE,
out vec2 v_rgbSW, out vec2 v_rgbSE,
out vec2 v_rgbM) {
vec2 inverseVP = 1.0 / resolution.xy;
v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;
v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;
v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;
v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;
v_rgbM = vec2(fragCoord * inverseVP);
}
void main () {
#if ANTIALIAS_TYPE == 1
mediump vec2 v_rgbNW;
mediump vec2 v_rgbNE;
mediump vec2 v_rgbSW;
mediump vec2 v_rgbSE;
mediump vec2 v_rgbM;
vec2 resolution = cc_screenSize.xy;
vec2 fragCoord = v_uv * resolution;
texcoords(fragCoord, resolution, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
fragColor = fxaa(outputResultMap, fragCoord, resolution, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
#elif ANTIALIAS_TYPE == 2
vec3 color = FxaaPixelShader(v_uv, outputResultMap, 1.0 / cc_screenSize.xy);
fragColor = vec4(color, texture(outputResultMap, v_uv).a);
#else
fragColor = texture(outputResultMap, v_uv);
#endif
}
}%