Created checkShaderCompilation to reduce code repetition