Beispiel #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         this.state = null;
     }
     PsmShaderProgram.Delete(this.handle);
     this.handle = 0;
 }
Beispiel #2
0
        protected ShaderProgram(ShaderProgram program)
        {
            int errorCode = PsmShaderProgram.AddRef(program.handle);

            if (errorCode != 0)
            {
                Error.ThrowNativeException(errorCode);
            }
            this.handle = program.handle;
            this.state  = program.state;
        }
Beispiel #3
0
        public ShaderProgram(byte[] vpFileImage, byte[] fpFileImage, ShaderProgramOption option)
        {
            string[] constKeys = ShaderProgram.GetConstKeys(option);
            int[]    constVals = ShaderProgram.GetConstVals(option);
            int      errorCode = PsmShaderProgram.FromImage(vpFileImage, fpFileImage, constKeys, constVals, out this.handle);

            if (errorCode != 0)
            {
                Error.ThrowNativeException(errorCode);
            }
            this.state = new ShaderProgramState(this.handle);
        }
Beispiel #4
0
 protected void SwapShader(ShaderProgram program)
 {
     if (program.handle != this.handle)
     {
         int errorCode = PsmShaderProgram.AddRef(program.handle);
         if (errorCode != 0)
         {
             Error.ThrowNativeException(errorCode);
         }
         PsmShaderProgram.Delete(this.handle);
         this.handle = program.handle;
         this.state  = program.state;
         GraphicsContext.NotifyUpdate(GraphicsUpdate.ShaderProgram);
     }
 }