Beispiel #1
0
        private void VertexAttribIPointer(uint index, int size, VertexAttribIType type, int stride, IntPtr pointer)
        {
            // TODO: GL_INVALID_VALUE is generated if index​ is greater than or equal to GL_MAX_VERTEX_ATTRIBS.
            if (size != 1 && size != 2 && size != 3 && size != 4)
            {
                SetLastError(ErrorCode.InvalidValue); return;
            }
            if (!Enum.IsDefined(typeof(VertexAttribIType), type))
            {
                SetLastError(ErrorCode.InvalidEnum); return;
            }
            if (stride < 0)
            {
                SetLastError(ErrorCode.InvalidValue); return;
            }
            VertexArrayObject vao = this.currentVertexArrayObject;

            if (vao == null)
            {
                SetLastError(ErrorCode.InvalidOperation); return;
            }
            GLBuffer buffer = this.currentBufferDict[BindBufferTarget.ArrayBuffer];

            // GL_INVALID_OPERATION is generated if zero is bound to the GL_ARRAY_BUFFER buffer object binding point and the pointer​ argument is not NULL.
            // TODO: why only when "pointer​ argument is not NULL"?
            if (buffer == null)
            {
                SetLastError(ErrorCode.InvalidOperation); return;
            }
            VertexAttribDesc desc = null;

            if (!vao.LocVertexAttribDict.TryGetValue(index, out desc))
            {
                desc = new VertexAttribDesc();
                vao.LocVertexAttribDict.Add(index, desc);
            }
            desc.inLocation = index;
            desc.vbo        = buffer;
            desc.dataSize   = size;
            desc.dataType   = (uint)type;
            //desc.normalize = false; // not needed.
            desc.startPos = (uint)pointer.ToInt32();
            desc.stride   = (uint)stride;
        }
 public abstract void VertexAttribIFormat([Flow(FlowDirection.In)] uint index, [Flow(FlowDirection.In)] int size, [Flow(FlowDirection.In)] VertexAttribIType type, [Flow(FlowDirection.In)] uint stride);
Beispiel #3
0
 public partial void VertexAttribIFormat([Flow(FlowDirection.In)] uint attribindex, [Flow(FlowDirection.In)] int size, [Flow(FlowDirection.In)] VertexAttribIType type, [Flow(FlowDirection.In)] uint relativeoffset);
 public static unsafe void VertexAttribIPointer <T0>(this ExtGpuShader4 thisApi, [Flow(FlowDirection.In)] uint index, [Flow(FlowDirection.In)] int size, [Flow(FlowDirection.In)] VertexAttribIType type, [Flow(FlowDirection.In)] uint stride, [Count(Computed = "size, type, stride"), Flow(FlowDirection.In)] ReadOnlySpan <T0> pointer) where T0 : unmanaged
 {
     // SpanOverloader
     thisApi.VertexAttribIPointer(index, size, type, stride, in pointer.GetPinnableReference());
 }