DXGL r163 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r162
|
r163
|
r164
>
Date:
16:46, 5 June 2012
Author:
admin
Status:
new
Tags:
Comment:
Add D3DTOP_ADDSMOOTH
Document shadergen.cpp
Modified paths:
/ddraw/glDirect3D.cpp
(modified) (
history
)
/ddraw/shadergen.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/glDirect3D.cpp
—
—
@@ -83,7 +83,8 @@
84
84
8, //dwFVFCaps
85
85
D3DTEXOPCAPS_SELECTARG1 | D3DTEXOPCAPS_SELECTARG2 | D3DTEXOPCAPS_MODULATE |
86
86
D3DTEXOPCAPS_MODULATE2X | D3DTEXOPCAPS_MODULATE4X | D3DTEXOPCAPS_ADD |
87
- D3DTEXOPCAPS_ADDSIGNED | D3DTEXOPCAPS_ADDSIGNED2X | D3DTEXOPCAPS_SUBTRACT, //dwTextureOpCaps
87
+ D3DTEXOPCAPS_ADDSIGNED | D3DTEXOPCAPS_ADDSIGNED2X | D3DTEXOPCAPS_SUBTRACT |
88
+ D3DTEXOPCAPS_ADDSMOOTH, //dwTextureOpCaps
88
89
8, //wMaxTextureBlendStages
89
90
8, //wMaxSimultaneousTextures
90
91
8, //dwMaxActiveLights
Index: ddraw/shadergen.cpp
—
—
@@ -90,6 +90,10 @@
91
91
10=cameraspaceposition 11=cameraspacereflectionvector
92
92
Bit 59: Texture image enabled
93
93
*/
94
+
95
+/**
96
+ * Clears the array of shaders.
97
+ */
94
98
void ZeroShaderArray()
95
99
{
96
100
ZeroMemory(genshaders,256*sizeof(GenShader));
—
—
@@ -97,6 +101,9 @@
98
102
isbuiltin = true;
99
103
}
100
104
105
+/**
106
+ * Deletes all shader programs in the array.
107
+ */
101
108
void ClearShaders()
102
109
{
103
110
for(int i = 0; i < shadercount; i++)
—
—
@@ -115,6 +122,17 @@
116
123
genindex = 0;
117
124
}
118
125
126
+/**
127
+ * Sets a shader by render state. If the shader does not exist, generates it.
128
+ * @param id
129
+ * 64-bit value containing current render states
130
+ * @param texstate
131
+ * Pointer to the texture stage state array, containing 8 64-bit state values
132
+ * @param texcoords
133
+ * Pointer to number of texture coordinates in each texture stage
134
+ * @param builtin
135
+ * If true, the id parameter is an index to a built-in shader for 2D blitting
136
+ */
119
137
void SetShader(__int64 id, TEXTURESTAGE *texstate, int *texcoords, bool builtin)
120
138
{
121
139
int shaderindex = -1;
—
—
@@ -176,6 +194,12 @@
177
195
}
178
196
}
179
197
198
+/**
199
+ * Retrieves the GLSL program currently in use
200
+ * @return
201
+ * Number of the current GLSL program, or if using built-in shaders, the ID of
202
+ * the shader
203
+ */
180
204
GLuint GetProgram()
181
205
{
182
206
if(isbuiltin) return current_shader & 0xFFFFFFFF;
—
—
@@ -301,6 +325,18 @@
302
326
diffuse += light.diffuse*NdotL;\n\
303
327
}\n";
304
328
329
+
330
+/**
331
+ * Creates an OpenGL shader program
332
+ * @param index
333
+ * Index of the shader in the array to generate
334
+ * @param id
335
+ * 64-bit value containing current render states
336
+ * @param texstate
337
+ * Pointer to the texture stage state array, containing 8 64-bit state values
338
+ * @param texcoords
339
+ * Pointer to number of texture coordinates in each texture stage
340
+ */
305
341
void CreateShader(int index, __int64 id, TEXTURESTAGE *texstate, int *texcoords)
306
342
{
307
343
string tmp;
—
—
@@ -638,6 +674,9 @@
639
675
case D3DTOP_SUBTRACT:
640
676
fsrc->append("color = " + arg1 + " - " + arg2 + ";\n");
641
677
break;
678
+ case D3DTOP_ADDSMOOTH:
679
+ fsrc->append("color = " + arg1 + " + " + arg2 + " - " + arg1 + " * " + arg2 + ";\n");
680
+ break;
642
681
}
643
682
}
644
683
fsrc->append(op_colorfragout);
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version