Vertex shaders can write to gl_PointSize (fixes #1603).

If a shader uses gl_PointSize then it can only be used when drawing points. If a shader doesn't use gl_PointSize then it can't be used when drawing points.

Added 'ConstantPointSize' and 'CurrentDPIScale' built-in shader uniforms.

ConstantPointSize is in DPI-scaled points, whereas gl_PointSize is in pixels, so to get the correct default behaviour a shader needs to do gl_PointSize = ConstantPointSize * CurrentDPIScale
This commit is contained in:
Alex Szpakowski
2021-01-23 13:47:12 -04:00
parent deff795908
commit 694d448e83
13 changed files with 83 additions and 87 deletions
+3 -3
View File
@@ -64,7 +64,6 @@ public:
BUILTIN_TEXTURE_VIDEO_CB,
BUILTIN_TEXTURE_VIDEO_CR,
BUILTIN_UNIFORMS_PER_DRAW,
BUILTIN_POINT_SIZE,
BUILTIN_MAX_ENUM
};
@@ -88,6 +87,7 @@ public:
STANDARD_DEFAULT,
STANDARD_VIDEO,
STANDARD_ARRAY,
STANDARD_POINTS,
STANDARD_MAX_ENUM
};
@@ -209,8 +209,7 @@ public:
virtual void setVideoTextures(Texture *ytexture, Texture *cbtexture, Texture *crtexture) = 0;
TextureType getMainTextureType() const;
void checkMainTextureType(TextureType textype, bool isDepthSampler) const;
void checkMainTexture(Texture *texture) const;
void validateDrawState(PrimitiveType primtype, Texture *maintexture) const;
static SourceInfo getSourceInfo(const std::string &src);
static std::string createShaderStageCode(Graphics *gfx, ShaderStage::StageType stage, const std::string &code, const SourceInfo &info);
@@ -239,6 +238,7 @@ protected:
struct ValidationReflection
{
std::map<std::string, BufferReflection> storageBuffers;
bool usesPointSize;
};
static bool validateInternal(ShaderStage* vertex, ShaderStage* pixel, std::string& err, ValidationReflection &reflection);