public GLSLGraphicsPipelineCompilier( IGLShaderModuleEntrypoint shaderModule, IGLGraphicsPipelineEntrypoint program, IGLUniformBlockEntrypoint uniformBlocks, IGLErrorHandler errHandler, IGLUniformBlockNameParser parser ) { mShaderModuleEntrypoint = shaderModule; mProgramEntrypoint = program; mErrHandler = errHandler; mUniformBlocks = uniformBlocks; mParser = parser; }
internal static int LinkShaders(IGLGraphicsPipelineEntrypoint entrypoint, IGLErrorHandler errHandler, int[] shaders) { int retVal = entrypoint.CreateProgram(); foreach (var shader in shaders) { entrypoint.AttachShaderToProgram(retVal, shader); //GL.AttachShader (retVal, shader); } entrypoint.CompileProgram(retVal); bool isCompiled = entrypoint.IsCompiled(retVal); //int linkStatus = 0; //GL.GetProgram(retVal,GetProgramParameterName.LinkStatus, out linkStatus); // return (linkStatus == (int)All.True) //int glinfoLogLength = 0; //GL.GetProgram(retVal, GetProgramParameterName.InfoLogLength, out glinfoLogLength); // return (glinfoLogLength > 1) bool hasMessages = entrypoint.HasCompilerMessages(retVal); if (hasMessages) { string buffer = entrypoint.GetCompilerMessages(retVal); // GL.GetProgramInfoLog(retVal); if (!isCompiled) { errHandler.Trace("Shader Linking failed with the following errors:"); } else { errHandler.Trace("Shader Linking succeeded, with following warnings/messages:\n"); } errHandler.Trace(buffer); } if (!isCompiled) { // #ifndef POSIX // assert(!"Shader failed linking, here's an assert to break you in the debugger."); // #endif entrypoint.DeleteProgram(retVal); retVal = 0; } return(retVal); }
public AndroidGLFramebufferHelper(IGLExtensionLookup lookup, IGLErrorHandler errHandler) { mErrHandler = errHandler; // eglGetProcAddress doesn't guarantied returning NULL if the entry point doesn't exist. The returned address *should* be the same for all invalid entry point var invalidFuncPtr = EGLGetProcAddress("InvalidFunctionName"); if (lookup.HasExtension("GL_EXT_discard_framebuffer")) { var glDiscardFramebufferEXTPtr = EGLGetProcAddress("glDiscardFramebufferEXT"); if (glDiscardFramebufferEXTPtr != invalidFuncPtr) { this.GLInvalidateFramebuffer = Marshal.GetDelegateForFunctionPointer <GLInvalidateFramebufferDelegate>(glDiscardFramebufferEXTPtr); this.SupportsInvalidateFramebuffer = true; } } if (lookup.HasExtension("GL_EXT_multisampled_render_to_texture")) { var glRenderbufferStorageMultisampleEXTPtr = EGLGetProcAddress("glRenderbufferStorageMultisampleEXT"); var glFramebufferTexture2DMultisampleEXTPtr = EGLGetProcAddress("glFramebufferTexture2DMultisampleEXT"); if (glRenderbufferStorageMultisampleEXTPtr != invalidFuncPtr && glFramebufferTexture2DMultisampleEXTPtr != invalidFuncPtr) { this.GLRenderbufferStorageMultisample = Marshal.GetDelegateForFunctionPointer <GLRenderbufferStorageMultisampleDelegate>(glRenderbufferStorageMultisampleEXTPtr); this.GLFramebufferTexture2DMultisample = Marshal.GetDelegateForFunctionPointer <GLFramebufferTexture2DMultisampleDelegate>(glFramebufferTexture2DMultisampleEXTPtr); } } else if (lookup.HasExtension("GL_IMG_multisampled_render_to_texture")) { var glRenderbufferStorageMultisampleIMGPtr = EGLGetProcAddress("glRenderbufferStorageMultisampleIMG"); var glFramebufferTexture2DMultisampleIMGPtr = EGLGetProcAddress("glFramebufferTexture2DMultisampleIMG"); if (glRenderbufferStorageMultisampleIMGPtr != invalidFuncPtr && glFramebufferTexture2DMultisampleIMGPtr != invalidFuncPtr) { this.GLRenderbufferStorageMultisample = Marshal.GetDelegateForFunctionPointer <GLRenderbufferStorageMultisampleDelegate>(glRenderbufferStorageMultisampleIMGPtr); this.GLFramebufferTexture2DMultisample = Marshal.GetDelegateForFunctionPointer <GLFramebufferTexture2DMultisampleDelegate>(glFramebufferTexture2DMultisampleIMGPtr); } } else if (lookup.HasExtension("GL_NV_framebuffer_multisample")) { var glRenderbufferStorageMultisampleNVPtr = EGLGetProcAddress("glRenderbufferStorageMultisampleNV"); var glBlitFramebufferNVPtr = EGLGetProcAddress("glBlitFramebufferNV"); if (glRenderbufferStorageMultisampleNVPtr != invalidFuncPtr && glBlitFramebufferNVPtr != invalidFuncPtr) { this.GLRenderbufferStorageMultisample = Marshal.GetDelegateForFunctionPointer <GLRenderbufferStorageMultisampleDelegate>(glRenderbufferStorageMultisampleNVPtr); this.GLBlitFramebuffer = Marshal.GetDelegateForFunctionPointer <GLBlitFramebufferDelegate>(glBlitFramebufferNVPtr); this.AllReadFramebuffer = AllReadFramebufferNV; this.AllDrawFramebuffer = AllDrawFramebufferNV; } } this.SupportsBlitFramebuffer = this.GLBlitFramebuffer != null; }
public GLDeviceMemory(MgMemoryAllocateInfo pAllocateInfo, IGLErrorHandler errHandler) { mErrHandler = errHandler; mBufferType = (GLMemoryBufferType)pAllocateInfo.MemoryTypeIndex; mIsHostCached = (mBufferType == GLMemoryBufferType.INDIRECT || mBufferType == GLMemoryBufferType.IMAGE); if (pAllocateInfo.AllocationSize > (ulong)int.MaxValue) { throw new ArgumentOutOfRangeException("pAllocateInfo.AllocationSize > int.MaxValue"); } mBufferSize = (int)pAllocateInfo.AllocationSize; if (mBufferType != GLMemoryBufferType.IMAGE) { mBufferTarget = GetBufferTarget(mBufferType); } if (mIsHostCached || pAllocateInfo.MemoryTypeIndex == (uint)GLMemoryBufferType.IMAGE) { mHandle = Marshal.AllocHGlobal(mBufferSize); } else { if (mBufferTarget.HasValue) { var buffers = new uint[1]; // ARB_direct_state_access // Allows buffer objects to be initialised without binding them GL.CreateBuffers(1, buffers); mErrHandler.LogGLError("GL.CreateBuffers"); mBufferId = buffers[0]; // TODO : update flags based on buffer request BufferStorageFlags flags = BufferStorageFlags.MapWriteBit | BufferStorageFlags.MapPersistentBit | BufferStorageFlags.MapCoherentBit; GL.NamedBufferStorage(mBufferId, mBufferSize, IntPtr.Zero, flags); mErrHandler.LogGLError("GL.NamedBufferStorage"); // BufferAccessMask rangeFlags = BufferAccessMask.MapWriteBit | BufferAccessMask.MapPersistentBit | BufferAccessMask.MapCoherentBit; // Handle = GL.MapNamedBufferRange (buffers[0], (IntPtr)0, BufferSize, rangeFlags); } } }
public GLCmdStateRenderer( IGLCmdBlendEntrypoint blend, IGLCmdStencilEntrypoint stencil, IGLCmdRasterizationEntrypoint raster, IGLCmdDepthEntrypoint depth, IGLNextCmdShaderProgramCache cache, IGLCmdScissorsEntrypoint scissor, IGLCmdDrawEntrypoint render, IGLCmdClearEntrypoint clear, IGLErrorHandler errHandler ) { mCache = cache; mBlend = blend; mStencil = stencil; mRaster = raster; mDepth = depth; mScissor = scissor; mRender = render; mClear = clear; mErrHandler = errHandler; }
public FullGLFramebufferHelperEXT(IGLErrorHandler errHandler) { mErrHandler = errHandler; this.SupportsBlitFramebuffer = true; this.SupportsInvalidateFramebuffer = false; }
public Es20GLFramebufferHelperSelector(IGLFramebufferSupport capabilities, IGLErrorHandler errHandler) { mErrHandler = errHandler; mCapabilities = capabilities; }
public FullGLShaderModuleEntrypoint(IGLErrorHandler errHandler) { mErrHandler = errHandler; }
public Es20GLFramebufferHelperSelector(IGLFramebufferSupport capabilities, IGLExtensionLookup lookup, IGLErrorHandler errHandler) { mCapabilities = capabilities; mLookup = lookup; mErrHandler = errHandler; }
public FullGLUniformBlockEntrypoint(IGLErrorHandler errHandler) { mErrHandler = errHandler; }
public Es20GLFramebufferHelper(IGLErrorHandler errHandler) { mErrHandler = errHandler; this.SupportsBlitFramebuffer = this.GLBlitFramebuffer != null; }
public FullGLDeviceMemoryEntrypoint(IGLErrorHandler errHandler) { mErrHandler = errHandler; }
public FullGLSamplerEntrypoint(IGLErrorHandler errHandler) { mErrHandler = errHandler; }
public FullGLDeviceImageViewEntrypoint(IGLErrorHandler errHandler, IGLImageFormatEntrypoint imgFormat) { mErrHandler = errHandler; mImgFormat = imgFormat; }
public FullGLCmdScissorsEntrypoint(IGLErrorHandler errHandler) { mErrHandler = errHandler; }
public FullGLCmdRasterizationEntrypoint(IGLErrorHandler errHandler) { mErrHandler = errHandler; }
public FullGLImageDescriptorEntrypoint(IGLErrorHandler errHandler) { mErrHandler = errHandler; }
public FullGLCmdVBOEntrypoint(IGLErrorHandler errHandler) { mErrHandler = errHandler; }
public FullGLGraphicsPipelineEntrypoint(IGLErrorHandler errHandler) { mErrHandler = errHandler; }