View Single Post
Old 10 January 2017, 04:48   #7
Registered User
rsn8887's Avatar
Join Date: Oct 2006
Location: USA
Posts: 782
Toni, I made some more tests. I see now that the two cases of
a) internal Null Filter
b) user-created Null Filter
are quite different.

In case a) the input texture that goes to _winuae.fx for post-processing is small, just the Amiga screen size. This small texture is the output of any of the "BEFORE" shaders and becomes the input to _winuae.fx.

In case b) the input texture that goes to _winuae.fx is much larger, ~the size of the host screen. It is the output of the "MIDDLE" shader.

Therefore it is quite understandable, although disappointing, that the two cases give slightly different results.

In addition, I realized that VPOS cannot be used to accurately calculate the magnification factor that happens inside the "MIDDLE" shader.

I understand each shader renders it's final output to its own s->lpTempTexture. (_winuae.fx post processing is an exception).

I would therefore like to ask is it possible in a future version of WinUAE to export a shader semantic called "TARGETDIMS" that simply contains the size of the s->lpTemptexture for that shader? For the BEFORE and AFTER shaders this would be identical to SOURCEDIMS but for the MIDDLE shader this would be very useful since it will allow me to calculate the magnification scaling factor between source and target etc.

In the source, these targetdims are given as w2,h2 in "createtexture."

static int createtexture (int ow, int oh, int win_w, int win_h)
	bool haveafter = false;

	int zw, zh;

	if (ow > win_w * dmultx && oh > win_h * dmultx) {
		zw = ow;
		zh = oh;
	} else {
		zw = win_w * dmultx;
		zh = win_h * dmultx;
	for (int i = 0; i < MAX_SHADERS; i++) {
		if (shaders[i].type == SHADERTYPE_BEFORE || shaders[i].type == SHADERTYPE_AFTER || shaders[i].type == SHADERTYPE_MIDDLE) {
			int w2, h2, w, h;
			if (shaders[i].type == SHADERTYPE_AFTER) {
				w2 = zw; h2 = zh;
				w = zw; h = zh;
				haveafter = true;
				if (!allocextratextures (&shaders[i], window_w, window_h))
					return 0;
			} else if (shaders[i].type == SHADERTYPE_MIDDLE) {
				// worktex_width = 800
				// extratex = amiga res
				w2 = zw; h2 = zh;
				w = zw; h = zh;
				if (!allocextratextures (&shaders[i], ow, oh))
					return 0;
			} else {
				w2 = ow;
				h2 = oh;
				w = ow;
				h = oh;
			if (FAILED (hr = d3ddev->CreateTexture (w2, h2, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &shaders[i].lpTempTexture, NULL))) {
				write_log (_T("%s: Failed to create working texture1: %s:%d:%d\n"), D3DHEAD, D3D_ErrorString (hr), i, shaders[i].type);
				return 0;
			write_log (_T("%s: %d*%d temp texture:%d:%d\n"), D3DHEAD, w2, h2, i, shaders[i].type);
			shaders[i].worktex_width = w;
			shaders[i].worktex_height = h;
	if (haveafter) {
		if (FAILED (hr = d3ddev->CreateTexture (window_w, window_h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpPostTempTexture, NULL))) {
			write_log (_T("%s: Failed to create temp texture: %s\n"), D3DHEAD, D3D_ErrorString (hr));
			return 0;
		write_log (_T("%s: %d*%d after texture\n"), D3DHEAD, window_w, window_h);
	return 1;

Last edited by rsn8887; 10 January 2017 at 05:13.
rsn8887 is offline  
Page generated in 0.03937 seconds with 10 queries