VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_regcombiner.c@ 66474

最後變更 在這個檔案從66474是 63942,由 vboxsync 提交於 8 年 前

OpenGL: fixed the most annoying coding style flaws, mainly removing spaces after '(' and before ')', no semantic change

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 2.8 KB
 
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
10static GLboolean __handleCombinerParameterData(GLenum pname, const GLfloat *params, GLenum extended_opcode)
11{
12 CR_GET_PACKER_CONTEXT(pc);
13 unsigned int params_length = 0;
14 unsigned int packet_length = sizeof(int) + sizeof(extended_opcode) + sizeof(pname);
15 unsigned char *data_ptr;
16
17 switch(pname)
18 {
19 case GL_CONSTANT_COLOR0_NV:
20 case GL_CONSTANT_COLOR1_NV:
21 params_length = 4 * sizeof(*params);
22 break;
23 case GL_NUM_GENERAL_COMBINERS_NV:
24 case GL_COLOR_SUM_CLAMP_NV:
25 params_length = sizeof(*params);
26 break;
27 default:
28 __PackError(__LINE__, __FILE__, GL_INVALID_ENUM,
29 "crPackCombinerParameter(bad pname)");
30 CRASSERT(0);
31 return GL_FALSE;
32 }
33 packet_length += params_length;
34 CR_GET_BUFFERED_POINTER(pc, packet_length);
35 WRITE_DATA(0, int, packet_length);
36 WRITE_DATA(sizeof(int) + 0, GLenum, extended_opcode);
37 WRITE_DATA(sizeof(int) + 4, GLenum, pname);
38 WRITE_DATA(sizeof(int) + 8, GLfloat, params[0]);
39 if (params_length > sizeof(*params))
40 {
41 WRITE_DATA(sizeof(int) + 12, GLfloat, params[1]);
42 WRITE_DATA(sizeof(int) + 16, GLfloat, params[2]);
43 WRITE_DATA(sizeof(int) + 20, GLfloat, params[3]);
44 CRASSERT(packet_length == sizeof(int) + 20 + 4);
45 }
46 return GL_TRUE;
47}
48
49void PACK_APIENTRY crPackCombinerParameterfvNV(GLenum pname, const GLfloat *params)
50{
51 CR_GET_PACKER_CONTEXT(pc);
52 if (__handleCombinerParameterData(pname, params, CR_COMBINERPARAMETERFVNV_EXTEND_OPCODE))
53 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
54 CR_UNLOCK_PACKER_CONTEXT(pc);
55}
56
57void PACK_APIENTRY crPackCombinerParameterivNV(GLenum pname, const GLint *params)
58{
59 /* floats and ints are the same size, so the packing should be the same */
60 CR_GET_PACKER_CONTEXT(pc);
61 if (__handleCombinerParameterData(pname, (const GLfloat *) params, CR_COMBINERPARAMETERIVNV_EXTEND_OPCODE))
62 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
63 CR_UNLOCK_PACKER_CONTEXT(pc);
64}
65
66void PACK_APIENTRY crPackCombinerStageParameterfvNV(GLenum stage, GLenum pname, const GLfloat *params)
67{
68 CR_GET_PACKER_CONTEXT(pc);
69 unsigned char *data_ptr;
70
71 CR_GET_BUFFERED_POINTER(pc, 32);
72 WRITE_DATA(0, GLint, 32);
73 WRITE_DATA(4, GLenum, CR_COMBINERSTAGEPARAMETERFVNV_EXTEND_OPCODE);
74 WRITE_DATA(8, GLenum, stage);
75 WRITE_DATA(12, GLenum, pname);
76 WRITE_DATA(16, GLfloat, params[0]);
77 WRITE_DATA(20, GLfloat, params[1]);
78 WRITE_DATA(24, GLfloat, params[2]);
79 WRITE_DATA(28, GLfloat, params[3]);
80 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
81 CR_UNLOCK_PACKER_CONTEXT(pc);
82}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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