mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-04 10:32:39 +08:00
24fe3ff784
* uniform * uniform buffer add * add dummy IA * first working version * misc & data structure optimize * fix webGL1 bug * rebase on 3.3 * add maxQuadPerDrawcall by device 现在每个DC能绘制的数量由设备返回的 uniform 数量上限决定 * add index * index bug fix * sliced ia add(Not finish) * change mat4 to vec4 * change stride num * new vec4PreUI finish * misc fix * size & anchor dirty add * bug fix * add UICapacityDirty (cherry picked from commit 417e10c8d3422363d80828539b110b93ee4d3cb1) * static buffer cache version (cherry picked from commit 1ffe7e7943cdf9af085aeda5ca218c3442fa9119) * static buffer update version (cherry picked from commit 964d9cb5b3230963b2a535acac99a34cde7eb63c) * cache localbuffer (cherry picked from commit 641b956def64023e0d47be66bc0c0a37ef1e9791) * fix setPosition event & fix DS release * weak sliced & filp tiled mode add * fix tiled y * fix sliced bug * ugly but work filled type add * update effect * filled mode effect * shader fix * RenderData dirty for render data update * revert fillbuffer * misc fix * support label bmfont by meshBuffer * fix sliced bug & commit Model * fixed some render dirty flag bug * cut code by macro.UI_GPU_DRIVEN * cut code by UI_GPU_DRIVEN Macro on build * cut file by UI_GPU_DRIVEN * I-batcher interface add * remove render queue cache * file name change * file name change * after merge * fix for v3.4 * useless remove * fix texture rotation * fix sliced when atlas rotation * useless code remove * native bind * update effect * fix DynamicOffsets bind bug * PR review fix * effect encapsulation * change chunk * update effect * update shader * remove color in fs * move code * fix UBO buffer bug * fix ubo count to 10 * fix vk bind
77 lines
1.6 KiB
Plaintext
77 lines
1.6 KiB
Plaintext
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
|
CCEffect %{
|
|
techniques:
|
|
- passes:
|
|
- vert: sprite-vs-gpu:vert
|
|
frag: sprite-fs-gpu:frag
|
|
depthStencilState:
|
|
depthTest: false
|
|
depthWrite: false
|
|
blendState:
|
|
targets:
|
|
- blend: true
|
|
blendSrc: src_alpha
|
|
blendDst: one_minus_src_alpha
|
|
blendDstAlpha: one_minus_src_alpha
|
|
rasterizerState:
|
|
cullMode: none
|
|
}%
|
|
|
|
CCProgram sprite-vs-gpu %{
|
|
precision highp float;
|
|
#include <cc-sprite-vs-gpu>
|
|
|
|
out vec4 v_color;
|
|
|
|
vec4 vert () {
|
|
SpriteVertexData i;
|
|
CCSpriteInput(i);
|
|
|
|
v_color = i.color;
|
|
vec4 pos = i.position;
|
|
// Vertex customization goes here
|
|
#if USE_PIXEL_ALIGNMENT
|
|
pos = cc_matView * pos;
|
|
pos.xyz = floor(pos.xyz);
|
|
pos = cc_matProj * pos;
|
|
#else
|
|
pos = cc_matViewProj * pos;
|
|
#endif
|
|
return pos;
|
|
}
|
|
}%
|
|
|
|
CCProgram sprite-fs-gpu %{
|
|
precision highp float;
|
|
#include <cc-sprite-fs-gpu>
|
|
#include <gamma>
|
|
|
|
in vec4 v_color;
|
|
|
|
#if USE_TEXTURE
|
|
#pragma builtin(local)
|
|
layout(set = 2, binding = 11) uniform sampler2D cc_spriteTexture;
|
|
#endif
|
|
|
|
vec4 frag () {
|
|
SpriteFragmentData i;
|
|
CCSpriteInput(i);
|
|
|
|
#if USE_TEXTURE
|
|
vec4 color = v_color * CCSpriteSample(cc_spriteTexture, i.uv);
|
|
#else
|
|
vec4 color = v_color;
|
|
#endif
|
|
|
|
// Customization goes here
|
|
|
|
#if IS_GRAY
|
|
// https://en.wikipedia.org/wiki/Grayscale
|
|
color.rgb = SRGBToLinear(color.rgb);
|
|
color.rgb = vec3(dot(color.rgb, vec3(0.2126, 0.7152, 0.0722)));
|
|
color.rgb = LinearToSRGB(color.rgb);
|
|
#endif
|
|
return color;
|
|
}
|
|
}%
|