File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -117,23 +117,19 @@ void CTexture::surface_set(ID3DBaseTexture* surf)
117117 _RELEASE (srv_all);
118118 CHK_DX (HW.pDevice ->CreateShaderResourceView (pSurface, &ViewDesc, &srv_all));
119119
120+ if (desc.SampleDesc .Count <= 1 )
121+ ViewDesc.Texture2DArray .ArraySize = desc.ArraySize ;
122+ else
123+ ViewDesc.Texture2DMSArray .ArraySize = desc.ArraySize ;
124+
120125 srv_per_slice.resize (desc.ArraySize );
121- for (u32 id = 0 ; id < desc. ArraySize ; ++id )
126+ for (auto &x : srv_per_slice )
122127 {
123- _RELEASE (srv_per_slice[id]);
124-
125- if (desc.SampleDesc .Count <= 1 )
126- {
127- ViewDesc.Texture2DArray .ArraySize = 1 ;
128- ViewDesc.Texture2DArray .FirstArraySlice = id;
129- }
130- else
131- {
132- ViewDesc.Texture2DMSArray .ArraySize = 1 ;
133- ViewDesc.Texture2DMSArray .FirstArraySlice = id;
134- }
135- CHK_DX (HW.pDevice ->CreateShaderResourceView (pSurface, &ViewDesc, &srv_per_slice[id]));
128+ x->Release ();
129+ x = nullptr ;
136130 }
131+ CHK_DX (HW.pDevice ->CreateShaderResourceView (pSurface, &ViewDesc, srv_per_slice.data ()));
132+
137133 set_slice (-1 );
138134 }
139135 else
You can’t perform that action at this time.
0 commit comments