The finite-element method is a preferred numerical method when electromagnetic fields at high accuracy are to be computed in nano-optics design. Here, we demonstrate a finite-element method using hp-adaptivity on tetrahedral meshes for computation of electromagnetic fields in a device with rough textures. The method allows for efficient computations on meshes with strong variations in element sizes. This enables to use precise geometry resolution of the rough textures. Convergence to highly accurate results is observed.