DXGL r398 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r397
|
r398
|
r399
>
Date:
00:20, 5 August 2013
Author:
admin
Status:
new
Tags:
Comment:
Add several variables and operations for 2D shader generator.
Modified paths:
/ddraw/shadergen2d.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/shadergen2d.cpp
—
—
@@ -35,7 +35,7 @@
36
36
Bit 14: ROP index bit 2
37
37
Bit 15: Use source color key (DDBLT_KEYSRC)
38
38
Bit 16: ROP index bit 3
39
-Bit 17: Use ROP (DDBLT_ROP)
39
+Bit 17: Use ROP (DDBLT_ROP, forces integer processing)
40
40
Bit 18: ROP index bit 4
41
41
Bit 19: Z-buffer blit (DDBLT_ZBUFFER)
42
42
Bit 20: Use dest. Z constant (DDBLT_ZBUFFERDESTCONSTOVERRIDE)
—
—
@@ -120,4 +120,298 @@
121
121
0x00000000,
122
122
0x00001000,
123
123
0x00000000
124
+};
125
+
126
+#define REVISION 1
127
+static const char header[] =
128
+ "//REV" STR(REVISION) "\n\
129
+#version 110\n";
130
+static const char vertexshader[] = "//2D Vertex Shader\n";
131
+static const char fragshader[] = "//2D Fragment Shader\n";
132
+static const char idheader[] = "//ID: 0x";
133
+static const char linefeed[] = "\n";
134
+static const char mainstart[] = "void main()\n{\n";
135
+static const char mainend[] = "} ";
136
+// Attributes
137
+static const char attr_srcxy[] = "attribute vec2 srcxy;\n";
138
+static const char attr_destxy[] = "attribute vec2 destxy;\n";
139
+static const char attr_patternxy[] = "attribute vec2 patternxy;\n";
140
+
141
+// Uniforms
142
+static const char var_srctex[] = "uniform sampler2d srctex;";
143
+static const char var_desttex[] = "uniform sampler2d desttex;";
144
+static const char var_patterntex[] = "uniform sampler2d patterntex;";
145
+
146
+// Variables
147
+static const char var_src[] = "ivec4 src;\n";
148
+static const char var_dest[] = "ivec4 dest;\n";
149
+static const char var_pattern[] = "ivec4 pattern;\n";
150
+
151
+// Operations
152
+static const char op_src[] = "src = ivec4(texture2D(src,gl_TexCoord[0].st)*255.5);\n";
153
+static const char op_dest[] = "dest = ivec4(texture2D(dest,gl_TexCoord[1].st)*255.5);\n";
154
+static const char op_pattern[] = "pattern = ivec4(texture2D(pattern,gl_TexCoord[2].st)*255.5);\n";
155
+static const char op_destout[] = "gl_FragColor = vec4(dest)/255.5;\n";
156
+
157
+
158
+// Functions
159
+
160
+// ROP Operations
161
+static const char *op_ROP[256] = {
162
+"dest = ivec4(0);",//00 BLACKNESS
163
+"",
164
+"",
165
+"",
166
+"",
167
+"",
168
+"",
169
+"",
170
+"",
171
+"",
172
+"",
173
+"",
174
+"",
175
+"",
176
+"",
177
+"",//0F
178
+"",//10
179
+"",
180
+"",
181
+"",
182
+"",
183
+"",
184
+"",
185
+"",
186
+"",
187
+"",
188
+"",
189
+"",
190
+"",
191
+"",
192
+"",
193
+"",//1F
194
+"",//20
195
+"",
196
+"",
197
+"",
198
+"",
199
+"",
200
+"",
201
+"",
202
+"",
203
+"",
204
+"",
205
+"",
206
+"",
207
+"",
208
+"",
209
+"",//2F
210
+"",//30
211
+"",
212
+"",
213
+"",
214
+"",
215
+"",
216
+"",
217
+"",
218
+"",
219
+"",
220
+"",
221
+"",
222
+"",
223
+"",
224
+"",
225
+"",//3F
226
+"",//40
227
+"",
228
+"",
229
+"",
230
+"",
231
+"",
232
+"",
233
+"",
234
+"",
235
+"",
236
+"",
237
+"",
238
+"",
239
+"",
240
+"",
241
+"",//4F
242
+"",//50
243
+"",
244
+"",
245
+"",
246
+"",
247
+"",
248
+"",
249
+"",
250
+"",
251
+"",
252
+"",
253
+"",
254
+"",
255
+"",
256
+"",
257
+"",//5F
258
+"",//60
259
+"",
260
+"",
261
+"",
262
+"",
263
+"",
264
+"",
265
+"",
266
+"",
267
+"",
268
+"",
269
+"",
270
+"",
271
+"",
272
+"",
273
+"",//6F
274
+"",//70
275
+"",
276
+"",
277
+"",
278
+"",
279
+"",
280
+"",
281
+"",
282
+"",
283
+"",
284
+"",
285
+"",
286
+"",
287
+"",
288
+"",
289
+"",//7F
290
+"",//80
291
+"",
292
+"",
293
+"",
294
+"",
295
+"",
296
+"",
297
+"",
298
+"",
299
+"",
300
+"",
301
+"",
302
+"",
303
+"",
304
+"",
305
+"",//8F
306
+"",//90
307
+"",
308
+"",
309
+"",
310
+"",
311
+"",
312
+"",
313
+"",
314
+"",
315
+"",
316
+"",
317
+"",
318
+"",
319
+"",
320
+"",
321
+"",//9F
322
+"",//A0
323
+"",
324
+"",
325
+"",
326
+"",
327
+"",
328
+"",
329
+"",
330
+"",
331
+"",
332
+"",
333
+"",
334
+"",
335
+"",
336
+"",
337
+"",//AF
338
+"",//B0
339
+"",
340
+"",
341
+"",
342
+"",
343
+"",
344
+"",
345
+"",
346
+"",
347
+"",
348
+"",
349
+"",
350
+"",
351
+"",
352
+"",
353
+"",//BF
354
+"",//C0
355
+"",
356
+"",
357
+"",
358
+"",
359
+"",
360
+"",
361
+"",
362
+"",
363
+"",
364
+"",
365
+"",
366
+"dest = src;\n",//CC SRCCOPY
367
+"",
368
+"",
369
+"",//CF
370
+"",//D0
371
+"",
372
+"",
373
+"",
374
+"",
375
+"",
376
+"",
377
+"",
378
+"",
379
+"",
380
+"",
381
+"",
382
+"",
383
+"",
384
+"",
385
+"",//DF
386
+"",//E0
387
+"",
388
+"",
389
+"",
390
+"",
391
+"",
392
+"",
393
+"",
394
+"",
395
+"",
396
+"",
397
+"",
398
+"",
399
+"",
400
+"",
401
+"",//EF
402
+"",//F0
403
+"",
404
+"",
405
+"",
406
+"",
407
+"",
408
+"",
409
+"",
410
+"",
411
+"",
412
+"",
413
+"",
414
+"",
415
+"",
416
+"",
417
+"dest = ivec4(255);\n",//FF WHITENESS
124
418
};
\ No newline at end of file
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