DXGL r906 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r905‎ | r906 | r907 >
Date:23:33, 2 April 2019
Author:admin
Status:new
Tags:
Comment:
Define a few code lines for texture rectangle shaders.
Modified paths:
  • /ddraw/ShaderGen2D.cpp (modified) (history)

Diff [purge]

Index: ddraw/ShaderGen2D.cpp
@@ -83,7 +83,8 @@
8484 "//REV" STR(SHADER2DVERSION) "\n";
8585 static const char version_110[] = "#version 110\n";
8686 static const char version_130[] = "#version 130\n";
87 -static const char ext_shader4[] = "#extension GL_EXT_gpu_shader4 : require";
 87+static const char ext_shader4[] = "#extension GL_EXT_gpu_shader4 : require\n";
 88+static const char ext_texrect[] = "#extension GL_ARB_texture_rectangle : require\n";
8889 static const char vertexshader[] = "//2D Vertex Shader\n";
8990 static const char fragshader[] = "//2D Fragment Shader\n";
9091 static const char idheader[] = "//ID: 0x";
@@ -101,7 +102,9 @@
102103 // Uniforms
103104 static const char unif_view[] = "uniform vec4 view;\n";
104105 static const char unif_srctex[] = "uniform sampler2D srctex;\n";
 106+static const char unif_srctexrect[] = "uniform sampler2DRect srctex;\n";
105107 static const char unif_desttex[] = "uniform sampler2D desttex;\n";
 108+static const char unif_desttexrect[] = "uniform sampler2DRect desttex;\n";
106109 static const char unif_patterntex[] = "uniform sampler2D patterntex;\n";
107110 static const char unif_stenciltex[] = "uniform sampler2D stenciltex;\n";
108111 static const char unif_srcpal[] = "uniform sampler2D srcpal;\n";
@@ -124,10 +127,15 @@
125128
126129 // Operations
127130 static const char op_src[] = "src = ivec4(texture2D(srctex,gl_TexCoord[0].st)*vec4(colorsizesrc)+.5);\n";
 131+static const char op_srcrect[] = "src = ivec4(texture2DRect(srctex,gl_TexCoord[0].st)*vec4(colorsizesrc)+.5);\n";
128132 static const char op_pixel[] = "pixel = ivec4(texture2D(srctex,gl_TexCoord[0].st)*vec4(colorsizedest)+.5);\n";
 133+static const char op_pixelrect[] = "pixel = ivec4(texture2DRect(srctex,gl_TexCoord[0].st)*vec4(colorsizedest)+.5);\n";
129134 static const char op_palpixel[] = "vec4 myindex = texture2D(srctex, gl_TexCoord[0].xy);\n\
130135 vec2 index = vec2(((myindex.x*(255.0/256.0))+(0.5/256.0)),0.5);\n\
131136 pixel = ivec4(texture2D(srcpal, index)*vec4(colorsizedest)+.5);\n";
 137+static const char op_palpixelrect[] = "vec4 myindex = texture2DRect(srctex, gl_TexCoord[0].xy);\n\
 138+vec2 index = vec2(((myindex.x*(255.0/256.0))+(0.5/256.0)),0.5);\n\
 139+pixel = ivec4(texture2D(srcpal, index)*vec4(colorsizedest)+.5);\n";
132140 static const char op_pixelmul256[] = "pixel = ivec4(vec4(256.0)*texture2D(srctex,gl_TexCoord[0].st)*vec4(colorsizedest)+.5);\n";
133141 static const char op_color[] = "pixel = fillcolor;\n";
134142 static const char op_dest[] = "dest = ivec4(texture2D(desttex,gl_TexCoord[1].st)*vec4(colorsizedest)+.5);\n";