GLSL writer: emit gl_PointSize = 1 in all vertex shaders for OpenGL.

The OpenGL ES 3.1 spec says:

"The point size is taken from the shader built-in gl_PointSize written by the vertex shader, and clamped to the implementation-dependent point size range. If the value written to gl_PointSize is less than or equal to zero, or if no value is written, the point size is undefined."

ANGLE/D3D11 will emit a warning on this and abort processing, causing dawn_end2end tests to fail.

Bug: dawn:1390
Change-Id: I6a56467842ba80d8a070af7240ee07bb111089dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87720
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White
2022-04-22 21:25:02 +00:00
committed by Dawn LUCI CQ
parent c0fe68907b
commit 790e4c2d60
745 changed files with 685 additions and 1474 deletions

View File

@@ -2207,6 +2207,9 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) {
// Emit original entry point function body
{
ScopedIndent si(this);
if (func->PipelineStage() == ast::PipelineStage::kVertex) {
line() << "gl_PointSize = 1.0;";
}
if (!EmitStatements(func->body->statements)) {
return false;

View File

@@ -234,6 +234,7 @@ Interface vert_main() {
}
void main() {
gl_PointSize = 1.0;
Interface inner_result = vert_main();
gl_Position = inner_result.pos;
col1_1 = inner_result.col1;