protected virtual void Dispose(bool disposing) { if (disposing) { this.state = null; } PsmShaderProgram.Delete(this.handle); this.handle = 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; }
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); }
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); } }