Skip to content

Commit

Permalink
[feature]: Support GL_External_OES #13832
Browse files Browse the repository at this point in the history
  • Loading branch information
bluesky013 committed Jan 6, 2023
1 parent c807031 commit 3af7f2b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions editor/assets/chunks/common/texture/texture-lod.chunk
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.

#pragma extension([GL_EXT_shader_texture_lod, __VERSION__ < 130])
#pragma extension([GL_OES_EGL_image_external, __VERSION__ >= 100, require])
#pragma extension([GL_OES_EGL_image_external_essl3, __VERSION__ >= 300, require])

vec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {
#if __VERSION__ < 130
Expand Down
27 changes: 27 additions & 0 deletions editor/assets/effects/builtin-texture-oes.effect
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Effect Syntax Guide: https://docs.cocos.com/creator/manual/zh/shader/index.html

CCEffect %{
techniques:
- name: opaque
passes:
- vert: legacy/main-functions/general-vs:vert # builtin header
frag: unlit-oes-fs:frag
properties: &props
mainTexture: { value: white }
}%

CCProgram unlit-oes-fs %{
precision highp float;
#include <common/texture/texture-lod>
#include <legacy/output>

in vec2 v_uv;
in vec3 v_position;

uniform samplerExternalOES mainTexture;

vec4 frag () {
vec4 col = texture(mainTexture, v_uv);
return CCFragOutput(col);
}
}%
11 changes: 11 additions & 0 deletions editor/assets/effects/builtin-texture-oes.effect.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ver": "1.6.2",
"importer": "effect",
"imported": true,
"uuid": "1d720f90-c734-4173-a814-a3afcdb5cf2a",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}
1 change: 1 addition & 0 deletions editor/exports/offline-mappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ typeMap.sampler1DArrayShadow = Type.SAMPLER1D_ARRAY;
typeMap.isampler2D = Type.SAMPLER2D;
typeMap.usampler2D = Type.SAMPLER2D;
typeMap.sampler2DShadow = Type.SAMPLER2D;
typeMap.samplerExternalOES = Type.SAMPLER2D;
typeMap.isampler2DArray = Type.SAMPLER2D_ARRAY;
typeMap.usampler2DArray = Type.SAMPLER2D_ARRAY;
typeMap.sampler2DArrayShadow = Type.SAMPLER2D_ARRAY;
Expand Down

0 comments on commit 3af7f2b

Please sign in to comment.