More Cg shader fixes for Mesa and Qualcomm drivers #90

This commit is contained in:
RobertBeckebans 2014-04-20 17:44:17 +02:00
parent a61dbbdd9f
commit e2ad1b2989
5 changed files with 31 additions and 1 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) 2013 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -158,6 +159,14 @@ float rand( float2 co ) {
return frac( sin( dot( co.xy, float2( 12.9898, 78.233 ) ) ) * 43758.5453 );
}
// RB begin
#ifndef PI
#define PI 3.14159265358979323846
#endif
#define DEG2RAD( a ) ( ( a ) * PI / 180.0f )
#define RAD2DEG( a ) ( ( a ) * 180.0f / PI )
// RB end
#define _half2( x ) half2( x )
#define _half3( x ) half3( x )

View file

@ -2,7 +2,8 @@
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2013 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -28,7 +29,11 @@ If you have questions concerning this license or the applicable additional terms
#include "global.inc"
// RB: no GPU skinning with ES 2.0
#if defined(USE_GPU_SKINNING)
uniform matrices_ubo { float4 matrices[408]; };
#endif
// RB end
uniform float4 rpUser0 : register(c128); // rpScroll
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude

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 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -28,7 +29,11 @@ If you have questions concerning this license or the applicable additional terms
#include "global.inc"
// RB: no GPU skinning with ES 2.0
#if defined(USE_GPU_SKINNING)
uniform matrices_ubo { float4 matrices[408]; };
#endif
// RB end
uniform float4 rpUser0 : register(c128); // rpScroll
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude

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 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -33,7 +34,11 @@ If you have questions concerning this license or the applicable additional terms
uniform float4 rpUser0 : register(c128); // rpScroll
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude
// RB: no GPU skinning with ES 2.0
#if defined(USE_GPU_SKINNING)
uniform matrices_ubo { float4 matrices[408]; };
#endif
// RB end
struct VS_IN {
float4 position : POSITION;

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 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -27,6 +28,9 @@ If you have questions concerning this license or the applicable additional terms
*/
float4 modelPosition = vertex.position;
// RB: no GPU skinning with ES 2.0
#if defined(USE_GPU_SKINNING)
BRANCH if ( rpEnableSkinning.x > 0.0 ) {
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
@ -64,6 +68,8 @@ BRANCH if ( rpEnableSkinning.x > 0.0 ) {
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
}
#endif
// RB end
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );