SANTA CLARA – The 49ers went into the NFL draft without a need at quarterback.

But shortly after all the picks had been made on Saturday, the 49ers agreed to a deal with undrafted rookie quarterback Wilton Speight, who finished his career with UCLA.

Speight agreed to a three-year contract with the 49ers, a league source told NBC Sports Bay Area. All undrafted rookies must sign three-year contracts.

Speight played seven games for first-year UCLA coach Chip Kelly. He completed 126 of 208 passes (60.6 percent) for 1,527 yards and six touchdowns.

Speight played his first three college seasons for Jim Harbaugh at Michigan. His best season came in 2016 when he completed 204 of 331 pass attempts for 2,538 yards and 18 touchdowns. He sustained an injury early in 2017 and appeared in only four games before transferring.

The 49ers typically carry four quarterbacks through training camp. C.J. Beathard and Nick Mullens will compete for the backup job behind starter Jimmy Garoppolo.

Follow the 49ers' undrafted free agent signings here:

-- Michigan/UCLA QB Wilton Speight

Ex-Michigan/UCLA QB Wilton Speight is signing with the #49ers as an undrafted rookie, league source says. He joins Jimmy Garoppolo, C.J. Beathard and Nick Mullens on the 90-man roster. — Matt Maiocco (@MaioccoNBCS) April 28, 2019

-- Arizona wide receiver Shawn Poindexter

-- Wyoming tight end Tyree Mayfield

More UDFA deals, per sources:



•New Mexico State LB Terrill Hanks with the #Dolphins



•Wisconsin FB Alec Ingold with the #Raiders



•Wyoming tight end Tyree Mayfield with the #49ers



•South Carolina G Zack Bailey with the #Bucs — Tom Pelissero (@TomPelissero) April 27, 2019

-- West Georgia WR Malik Henry

West Georgia WR Malik Henry is signing with the 49ers as a UDFA, per source. — Matt Barrows (@mattbarrows) April 27, 2019

-- Wake Forest cornerback Cam Glenn

-- Stephen F. Austin long snapper Chris Wilkerson

Stephen F. Austin long snapper Chris Wilkerson to the San Francisco 49ers @chriswilk51 — Aaron Wilson (@AaronWilson_NFL) April 27, 2019

-- Penn State DT Kevin Givens

Per agent Kaveh Akbari of @MBKSports, Kevin Givens signing with 49ers as free agent. — Neil Rudel (@NeilRudel) April 27, 2019

-- Florida Atlantic DL Hunter Snyder

Florida Atlantic DL Hunter Snyder gets a minicamp tryout with the 49ers, per a soruce — Aaron Wilson (@AaronWilson_NFL) April 28, 2019

-- Iowa OT Ross Reynolds

Iowa OT Ross Reynolds

6’4

295

Started in all 13 games at left guard in 2018 https://t.co/4CtrznQ5Xk — Jennifer Lee Chan (@jenniferleechan) April 28, 2019

-- Midwestern State QB Layton Rabb

QB Layton Rabb of Midwestern State is scheduled to attend #49ers rookie camp this week on a tryout basis. https://t.co/9h2NqQ3NyQ — Matt Maiocco (@MaioccoNBCS) April 29, 2019

-- Rutgers LB Deonte Roberts