DXGL r127 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r126
|
r127
|
r128
>
Date:
01:29, 15 March 2012
Author:
admin
Status:
new
Tags:
Comment:
Fix shader generation rollover crash
Modified paths:
/ddraw/shadergen.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/shadergen.cpp
—
—
@@ -157,17 +157,17 @@
158
158
if(genshaders[genindex].shader.prog)
159
159
{
160
160
glUseProgram(0);
161
- glDeleteProgram(genshaders[shaderindex].shader.prog);
162
- glDeleteShader(genshaders[shaderindex].shader.vs);
163
- glDeleteShader(genshaders[shaderindex].shader.fs);
164
- delete genshaders[shaderindex].shader.vsrc;
165
- delete genshaders[shaderindex].shader.fsrc;
166
- ZeroMemory(&genshaders[shaderindex],sizeof(GenShader));
161
+ glDeleteProgram(genshaders[genindex].shader.prog);
162
+ glDeleteShader(genshaders[genindex].shader.vs);
163
+ glDeleteShader(genshaders[genindex].shader.fs);
164
+ delete genshaders[genindex].shader.vsrc;
165
+ delete genshaders[genindex].shader.fsrc;
166
+ ZeroMemory(&genshaders[genindex],sizeof(GenShader));
167
167
}
168
168
CreateShader(genindex,id,texstate,texcoords);
169
169
shaderindex = genindex;
170
170
genindex++;
171
- if(genindex == 256) genindex = 0;
171
+ if(genindex >= 256) genindex = 0;
172
172
}
173
173
genshaders[shaderindex].id = id;
174
174
glUseProgram(genshaders[shaderindex].shader.prog);
—
—
@@ -255,7 +255,7 @@
256
256
(material.specular * specular) + material.emissive;\n\
257
257
gl_FrontColor = color;\n";
258
258
static const char op_colorfragout[] = "gl_FragColor = color;\n";
259
-static const char op_fragpassthru[] = "color = gl_Color;\n";
259
+static const char op_colorfragin[] = "color = gl_Color;\n";
260
260
261
261
// Functions
262
262
static const char func_dirlight[] = "void DirLight(in Light light)\n\
—
—
@@ -412,7 +412,6 @@
413
413
idstring[21] = 0;
414
414
fsrc->append(idheader);
415
415
fsrc->append(idstring);
416
- // Attributs
417
416
// Uniforms
418
417
// Variables
419
418
fsrc->append(var_color);
—
—
@@ -419,7 +418,11 @@
420
419
// Functions
421
420
// Main
422
421
fsrc->append(mainstart);
423
- fsrc->append(op_fragpassthru);
422
+ fsrc->append(op_colorfragin);
423
+ for(int i = 0; i < 8; i++)
424
+ {
425
+
426
+ }
424
427
fsrc->append(op_colorfragout);
425
428
fsrc->append(mainend);
426
429
#ifdef _DEBUG
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