Changeset 102617 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Dec 15, 2023 5:25:47 PM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-shader.cpp
r99688 r102617 2080 2080 2081 2081 static void dxbcGenerateSemantics(DXShaderInfo *pInfo, uint32_t cSignature, 2082 SVGA3dDXSignatureEntry const*paSignature,2082 SVGA3dDXSignatureEntry *paSignature, 2083 2083 DXShaderAttributeSemantic *paSemantic, 2084 2084 uint32_t u32BlobType); … … 2418 2418 { "SV_IsFrontFace", 1 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_IS_FRONT_FACE 9 2419 2419 { "SV_SampleIndex", 1 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_SAMPLE_INDEX 10 2420 /** @todo Is this a correct name for all TessFactors? */2421 2420 { "SV_TessFactor", 3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_EQ_0_EDGE_TESSFACTOR 11 2422 2421 { "SV_TessFactor", 3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_EQ_0_EDGE_TESSFACTOR 12 2423 2422 { "SV_TessFactor", 3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_EQ_1_EDGE_TESSFACTOR 13 2424 2423 { "SV_TessFactor", 3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_EQ_1_EDGE_TESSFACTOR 14 2425 { "SV_ TessFactor",3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_INSIDE_TESSFACTOR 152426 { "SV_ TessFactor",3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_INSIDE_TESSFACTOR 162424 { "SV_InsideTessFactor", 3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_INSIDE_TESSFACTOR 15 2425 { "SV_InsideTessFactor", 3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_INSIDE_TESSFACTOR 16 2427 2426 { "SV_TessFactor", 3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_U_EQ_0_EDGE_TESSFACTOR 17 2428 2427 { "SV_TessFactor", 3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_V_EQ_0_EDGE_TESSFACTOR 18 2429 2428 { "SV_TessFactor", 3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_W_EQ_0_EDGE_TESSFACTOR 19 2430 { "SV_ TessFactor",3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_INSIDE_TESSFACTOR 202429 { "SV_InsideTessFactor", 3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_INSIDE_TESSFACTOR 20 2431 2430 { "SV_TessFactor", 3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_LINE_DETAIL_TESSFACTOR 21 2432 2431 { "SV_TessFactor", 3 }, // SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_LINE_DENSITY_TESSFACTOR 22 … … 2436 2435 { "SV_TARGET", 3 }; // SVGADX_SIGNATURE_SEMANTIC_NAME_UNDEFINED 0 2437 2436 2437 2438 /* A clone of D3D_NAME */ 2439 typedef enum 2440 { 2441 D3D_SV_UNDEFINED = 0, 2442 D3D_SV_POSITION = 1, 2443 D3D_SV_CLIP_DISTANCE = 2, 2444 D3D_SV_CULL_DISTANCE = 3, 2445 D3D_SV_RENDER_TARGET_ARRAY_INDEX = 4, 2446 D3D_SV_VIEWPORT_ARRAY_INDEX = 5, 2447 D3D_SV_VERTEX_ID = 6, 2448 D3D_SV_PRIMITIVE_ID = 7, 2449 D3D_SV_INSTANCE_ID = 8, 2450 D3D_SV_IS_FRONT_FACE = 9, 2451 D3D_SV_SAMPLE_INDEX = 10, 2452 D3D_SV_FINAL_QUAD_EDGE_TESSFACTOR = 11, 2453 D3D_SV_FINAL_QUAD_INSIDE_TESSFACTOR = 12, 2454 D3D_SV_FINAL_TRI_EDGE_TESSFACTOR = 13, 2455 D3D_SV_FINAL_TRI_INSIDE_TESSFACTOR = 14, 2456 D3D_SV_FINAL_LINE_DETAIL_TESSFACTOR = 15, 2457 D3D_SV_FINAL_LINE_DENSITY_TESSFACTOR = 16 2458 } D3DSYSTEMVALUE; 2459 2460 static uint32_t svga2dxSystemValue(SVGA3dDXSignatureSemanticName semanticName) 2461 { 2462 switch (semanticName) 2463 { 2464 case SVGADX_SIGNATURE_SEMANTIC_NAME_UNDEFINED: return D3D_SV_UNDEFINED; 2465 case SVGADX_SIGNATURE_SEMANTIC_NAME_POSITION: return D3D_SV_POSITION; 2466 case SVGADX_SIGNATURE_SEMANTIC_NAME_CLIP_DISTANCE: return D3D_SV_CLIP_DISTANCE; 2467 case SVGADX_SIGNATURE_SEMANTIC_NAME_CULL_DISTANCE: return D3D_SV_CULL_DISTANCE; 2468 case SVGADX_SIGNATURE_SEMANTIC_NAME_RENDER_TARGET_ARRAY_INDEX: return D3D_SV_RENDER_TARGET_ARRAY_INDEX; 2469 case SVGADX_SIGNATURE_SEMANTIC_NAME_VIEWPORT_ARRAY_INDEX: return D3D_SV_VIEWPORT_ARRAY_INDEX; 2470 case SVGADX_SIGNATURE_SEMANTIC_NAME_VERTEX_ID: return D3D_SV_VERTEX_ID; 2471 case SVGADX_SIGNATURE_SEMANTIC_NAME_PRIMITIVE_ID: return D3D_SV_PRIMITIVE_ID; 2472 case SVGADX_SIGNATURE_SEMANTIC_NAME_INSTANCE_ID: return D3D_SV_INSTANCE_ID; 2473 case SVGADX_SIGNATURE_SEMANTIC_NAME_IS_FRONT_FACE: return D3D_SV_IS_FRONT_FACE; 2474 case SVGADX_SIGNATURE_SEMANTIC_NAME_SAMPLE_INDEX: return D3D_SV_SAMPLE_INDEX; 2475 case SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_EQ_0_EDGE_TESSFACTOR: return D3D_SV_FINAL_QUAD_EDGE_TESSFACTOR; 2476 case SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_EQ_0_EDGE_TESSFACTOR: return D3D_SV_FINAL_QUAD_EDGE_TESSFACTOR; 2477 case SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_EQ_1_EDGE_TESSFACTOR: return D3D_SV_FINAL_QUAD_EDGE_TESSFACTOR; 2478 case SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_EQ_1_EDGE_TESSFACTOR: return D3D_SV_FINAL_QUAD_EDGE_TESSFACTOR; 2479 case SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_U_INSIDE_TESSFACTOR: return D3D_SV_FINAL_QUAD_INSIDE_TESSFACTOR; 2480 case SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_QUAD_V_INSIDE_TESSFACTOR: return D3D_SV_FINAL_QUAD_INSIDE_TESSFACTOR; 2481 case SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_U_EQ_0_EDGE_TESSFACTOR: return D3D_SV_FINAL_TRI_EDGE_TESSFACTOR; 2482 case SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_V_EQ_0_EDGE_TESSFACTOR: return D3D_SV_FINAL_TRI_EDGE_TESSFACTOR; 2483 case SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_W_EQ_0_EDGE_TESSFACTOR: return D3D_SV_FINAL_TRI_EDGE_TESSFACTOR; 2484 case SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_TRI_INSIDE_TESSFACTOR: return D3D_SV_FINAL_TRI_INSIDE_TESSFACTOR; 2485 case SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_LINE_DETAIL_TESSFACTOR: return D3D_SV_FINAL_LINE_DETAIL_TESSFACTOR; 2486 case SVGADX_SIGNATURE_SEMANTIC_NAME_FINAL_LINE_DENSITY_TESSFACTOR: return D3D_SV_FINAL_LINE_DENSITY_TESSFACTOR; 2487 } 2488 2489 AssertFailedReturn(D3D_SV_UNDEFINED); 2490 } 2438 2491 2439 2492 static VGPUSemanticInfo const *dxbcSemanticInfo(DXShaderInfo const *pInfo, SVGA3dDXSignatureSemanticName enmSemanticName, uint32_t u32BlobType) … … 2452 2505 2453 2506 static void dxbcGenerateSemantics(DXShaderInfo *pInfo, uint32_t cSignature, 2454 SVGA3dDXSignatureEntry const*paSignature,2507 SVGA3dDXSignatureEntry *paSignature, 2455 2508 DXShaderAttributeSemantic *paSemantic, 2456 2509 uint32_t u32BlobType) … … 2458 2511 for (uint32_t iSignatureEntry = 0; iSignatureEntry < cSignature; ++iSignatureEntry) 2459 2512 { 2460 SVGA3dDXSignatureEntry const *src = &paSignature[iSignatureEntry]; 2461 DXShaderAttributeSemantic *dst = &paSemantic[iSignatureEntry]; 2462 2463 ASSERT_GUEST_RETURN_VOID(src->semanticName < SVGADX_SIGNATURE_SEMANTIC_NAME_MAX); 2464 2465 VGPUSemanticInfo const *pSemanticInfo = dxbcSemanticInfo(pInfo, src->semanticName, u32BlobType); 2466 dst->pcszSemanticName = pSemanticInfo->pszName; 2467 dst->SemanticIndex = 0; 2513 SVGA3dDXSignatureEntry *pSignatureEntry = &paSignature[iSignatureEntry]; 2514 DXShaderAttributeSemantic *pSemantic = &paSemantic[iSignatureEntry]; 2515 2516 ASSERT_GUEST_RETURN_VOID(pSignatureEntry->semanticName < SVGADX_SIGNATURE_SEMANTIC_NAME_MAX); 2517 2518 VGPUSemanticInfo const *pSemanticInfo = dxbcSemanticInfo(pInfo, pSignatureEntry->semanticName, u32BlobType); 2519 pSemantic->pcszSemanticName = pSemanticInfo->pszName; 2520 pSemantic->SemanticIndex = 0; 2521 if (pSignatureEntry->componentType == SVGADX_SIGNATURE_REGISTER_COMPONENT_UNKNOWN) 2522 pSignatureEntry->componentType = pSemanticInfo->u32Type; 2468 2523 for (uint32_t i = 0; i < iSignatureEntry; ++i) 2469 2524 { 2470 DXShaderAttributeSemantic const *p Semantic = &paSemantic[i];2471 if (RTStrCmp(p Semantic->pcszSemanticName, dst->pcszSemanticName) == 0)2472 ++ dst->SemanticIndex;2525 DXShaderAttributeSemantic const *pPriorSemantic = &paSemantic[i]; 2526 if (RTStrCmp(pPriorSemantic->pcszSemanticName, pSemantic->pcszSemanticName) == 0) 2527 ++pSemantic->SemanticIndex; 2473 2528 } 2474 2529 } … … 2520 2575 } 2521 2576 dst->idxSemantic = srcSemantic->SemanticIndex; 2522 dst->enmSystemValue = s rcEntry->semanticName;2577 dst->enmSystemValue = svga2dxSystemValue(srcEntry->semanticName); 2523 2578 dst->enmComponentType = srcEntry->componentType; 2524 2579 dst->idxRegister = srcEntry->registerIndex;
Note:
See TracChangeset
for help on using the changeset viewer.