Jump to content

  • Log In with Google      Sign In   
  • Create Account

BlackJoker

Member Since 28 Feb 2013
Offline Last Active Today, 12:49 AM

Topics I've Started

Update only portion of data inside constant buffer D3D12

21 April 2016 - 06:20 AM

Hi.

I started to learn DX12 and I have a question regarding constant buffer update.

 

I need to write only to the certain parts of my constant buffer by offset.

In D3D11 I could do like that:

 

BackingBuffer is type of DataBuffer and I could write there my data separately by offsets like this:

BackingBuffer.Set(offset, ref value);

And then update my constant buffer:

// Setup the dest region inside the buffer
            if ((this.Description.BindFlags & BindFlags.ConstantBuffer) != 0)
            {
               device.UpdateSubresource(new DataBox(BackingBuffer.Pointer, 0, 0), constantBuffer);
            }
            else
            {
               var destRegion = new ResourceRegion(offsetInBytes, 0, 0, offsetInBytes + BackingBuffer.Size, 1, 1);
               device.UpdateSubresource(new DataBox(BackingBuffer.Pointer, 0, 0), constantBuffer, 0, destRegion);
            }

How can I do the same in D3D12?


Copy Non-MSAA texture to MSAA texture

07 April 2016 - 03:25 AM

Hi all,

I want to draw some pixels of the rendertarget texture with different color.

For that I must create staging texture, update data and then copy texture to rendertarget.

The issue is that my rendertarget has MSAA, but staging textures can`t be created with MSAA.

So, my option is to use resolvesubresource, but that method doesnt want to copy texture if it has non default usage.

 

I can create another texture without MSAA, then create staging texture from it and then copy rendertarget texture with resolvesubresource. That will let me get texture data and change pixel colors, but how do I copy Non-MSAA texture back to MSAA texture?

 

I didnt find any solution for that yet except not using MSAA rendertarget, but that no good option for me. Maybe there are some another way to solve this issue?

 


Copy shared textures between D3D11 devices

21 March 2016 - 04:06 AM

I am trying to copy shared texture 2d between 2 different D3D11 devices, but this is not so easy as I thought.

 

I have 2 d3d devices + 2 device contexts( one per device) and 2 texture2d (one created with first device and second with second device correspondingly).

 

When i try do like that:

 

deviceContext2.CopyResource(textureOnDevice2 (source), textureOnDevice1 (destination))

 

I receive the following error: D3D11 CORRUPTION: ID3D11DeviceContext::CopyResource: Second parameter does not match device. [ MISCELLANEOUS CORRUPTION #14: CORRUPTED_PARAMETER2]

 

Both textures were created with ResourceOptionFlag = Shared, so it must be possible to copy textures between devices.

 

What I am missing here?

 


Setting of several scissor rectangles correctly

19 February 2016 - 06:33 AM

Hi all,

 

I and developing 2D UI system and want to implement correct clipping.

 

For ex I want to clip control with some specific clip rectangle and at the same time clip it by parents clip rectangle to be sure it will not display out of the parent element.

 

For that I use several clip rectangles, but only parents rectangle works.

 

In msdn says that if you want to use several rectangles, you need to set several viewports.

As I am using absolute coordinates, I am setting 3 same viewports and 3 different rectangles, but seems that only last rectangle applies.

 

So, my question is how to correctly apply several rectangles for clipping at the same time? Is it possible?


Filling empty shape algoritm

15 February 2016 - 05:30 PM

Hi all,

I faced with the problem when I need to fill created shape with some color, but the problem is that my geometry is empty inside. Its just a border consisting of 4 rectangles. I know that WPF and also D2D have algorithms for filling any geometry with color, but how to do it in DirectX?

 

I am wondering does someone already did something similar?


PARTNERS