Add samplerExternalOES type to shader globals

This commit is contained in:
Chaosus 2024-11-24 14:18:53 +03:00
parent 0c45ace151
commit 7ecdfc8b52
3 changed files with 16 additions and 0 deletions

View file

@ -65,6 +65,7 @@ static const char *global_var_type_names[RS::GLOBAL_VAR_TYPE_MAX] = {
"sampler2DArray",
"sampler3D",
"samplerCube",
"samplerExternalOES",
};
class ShaderGlobalsEditorInterface : public Object {
@ -232,6 +233,11 @@ protected:
pinfo.hint = PROPERTY_HINT_RESOURCE_TYPE;
pinfo.hint_string = "Cubemap,CompressedCubemap";
} break;
case RS::GLOBAL_VAR_TYPE_SAMPLEREXT: {
pinfo.type = Variant::OBJECT;
pinfo.hint = PROPERTY_HINT_RESOURCE_TYPE;
pinfo.hint_string = "ExternalTexture";
} break;
default: {
} break;
}
@ -339,6 +345,9 @@ static Variant create_var(RS::GlobalShaderParameterType p_type) {
case RS::GLOBAL_VAR_TYPE_SAMPLERCUBE: {
return "";
}
case RS::GLOBAL_VAR_TYPE_SAMPLEREXT: {
return "";
}
default: {
return Variant();
}

View file

@ -197,6 +197,11 @@ void ShaderGlobalsOverride::_get_property_list(List<PropertyInfo> *p_list) const
pinfo.hint = PROPERTY_HINT_RESOURCE_TYPE;
pinfo.hint_string = "Cubemap";
} break;
case RS::GLOBAL_VAR_TYPE_SAMPLEREXT: {
pinfo.type = Variant::OBJECT;
pinfo.hint = PROPERTY_HINT_RESOURCE_TYPE;
pinfo.hint_string = "ExternalTexture";
} break;
default: {
} break;
}

View file

@ -1868,6 +1868,8 @@ int RenderingServer::global_shader_uniform_type_get_shader_datatype(GlobalShader
return ShaderLanguage::TYPE_SAMPLER3D;
case RS::GLOBAL_VAR_TYPE_SAMPLERCUBE:
return ShaderLanguage::TYPE_SAMPLERCUBE;
case RS::GLOBAL_VAR_TYPE_SAMPLEREXT:
return ShaderLanguage::TYPE_SAMPLEREXT;
default:
return ShaderLanguage::TYPE_MAX; // Invalid or not found.
}