Merge pull request #99622 from Chaosus/shader_fix_global_empty_type

Add `samplerExternalOES` type to shader globals
This commit is contained in:
Thaddeus Crews 2024-12-11 17:35:40 -06:00
commit b773fff5a4
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84
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.
}