Compiler - implement gl_PointCoord and point size clamping

TRAC #11592 Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@70 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 76b82085
...@@ -83,6 +83,7 @@ void OutputHLSL::header() ...@@ -83,6 +83,7 @@ void OutputHLSL::header()
"\n" "\n"
"static float4 gl_Color[1] = {float4(0, 0, 0, 0)};\n" "static float4 gl_Color[1] = {float4(0, 0, 0, 0)};\n"
"static float4 gl_FragCoord = float4(0, 0, 0, 0);\n" "static float4 gl_FragCoord = float4(0, 0, 0, 0);\n"
"static float2 gl_PointCoord = float2(0.5, 0.5);\n"
"static bool gl_FrontFacing = false;\n" "static bool gl_FrontFacing = false;\n"
"\n" "\n"
"float4 gl_texture2D(sampler2D s, float2 t)\n" "float4 gl_texture2D(sampler2D s, float2 t)\n"
...@@ -180,7 +181,7 @@ void OutputHLSL::header() ...@@ -180,7 +181,7 @@ void OutputHLSL::header()
out << "};\n" out << "};\n"
"\n" "\n"
"static float4 gl_Position = float4(0, 0, 0, 0);\n" "static float4 gl_Position = float4(0, 0, 0, 0);\n"
"static float gl_PointSize = float(0);\n"; "static float gl_PointSize = float(1);\n";
out << varyingGlobals; out << varyingGlobals;
out << "\n"; out << "\n";
} }
...@@ -792,7 +793,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -792,7 +793,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
" output.gl_Position.y = -(gl_Position.y - gl_HalfPixelSize.y * gl_Position.w);\n" " output.gl_Position.y = -(gl_Position.y - gl_HalfPixelSize.y * gl_Position.w);\n"
" output.gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n" " output.gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
" output.gl_Position.w = gl_Position.w;\n" " output.gl_Position.w = gl_Position.w;\n"
" output.gl_PointSize = gl_PointSize;\n" " output.gl_PointSize = 1.0;\n"
" output.gl_FragCoord = gl_Position;\n"; " output.gl_FragCoord = gl_Position;\n";
TSymbolTableLevel *symbols = context.symbolTable.getGlobalLevel(); TSymbolTableLevel *symbols = context.symbolTable.getGlobalLevel();
......
...@@ -61,6 +61,9 @@ enum ...@@ -61,6 +61,9 @@ enum
IMPLEMENTATION_COLOR_READ_TYPE = GL_UNSIGNED_SHORT_5_6_5 IMPLEMENTATION_COLOR_READ_TYPE = GL_UNSIGNED_SHORT_5_6_5
}; };
const float ALIASED_POINT_SIZE_RANGE_MIN = 1.0f;
const float ALIASED_POINT_SIZE_RANGE_MAX = 1.0f;
// Because indices are accessed internally, we convert them to a common format. // Because indices are accessed internally, we convert them to a common format.
typedef unsigned short Index; typedef unsigned short Index;
......
...@@ -1764,12 +1764,12 @@ void __stdcall glGetFloatv(GLenum pname, GLfloat* params) ...@@ -1764,12 +1764,12 @@ void __stdcall glGetFloatv(GLenum pname, GLfloat* params)
{ {
switch (pname) switch (pname)
{ {
case GL_LINE_WIDTH: *params = context->lineWidth; break; case GL_LINE_WIDTH:
*params = context->lineWidth;
break;
case GL_ALIASED_LINE_WIDTH_RANGE: case GL_ALIASED_LINE_WIDTH_RANGE:
{ params[0] = gl::ALIASED_POINT_SIZE_RANGE_MIN;
params[0] = 1.0f; params[1] = gl::ALIASED_POINT_SIZE_RANGE_MAX;
params[1] = 1.0f;
}
break; break;
default: default:
UNIMPLEMENTED(); // FIXME UNIMPLEMENTED(); // FIXME
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment