Dear DirectX11/SharpDX developer, dear community members,
first of all many thanks for this very impressive project.
Because of many troubles with WPF Shader Model (no vertex shader, no multipass, etc, etc) I've switched to use DirectX and SharpDX is only a managed wrapper of my choose.
For a first exercise I've tried to draw a simple (unscaled) image which is succeeded with DrawBitmap. The image was drawn exactly same as used bitmap. Only if I resize the window, the image also will be resized. Need to resize swap chain?
For the next I've tried to do exactly the same, but switch in a little Pixel Shader and after a day I've understand that is only possible only if I have Vertex Shader too. Maybe some enhancement can be made?
A get two possibilities: use triangle list / triangle strip OR use quad vertex shader as described here
PS_IN VSQuad(uint VertexID: SV_VertexID)
// ouputs a full screen quad with tex coords
Out.tex = float2( (VertexID << 1) & 2, VertexID & 2 );
Out.pos = float4( Out.tex * float2( 2.0f, -2.0f ) + float2( -1.0f, 1.0f), 0.0f, 1.0f );
and setup the bitmap as texture in pixel shader resource.
Test pixel shader looks like:
float4 PS( PS_IN input ) : SV_Target
// Simple invert each color channel value
float4 color = picture.Sample(pictureSampler, input.tex);
But for now I've two problems:
the first one the texture is (of course) not drawn in original size but in window size and resizes with window. I hope, I only need to update swap chain size to prevent resizing. But how to generate a quad of correctly size whis is exactly of my bitmap (texture size)?
The next problem: all interpolation between pixels must be prevented in pixel shader because of exactly pixel values (and neighbor pixels) must be accessed. Accordingly to MS the Mip-Mapping must be disabled, but there are not "NONE" (DISABLED) value of Filter enumeration. So it looks to be impossible to get exactly pixel values or I've missed something?
What I try to do in the end:
this should be two pass pixel shader:
1st stage zoom (with own algorithm) (in or out) a particular 2D-region of smaller/bigger image
2nd stage does some kernel filtering of zoomed region
P.S. The images to rasterize will be continuosly (and at high frame rate) updated from an observation camera.
 is a little bit more explanation, which I try to achieve.
This sounds very easy, but I've don't found an example (neither SharpDX nor WPF) how to do this correctly, mainly because all examples does only filter and not rescale an input image and does not need an access to exactly pixel values. My problem is, there are some artifacts, if not exactly pixel values will be used by zoom algorithms.
It will be really very helpful for me, if somebody can explain, how to do this "simple" thing or enhance SharpDX Sample library.
Many, many thanks in advice.