diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp
index 33933b11..d94a06d1 100644
--- a/src/libcamera/software_isp/debayer_egl.cpp
+++ b/src/libcamera/software_isp/debayer_egl.cpp
@@ -244,6 +244,13 @@ int DebayerEGL::initBayerShaders(PixelFormat inputFormat, PixelFormat outputForm
 		break;
 	};
 
+	/* GL_RG textures need GL_EXT_texture_rg before ES 3.0 */
+	if (glFormat_ == GL_RG && !egl_.hasGLESVersion(3, 0) &&
+	    !egl_.hasGLESExtension("GL_EXT_texture_rg")) {
+		LOG(Debayer, Error) << "GL_EXT_texture_rg not supported for unpacked input format";
+		return -EINVAL;
+	}
+
 	if (egl_.compileVertexShader(vertexShaderId_, vertexShaderData,
 				     shaderEnv)) {
 		LOG(Debayer, Error) << "Compile vertex shader fail";
