Code Monkey home page Code Monkey logo

learningdirectx12's People

Contributors

georgesarkisyan1971 avatar jpvanoosten avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

learningdirectx12's Issues

Texture loading bug with specific .png images

I have come across two .png images which cause a crash when it is being loaded with CommandList::LoadTextureFromFile. It seems to be an issue where the formats are mismatched when generating mips.

This is with the latest revision of master (at the time of writing).

STEPS TO REPRODUCE
Download the images from below, and put them in Assets/Textures/[image_name].png
Load the texture like normal. For example in Tutorial4.cpp at line 193, insert:

Texture tempTex;
commandList->LoadTextureFromFile(tempTex, L"Assets/Textures/AlKharidWarrior.png");

AlKharidWarrior
char

Error message

D3D12 ERROR: ID3D12Device::CreateShaderResourceView: The Format (0x57, B8G8R8A8_UNORM) is invalid when creating a View; it is not a fully qualified format within the same family as the Format of the Resource (0x1c, R8G8B8A8_UNORM). [ STATE_CREATION ERROR #28: CREATESHADERRESOURCEVIEW_INVALIDFORMAT]
D3D12: **BREAK** enabled for the previous message, which was: [ ERROR STATE_CREATION #28: CREATESHADERRESOURCEVIEW_INVALIDFORMAT ]
Exception thrown at 0x00007FFE8608A388 (KernelBase.dll) in Tutorial4.exe: 0x0000087A (parameters: 0x0000000000000001, 0x0000000429168810, 0x000000042916A710).
Unhandled exception at 0x00007FFE8608A388 (KernelBase.dll) in Tutorial4.exe: 0x0000087A (parameters: 0x0000000000000001, 0x0000000429168810, 0x000000042916A710).

Stacktrace

 Tutorial4.exe!Texture::CreateShaderResourceView(const D3D12_SHADER_RESOURCE_VIEW_DESC * srvDesc) Line 189	
 Tutorial4.exe!Texture::GetShaderResourceView(const D3D12_SHADER_RESOURCE_VIEW_DESC * srvDesc) Line 217	
 Tutorial4.exe!CommandList::SetShaderResourceView(unsigned int rootParameterIndex, unsigned int descriptorOffset, const Resource & resource, D3D12_RESOURCE_STATES stateAfter, unsigned int firstSubresource, unsigned int numSubresources, const D3D12_SHADER_RESOURCE_VIEW_DESC * srv) Line 892	
 Tutorial4.exe!CommandList::GenerateMips_UAV(Texture & texture, DXGI_FORMAT format) Line 550	
 Tutorial4.exe!CommandList::GenerateMips(Texture & texture) Line 472	
 Tutorial4.exe!CommandList::GenerateMips(Texture & texture) Line 359	
 Tutorial4.exe!CommandList::LoadTextureFromFile(Texture & texture, const std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > & fileName, TextureUsage textureUsage) Line 346	
 Tutorial4.exe!Tutorial4::LoadContent() Line 195	

Minimal example to reproduce "D3D12_RESOURCE_STATES has bits that mismatch support required from D3D12_RESOURCE_FLAGS" Error

On Monday we were tracking a bug where loading the textures for a mesh would randomly cause the DirectX error: D3D12_RESOURCE_STATES has bits that mismatch support required from D3D12_RESOURCE_FLAGS.

I found a minimal way to reproduce this error. Firstly, write a simple loop (I put this in Tutorial3::LoadContent() ):

auto commandQueue = Application::Get().GetCommandQueue(D3D12_COMMAND_LIST_TYPE_COPY);
Texture dummyTextures[20];
for (int i = 0; i < 20; ++i)
{
	auto commandList = commandQueue->GetCommandList();
	commandList->LoadTextureFromFile(dummyTextures[i], L"Assets/Textures/Directx9.png");
	auto fenceVal = commandQueue->ExecuteCommandList(commandList);
	commandQueue->WaitForFenceValue(fenceVal);
}

THEN you need to disable the cache check in CommandList::LoadTextureFromFile() so you are actually emulating loading a lot of different textures after each other. Otherwise the command doesn't do anything on the gpu.

    ...
    auto iter = ms_TextureCache.find( fileName );
    if ( false /*iter != ms_TextureCache.end()*/ )
    {
        texture.SetTextureUsage(textureUsage);
        texture.SetD3D12Resource(iter->second);
        texture.CreateViews();
        texture.SetName(fileName);
    }
    else
    {
        TexMetadata metadata;
        ....

Then after usually ~5 iterations you will get the same error we know and love:

D3D12 ERROR: ID3D12CommandList::ResourceBarrier: D3D12_RESOURCE_STATES has bits that mismatch support required from D3D12_RESOURCE_FLAGS. [ RESOURCE_MANIPULATION ERROR #524: RESOURCE_BARRIER_MISMATCHING_MISC_FLAGS]
D3D12: **BREAK** enabled for the previous message, which was: [ ERROR RESOURCE_MANIPULATION #524: RESOURCE_BARRIER_MISMATCHING_MISC_FLAGS ]
Exception thrown at 0x00007FFF3DDAA388 (KernelBase.dll) in EngineLyra.exe: 0x0000087A (parameters: 0x0000000000000001, 0x000000B3B31F5470, 0x000000B3B31F7370).
Unhandled exception at 0x00007FFF3DDAA388 (KernelBase.dll) in EngineLyra.exe: 0x0000087A (parameters: 0x0000000000000001, 0x000000B3B31F5470, 0x000000B3B31F7370).

This makes me suspect that there is some unsafe deletions being made. You mentioned that the cleanup for staging resources and other temporary resources happens on a seperate thread. Perhaps something is not fully thread safe. I will do more debugging tomorrow to find out more.

Crash after minimizing the window

When minimizing the window, the width and height are set to zero and then it tries to resize the RTV to zero which causes an issue on resizing the textures. Making sure that the width and height will not get below 1 in the resize event args will resolve this problem.

WARP

When I set g_UseWarp = falseand build and run the program it will crash if I push "alt + enter" many times to go in the borderless state and back but it works perfectly when I set g_UseWarp = true
do you know exactly why?

The GenerateProjectFiles.bat crash with VS2022

I got the following error message and not sure how to resolve it:
Severity Code Description Project File Line Suppression State
Error CMake Error:
Running

'C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe' '-C' 'C:/Users/mt_la/source/repos/LearningDirectX12/out/build/x64-Debug' '-t' 'recompact'

failed with:

ninja: error: build.ninja:3588: bad $-escape (literal $ must be written as $$) C:\Users\mt_la\source\repos\LearningDirectX12\ ninja

I added the following but still not working:
IF %VS_VERSION% == 17 (
SET CMAKE_GENERATOR="Visual Studio 17 2022"
SET CMAKE_BINARY_DIR=build_vs2022
) ELSE IF %VS_VERSION% == 16 (
SET CMAKE_GENERATOR="Visua ...

Read Access Violation in Window::RegisterCallbacks()

Hi,

I am getting a read access violation when I reach this line;

`void Window::RegisterCallbacks(std::shared_ptr arg_pGame)
{
m_pGame = arg_pGame; //Read Access violation here

return;

}
`
I am new to this, but my hunch is that since we are passing it "shared_from_this", it may not be move assignable. I could be completely wrong too.

How would I fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.