VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_point.c@ 70939

Last change on this file since 70939 was 69392, checked in by vboxsync, 7 years ago

GuestHost/OpenGL: scm updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.2 KB
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#include "packer.h"
8#include "cr_opcodes.h"
9#include "cr_version.h"
10
11#ifdef CR_ARB_point_parameters
12
13static GLboolean __handlePointDataf( GLenum pname, const GLfloat *params )
14{
15 CR_GET_PACKER_CONTEXT(pc);
16 int params_length = 0;
17 int packet_length = 2 * sizeof( int ) + sizeof( pname );
18 unsigned char *data_ptr;
19 switch( pname )
20 {
21 case GL_POINT_SIZE_MIN_ARB:
22 case GL_POINT_SIZE_MAX_ARB:
23 case GL_POINT_FADE_THRESHOLD_SIZE_ARB:
24 params_length = sizeof( *params );
25 break;
26 case GL_POINT_DISTANCE_ATTENUATION_ARB:
27 params_length = 3 * sizeof( *params );
28 break;
29 default:
30 {
31 char msg[100];
32 sprintf(msg, "Invalid pname in PointParameter: %d", (int) pname );
33 __PackError( __LINE__, __FILE__, GL_INVALID_ENUM, msg);
34 }
35 return GL_FALSE;
36 }
37 packet_length += params_length;
38
39 CR_GET_BUFFERED_POINTER(pc, packet_length );
40 WRITE_DATA( 0, GLint, packet_length );
41 WRITE_DATA( 4, GLenum, CR_POINTPARAMETERFVARB_EXTEND_OPCODE );
42 WRITE_DATA( 8, GLenum, pname );
43 WRITE_DATA( 12, GLfloat, params[0] );
44 if (packet_length > 16)
45 {
46 WRITE_DATA( 16, GLfloat, params[1] );
47 WRITE_DATA( 20, GLfloat, params[2] );
48 }
49 return GL_TRUE;
50}
51
52void PACK_APIENTRY crPackPointParameterfvARB(GLenum pname, const GLfloat *params)
53{
54 CR_GET_PACKER_CONTEXT(pc);
55 if (__handlePointDataf( pname, params ))
56 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
57 CR_UNLOCK_PACKER_CONTEXT(pc);
58}
59
60#endif
61
62static GLboolean __handlePointDatai( GLenum pname, const GLint *params )
63{
64 CR_GET_PACKER_CONTEXT(pc);
65 int params_length = 0;
66 int packet_length = 2 * sizeof( int ) + sizeof( pname );
67 unsigned char *data_ptr;
68 switch( pname )
69 {
70 case GL_POINT_SIZE_MIN_ARB:
71 case GL_POINT_SIZE_MAX_ARB:
72 case GL_POINT_FADE_THRESHOLD_SIZE_ARB:
73 params_length = sizeof( *params );
74 break;
75 case GL_POINT_DISTANCE_ATTENUATION_ARB:
76 params_length = 3 * sizeof( *params );
77 break;
78 default:
79 {
80 char msg[100];
81 sprintf(msg, "Invalid pname in PointParameter: %d", (int) pname );
82 __PackError( __LINE__, __FILE__, GL_INVALID_ENUM, msg);
83 }
84 return GL_FALSE;
85 }
86 packet_length += params_length;
87
88 CR_GET_BUFFERED_POINTER(pc, packet_length );
89 WRITE_DATA( 0, GLint, packet_length );
90 WRITE_DATA( 4, GLenum, CR_POINTPARAMETERIV_EXTEND_OPCODE );
91 WRITE_DATA( 8, GLenum, pname );
92 WRITE_DATA( 12, GLint, params[0] );
93 if (packet_length > 16)
94 {
95 WRITE_DATA( 16, GLint, params[1] );
96 WRITE_DATA( 20, GLint, params[2] );
97 }
98 return GL_TRUE;
99}
100
101void PACK_APIENTRY crPackPointParameteriv(GLenum pname, const GLint *params)
102{
103 CR_GET_PACKER_CONTEXT(pc);
104 if (__handlePointDatai( pname, params ))
105 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
106 CR_UNLOCK_PACKER_CONTEXT(pc);
107}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette