port from perforce
This commit is contained in:
774
hgplus/obliterator/b288.asm
Normal file
774
hgplus/obliterator/b288.asm
Normal file
@@ -0,0 +1,774 @@
|
||||
; b288.asm - las/mercury
|
||||
[BITS 32]
|
||||
;---
|
||||
%define WIDTH 1280
|
||||
%define HEIGHT 720
|
||||
%ifdef DEBUG
|
||||
%else
|
||||
;%define FULLSCREEN
|
||||
%endif
|
||||
;---
|
||||
%include "inc/macros.inc"
|
||||
%include "inc/windows.inc"
|
||||
%include "inc/dxgi.inc"
|
||||
%include "inc/d3d11.inc"
|
||||
;---
|
||||
%define SAMPLE_RATE 44100
|
||||
%define MAX_INSTRUMENTS 13
|
||||
%define MAX_VOICES 2
|
||||
%define HLD 1
|
||||
%define BPM 135.110291
|
||||
%define MAX_PATTERNS 137
|
||||
%define PATTERN_SIZE_SHIFT 3
|
||||
%define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
|
||||
%define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
|
||||
%define SAMPLES_PER_TICK 4896
|
||||
%define DEF_LFO_NORMALIZE 0.0000510621
|
||||
%define MAX_SAMPLES (SAMPLES_PER_TICK*MAX_TICKS)
|
||||
extern __4klang_render@4
|
||||
;---
|
||||
struc TEXTURE_2D_SRV_UAV_RTV
|
||||
.TEX: resd 1
|
||||
.SRV: resd 1
|
||||
.UAV: resd 1
|
||||
.RTV: resd 1
|
||||
endstruc
|
||||
;---
|
||||
DATA_SECTION WFMTEX
|
||||
_waveFormatEx:
|
||||
istruc WAVEFORMATEX
|
||||
at WAVEFORMATEX.wFormatTag, dw WAVE_FORMAT_IEEE_FLOAT
|
||||
at WAVEFORMATEX.nChannels, dw 2
|
||||
at WAVEFORMATEX.nSamplesPerSec, dd 44100
|
||||
at WAVEFORMATEX.nAvgBytesPerSec, dd 44100*4*2
|
||||
at WAVEFORMATEX.nBlockAlign, dw 4*2
|
||||
at WAVEFORMATEX.wBitsPerSample, dw 4*8
|
||||
at WAVEFORMATEX.cbSize, dw 0
|
||||
iend
|
||||
|
||||
DATA_SECTION WHDR
|
||||
_waveHdr:
|
||||
istruc WAVEHDR
|
||||
at WAVEHDR.lpData, dd _sndBuffer
|
||||
at WAVEHDR.dwBufferLength, dd _sndBufferEnd-_sndBuffer
|
||||
at WAVEHDR.dwBytesRecorded, dd 0
|
||||
at WAVEHDR.dwUser, dd 0
|
||||
at WAVEHDR.dwFlags, dd WHDR_PREPARED
|
||||
at WAVEHDR.dwLoops, dd 0
|
||||
at WAVEHDR.lpNext, dd 0
|
||||
at WAVEHDR.reserved, dd 0
|
||||
iend
|
||||
|
||||
DATA_SECTION TIME
|
||||
_mmTime:
|
||||
istruc MMTIME
|
||||
at MMTIME.wType, dd TIME_SAMPLES
|
||||
at MMTIME.data, dd 0
|
||||
iend
|
||||
|
||||
DATA_SECTION SC_DESC
|
||||
_swapChainDesc:
|
||||
istruc DXGI_SWAP_CHAIN_DESC
|
||||
at DXGI_SWAP_CHAIN_DESC.BufferDesc.Width, dd WIDTH
|
||||
at DXGI_SWAP_CHAIN_DESC.BufferDesc.Height, dd HEIGHT
|
||||
at DXGI_SWAP_CHAIN_DESC.BufferDesc.RefreshRate.Numerator, dd 0
|
||||
at DXGI_SWAP_CHAIN_DESC.BufferDesc.RefreshRate.Denominator, dd 1
|
||||
at DXGI_SWAP_CHAIN_DESC.BufferDesc.Format, dd DXGI_FORMAT_R8G8B8A8_UNORM ; DXGI_FORMAT_R16G16B16A16_FLOAT
|
||||
at DXGI_SWAP_CHAIN_DESC.BufferDesc.ScanlineOrdering, dd DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED
|
||||
at DXGI_SWAP_CHAIN_DESC.BufferDesc.Scaling, dd DXGI_MODE_SCALING_UNSPECIFIED
|
||||
at DXGI_SWAP_CHAIN_DESC.SampleDesc.Count, dd 1
|
||||
at DXGI_SWAP_CHAIN_DESC.SampleDesc.Quality, dd 0
|
||||
at DXGI_SWAP_CHAIN_DESC.BufferUsage, dd DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_UNORDERED_ACCESS | DXGI_USAGE_SHADER_INPUT
|
||||
at DXGI_SWAP_CHAIN_DESC.BufferCount, dd 1
|
||||
at DXGI_SWAP_CHAIN_DESC.OutputWindow, dd 0
|
||||
%ifdef FULLSCREEN
|
||||
at DXGI_SWAP_CHAIN_DESC.Windowed, dd 0
|
||||
%else
|
||||
at DXGI_SWAP_CHAIN_DESC.Windowed, dd 0xffffffff
|
||||
%endif
|
||||
at DXGI_SWAP_CHAIN_DESC.SwapEffect, dd DXGI_SWAP_EFFECT_DISCARD
|
||||
at DXGI_SWAP_CHAIN_DESC.Flags, dd 0
|
||||
iend
|
||||
|
||||
DATA_SECTION TEX_DESC
|
||||
_textureDesc:
|
||||
istruc D3D11_TEXTURE2D_DESC
|
||||
at D3D11_TEXTURE2D_DESC.Width, dd 0
|
||||
at D3D11_TEXTURE2D_DESC.Height, dd 0
|
||||
at D3D11_TEXTURE2D_DESC.MipLevels, dd 0
|
||||
at D3D11_TEXTURE2D_DESC.ArraySize, dd 1
|
||||
at D3D11_TEXTURE2D_DESC.Format, dd DXGI_FORMAT_R16G16B16A16_FLOAT
|
||||
at D3D11_TEXTURE2D_DESC.SampleDesc.Count, dd 1
|
||||
at D3D11_TEXTURE2D_DESC.SampleDesc.Quality, dd 0
|
||||
at D3D11_TEXTURE2D_DESC.Usage, dd D3D11_USAGE_DEFAULT
|
||||
at D3D11_TEXTURE2D_DESC.BindFlags, dd D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS
|
||||
at D3D11_TEXTURE2D_DESC.CPUAccessFlags, dd 0
|
||||
at D3D11_TEXTURE2D_DESC.MiscFlags, dd D3D11_RESOURCE_MISC_GENERATE_MIPS
|
||||
iend
|
||||
|
||||
DATA_SECTION CD_DESC
|
||||
_constantBufferDesc:
|
||||
istruc D3D11_BUFFER_DESC
|
||||
at D3D11_BUFFER_DESC.ByteWidth, dd 64
|
||||
at D3D11_BUFFER_DESC.Usage, dd D3D11_USAGE_DYNAMIC
|
||||
at D3D11_BUFFER_DESC.BindFlags, dd D3D11_BIND_CONSTANT_BUFFER
|
||||
at D3D11_BUFFER_DESC.CPUAccessFlags, dd D3D11_CPU_ACCESS_WRITE
|
||||
at D3D11_BUFFER_DESC.MiscFlags, dd 0
|
||||
at D3D11_BUFFER_DESC.StructureByteStride, dd 0
|
||||
iend
|
||||
|
||||
DATA_SECTION IB_DESC:
|
||||
|
||||
_indirectDispatchBufferDesc:
|
||||
istruc D3D11_BUFFER_DESC
|
||||
at D3D11_BUFFER_DESC.ByteWidth, dd _indirectDispatchBufferInitialDataEnd - _indirectDispatchBufferInitialData
|
||||
at D3D11_BUFFER_DESC.Usage, dd D3D11_USAGE_DEFAULT
|
||||
at D3D11_BUFFER_DESC.BindFlags, dd D3D11_BIND_UNORDERED_ACCESS
|
||||
at D3D11_BUFFER_DESC.CPUAccessFlags, dd 0
|
||||
at D3D11_BUFFER_DESC.MiscFlags, dd D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS
|
||||
at D3D11_BUFFER_DESC.StructureByteStride, dd 16
|
||||
iend
|
||||
|
||||
DATA_SECTION IB_UAV
|
||||
_indirectDispatchBufferUAVDesc:
|
||||
istruc D3D11_UNORDERED_ACCESS_VIEW_DESC
|
||||
at D3D11_UNORDERED_ACCESS_VIEW_DESC.Format, dd DXGI_FORMAT_R32G32B32A32_UINT
|
||||
at D3D11_UNORDERED_ACCESS_VIEW_DESC.ViewDimension, dd D3D11_UAV_DIMENSION_BUFFER
|
||||
at D3D11_UNORDERED_ACCESS_VIEW_DESC.Buffer.FirstElement, dd 0
|
||||
at D3D11_UNORDERED_ACCESS_VIEW_DESC.Buffer.NumElements, dd (_indirectDispatchBufferInitialDataEnd - _indirectDispatchBufferInitialData)/16
|
||||
at D3D11_UNORDERED_ACCESS_VIEW_DESC.Buffer.Flags, dd 0
|
||||
iend
|
||||
|
||||
DATA_SECTION IB_PTR
|
||||
_indirectDispatchBufferSubresourceData:
|
||||
istruc D3D11_SUBRESOURCE_DATA
|
||||
at D3D11_SUBRESOURCE_DATA.pSysMem, dd _indirectDispatchBufferInitialData
|
||||
at D3D11_SUBRESOURCE_DATA.SysMemPitch, dd 0
|
||||
at D3D11_SUBRESOURCE_DATA.SysMemSlicePitch, dd 0
|
||||
iend
|
||||
|
||||
DATA_SECTION IB_INIT
|
||||
_indirectDispatchBufferInitialData:
|
||||
dd 1, 1, 1, 0 ; MCP
|
||||
_zeros:
|
||||
dd 0, 0, 0, 0 ; Scene0
|
||||
dd 0, 0, 0, 0 ; Scene1
|
||||
dd 0, 0, 0, 0 ; Scene2
|
||||
dd 0, 0, 0, 0 ; Scene3
|
||||
dd 0, 0, 0, 0 ; Scene4
|
||||
dd 0, 0, 0, 0 ; Streaks
|
||||
dd 0, 0, 0, 0 ; Blur
|
||||
dd 0, 0, 0, 0 ; Blur
|
||||
dd 0, 0, 0, 0 ; Blur
|
||||
dd 0, 0, 0, 0 ; Blur
|
||||
dd 0, 0, 0, 0 ; Blur
|
||||
dd 0, 0, 0, 0 ; Blur
|
||||
dd 0, 0, 0, 0 ; Merge
|
||||
_indirectDispatchBufferInitialDataEnd:
|
||||
|
||||
DATA_SECTION SAM_DESC
|
||||
_samplerDesc:
|
||||
istruc D3D11_SAMPLER_DESC
|
||||
at D3D11_SAMPLER_DESC.Filter, dd D3D11_FILTER_MIN_MAG_MIP_LINEAR
|
||||
at D3D11_SAMPLER_DESC.AddressU, dd D3D11_TEXTURE_ADDRESS_CLAMP
|
||||
at D3D11_SAMPLER_DESC.AddressV, dd D3D11_TEXTURE_ADDRESS_CLAMP
|
||||
at D3D11_SAMPLER_DESC.AddressW, dd D3D11_TEXTURE_ADDRESS_CLAMP
|
||||
at D3D11_SAMPLER_DESC.MipLODBias, dd 0
|
||||
at D3D11_SAMPLER_DESC.MaxAnisotropy, dd 1
|
||||
at D3D11_SAMPLER_DESC.ComparisonFunc, dd D3D11_COMPARISON_ALWAYS
|
||||
at D3D11_SAMPLER_DESC.BorderColor, dd 0, 0, 0, 0
|
||||
at D3D11_SAMPLER_DESC.MinLOD, dd 0
|
||||
at D3D11_SAMPLER_DESC.MaxLOD, dd 0x7f7fffff
|
||||
iend
|
||||
|
||||
DATA_SECTION UUID
|
||||
_uuidTexture2D:
|
||||
dd 0x6f15aaf2
|
||||
dw 0xd208
|
||||
dw 0x4e89
|
||||
db 0x9a,0xb4,0x48,0x95,0x35,0xd3,0x4f,0x9c
|
||||
|
||||
DATA_SECTION SHADER
|
||||
%define SHADER_ID_POSITION 20
|
||||
_src:
|
||||
incbin "gpu/b288.inc"
|
||||
db 0
|
||||
_srcEnd:
|
||||
_target:
|
||||
db "cs_5"
|
||||
_entrypoint:
|
||||
db "_0", 0
|
||||
_null:
|
||||
dd 0
|
||||
|
||||
BSS_SECTION SND
|
||||
_sndBuffer: resd MAX_SAMPLES*2
|
||||
_sndBufferEnd:
|
||||
_waveHandle: resd 1024
|
||||
|
||||
BSS_SECTION D3D
|
||||
_device: resd 1
|
||||
_context: resd 1
|
||||
_swapChain: resd 1
|
||||
|
||||
_backBufferTexture: resd 1
|
||||
_backBufferUAV: resd 1
|
||||
|
||||
_sampler: resd 1
|
||||
|
||||
_constantBuffer: resd 1
|
||||
_mappedResource: resb D3D11_MAPPED_SUBRESOURCE_size
|
||||
|
||||
_indirectDispatchBuffer: resd 1
|
||||
_indirectDispatchBufferUAV: resd 1
|
||||
|
||||
_blob: resd 1
|
||||
|
||||
BSS_SECTION CS
|
||||
_computeShaders:
|
||||
_scene4: resd 1
|
||||
_scene3: resd 1
|
||||
_scene2: resd 1
|
||||
_scene1: resd 1
|
||||
_scene0: resd 1
|
||||
_merge: resd 1
|
||||
_streaks: resd 1
|
||||
_blur1: resd 1
|
||||
_blur0: resd 1
|
||||
_mcp: resd 1
|
||||
_computeShadersEnd:
|
||||
|
||||
BSS_SECTION RES
|
||||
_textureSRVUAVRTV: resb TEXTURE_2D_SRV_UAV_RTV_size
|
||||
|
||||
_tmpTexture1SRVUAVRTV: resb TEXTURE_2D_SRV_UAV_RTV_size
|
||||
_blurTexture1SRVUAVRTV: resb TEXTURE_2D_SRV_UAV_RTV_size
|
||||
|
||||
_tmpTexture8SRVUAVRTV: resb TEXTURE_2D_SRV_UAV_RTV_size
|
||||
_blurTexture8SRVUAVRTV: resb TEXTURE_2D_SRV_UAV_RTV_size
|
||||
|
||||
_tmpTexture32SRVUAVRTV: resb TEXTURE_2D_SRV_UAV_RTV_size
|
||||
_blurTexture32SRVUAVRTV: resb TEXTURE_2D_SRV_UAV_RTV_size
|
||||
|
||||
_streaks4SRVUAVRTV: resb TEXTURE_2D_SRV_UAV_RTV_size
|
||||
|
||||
|
||||
TEXT_SECTION SUR
|
||||
_createSRVUAVRTV: ; target, width, height
|
||||
pop eax
|
||||
pop edi
|
||||
pop dword [_textureDesc + D3D11_TEXTURE2D_DESC.Height]
|
||||
pop dword [_textureDesc + D3D11_TEXTURE2D_DESC.Width]
|
||||
push eax
|
||||
|
||||
lea eax, [edi + TEXTURE_2D_SRV_UAV_RTV.TEX]
|
||||
push eax
|
||||
push byte 0
|
||||
push dword _textureDesc
|
||||
com _device, ID3D11Device.CreateTexture2D
|
||||
|
||||
lea eax, [edi + TEXTURE_2D_SRV_UAV_RTV.SRV]
|
||||
push eax
|
||||
push byte 0
|
||||
push dword [edi + TEXTURE_2D_SRV_UAV_RTV.TEX]
|
||||
com _device, ID3D11Device.CreateShaderResourceView
|
||||
|
||||
lea eax, [edi + TEXTURE_2D_SRV_UAV_RTV.UAV]
|
||||
push eax
|
||||
push byte 0
|
||||
push dword [edi + TEXTURE_2D_SRV_UAV_RTV.TEX]
|
||||
com _device, ID3D11Device.CreateUnorderedAccessView
|
||||
|
||||
lea eax, [edi + TEXTURE_2D_SRV_UAV_RTV.RTV]
|
||||
push eax
|
||||
push byte 0
|
||||
push dword [edi + TEXTURE_2D_SRV_UAV_RTV.TEX]
|
||||
com _device, ID3D11Device.CreateRenderTargetView
|
||||
ret
|
||||
|
||||
TEXT_SECTION PIPELINE
|
||||
_run:
|
||||
push dword _mappedResource
|
||||
push byte 0
|
||||
push byte D3D11_MAP_WRITE_DISCARD
|
||||
push byte 0
|
||||
push dword [_constantBuffer]
|
||||
com _context, ID3D11DeviceContext.Map
|
||||
|
||||
mov eax, [_mappedResource+D3D11_MAPPED_SUBRESOURCE.pData]
|
||||
push dword 44100
|
||||
fild dword [_mmTime + MMTIME.data]
|
||||
fidiv dword [esp]
|
||||
fstp dword [eax]
|
||||
pop eax
|
||||
|
||||
push byte 0
|
||||
push dword [_constantBuffer]
|
||||
com _context, ID3D11DeviceContext.Unmap
|
||||
|
||||
push dword _constantBuffer
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetConstantBuffers
|
||||
|
||||
push dword [_indirectDispatchBufferUAV]
|
||||
push dword [_textureSRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.UAV]
|
||||
mov eax, esp
|
||||
push byte 0
|
||||
push eax
|
||||
push byte 2
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetUnorderedAccessViews
|
||||
add esp, byte 8
|
||||
|
||||
; MCP
|
||||
push dword 16*0
|
||||
push dword [_indirectDispatchBuffer]
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_mcp]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
; SCENES
|
||||
; 0
|
||||
push dword 16*1
|
||||
push dword [_indirectDispatchBuffer]
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_scene0]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
; 1
|
||||
push dword 16*2
|
||||
push dword [_indirectDispatchBuffer]
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_scene1]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
; 2
|
||||
push dword 16*3
|
||||
push dword [_indirectDispatchBuffer]
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_scene2]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
; 3
|
||||
push dword 16*4
|
||||
push dword [_indirectDispatchBuffer]
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_scene3]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
; 4
|
||||
push byte 16*5
|
||||
push dword [_indirectDispatchBuffer]
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_scene4]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
push dword [_textureSRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV]
|
||||
com _context, ID3D11DeviceContext.GenerateMips
|
||||
|
||||
; STREAKS
|
||||
push byte 0
|
||||
push dword _streaks4SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.UAV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetUnorderedAccessViews
|
||||
|
||||
push dword _textureSRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetShaderResources
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_streaks]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
|
||||
push dword 16*6
|
||||
push dword [_indirectDispatchBuffer]
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
; BLUR 1
|
||||
; 0
|
||||
push byte 0
|
||||
push dword _tmpTexture1SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.UAV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetUnorderedAccessViews
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_blur0]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
|
||||
push dword 16*7
|
||||
push dword [_indirectDispatchBuffer]
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
; 1
|
||||
push byte 0
|
||||
push dword _blurTexture1SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.UAV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetUnorderedAccessViews
|
||||
|
||||
push dword _tmpTexture1SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetShaderResources
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_blur1]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
|
||||
push dword 16*8
|
||||
push dword [_indirectDispatchBuffer]
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
push dword [_blurTexture1SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV]
|
||||
com _context, ID3D11DeviceContext.GenerateMips
|
||||
|
||||
; BLUR 8
|
||||
; 0
|
||||
push byte 0
|
||||
push dword _tmpTexture8SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.UAV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetUnorderedAccessViews
|
||||
|
||||
push dword _blurTexture1SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetShaderResources
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_blur0]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
|
||||
push dword 16*9
|
||||
push dword [_indirectDispatchBuffer]
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
; 1
|
||||
push byte 0
|
||||
push dword _blurTexture8SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.UAV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetUnorderedAccessViews
|
||||
|
||||
push dword _tmpTexture8SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetShaderResources
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_blur1]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
|
||||
push dword 16*10
|
||||
push dword [_indirectDispatchBuffer]
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
push dword [_blurTexture8SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV]
|
||||
com _context, ID3D11DeviceContext.GenerateMips
|
||||
|
||||
; BLUR 32
|
||||
; 0
|
||||
push byte 0
|
||||
push dword _tmpTexture32SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.UAV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetUnorderedAccessViews
|
||||
|
||||
push dword _blurTexture8SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetShaderResources
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_blur0]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
|
||||
push dword 16*11
|
||||
push dword [_indirectDispatchBuffer]
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
; 1
|
||||
push byte 0
|
||||
push dword _blurTexture32SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.UAV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetUnorderedAccessViews
|
||||
|
||||
push dword _tmpTexture32SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetShaderResources
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_blur1]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
|
||||
push dword 16*12
|
||||
push dword [_indirectDispatchBuffer]
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
push dword [_blurTexture32SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV]
|
||||
com _context, ID3D11DeviceContext.GenerateMips
|
||||
|
||||
; MERGE
|
||||
push byte 0
|
||||
push dword _backBufferUAV
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetUnorderedAccessViews
|
||||
|
||||
push dword [_streaks4SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV]
|
||||
push dword [_blurTexture32SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV]
|
||||
push dword [_blurTexture8SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV]
|
||||
push dword [_blurTexture1SRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV]
|
||||
push dword [_textureSRVUAVRTV + TEXTURE_2D_SRV_UAV_RTV.SRV]
|
||||
push esp
|
||||
push byte 5
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetShaderResources
|
||||
add esp, byte 20
|
||||
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword [_merge]
|
||||
com _context, ID3D11DeviceContext.CSSetShader
|
||||
|
||||
push dword 16*13
|
||||
push dword [_indirectDispatchBuffer]
|
||||
com _context, ID3D11DeviceContext.DispatchIndirect
|
||||
|
||||
push dword _zeros
|
||||
push byte 8
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetShaderResources
|
||||
ret
|
||||
|
||||
TEXT_SECTION MAINLOOP
|
||||
global _start
|
||||
_start:
|
||||
%ifdef FULLSCREEN
|
||||
push byte 0
|
||||
push byte 0
|
||||
push byte 0
|
||||
push byte 0
|
||||
push byte 0
|
||||
push byte 0
|
||||
push byte 0
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword WS_POPUP | WS_VISIBLE | WS_MAXIMIZE
|
||||
push byte 0
|
||||
push dword ATOM_STATIC
|
||||
push byte 0
|
||||
%else
|
||||
push byte 0
|
||||
push byte 0
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword HEIGHT
|
||||
push dword WIDTH
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword WS_POPUP | WS_VISIBLE
|
||||
push byte 0
|
||||
push dword ATOM_STATIC
|
||||
push byte 0
|
||||
%endif
|
||||
call _CreateWindowExA@48
|
||||
mov [_swapChainDesc + DXGI_SWAP_CHAIN_DESC.OutputWindow], eax
|
||||
%ifdef FULLSCREEN
|
||||
call _ShowCursor@4
|
||||
%endif
|
||||
push dword _context
|
||||
push byte 0
|
||||
push dword _device
|
||||
push dword _swapChain
|
||||
push dword _swapChainDesc
|
||||
push byte D3D11_SDK_VERSION
|
||||
push byte 0
|
||||
push byte 0
|
||||
push byte D3D11_CREATE_DEVICE_DEBUG
|
||||
push byte 0
|
||||
push byte D3D_DRIVER_TYPE_HARDWARE
|
||||
push byte 0
|
||||
call _D3D11CreateDeviceAndSwapChain@48
|
||||
|
||||
mov ebx, dword (_computeShadersEnd - _computeShaders)/4-1
|
||||
_compileShader:
|
||||
push byte 0
|
||||
push dword _blob
|
||||
push byte 0
|
||||
push dword D3DCOMPILE_OPTIMIZATION_LEVEL3
|
||||
push dword _target
|
||||
push dword _entrypoint
|
||||
push byte 0
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword _srcEnd-_src
|
||||
push dword _src
|
||||
call _D3DCompile@44
|
||||
|
||||
lea eax, [_computeShaders + ebx*4]
|
||||
push eax
|
||||
push byte 0
|
||||
com _blob, ID3D10Blob.GetBufferSize
|
||||
push eax
|
||||
com _blob, ID3D10Blob.GetBufferPointer
|
||||
push eax
|
||||
com _device, ID3D11Device.CreateComputeShader
|
||||
|
||||
inc byte [_src + SHADER_ID_POSITION]
|
||||
dec ebx
|
||||
jns short _compileShader
|
||||
|
||||
push dword _backBufferTexture
|
||||
push dword _uuidTexture2D
|
||||
push byte 0
|
||||
com _swapChain, IDXGISwapChain.GetBuffer
|
||||
|
||||
push dword _backBufferUAV
|
||||
push byte 0
|
||||
push dword [_backBufferTexture]
|
||||
com _device, ID3D11Device.CreateUnorderedAccessView
|
||||
|
||||
_createIndirectDispatchBuffer:
|
||||
push dword _indirectDispatchBuffer
|
||||
push dword _indirectDispatchBufferSubresourceData
|
||||
push dword _indirectDispatchBufferDesc
|
||||
com _device, ID3D11Device.CreateBuffer
|
||||
|
||||
push dword _indirectDispatchBufferUAV
|
||||
push dword _indirectDispatchBufferUAVDesc
|
||||
push dword [_indirectDispatchBuffer]
|
||||
com _device, ID3D11Device.CreateUnorderedAccessView
|
||||
|
||||
_createConstantBuffer:
|
||||
push dword _constantBuffer
|
||||
push byte 0
|
||||
push dword _constantBufferDesc
|
||||
com _device, ID3D11Device.CreateBuffer
|
||||
|
||||
_createSampler:
|
||||
push dword _sampler
|
||||
push dword _samplerDesc
|
||||
com _device, ID3D11Device.CreateSamplerState
|
||||
|
||||
push dword _sampler
|
||||
push byte 1
|
||||
push byte 0
|
||||
com _context, ID3D11DeviceContext.CSSetSamplers
|
||||
|
||||
_createTextures:
|
||||
push dword WIDTH
|
||||
push dword HEIGHT
|
||||
push dword _textureSRVUAVRTV
|
||||
call _createSRVUAVRTV
|
||||
|
||||
push dword WIDTH
|
||||
push dword HEIGHT
|
||||
push dword _tmpTexture1SRVUAVRTV
|
||||
call _createSRVUAVRTV
|
||||
push dword WIDTH
|
||||
push dword HEIGHT
|
||||
push dword _blurTexture1SRVUAVRTV
|
||||
call _createSRVUAVRTV
|
||||
|
||||
push dword WIDTH/8
|
||||
push dword HEIGHT/8
|
||||
push dword _tmpTexture8SRVUAVRTV
|
||||
call _createSRVUAVRTV
|
||||
push dword WIDTH/8
|
||||
push dword HEIGHT/8
|
||||
push dword _blurTexture8SRVUAVRTV
|
||||
call _createSRVUAVRTV
|
||||
|
||||
push dword WIDTH/32
|
||||
push dword HEIGHT/32
|
||||
push dword _tmpTexture32SRVUAVRTV
|
||||
call _createSRVUAVRTV
|
||||
push dword WIDTH/32
|
||||
push dword HEIGHT/32
|
||||
push dword _blurTexture32SRVUAVRTV
|
||||
call _createSRVUAVRTV
|
||||
|
||||
push dword WIDTH/4
|
||||
push dword HEIGHT/4
|
||||
push dword _streaks4SRVUAVRTV
|
||||
call _createSRVUAVRTV
|
||||
|
||||
_renderAudio:
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword _sndBuffer
|
||||
push dword __4klang_render@4
|
||||
push byte 0
|
||||
push byte 0
|
||||
call _CreateThread@24
|
||||
|
||||
_playAudio:
|
||||
push byte 0
|
||||
push byte 0
|
||||
push byte 0
|
||||
push dword _waveFormatEx
|
||||
push byte WAVE_MAPPER
|
||||
push dword _waveHandle
|
||||
call _waveOutOpen@24
|
||||
|
||||
push byte WAVEHDR_size
|
||||
push dword _waveHdr
|
||||
push dword [_waveHandle]
|
||||
call _waveOutWrite@12
|
||||
|
||||
_mainloop:
|
||||
push byte MMTIME_size
|
||||
push dword _mmTime
|
||||
push dword [_waveHandle]
|
||||
call _waveOutGetPosition@12
|
||||
|
||||
call _run
|
||||
|
||||
push byte 0
|
||||
push byte 1
|
||||
com _swapChain, IDXGISwapChain.Present
|
||||
|
||||
mov eax, dword [_mmTime + MMTIME.data]
|
||||
cmp eax, dword MAX_SAMPLES
|
||||
jae short _end
|
||||
|
||||
push byte VK_ESCAPE
|
||||
call _GetAsyncKeyState@4
|
||||
dec eax
|
||||
js short _mainloop
|
||||
;js _mainloop
|
||||
_end:
|
||||
push eax
|
||||
call _ExitProcess@4
|
||||
Reference in New Issue
Block a user