Browse Source

Fix PrimBuild with non Fixed Function Pipeline.

LuisAntonRebollo 10 years ago
parent
commit
fa1b2d87b1
2 changed files with 13 additions and 0 deletions
  1. 2 0
      Engine/source/gfx/gfxDevice.h
  2. 11 0
      Engine/source/gfx/primBuilder.cpp

+ 2 - 0
Engine/source/gfx/gfxDevice.h

@@ -868,6 +868,8 @@ public:
    /// Sets the current stateblock (actually activated in ::updateStates)
    /// Sets the current stateblock (actually activated in ::updateStates)
    virtual void setStateBlock( GFXStateBlock *block );
    virtual void setStateBlock( GFXStateBlock *block );
 
 
+   GFXStateBlock* getStateBlock() { return mNewStateBlock; }
+
    /// This sets a stateblock directly from the description
    /// This sets a stateblock directly from the description
    /// structure.  Its acceptable to use this for debug rendering
    /// structure.  Its acceptable to use this for debug rendering
    /// and other low frequency rendering tasks.
    /// and other low frequency rendering tasks.

+ 11 - 0
Engine/source/gfx/primBuilder.cpp

@@ -180,7 +180,18 @@ void end( bool useGenericShaders )
    }
    }
 
 
    if ( useGenericShaders )
    if ( useGenericShaders )
+   {
+	   GFXStateBlock *currentBlock = GFX->getStateBlock();
+	   if (currentBlock && currentBlock->getDesc().samplersDefined)
+	   {
+		   if (currentBlock->getDesc().vertexColorEnable)
       GFX->setupGenericShaders( GFXDevice::GSModColorTexture );
       GFX->setupGenericShaders( GFXDevice::GSModColorTexture );
+		   else
+			   GFX->setupGenericShaders( GFXDevice::GSTexture );
+	   }
+	   else
+		   GFX->setupGenericShaders( GFXDevice::GSColor );
+   }
 
 
    const GFXVertexPCT *srcVerts = mTempVertBuff.address();
    const GFXVertexPCT *srcVerts = mTempVertBuff.address();
    U32 numVerts = mCurVertIndex;
    U32 numVerts = mCurVertIndex;