mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 05:28:05 +02:00
anv/device: Remove some #ifdef'd out code
This was a left-over from the dynamic state update.
This commit is contained in:
parent
010c6efd65
commit
982466aeff
1 changed files with 0 additions and 177 deletions
|
|
@ -1774,183 +1774,6 @@ void anv_UpdateDescriptorSets(
|
|||
}
|
||||
}
|
||||
|
||||
// State object functions
|
||||
|
||||
#if 0
|
||||
|
||||
static inline int64_t
|
||||
clamp_int64(int64_t x, int64_t min, int64_t max)
|
||||
{
|
||||
if (x < min)
|
||||
return min;
|
||||
else if (x < max)
|
||||
return x;
|
||||
else
|
||||
return max;
|
||||
}
|
||||
|
||||
VkResult anv_CreateDynamicViewportState(
|
||||
VkDevice _device,
|
||||
const VkDynamicViewportStateCreateInfo* pCreateInfo,
|
||||
VkDynamicViewportState* pState)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
struct anv_dynamic_vp_state *state;
|
||||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DYNAMIC_VIEWPORT_STATE_CREATE_INFO);
|
||||
|
||||
state = anv_device_alloc(device, sizeof(*state), 8,
|
||||
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
||||
if (state == NULL)
|
||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
unsigned count = pCreateInfo->viewportAndScissorCount;
|
||||
state->sf_clip_vp = anv_state_pool_alloc(&device->dynamic_state_pool,
|
||||
count * 64, 64);
|
||||
state->cc_vp = anv_state_pool_alloc(&device->dynamic_state_pool,
|
||||
count * 8, 32);
|
||||
state->scissor = anv_state_pool_alloc(&device->dynamic_state_pool,
|
||||
count * 32, 32);
|
||||
|
||||
for (uint32_t i = 0; i < pCreateInfo->viewportAndScissorCount; i++) {
|
||||
const VkViewport *vp = &pCreateInfo->pViewports[i];
|
||||
const VkRect2D *s = &pCreateInfo->pScissors[i];
|
||||
|
||||
/* The gen7 state struct has just the matrix and guardband fields, the
|
||||
* gen8 struct adds the min/max viewport fields. */
|
||||
struct GEN8_SF_CLIP_VIEWPORT sf_clip_viewport = {
|
||||
.ViewportMatrixElementm00 = vp->width / 2,
|
||||
.ViewportMatrixElementm11 = vp->height / 2,
|
||||
.ViewportMatrixElementm22 = (vp->maxDepth - vp->minDepth) / 2,
|
||||
.ViewportMatrixElementm30 = vp->originX + vp->width / 2,
|
||||
.ViewportMatrixElementm31 = vp->originY + vp->height / 2,
|
||||
.ViewportMatrixElementm32 = (vp->maxDepth + vp->minDepth) / 2,
|
||||
.XMinClipGuardband = -1.0f,
|
||||
.XMaxClipGuardband = 1.0f,
|
||||
.YMinClipGuardband = -1.0f,
|
||||
.YMaxClipGuardband = 1.0f,
|
||||
.XMinViewPort = vp->originX,
|
||||
.XMaxViewPort = vp->originX + vp->width - 1,
|
||||
.YMinViewPort = vp->originY,
|
||||
.YMaxViewPort = vp->originY + vp->height - 1,
|
||||
};
|
||||
|
||||
struct GEN7_CC_VIEWPORT cc_viewport = {
|
||||
.MinimumDepth = vp->minDepth,
|
||||
.MaximumDepth = vp->maxDepth
|
||||
};
|
||||
|
||||
/* Since xmax and ymax are inclusive, we have to have xmax < xmin or
|
||||
* ymax < ymin for empty clips. In case clip x, y, width height are all
|
||||
* 0, the clamps below produce 0 for xmin, ymin, xmax, ymax, which isn't
|
||||
* what we want. Just special case empty clips and produce a canonical
|
||||
* empty clip. */
|
||||
static const struct GEN7_SCISSOR_RECT empty_scissor = {
|
||||
.ScissorRectangleYMin = 1,
|
||||
.ScissorRectangleXMin = 1,
|
||||
.ScissorRectangleYMax = 0,
|
||||
.ScissorRectangleXMax = 0
|
||||
};
|
||||
|
||||
const int max = 0xffff;
|
||||
struct GEN7_SCISSOR_RECT scissor = {
|
||||
/* Do this math using int64_t so overflow gets clamped correctly. */
|
||||
.ScissorRectangleYMin = clamp_int64(s->offset.y, 0, max),
|
||||
.ScissorRectangleXMin = clamp_int64(s->offset.x, 0, max),
|
||||
.ScissorRectangleYMax = clamp_int64((uint64_t) s->offset.y + s->extent.height - 1, 0, max),
|
||||
.ScissorRectangleXMax = clamp_int64((uint64_t) s->offset.x + s->extent.width - 1, 0, max)
|
||||
};
|
||||
|
||||
GEN8_SF_CLIP_VIEWPORT_pack(NULL, state->sf_clip_vp.map + i * 64, &sf_clip_viewport);
|
||||
GEN7_CC_VIEWPORT_pack(NULL, state->cc_vp.map + i * 32, &cc_viewport);
|
||||
|
||||
if (s->extent.width <= 0 || s->extent.height <= 0) {
|
||||
GEN7_SCISSOR_RECT_pack(NULL, state->scissor.map + i * 32, &empty_scissor);
|
||||
} else {
|
||||
GEN7_SCISSOR_RECT_pack(NULL, state->scissor.map + i * 32, &scissor);
|
||||
}
|
||||
}
|
||||
|
||||
*pState = anv_dynamic_vp_state_to_handle(state);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
void anv_DestroyDynamicViewportState(
|
||||
VkDevice _device,
|
||||
VkDynamicViewportState _vp_state)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
ANV_FROM_HANDLE(anv_dynamic_vp_state, vp_state, _vp_state);
|
||||
|
||||
anv_state_pool_free(&device->dynamic_state_pool, vp_state->sf_clip_vp);
|
||||
anv_state_pool_free(&device->dynamic_state_pool, vp_state->cc_vp);
|
||||
anv_state_pool_free(&device->dynamic_state_pool, vp_state->scissor);
|
||||
|
||||
anv_device_free(device, vp_state);
|
||||
}
|
||||
|
||||
void anv_DestroyDynamicRasterState(
|
||||
VkDevice _device,
|
||||
VkDynamicRasterState _rs_state)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
ANV_FROM_HANDLE(anv_dynamic_rs_state, rs_state, _rs_state);
|
||||
|
||||
anv_device_free(device, rs_state);
|
||||
}
|
||||
|
||||
VkResult anv_CreateDynamicColorBlendState(
|
||||
VkDevice _device,
|
||||
const VkDynamicColorBlendStateCreateInfo* pCreateInfo,
|
||||
VkDynamicColorBlendState* pState)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
struct anv_dynamic_cb_state *state;
|
||||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DYNAMIC_COLOR_BLEND_STATE_CREATE_INFO);
|
||||
|
||||
state = anv_device_alloc(device, sizeof(*state), 8,
|
||||
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
||||
if (state == NULL)
|
||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
struct GEN7_COLOR_CALC_STATE color_calc_state = {
|
||||
.BlendConstantColorRed = pCreateInfo->blendConst[0],
|
||||
.BlendConstantColorGreen = pCreateInfo->blendConst[1],
|
||||
.BlendConstantColorBlue = pCreateInfo->blendConst[2],
|
||||
.BlendConstantColorAlpha = pCreateInfo->blendConst[3]
|
||||
};
|
||||
|
||||
GEN7_COLOR_CALC_STATE_pack(NULL, state->color_calc_state, &color_calc_state);
|
||||
|
||||
*pState = anv_dynamic_cb_state_to_handle(state);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
void anv_DestroyDynamicColorBlendState(
|
||||
VkDevice _device,
|
||||
VkDynamicColorBlendState _cb_state)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
ANV_FROM_HANDLE(anv_dynamic_cb_state, cb_state, _cb_state);
|
||||
|
||||
anv_device_free(device, cb_state);
|
||||
}
|
||||
|
||||
void anv_DestroyDynamicDepthStencilState(
|
||||
VkDevice _device,
|
||||
VkDynamicDepthStencilState _ds_state)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
ANV_FROM_HANDLE(anv_dynamic_ds_state, ds_state, _ds_state);
|
||||
|
||||
anv_device_free(device, ds_state);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
VkResult anv_CreateFramebuffer(
|
||||
VkDevice _device,
|
||||
const VkFramebufferCreateInfo* pCreateInfo,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue