Skip to content

Instantly share code, notes, and snippets.

View shorttermmem's full-sized avatar
🎯
Focusing

stm shorttermmem

🎯
Focusing
View GitHub Profile
def permute_all(a, l, r):
if l==r:
print("".join(a))
else:
for i in range(l,r+1):
a[l], a[i] = a[i], a[l]
permute_all(a, l+1, r)
a[l], a[i] = a[i], a[l] # backtrack
# Driver program to test the above function
@shorttermmem
shorttermmem / tree_lca.cc
Created March 25, 2019 23:15
LEETCODE 30
#include <stdio.h>
//**
// Definition for a binary tree node.
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
};
short* p = (short *)&(pDstResource);
std::wstring pointer = L"\t 0x" + std::to_wstring(*p) + L" - ";
OutputDebugStringW(pointer.c_str());
@shorttermmem
shorttermmem / rootsignature.error
Last active January 4, 2024 20:02
Common root signature errors compilation.
Root Signature doesn't match Compute Shader: A Shader is declaring a resource object as a texture using a register mapped to a root descriptor SRV (RegisterSpace=0, ShaderRegister=0).
SRV or UAV root descriptors can only be Raw or Structured buffers.
[ STATE_CREATION ERROR #882: CREATECOMPUTEPIPELINESTATE_CS_ROOT_SIGNATURE_MISMATCH]
When binding a texture object directly to root signature rather than through descriptor table.
D3D12 CORRUPTION: ID3D12CommandList::CopyTextureRegion: pResource in the first parameter is corrupt. [ MISCELLANEOUS CORRUPTION #3: CORRUPTED_PARAMETER1]
@shorttermmem
shorttermmem / CMakeList.txt
Created May 16, 2018 16:59
Sample cmake script
##################################################
# run this script
cmake -DWIN32 -P CMakeList.txt
##################################################
# control flow
if(WIN32)
message("You are running on Windows.")
endif
@shorttermmem
shorttermmem / .gitconfig
Last active January 30, 2018 05:29
Everything Git!
[user]
name = my name
email = me@example.com
[core]
editor = vi
[alias]
aa = add --all
bv = branch -vv
ba = branch -ra
bd = branch -d
@shorttermmem
shorttermmem / DrawObjectsForView
Created March 1, 2015 21:16
Example snippet for drawing all subsets.
for (UINT subset = 0; subset < m_Mesh.GetNumSubsets(0); ++subset)
{
// Get the subset
auto pSubset = m_Mesh.GetSubset(0, subset);
auto PrimType = CDXUTSDKMesh::GetPrimitiveType11((SDKMESH_PRIMITIVE_TYPE)pSubset->PrimitiveType);
pd3dImmediateContext->IASetPrimitiveTopology(PrimType);
// Ignores most of the material information in them mesh to use only a simple shader
auto pDiffuseRV = m_Mesh.GetMaterial(pSubset->MaterialID)->pDiffuseRV11;