コード例 #1
0
void __indirect_glIndexPointer( GLenum type, GLsizei stride,
				const GLvoid * pointer )
{
    uint16_t opcode;
    __GLXcontext *gc = __glXGetCurrentContext();
    __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
    struct array_state_vector * arrays = state->array_state;
    struct array_state * a;


    if (stride < 0) {
        __glXSetError(gc, GL_INVALID_VALUE);
        return;
    }
    
    switch ( type ) {
    case GL_UNSIGNED_BYTE:	opcode = X_GLrop_Indexubv; break;
    case GL_SHORT:		opcode = X_GLrop_Indexsv; break;
    case GL_INT:		opcode = X_GLrop_Indexiv; break;
    case GL_FLOAT:		opcode = X_GLrop_Indexfv; break;
    case GL_DOUBLE:		opcode = X_GLrop_Indexdv; break;
    default:
        __glXSetError(gc, GL_INVALID_ENUM);
        return;
    }

    a = get_array_entry( arrays, GL_INDEX_ARRAY, 0 );
    assert( a != NULL );
    COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, 1, GL_FALSE, 4,
			    opcode );

    if ( a->enabled ) {
	arrays->array_info_cache_valid = GL_FALSE;
    }
}
コード例 #2
0
int dm_bitset_test_bit(struct dm_disk_bitset *info, dm_block_t root,
		       uint32_t index, dm_block_t *new_root, bool *result)
{
	int r;
	unsigned b = index % BITS_PER_ARRAY_ENTRY;

	r = get_array_entry(info, root, index, new_root);
	if (r)
		return r;

	*result = test_bit(b, (unsigned long *) &info->current_bits);
	return 0;
}
コード例 #3
0
GLboolean
__glXGetArrayStride( const __GLXattribute * const state,
		     GLenum key, unsigned index, GLintptr * dest )
{
    const struct array_state_vector * arrays = state->array_state;
    const struct array_state * a = get_array_entry( (struct array_state_vector *) arrays,
						    key, index );

    if ( a != NULL ) {
	*dest = (GLintptr) a->user_stride;
    }

    return (a != NULL);
}
コード例 #4
0
int dm_bitset_clear_bit(struct dm_disk_bitset *info, dm_block_t root,
			uint32_t index, dm_block_t *new_root)
{
	int r;
	unsigned b = index % BITS_PER_ARRAY_ENTRY;

	r = get_array_entry(info, root, index, new_root);
	if (r)
		return r;

	clear_bit(b, (unsigned long *) &info->current_bits);
	info->dirty = true;

	return 0;
}
コード例 #5
0
GLboolean
__glXGetArrayPointer( const __GLXattribute * const state,
		      GLenum key, unsigned index, void ** dest )
{
    const struct array_state_vector * arrays = state->array_state;
    const struct array_state * a = get_array_entry( (struct array_state_vector *) arrays,
						    key, index );


    if ( a != NULL ) {
	*dest = (void *) (a->data);
    }

    return (a != NULL);
}
コード例 #6
0
void __indirect_glVertexPointer( GLint size, GLenum type, GLsizei stride,
				 const GLvoid * pointer )
{
    static const uint16_t short_ops[5] = {
	0, 0, X_GLrop_Vertex2sv, X_GLrop_Vertex3sv, X_GLrop_Vertex4sv
    };
    static const uint16_t int_ops[5] = {
	0, 0, X_GLrop_Vertex2iv, X_GLrop_Vertex3iv, X_GLrop_Vertex4iv
    };
    static const uint16_t float_ops[5] = {
	0, 0, X_GLrop_Vertex2fv, X_GLrop_Vertex3fv, X_GLrop_Vertex4fv
    };
    static const uint16_t double_ops[5] = {
	0, 0, X_GLrop_Vertex2dv, X_GLrop_Vertex3dv, X_GLrop_Vertex4dv
    };
    uint16_t opcode;
    __GLXcontext *gc = __glXGetCurrentContext();
    __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
    struct array_state_vector * arrays = state->array_state;
    struct array_state * a;


    if (size < 2 || size > 4 || stride < 0) {
        __glXSetError(gc, GL_INVALID_VALUE);
        return;
    }
    
    switch ( type ) {
    case GL_SHORT:	opcode = short_ops[size]; break;
    case GL_INT:	opcode = int_ops[size]; break;
    case GL_FLOAT:	opcode = float_ops[size]; break;
    case GL_DOUBLE:	opcode = double_ops[size]; break;
    default:
        __glXSetError(gc, GL_INVALID_ENUM);
        return;
    }

    a = get_array_entry( arrays, GL_VERTEX_ARRAY, 0 );
    assert( a != NULL );
    COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, GL_FALSE, 4,
			    opcode );

    if ( a->enabled ) {
	arrays->array_info_cache_valid = GL_FALSE;
    }
}
コード例 #7
0
void __indirect_glSecondaryColorPointerEXT( GLint size, GLenum type, GLsizei stride,
				const GLvoid * pointer )
{
    uint16_t opcode;
    __GLXcontext *gc = __glXGetCurrentContext();
    __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
    struct array_state_vector * arrays = state->array_state;
    struct array_state * a;


    if (size != 3 || stride < 0) {
        __glXSetError(gc, GL_INVALID_VALUE);
        return;
    }
    
    switch ( type ) {
    case GL_BYTE:		opcode = 4126; break;
    case GL_UNSIGNED_BYTE:	opcode = 4131; break;
    case GL_SHORT:		opcode = 4127; break;
    case GL_UNSIGNED_SHORT:	opcode = 4132; break;
    case GL_INT:		opcode = 4128; break;
    case GL_UNSIGNED_INT:	opcode = 4133; break;
    case GL_FLOAT:		opcode = 4129; break;
    case GL_DOUBLE:		opcode = 4130; break;
    default:
        __glXSetError(gc, GL_INVALID_ENUM);
        return;
    }

    a = get_array_entry( arrays, GL_SECONDARY_COLOR_ARRAY, 0 );
    if ( a == NULL ) {
        __glXSetError(gc, GL_INVALID_OPERATION);
        return;
    }

    COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, GL_TRUE, 4,
			    opcode );

    if ( a->enabled ) {
	arrays->array_info_cache_valid = GL_FALSE;
    }
}
コード例 #8
0
GLboolean
__glXSetArrayEnable( __GLXattribute * state,
		     GLenum key, unsigned index, GLboolean enable )
{
    struct array_state_vector * arrays = state->array_state;
    struct array_state * a;
    

    if ( key == GL_TEXTURE_COORD_ARRAY ) {
	index = arrays->active_texture_unit;
    }

    a = get_array_entry( arrays, key, index );

    if ( (a != NULL) && (a->enabled != enable) ) {
	a->enabled = enable;
	arrays->array_info_cache_valid = GL_FALSE;
    }

    return (a != NULL);
}
コード例 #9
0
void __indirect_glEdgeFlagPointer( GLsizei stride, const GLvoid * pointer )
{
    __GLXcontext *gc = __glXGetCurrentContext();
    __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
    struct array_state_vector * arrays = state->array_state;
    struct array_state * a;


    if (stride < 0) {
        __glXSetError(gc, GL_INVALID_VALUE);
        return;
    }
    

    a = get_array_entry( arrays, GL_EDGE_FLAG_ARRAY, 0 );
    assert( a != NULL );
    COMMON_ARRAY_DATA_INIT( a, pointer, GL_UNSIGNED_BYTE, stride, 1, GL_FALSE,
			    4, X_GLrop_EdgeFlagv );

    if ( a->enabled ) {
	arrays->array_info_cache_valid = GL_FALSE;
    }
}
コード例 #10
0
void __indirect_glFogCoordPointerEXT( GLenum type, GLsizei stride,
				const GLvoid * pointer )
{
    uint16_t opcode;
    __GLXcontext *gc = __glXGetCurrentContext();
    __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
    struct array_state_vector * arrays = state->array_state;
    struct array_state * a;


    if (stride < 0) {
        __glXSetError(gc, GL_INVALID_VALUE);
        return;
    }

    switch ( type ) {
    case GL_FLOAT:		opcode = 4124; break;
    case GL_DOUBLE:		opcode = 4125; break;
    default:
        __glXSetError(gc, GL_INVALID_ENUM);
        return;
    }

    a = get_array_entry( arrays, GL_FOG_COORD_ARRAY, 0 );
    if ( a == NULL ) {
        __glXSetError(gc, GL_INVALID_OPERATION);
        return;
    }

    COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, 1, GL_FALSE, 4,
			    opcode );

    if ( a->enabled ) {
	arrays->array_info_cache_valid = GL_FALSE;
    }
}
コード例 #11
0
void __indirect_glVertexAttribPointerARB(GLuint index, GLint size,
					 GLenum type, GLboolean normalized,
					 GLsizei stride,
					 const GLvoid * pointer)
{
    static const uint16_t short_ops[5]  = { 0, 4189, 4190, 4191, 4192 };
    static const uint16_t float_ops[5]  = { 0, 4193, 4194, 4195, 4196 };
    static const uint16_t double_ops[5] = { 0, 4197, 4198, 4199, 4200 };

    uint16_t opcode;
    __GLXcontext *gc = __glXGetCurrentContext();
    __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
    struct array_state_vector * arrays = state->array_state;
    struct array_state * a;
    unsigned true_immediate_count;
    unsigned true_immediate_size;


    if ( (size < 1) || (size > 4) || (stride < 0) 
	 || (index > arrays->num_vertex_program_attribs) ){
        __glXSetError(gc, GL_INVALID_VALUE);
        return;
    }

    if ( normalized && (type != GL_FLOAT) && (type != GL_DOUBLE)) {
	switch( type ) {
	case GL_BYTE:           opcode = X_GLrop_VertexAttrib4NbvARB;  break;
	case GL_UNSIGNED_BYTE:  opcode = X_GLrop_VertexAttrib4NubvARB; break;
	case GL_SHORT:          opcode = X_GLrop_VertexAttrib4NsvARB;  break;
	case GL_UNSIGNED_SHORT: opcode = X_GLrop_VertexAttrib4NusvARB; break;
	case GL_INT:            opcode = X_GLrop_VertexAttrib4NivARB;  break;
	case GL_UNSIGNED_INT:   opcode = X_GLrop_VertexAttrib4NuivARB; break;
	default:
	    __glXSetError(gc, GL_INVALID_ENUM);
	    return;
	}
	
	true_immediate_count = 4;
    }
    else {
	true_immediate_count = size;

	switch( type ) {
	case GL_BYTE:
	    opcode = X_GLrop_VertexAttrib4bvARB;
	    true_immediate_count = 4;
	    break;
	case GL_UNSIGNED_BYTE:
	    opcode = X_GLrop_VertexAttrib4ubvARB;
	    true_immediate_count = 4;
	    break;
	case GL_SHORT:
	    opcode = short_ops[size];
	    break;
	case GL_UNSIGNED_SHORT:
	    opcode = X_GLrop_VertexAttrib4usvARB;
	    true_immediate_count = 4;
	    break;
	case GL_INT:
            opcode = X_GLrop_VertexAttrib4ivARB;
	    true_immediate_count = 4;
	    break;
	case GL_UNSIGNED_INT:
	    opcode = X_GLrop_VertexAttrib4uivARB;
	    true_immediate_count = 4;
	    break;
	case GL_FLOAT:
	    opcode = float_ops[size];
	    break;
	case GL_DOUBLE:
	    opcode = double_ops[size];
	    break;
	default:
	    __glXSetError(gc, GL_INVALID_ENUM);
	    return;
	}
    }

    a = get_array_entry( arrays, GL_VERTEX_ATTRIB_ARRAY_POINTER, index );
    if ( a == NULL ) {
        __glXSetError(gc, GL_INVALID_OPERATION);
        return;
    }

    COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, normalized, 8,
			    opcode );

    true_immediate_size = __glXTypeSize(type) * true_immediate_count;
    ((uint16_t *) (a)->header)[0] = __GLX_PAD(a->header_size 
					      + true_immediate_size);

    if ( a->enabled ) {
	arrays->array_info_cache_valid = GL_FALSE;
    }
}
コード例 #12
0
void __indirect_glTexCoordPointer( GLint size, GLenum type, GLsizei stride,
				   const GLvoid * pointer )
{
    static const uint16_t short_ops[5] = {
	0, X_GLrop_TexCoord1sv, X_GLrop_TexCoord2sv, X_GLrop_TexCoord3sv, X_GLrop_TexCoord4sv
    };
    static const uint16_t int_ops[5] = {
	0, X_GLrop_TexCoord1iv, X_GLrop_TexCoord2iv, X_GLrop_TexCoord3iv, X_GLrop_TexCoord4iv
    };
    static const uint16_t float_ops[5] = {
	0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2fv, X_GLrop_TexCoord3fv, X_GLrop_TexCoord4fv
    };
    static const uint16_t double_ops[5] = {
	0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2dv, X_GLrop_TexCoord3dv, X_GLrop_TexCoord4dv
    };

    static const uint16_t mshort_ops[5] = {
	0, X_GLrop_MultiTexCoord1svARB, X_GLrop_MultiTexCoord2svARB, X_GLrop_MultiTexCoord3svARB, X_GLrop_MultiTexCoord4svARB
    };
    static const uint16_t mint_ops[5] = {
	0, X_GLrop_MultiTexCoord1ivARB, X_GLrop_MultiTexCoord2ivARB, X_GLrop_MultiTexCoord3ivARB, X_GLrop_MultiTexCoord4ivARB
    };
    static const uint16_t mfloat_ops[5] = {
	0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2fvARB, X_GLrop_MultiTexCoord3fvARB, X_GLrop_MultiTexCoord4fvARB
    };
    static const uint16_t mdouble_ops[5] = {
	0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2dvARB, X_GLrop_MultiTexCoord3dvARB, X_GLrop_MultiTexCoord4dvARB
    };

    uint16_t opcode;
    __GLXcontext *gc = __glXGetCurrentContext();
    __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
    struct array_state_vector * arrays = state->array_state;
    struct array_state * a;
    unsigned header_size;
    unsigned index;


    if (size < 1 || size > 4 || stride < 0) {
        __glXSetError(gc, GL_INVALID_VALUE);
        return;
    }
    
    index = arrays->active_texture_unit;
    if ( index == 0 ) {
	switch ( type ) {
	case GL_SHORT:		opcode = short_ops[size]; break;
	case GL_INT:		opcode = int_ops[size]; break;
	case GL_FLOAT:		opcode = float_ops[size]; break;
	case GL_DOUBLE:		opcode = double_ops[size]; break;
	default:
	    __glXSetError(gc, GL_INVALID_ENUM);
	    return;
	}

	header_size = 4;
    }
    else {
	switch ( type ) {
	case GL_SHORT:		opcode = mshort_ops[size]; break;
	case GL_INT:		opcode = mint_ops[size]; break;
	case GL_FLOAT:		opcode = mfloat_ops[size]; break;
	case GL_DOUBLE:		opcode = mdouble_ops[size]; break;
	default:
	    __glXSetError(gc, GL_INVALID_ENUM);
	    return;
	}

	header_size = 8;
    }

    a = get_array_entry( arrays, GL_TEXTURE_COORD_ARRAY, index );
    assert( a != NULL );
    COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, GL_FALSE,
			    header_size, opcode );

    if ( a->enabled ) {
	arrays->array_info_cache_valid = GL_FALSE;
    }
}