Changed Mesa backend to output GLSL ES 3.00 in order to support shadow mapping

This commit is contained in:
Robert Beckebans 2014-05-11 11:30:56 +02:00
parent 14f87fe9db
commit 11456a231d
15 changed files with 155 additions and 77 deletions

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2014 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -65,22 +66,22 @@ void main( VS_IN vertex, out VS_OUT result ) {
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
int joint = int(vertex.color.x * 255.1 * 3.0);
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
joint = int(vertex.color.y * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
joint = int(vertex.color.z * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
joint = int(vertex.color.w * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2014 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -52,22 +53,22 @@ void main( VS_IN vertex, out VS_OUT result ) {
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
int joint = int(vertex.color.x * 255.1 * 3.0);
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
joint = int(vertex.color.y * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
joint = int(vertex.color.z * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
joint = int(vertex.color.w * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2014 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -59,22 +60,22 @@ void main( VS_IN vertex, out VS_OUT result ) {
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
int joint = int(vertex.color.x * 255.1 * 3.0);
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
joint = int(vertex.color.y * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
joint = int(vertex.color.z * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
joint = int(vertex.color.w * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2014 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -55,22 +56,22 @@ void main( VS_IN vertex, out VS_OUT result ) {
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
int joint = int(vertex.color.x * 255.1 * 3.0);
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
joint = int(vertex.color.y * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
joint = int(vertex.color.z * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
joint = int(vertex.color.w * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;

View file

@ -72,22 +72,22 @@ void main( VS_IN vertex, out VS_OUT result ) {
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
int joint = int(vertex.color.x * 255.1 * 3.0);
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
joint = int(vertex.color.y * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
joint = int(vertex.color.z * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
joint = int(vertex.color.w * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2014 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -67,22 +68,22 @@ void main( VS_IN vertex, out VS_OUT result ) {
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
int joint = int(vertex.color.x * 255.1 * 3.0);
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
joint = int(vertex.color.y * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
joint = int(vertex.color.z * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
joint = int(vertex.color.w * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;

View file

@ -192,7 +192,7 @@ void main( PS_IN fragment, out PS_OUT result )
shadowTexcoord.xyz /= shadowTexcoord.w;
shadowTexcoord.z = shadowTexcoord.z * 0.9991;
//shadowTexcoord.z = shadowTexcoord.z - bias;
shadowTexcoord.w = shadowIndex;
shadowTexcoord.w = float(shadowIndex);
#if 0
result.color.xyz = float3( shadowTexcoord.z, shadowTexcoord.z, shadowTexcoord.z );
@ -238,7 +238,7 @@ void main( PS_IN fragment, out PS_OUT result )
float shadow = 0.0;
float stepSize = 1.0 / 16;
float stepSize = 1.0 / 16.0;
float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;
for( int i = 0; i < 16; i++ )
@ -250,7 +250,7 @@ void main( PS_IN fragment, out PS_OUT result )
jitterTC.x += stepSize;
}
shadow *= ( 1.0 / 16 );
shadow *= ( 1.0 / 16.0 );
#else
float shadow = texture( samp5, shadowTexcoord.xywz );
#endif

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2014 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -76,11 +77,11 @@ void main( PS_IN fragment, out PS_OUT result ) {
float2 delta = ( fragment.texcoord0 - prevTexCoord );
float3 sum = float3( 0.0 );
float goodSamples = 0;
float goodSamples = 0.0;
float samples = rpOverbright.x;
for ( float i = 0 ; i < samples ; i = i + 1 ) {
float2 pos = fragment.texcoord0 + delta * ( ( i / ( samples - 1 ) ) - 0.5 );
for ( float i = 0.0 ; i < samples ; i = i + 1.0 ) {
float2 pos = fragment.texcoord0 + delta * ( ( i / ( samples - 1.0 ) ) - 0.5 );
float4 color = tex2D( samp0, pos );
// only take the values that are not part of the weapon
sum += color.xyz * color.w;

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2014 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -52,22 +53,22 @@ void main( VS_IN vertex, out VS_OUT result ) {
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
int joint = int(vertex.color.x * 255.1 * 3.0);
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
joint = int(vertex.color.y * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
joint = int(vertex.color.z * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
joint = int(vertex.color.w * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Coypright (C) 2014 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -52,22 +53,22 @@ void main( VS_IN vertex, out VS_OUT result ) {
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
int joint = int(vertex.color.x * 255.1 * 3.0);
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
joint = int(vertex.color.y * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
joint = int(vertex.color.z * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
joint = int(vertex.color.w * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;

View file

@ -3,7 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2013 Robert Beckebans
Copyright (C) 2013-2014 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -43,22 +43,22 @@ BRANCH if ( rpEnableSkinning.x > 0.0 ) {
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
int joint = int(vertex.color.x * 255.1 * 3.0);
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
joint = int(vertex.color.y * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
joint = int(vertex.color.z * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
joint = int(vertex.color.w * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2014 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -55,22 +56,22 @@ void main( VS_IN vertex, out VS_OUT result ) {
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
int joint = int(vertex.color.x * 255.1 * 3.0);
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
joint = int(vertex.color.y * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
joint = int(vertex.color.z * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
joint = int(vertex.color.w * 255.1 * 3.0);
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;

View file

@ -131,12 +131,12 @@ attribInfo_t attribsPC[] =
{ "float", "facing", "FACE", "gl_FrontFacing", 0, AT_PS_IN | AT_PS_IN_RESERVED, 0 },
// fragment program output
{ "float4", "color", "COLOR", "gl_FragColor", 0, AT_PS_OUT | AT_PS_OUT_RESERVED, 0 }, // GLSL version 1.2 doesn't allow for custom color name mappings
{ "half4", "hcolor", "COLOR", "gl_FragColor", 0, AT_PS_OUT | AT_PS_OUT_RESERVED, 0 },
{ "float4", "color0", "COLOR0", "gl_FragColor", 0, AT_PS_OUT | AT_PS_OUT_RESERVED, 0 },
{ "float4", "color1", "COLOR1", "gl_FragColor", 1, AT_PS_OUT | AT_PS_OUT_RESERVED, 0 },
{ "float4", "color2", "COLOR2", "gl_FragColor", 2, AT_PS_OUT | AT_PS_OUT_RESERVED, 0 },
{ "float4", "color3", "COLOR3", "gl_FragColor", 3, AT_PS_OUT | AT_PS_OUT_RESERVED, 0 },
{ "float4", "color", "COLOR", "fo_FragColor", 0, AT_PS_OUT /*| AT_PS_OUT_RESERVED*/, 0 }, // GLSL version 1.2 doesn't allow for custom color name mappings
{ "half4", "hcolor", "COLOR", "fo_FragColor", 0, AT_PS_OUT /*| AT_PS_OUT_RESERVED*/, 0 },
{ "float4", "color0", "COLOR0", "fo_FragColor", 0, AT_PS_OUT /*| AT_PS_OUT_RESERVED*/, 0 },
{ "float4", "color1", "COLOR1", "fo_FragColor", 1, AT_PS_OUT /*| AT_PS_OUT_RESERVED*/, 0 },
{ "float4", "color2", "COLOR2", "fo_FragColor", 2, AT_PS_OUT /*| AT_PS_OUT_RESERVED*/, 0 },
{ "float4", "color3", "COLOR3", "fo_FragColor", 3, AT_PS_OUT /*| AT_PS_OUT_RESERVED*/, 0 },
{ "float", "depth", "DEPTH", "gl_FragDepth", 4, AT_PS_OUT | AT_PS_OUT_RESERVED, 0 },
// vertex to fragment program pass through
@ -833,6 +833,22 @@ const char* vertexInsert_GLSL_ES_1_0 =
};
#endif // #if defined(USE_GLES2)
const char* vertexInsert_GLSL_ES_3_00 =
{
"#version 300 es\n"
"#define PC\n"
"precision mediump float;\n"
//"#extension GL_ARB_gpu_shader5 : enable\n"
"\n"
"float saturate( float v ) { return clamp( v, 0.0, 1.0 ); }\n"
"vec2 saturate( vec2 v ) { return clamp( v, 0.0, 1.0 ); }\n"
"vec3 saturate( vec3 v ) { return clamp( v, 0.0, 1.0 ); }\n"
"vec4 saturate( vec4 v ) { return clamp( v, 0.0, 1.0 ); }\n"
//"vec4 tex2Dlod( sampler2D sampler, vec4 texcoord ) { return textureLod( sampler, texcoord.xy, texcoord.w ); }\n"
"\n"
};
const char* vertexInsert_GLSL_1_50 =
{
"#version 150\n"
@ -945,6 +961,47 @@ const char* fragmentInsert_GLSL_ES_1_0 =
#endif // #if defined(USE_GLES2)
const char* fragmentInsert_GLSL_ES_3_00 =
{
"#version 300 es\n"
"#define PC\n"
"precision mediump float;\n"
"\n"
"void clip( float v ) { if ( v < 0.0 ) { discard; } }\n"
"void clip( vec2 v ) { if ( any( lessThan( v, vec2( 0.0 ) ) ) ) { discard; } }\n"
"void clip( vec3 v ) { if ( any( lessThan( v, vec3( 0.0 ) ) ) ) { discard; } }\n"
"void clip( vec4 v ) { if ( any( lessThan( v, vec4( 0.0 ) ) ) ) { discard; } }\n"
"\n"
"float saturate( float v ) { return clamp( v, 0.0, 1.0 ); }\n"
"vec2 saturate( vec2 v ) { return clamp( v, 0.0, 1.0 ); }\n"
"vec3 saturate( vec3 v ) { return clamp( v, 0.0, 1.0 ); }\n"
"vec4 saturate( vec4 v ) { return clamp( v, 0.0, 1.0 ); }\n"
"\n"
"vec4 tex2D( sampler2D sampler, vec2 texcoord ) { return texture( sampler, texcoord.xy ); }\n"
"vec4 tex2D( sampler2DShadow sampler, vec3 texcoord ) { return vec4( texture( sampler, texcoord.xyz ) ); }\n"
"\n"
"vec4 tex2D( sampler2D sampler, vec2 texcoord, vec2 dx, vec2 dy ) { return textureGrad( sampler, texcoord.xy, dx, dy ); }\n"
"vec4 tex2D( sampler2DShadow sampler, vec3 texcoord, vec2 dx, vec2 dy ) { return vec4( textureGrad( sampler, texcoord.xyz, dx, dy ) ); }\n"
"\n"
"vec4 texCUBE( samplerCube sampler, vec3 texcoord ) { return texture( sampler, texcoord.xyz ); }\n"
"vec4 texCUBE( samplerCubeShadow sampler, vec4 texcoord ) { return vec4( texture( sampler, texcoord.xyzw ) ); }\n"
"\n"
//"vec4 tex1Dproj( sampler1D sampler, vec2 texcoord ) { return textureProj( sampler, texcoord ); }\n"
"vec4 tex2Dproj( sampler2D sampler, vec3 texcoord ) { return textureProj( sampler, texcoord ); }\n"
"vec4 tex3Dproj( sampler3D sampler, vec4 texcoord ) { return textureProj( sampler, texcoord ); }\n"
"\n"
//"vec4 tex1Dbias( sampler1D sampler, vec4 texcoord ) { return texture( sampler, texcoord.x, texcoord.w ); }\n"
"vec4 tex2Dbias( sampler2D sampler, vec4 texcoord ) { return texture( sampler, texcoord.xy, texcoord.w ); }\n"
"vec4 tex3Dbias( sampler3D sampler, vec4 texcoord ) { return texture( sampler, texcoord.xyz, texcoord.w ); }\n"
"vec4 texCUBEbias( samplerCube sampler, vec4 texcoord ) { return texture( sampler, texcoord.xyz, texcoord.w ); }\n"
"\n"
//"vec4 tex1Dlod( sampler1D sampler, vec4 texcoord ) { return textureLod( sampler, texcoord.x, texcoord.w ); }\n"
"vec4 tex2Dlod( sampler2D sampler, vec4 texcoord ) { return textureLod( sampler, texcoord.xy, texcoord.w ); }\n"
"vec4 tex3Dlod( sampler3D sampler, vec4 texcoord ) { return textureLod( sampler, texcoord.xyz, texcoord.w ); }\n"
"vec4 texCUBElod( samplerCube sampler, vec4 texcoord ) { return textureLod( sampler, texcoord.xyz, texcoord.w ); }\n"
"\n"
};
const char* fragmentInsert_GLSL_1_50 =
{
"#version 150\n"
@ -1180,7 +1237,7 @@ idStr ConvertCG2GLSL( const idStr& in, const char* name, bool isVertexProgram, i
{
case GLDRV_OPENGL_ES2:
case GLDRV_OPENGL_ES3:
case GLDRV_OPENGL_MESA:
//case GLDRV_OPENGL_MESA:
{
program += "attribute " + varsIn[i].type + " " + varsIn[i].nameGLSL + ";\n";
break;
@ -1213,7 +1270,7 @@ idStr ConvertCG2GLSL( const idStr& in, const char* name, bool isVertexProgram, i
{
case GLDRV_OPENGL_ES2:
case GLDRV_OPENGL_ES3:
case GLDRV_OPENGL_MESA:
//case GLDRV_OPENGL_MESA:
{
program += "varying " + varsOut[i].type + " " + varsOut[i].nameGLSL + ";\n";
break;
@ -1243,7 +1300,7 @@ idStr ConvertCG2GLSL( const idStr& in, const char* name, bool isVertexProgram, i
{
case GLDRV_OPENGL_ES2:
case GLDRV_OPENGL_ES3:
case GLDRV_OPENGL_MESA:
//case GLDRV_OPENGL_MESA:
{
program += "varying " + varsIn[i].type + " " + varsIn[i].nameGLSL + ";\n";
break;
@ -1508,13 +1565,19 @@ idStr ConvertCG2GLSL( const idStr& in, const char* name, bool isVertexProgram, i
{
case GLDRV_OPENGL_ES2:
case GLDRV_OPENGL_ES3:
case GLDRV_OPENGL_MESA:
{
out.ReAllocate( idStr::Length( vertexInsert_GLSL_ES_1_0 ) + in.Length() * 2, false );
out += vertexInsert_GLSL_ES_1_0;
break;
}
case GLDRV_OPENGL_MESA:
{
out.ReAllocate( idStr::Length( vertexInsert_GLSL_ES_3_00 ) + in.Length() * 2, false );
out += vertexInsert_GLSL_ES_3_00;
break;
}
default:
{
out.ReAllocate( idStr::Length( vertexInsert_GLSL_1_50 ) + in.Length() * 2, false );
@ -1531,13 +1594,19 @@ idStr ConvertCG2GLSL( const idStr& in, const char* name, bool isVertexProgram, i
{
case GLDRV_OPENGL_ES2:
case GLDRV_OPENGL_ES3:
case GLDRV_OPENGL_MESA:
{
out.ReAllocate( idStr::Length( fragmentInsert_GLSL_ES_1_0 ) + in.Length() * 2, false );
out += fragmentInsert_GLSL_ES_1_0;
break;
}
case GLDRV_OPENGL_MESA:
{
out.ReAllocate( idStr::Length( fragmentInsert_GLSL_ES_3_00 ) + in.Length() * 2, false );
out += fragmentInsert_GLSL_ES_3_00;
break;
}
default:
{
out.ReAllocate( idStr::Length( fragmentInsert_GLSL_1_50 ) + in.Length() * 2, false );
@ -1610,13 +1679,19 @@ GLuint idRenderProgManager::LoadGLSLShader( GLenum target, const char* name, con
{
case GLDRV_OPENGL_ES2:
case GLDRV_OPENGL_ES3:
case GLDRV_OPENGL_MESA:
{
outFileGLSL.Format( "renderprogs/glsles-1_0/%s%s", name, nameOutSuffix );
outFileUniforms.Format( "renderprogs/glsles-1_0/%s%s", name, nameOutSuffix );
break;
}
case GLDRV_OPENGL_MESA:
{
outFileGLSL.Format( "renderprogs/glsles-3_00/%s%s", name, nameOutSuffix );
outFileUniforms.Format( "renderprogs/glsles-3_00/%s%s", name, nameOutSuffix );
break;
}
default:
{
outFileGLSL.Format( "renderprogs/glsl-1_50/%s%s", name, nameOutSuffix );

View file

@ -766,9 +766,10 @@ void R_InitOpenGL()
float glVersion = atof( glConfig.version_string );
float glslVersion = atof( glConfig.shading_language_string );
idLib::Printf( "OpenGL Version: %3.1f\n", glVersion );
idLib::Printf( "OpenGL Vendor : %s\n", glConfig.vendor_string );
idLib::Printf( "OpenGL GLSL : %3.1f\n", glslVersion );
idLib::Printf( "OpenGL Version : %3.1f\n", glVersion );
idLib::Printf( "OpenGL Vendor : %s\n", glConfig.vendor_string );
idLib::Printf( "OpenGL Renderer : %s\n", glConfig.renderer_string );
idLib::Printf( "OpenGL GLSL : %3.1f\n", glslVersion );
// OpenGL driver constants
GLint temp;

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2013-2014 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -47,21 +48,7 @@ If you have questions concerning this license or the applicable additional terms
#include "rc/doom_resource.h"
#include "../../renderer/tr_local.h"
/*
// WGL_ARB_extensions_string
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
// WGL_EXT_swap_interval
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
// WGL_ARB_pixel_format
PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB;
PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGetPixelFormatAttribfvARB;
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
// WGL_ARB_create_context
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
*/
idCVar r_useOpenGL32( "r_useOpenGL32", "1", CVAR_INTEGER, "0 = OpenGL 2.0, 1 = OpenGL 3.2 compatibility profile, 2 = OpenGL 3.2 core profile", 0, 2 );
@ -360,6 +347,13 @@ static HGLRC CreateOpenGLContextOnDC( const HDC hdc, const bool debugContext )
int useOpenGL32 = r_useOpenGL32.GetInteger();
HGLRC m_hrc = NULL;
// RB: for GLintercept 1.2.0 or otherwise we can't diff the framebuffers using the XML log
if( !WGLEW_ARB_create_context || useOpenGL32 == 0 )
{
return wglCreateContext( hdc );
}
// RB end
for( int i = 0; i < 2; i++ )
{
const int glMajorVersion = ( useOpenGL32 != 0 ) ? 3 : 2;
@ -1279,7 +1273,6 @@ parameters and try again.
*/
bool GLimp_Init( glimpParms_t parms )
{
const char* driverName;
HDC hDC;
cmdSystem->AddCommand( "testSwapBuffers", GLimp_TestSwapBuffers, CMD_FL_SYSTEM, "Times swapbuffer options" );