我们知道在计算机上运行的所有内容都是由许多人合作的庞大程序.
因此,当计算机挂起而我们无法做任何事情时,会发生什么呢?此外,这个场景中的所有内容都冻结了程序中实现的内容吗?或者它是否像程序计数器卡住并且不能增加,因此处理器中存在一些问题?
float4 position [[position]];
以下代码段做什么?
#include <metal_stdlib>
using namespace metal;
struct Vertex
{
float4 position [[position]];
float4 color;
};
vertex Vertex vertex_main(device Vertex *vertices [[buffer(0)]], uint vid [[vertex_id]])
{
return vertices[vid];
}
Run Code Online (Sandbox Code Playgroud)
我[[position]]
对函数定义中的部分和类似用法感到困惑。
一般来说非常陌生,从Metal开始直接需要,很快就会试用OpenGL.
想知道问题在外行人的意义上是什么意思.另外,'n'的范围是多少,我刚刚在我制作的2D三角形中将其用作0.
为什么以下内容是合法的:
typedef struct a aType;
struct a
{
int x;
aType *b;
};
Run Code Online (Sandbox Code Playgroud)
以及以下违法行为:
void main()
{
typedef struct a aType;
aType someVariable;
struct a
{
int x;
aType *b;
};
}
Run Code Online (Sandbox Code Playgroud)
我只是很好奇,因为在每种情况下它都是前向引用,据我所知,至少对于函数和变量来说,前向引用是不合法的。
另外,这个问题的答案对于 C++ 来说也是一样的吗?