警告:片段着色器无法读取顶点着色器'v_gradient'的输出 [英] WARNING: Output of vertex shader 'v_gradient' not read by fragment shader

查看:525
本文介绍了警告:片段着色器无法读取顶点着色器'v_gradient'的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用xcode 8在ios 10中运行我的应用程序时,我在调试控制台中收到以下消息,并且通过UI获取冻结可以让任何人知道为什么会发生这种情况

When i run my app in ios 10 using xcode 8 i am getting following message in debug console, and by UI getting freezed can any one know why this is happening

 ERROR
 /BuildRoot/Library/Caches/com.apple.xbs/Sources/VectorKit/VectorKit-1228.30.7.17.9/GeoGL/GeoGL/GLCoreContext.cpp
 1763: InfoLog SolidRibbonShader: ERROR
 /BuildRoot/Library/Caches/com.apple.xbs/Sources/VectorKit/VectorKit-1228.30.7.17.9/GeoGL/GeoGL/GLCoreContext.cpp
 1764: WARNING: Output of vertex shader 'v_gradient' not read by
 fragment shader


推荐答案

回答

在Xcode中可能会收到此警告的一种情况是使用使用着色器的应用程序时作为 Maps 应用程序,带有 MKMapView 。您会发现地图视图在具有真实硬件/本机操作系统的真实设备上没有该警告的情况下按预期工作。

One of the situations where you might get this warning in Xcode is when using an app that uses shaders such as the Maps app with an MKMapView. You'll find that the map view works as expected without that warning on a real device with real hardware/native OS.

在sim中, SolidRibbonShader 片段着色器无法读取输出 v_gradient 顶点着色器,因为它是一个错误的测试版或Xcode版本。然而,着色器在真实设备上被识别。

In the sim the SolidRibbonShader fragment shader is not able to read the output of the v_gradient vertex shader either because it's a buggy beta or release of Xcode. However the shaders are recognized on a real device.

解释

这些着色器属于 OpenGL渲染管道即可。渲染管道是OpenGL渲染对象时所采用的步骤序列。

Those shaders belong to the OpenGL Rendering Pipeline. The Rendering Pipeline is the sequence of steps that OpenGL takes when rendering objects.

渲染管道负责应用纹理,将顶点转换为正确的坐标系以及在屏幕上显示字符等内容。

The rendering pipeline is responsible for things like applying texture, converting the vertices to the right coordinate system and displaying the character on the screen etc.

此管道中有六个阶段。


  1. 每顶点操作

  2. 原始汇编

  3. 原始处理

  4. 光栅化

  5. 片段处理

  6. 每片段操作

  1. Per-Vertex Operation
  2. Primitive Assembly
  3. Primitive Processing
  4. Rasterization
  5. Fragment Processing
  6. Per-Fragment Operation

最后,您的设备屏幕上会出现一个图像。这六个阶段称为 OpenGL渲染管道,所有用于渲染的数据都必须通过它。

Finally, an image appears on the screen of your device. These six stages are called the OpenGL Rendering Pipeline and all data used for rendering must go through it.

什么是着色器?

着色器是由您开发的一个小程序,位于GPU中。着色器使用称为 OpenGL着色语言(GLSL)的特殊图形语言编写。

A shader is a small program developed by you that lives in the GPU. A shader is written in a special graphics language called OpenGL Shading Language(GLSL).

着色器取代了OpenGL渲染管道中的两个重要阶段:每顶点处理每片段处理阶段。这两个阶段中的每个阶段都有一个着色器。

A shader takes the place of two important stages in the OpenGL Rendering Pipeline: Per-Vertex Processing and Per-Fragment Processing stage. There is one shader for each of these two stages.

顶点着色器的最终目标是提供网格顶点到渲染管道的最终变换。 片段着色器的目标是为每个前往帧缓冲区的像素提供着色和纹理数据。

The ultimate goal of the Vertex Shader is to provide the final transformation of the mesh vertices to the rendering pipeline. The goal of the Fragment shader is to provide Coloring and Texture data to each pixel heading to the framebuffer.

顶点着色器将三角形的顶点从局部模型坐标系转换为屏幕位置。 片段着色器计算屏幕上光栅化的三角形内像素的颜色。

Vertex shaders transform the vertices of a triangle from a local model coordinate system to the screen position. Fragment shaders compute the color of a pixel within a triangle rasterized on screen.

分离着色器对象速度编译和链接

许多OpenGL ES应用程序使用多个顶点片段着色器,它是通常可以使用不同的顶点着色器重用相同的片段着色器,反之亦然。因为核心OpenGL ES规范要求在单个着色器程序中将顶点片段着色器链接在一起,所以混合和匹配着色器会导致大量程序,从而增加初始化应用时的总着色器编译和链接时间。

Many OpenGL ES apps use several vertex and fragment shaders, and it is often useful to reuse the same fragment shader with different vertex shaders or vice versa. Because the core OpenGL ES specification requires a vertex and fragment shader to be linked together in a single shader program, mixing and matching shaders results in a large number of programs, increasing the total shader compile and link time when you initialize your app.

这篇关于警告:片段着色器无法读取顶点着色器'v_gradient'的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆