Example #1
0
        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);
        }
Example #2
0
 public GLSLGraphicsPipelineCompilier(
     IGLShaderModuleEntrypoint shaderModule,
     IGLGraphicsPipelineEntrypoint program,
     IGLUniformBlockEntrypoint uniformBlocks,
     IGLErrorHandler errHandler,
     IGLUniformBlockNameParser parser
     )
 {
     mShaderModuleEntrypoint = shaderModule;
     mProgramEntrypoint      = program;
     mErrHandler             = errHandler;
     mUniformBlocks          = uniformBlocks;
     mParser = parser;
 }
Example #3
0
        public GLGraphicsPipeline(
            IGLGraphicsPipelineEntrypoint entrypoint,
            int programId,
            MgGraphicsPipelineCreateInfo info,
            GLInternalCache internalCache,
            IGLPipelineLayout layout
            )
        {
            mEntrypoint = entrypoint;

            if (info.VertexInputState == null)
            {
                throw new ArgumentNullException("info.VertexInputState");
            }

            if (info.InputAssemblyState == null)
            {
                throw new ArgumentNullException("info.InputAssemblyState");
            }

            if (info.RasterizationState == null)
            {
                throw new ArgumentNullException("info.RasterizationState");
            }

            ProgramID     = programId;
            InternalCache = internalCache;
            Layout        = layout;

            PopulateVertexDefinition(info.VertexInputState);

            PopulatePipelineConstants(info.RasterizationState);

            PopulateCmdFallbacks(info.RasterizationState);

            PopulateInputAssembly(info.InputAssemblyState);

            PopulateDepthStencilState(info.DepthStencilState);

            PopulateDynamicStates(info.DynamicState);

            PopulateColorBlend(info.ColorBlendState);

            PopulateViewports(info.ViewportState);
        }
Example #4
0
 public DefaultGLDeviceEntrypoint
 (
     IGLCmdVBOEntrypoint vbo,
     IGLSamplerEntrypoint sampler,
     IGLDeviceImageEntrypoint image,
     IGLDeviceImageViewEntrypoint imageView,
     IGLImageDescriptorEntrypoint imageDescriptor,
     IGLShaderModuleEntrypoint shaderModule,
     IGLDescriptorPoolEntrypoint descriptorPool,
     IGLBufferEntrypoint buffers,
     IGLDeviceMemoryEntrypoint deviceMemory,
     IGLSemaphoreEntrypoint semaphore,
     IGLGraphicsPipelineEntrypoint graphicsPipeline,
     IGLImageFormatEntrypoint imageFormat,
     IGLGraphicsPipelineCompiler graphicsCompiler,
     IGLFenceEntrypoint fence,
     IGLCmdShaderProgramEntrypoint shaderProgram,
     IGLDescriptorSetEntrypoint descriptorSet,
     IGLUniformBlockEntrypoint uniformBlocks
 )
 {
     VBO              = vbo;
     Sampler          = sampler;
     Image            = image;
     ImageView        = imageView;
     ImageDescriptor  = imageDescriptor;
     ShaderModule     = shaderModule;
     DescriptorPool   = descriptorPool;
     Buffers          = buffers;
     DeviceMemory     = deviceMemory;
     Semaphore        = semaphore;
     GraphicsPipeline = graphicsPipeline;
     ImageFormat      = imageFormat;
     GraphicsCompiler = graphicsCompiler;
     Fence            = fence;
     ShaderProgram    = shaderProgram;
     DescriptorSet    = descriptorSet;
     UniformBlocks    = uniformBlocks;
 }
Example #5
0
 public GLSLTextShader(IGLGraphicsPipelineEntrypoint program)
 {
     mEntrypoint = program;
 }