I just want to change the cull mode CullMode.Back to CullMode.Front though, I can not make it with CommandBuffer.DrawRendererList() new RendererList sytem function. Since there is no parameter in the parameter list that receive RenderStateBlock in CreateDrawingSetteing() function, I have to set RenderStateBlock to param.stateBlocks manually(this is real weired isn’t it?).
Used to be Context.DrawRenderers() function had the parameter as;
// Before URP 16
context.DrawRenderers(renderingData.cullResults, ref drawSettings, ref _filteringSettings, ref _renderStateBlock);
Now URP16 RendererList system, what I guessed and tried is as follows,
_renderStateBlock = new RenderStateBlock(RenderStateMask.Raster);
_renderStateBlock.rasterState = new RasterState(cullingMode: CullMode.Front, offsetUnits: 0, offsetFactor: 0, depthClip: true);
.
.
.
var sortingCriteria = _isOpaque ? renderingData.cameraData.defaultOpaqueSortFlags : SortingCriteria.CommonTransparent;
var drawSettings = CreateDrawingSettings(_shaderTagIdList, ref renderingData, sortingCriteria);
RendererListParams param = new RendererListParams(renderingData.cullResults, drawSettings, _filteringSettings );
NativeArray<RenderStateBlock> blocks = new NativeArray<RenderStateBlock>( 1, Allocator.Temp );
blocks[0] = _renderStateBlock;
param.stateBlocks = blocks;
RendererList rendererList = context.CreateRendererList(ref param);
cmd.DrawRendererList(rendererList);
This code brings exception that tagValue seems to be not initialized even though the tagName passed to drawSettings propery.
So, I want to know proper way to set RenderStateBlock for DrawRendererList function.