@@ -146,9 +146,11 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
146146
147147 append_line (buf, &len, " struct PSInput {" );
148148 append_line (buf, &len, " float4 position : SV_POSITION;" );
149- if (ccf.used_textures [0 ] || ccf.used_textures [1 ]) {
150- append_line (buf, &len, " float2 uv : TEXCOORD;" );
151- num_floats += 2 ;
149+ for (int t = 0 ; t < 2 ; t++) {
150+ if (ccf.used_textures [t]) {
151+ len += sprintf (buf + len, " float2 uv%d : TEXCOORD%d;" , t, t);
152+ num_floats += 2 ;
153+ }
152154 }
153155 if ((cc.cm .use_alpha && cc.cm .use_dither ) || ccf.do_noise ) {
154156 append_line (buf, &len, " float4 screenPos : TEXCOORD1;" );
@@ -218,8 +220,10 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
218220 // Vertex shader
219221
220222 append_str (buf, &len, " PSInput VSMain(float4 position : POSITION" );
221- if (ccf.used_textures [0 ] || ccf.used_textures [1 ]) {
222- append_str (buf, &len, " , float2 uv : TEXCOORD" );
223+ for (int t = 0 ; t < 2 ; t++) {
224+ if (ccf.used_textures [t]) {
225+ len += sprintf (buf + len, " , float2 uv%d : TEXCOORD%d" , t, t);
226+ }
223227 }
224228 if (cc.cm .use_fog ) {
225229 append_str (buf, &len, " , float4 fog : FOG" );
@@ -236,8 +240,10 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
236240 if ((cc.cm .use_alpha && cc.cm .use_dither ) || ccf.do_noise ) {
237241 append_line (buf, &len, " result.screenPos = position;" );
238242 }
239- if (ccf.used_textures [0 ] || ccf.used_textures [1 ]) {
240- append_line (buf, &len, " result.uv = uv;" );
243+ for (int t = 0 ; t < 2 ; t++) {
244+ if (ccf.used_textures [t]) {
245+ len += sprintf (buf + len, " result.uv%d = uv%d;" , t, t);
246+ }
241247 }
242248 if (cc.cm .use_fog ) {
243249 append_line (buf, &len, " result.fog = fog;" );
@@ -266,11 +272,11 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
266272 if (three_point_filtering) {
267273 append_line (buf, &len, " float4 texVal0;" );
268274 append_line (buf, &len, " if (textures[0].linear_filtering)" );
269- append_line (buf, &len, " texVal0 = tex2D3PointFilter(g_texture0, g_sampler0, input.uv , float2(textures[0].width, textures[0].height));" );
275+ append_line (buf, &len, " texVal0 = tex2D3PointFilter(g_texture0, g_sampler0, input.uv0 , float2(textures[0].width, textures[0].height));" );
270276 append_line (buf, &len, " else" );
271- append_line (buf, &len, " texVal0 = g_texture0.Sample(g_sampler0, input.uv );" );
277+ append_line (buf, &len, " texVal0 = g_texture0.Sample(g_sampler0, input.uv0 );" );
272278 } else {
273- append_line (buf, &len, " float4 texVal0 = g_texture0.Sample(g_sampler0, input.uv );" );
279+ append_line (buf, &len, " float4 texVal0 = g_texture0.Sample(g_sampler0, input.uv0 );" );
274280 }
275281 }
276282 if (ccf.used_textures [1 ]) {
@@ -289,11 +295,11 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
289295 if (three_point_filtering) {
290296 append_line (buf, &len, " float4 texVal1;" );
291297 append_line (buf, &len, " if (textures[1].linear_filtering)" );
292- append_line (buf, &len, " texVal1 = tex2D3PointFilter(g_texture1, g_sampler1, input.uv , float2(textures[1].width, textures[1].height));" );
298+ append_line (buf, &len, " texVal1 = tex2D3PointFilter(g_texture1, g_sampler1, input.uv1 , float2(textures[1].width, textures[1].height));" );
293299 append_line (buf, &len, " else" );
294- append_line (buf, &len, " texVal1 = g_texture1.Sample(g_sampler1, input.uv );" );
300+ append_line (buf, &len, " texVal1 = g_texture1.Sample(g_sampler1, input.uv1 );" );
295301 } else {
296- append_line (buf, &len, " float4 texVal1 = g_texture1.Sample(g_sampler1, input.uv );" );
302+ append_line (buf, &len, " float4 texVal1 = g_texture1.Sample(g_sampler1, input.uv1 );" );
297303 }
298304 }
299305 }
0 commit comments