We study the boundary-value problem \(\begin{aligned} {\left\{ \begin{array}{ll} \mathrm {{div}}\left( |\mathbb {M}(x)\nabla u(x)|^{p(x)-2}\mathbb {M}^2(x)\nabla u(x)\right) =\mathrm {{div}}\left( |\mathbb {M}(x) F(x)|^{p(x)-2}\mathbb {M}^2(x)F(x)\right) & ~ \text {in}~\Omega ,\\ u(x)=0& \text {on}~\partial \Omega , \end{array}\right. } \end{aligned}\) which has a degeneracy or singularity arising from the nonnegative matrix weight \(\mathbb {M}(x)\) . A global Calderón-Zygmund estimate for the relative weight is established under minimal regularity requirements on the associated operator by proving that \( |\nabla u(x)|^{p(x)}\) is as integrable as \( |F(x)|^{p(x)}\) in \(L^{\gamma }\left( \Omega , |\mathbb {M}(x)|^{ \gamma p(x) }dx\right) \) for every \(1<\gamma <\infty \) , under the assumptions that the variable exponent p(x) has a small log-Hölder constant, \(\mathbb {M}(x)\) has a small log-BMO semi-norm and that the boundary \(\partial \Omega \) of the nonsmooth bounded domain \(\Omega \) is flat in the Reifenberg sense. Our work is a natural extension and outgrowth of the uniformly elliptic problem when the matrix \(\mathbb {M}(x)\) is a constant matrix as in [1, 7] to the degenerate or singular one when a coefficient of the nonlinearity might goes to zero or \(\infty \) .