DXGL r899 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r898
|
r899
|
r900
>
Date:
23:23, 8 March 2019
Author:
admin
Status:
new
Tags:
Comment:
Multiply 24-bit depth buffers by 256 when sampling as color for Blt operations.
Modified paths:
/ddraw/ShaderGen2D.cpp
(modified) (
history
)
/ddraw/glTexture.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/ShaderGen2D.cpp
—
—
@@ -69,6 +69,8 @@
70
70
0x14: 4-bit palette index (future)
71
71
0x15: 2-bit palette index (future)
72
72
0x16: 1-bit palette index (future)
73
+0x18: 24-bit Depth
74
+0x19: 24-bit Depth, 8-bit Stencil
73
75
0x20: (first entry for specific RGB formats) (future)
74
76
0x80: (first entry for specific YUV formats) (future)
75
77
0xC0: (first entry for compressed) (future)
—
—
@@ -123,6 +125,7 @@
124
126
static const char op_palpixel[] = "vec4 myindex = texture2D(srctex, gl_TexCoord[0].xy);\n\
125
127
vec2 index = vec2(((myindex.x*(255.0/256.0))+(0.5/256.0)),0.5);\n\
126
128
pixel = ivec4(texture2D(srcpal, index)*vec4(colorsizedest)+.5);\n";
129
+static const char op_pixelmul256[] = "pixel = ivec4(vec4(256.0)*texture2D(srctex,gl_TexCoord[0].st)*vec4(colorsizedest)+.5);\n";
127
130
static const char op_color[] = "pixel = fillcolor;\n";
128
131
static const char op_dest[] = "dest = ivec4(texture2D(desttex,gl_TexCoord[1].st)*vec4(colorsizedest)+.5);\n";
129
132
static const char op_pattern[] = "patternst = vec2(mod(gl_FragCoord.x,float(patternsize.x))/float(patternsize.x),\n\
—
—
@@ -912,6 +915,10 @@
913
916
case 0x13:
914
917
String_Append(fsrc, op_palpixel);
915
918
break;
919
+ case 0x18:
920
+ case 0x19:
921
+ String_Append(fsrc, op_pixelmul256);
922
+ break;
916
923
}
917
924
}
918
925
if (id & DDBLT_KEYSRC) String_Append(fsrc, op_src);
Index: ddraw/glTexture.cpp
—
—
@@ -1140,6 +1140,7 @@
1141
1141
This->convfunctionupload = 17;
1142
1142
This->convfunctiondownload = 18;
1143
1143
This->internalsize = 4;
1144
+ This->blttype = 0x18;
1144
1145
This->internalformats[0] = GL_DEPTH_COMPONENT24;
1145
1146
This->format = GL_DEPTH_COMPONENT;
1146
1147
This->type = GL_UNSIGNED_INT;
—
—
@@ -1154,6 +1155,7 @@
1155
1156
This->colorbits[3] = 0;
1156
1157
break;
1157
1158
case 20: // 32/24 bit Z buffer
1159
+ This->blttype = 0x18;
1158
1160
This->internalformats[0] = GL_DEPTH_COMPONENT24;
1159
1161
This->format = GL_DEPTH_COMPONENT;
1160
1162
This->type = GL_UNSIGNED_INT;
—
—
@@ -1182,6 +1184,7 @@
1183
1185
This->colorbits[3] = 0;
1184
1186
break;
1185
1187
case 22: // 32-bit Z/Stencil buffer, depth LSB
1188
+ This->blttype = 0x18;
1186
1189
This->internalformats[0] = GL_DEPTH24_STENCIL8;
1187
1190
This->format = GL_DEPTH_STENCIL;
1188
1191
This->type = GL_UNSIGNED_INT_24_8;
—
—
@@ -1196,6 +1199,7 @@
1197
1200
This->colorbits[3] = 8;
1198
1201
break;
1199
1202
case 23: // 32-bit Z/Stencil buffer, depth MSB
1203
+ This->blttype = 0x18;
1200
1204
This->internalformats[0] = GL_DEPTH24_STENCIL8;
1201
1205
This->format = GL_DEPTH_STENCIL;
1202
1206
This->type = GL_UNSIGNED_INT_24_8;
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