Set correct alpha size in QWindow format.
This somehow fixes Direct3D 11 ANGLE backend colors issue.
This commit is contained in:
		
							parent
							
								
									51cfd0ba35
								
							
						
					
					
						commit
						27fd82a365
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		|  | @ -44,7 +44,6 @@ Capabilities CheckCapabilities(QWidget *widget) { | ||||||
| 		return {}; | 		return {}; | ||||||
| 	} | 	} | ||||||
| 	auto format = QSurfaceFormat(); | 	auto format = QSurfaceFormat(); | ||||||
| 	format.setAlphaBufferSize(8); |  | ||||||
| 	if (widget) { | 	if (widget) { | ||||||
| 		if (!widget->window()->windowHandle()) { | 		if (!widget->window()->windowHandle()) { | ||||||
| 			widget->window()->createWinId(); | 			widget->window()->createWinId(); | ||||||
|  | @ -57,6 +56,11 @@ Capabilities CheckCapabilities(QWidget *widget) { | ||||||
| 			LOG_ONCE(("OpenGL: Not supported for window.")); | 			LOG_ONCE(("OpenGL: Not supported for window.")); | ||||||
| 			return {}; | 			return {}; | ||||||
| 		} | 		} | ||||||
|  | 		format = widget->window()->windowHandle()->format(); | ||||||
|  | 		format.setAlphaBufferSize(8); | ||||||
|  | 		widget->window()->windowHandle()->setFormat(format); | ||||||
|  | 	} else { | ||||||
|  | 		format.setAlphaBufferSize(8); | ||||||
| 	} | 	} | ||||||
| 	auto tester = QOpenGLWidget(widget); | 	auto tester = QOpenGLWidget(widget); | ||||||
| 	tester.setFormat(format); | 	tester.setFormat(format); | ||||||
|  | @ -104,6 +108,7 @@ Capabilities CheckCapabilities(QWidget *widget) { | ||||||
| 			return {}; | 			return {}; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
| 	const auto supported = context->format(); | 	const auto supported = context->format(); | ||||||
| 	switch (supported.profile()) { | 	switch (supported.profile()) { | ||||||
| 	case QSurfaceFormat::NoProfile: { | 	case QSurfaceFormat::NoProfile: { | ||||||
|  | @ -121,6 +126,7 @@ Capabilities CheckCapabilities(QWidget *widget) { | ||||||
| 		LOG_ONCE(("OpenGL Profile: Compatibility.")); | 		LOG_ONCE(("OpenGL Profile: Compatibility.")); | ||||||
| 	} break; | 	} break; | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
| 	[[maybe_unused]] static const auto extensionsLogged = [&] { | 	[[maybe_unused]] static const auto extensionsLogged = [&] { | ||||||
| 		const auto renderer = reinterpret_cast<const char*>( | 		const auto renderer = reinterpret_cast<const char*>( | ||||||
| 			functions->glGetString(GL_RENDERER)); | 			functions->glGetString(GL_RENDERER)); | ||||||
|  | @ -138,6 +144,7 @@ Capabilities CheckCapabilities(QWidget *widget) { | ||||||
| 		LOG(("OpenGL Extensions: %1").arg(list.join(", "))); | 		LOG(("OpenGL Extensions: %1").arg(list.join(", "))); | ||||||
| 		return true; | 		return true; | ||||||
| 	}(); | 	}(); | ||||||
|  | 
 | ||||||
| 	const auto version = u"%1.%2"_q | 	const auto version = u"%1.%2"_q | ||||||
| 		.arg(supported.majorVersion()) | 		.arg(supported.majorVersion()) | ||||||
| 		.arg(supported.majorVersion()); | 		.arg(supported.majorVersion()); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 John Preston
						John Preston